From c687101856e833222d597c8a90bab085256c8852 Mon Sep 17 00:00:00 2001 From: Andrey Romanov Date: Tue, 19 Oct 2021 14:30:20 +0300 Subject: [PATCH 01/21] support metadata parsing --- src/DracoPy.cpp | 8175 +++++++++++++++++++++++++++++++++-------------- src/DracoPy.h | 160 +- src/DracoPy.pxd | 13 + src/DracoPy.pyx | 97 +- 4 files changed, 6066 insertions(+), 2379 deletions(-) diff --git a/src/DracoPy.cpp b/src/DracoPy.cpp index 2fd918f..520ad33 100644 --- a/src/DracoPy.cpp +++ b/src/DracoPy.cpp @@ -1,14 +1,16 @@ -/* Generated by Cython 0.29.22 */ +/* Generated by Cython 0.29.24 */ +#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_24" +#define CYTHON_HEX_VERSION 0x001D18F0 #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof @@ -440,8 +442,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 +456,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 @@ -624,9 +634,10 @@ static CYTHON_INLINE float __PYX_NAN() { #include "stdexcept" #include "typeinfo" #include +#include +#include #include #include "DracoPy.h" -#include #ifdef _OPENMP #include #endif /* _OPENMP */ @@ -835,7 +846,7 @@ static const char *__pyx_filename; static const char *__pyx_f[] = { - "src/DracoPy.pyx", + "src\\DracoPy.pyx", "stringsource", }; @@ -927,6 +938,12 @@ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ const char* function_name); +/* 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); + /* PyObjectSetAttrStr.proto */ #if CYTHON_USE_TYPE_SLOTS #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL) @@ -936,15 +953,104 @@ static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) #endif -/* DictGetItem.proto */ -#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY -static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); -#define __Pyx_PyObject_Dict_GetItem(obj, name)\ - (likely(PyDict_CheckExact(obj)) ?\ - __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name)) +/* PyObjectCall.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); #else -#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) -#define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name) +#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); + +/* SliceObject.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( + PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** py_start, PyObject** py_stop, PyObject** py_slice, + int has_cstart, int has_cstop, int wraparound); + +/* PyCFunctionFastCall.proto */ +#if CYTHON_FAST_PYCCALL +static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); +#else +#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) +#endif + +/* PyFunctionFastCall.proto */ +#if CYTHON_FAST_PYCALL +#define __Pyx_PyFunction_FastCall(func, args, nargs)\ + __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) +#if 1 || PY_VERSION_HEX < 0x030600B1 +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); +#else +#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) +#endif +#define __Pyx_BUILD_ASSERT_EXPR(cond)\ + (sizeof(char [1 - 2*!(cond)]) - 1) +#ifndef Py_MEMBER_SIZE +#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) +#endif + static size_t __pyx_pyframe_localsplus_offset = 0; + #include "frameobject.h" + #define __Pxy_PyFrame_Initialize_Offsets()\ + ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ + (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 + +/* PyObjectCall2Args.proto */ +static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); + +/* PyObjectCallMethO.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +#endif + +/* PyObjectCallOneArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + +/* 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 /* PyDictVersioning.proto */ @@ -994,54 +1100,43 @@ static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_ve static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); #endif -/* PyFunctionFastCall.proto */ -#if CYTHON_FAST_PYCALL -#define __Pyx_PyFunction_FastCall(func, args, nargs)\ - __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); +/* ListAppend.proto */ +#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS +static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + __Pyx_SET_SIZE(list, len + 1); + return 0; + } + return PyList_Append(list, x); +} #else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) -#endif -#define __Pyx_BUILD_ASSERT_EXPR(cond)\ - (sizeof(char [1 - 2*!(cond)]) - 1) -#ifndef Py_MEMBER_SIZE -#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) -#endif - static size_t __pyx_pyframe_localsplus_offset = 0; - #include "frameobject.h" - #define __Pxy_PyFrame_Initialize_Offsets()\ - ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ - (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)) +#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) #endif -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); -#else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) -#endif +/* PyObjectGetMethod.proto */ +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); -/* 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 +/* PyObjectCallMethod1.proto */ +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); -/* PyObjectCall2Args.proto */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); +/* append.proto */ +static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x); -/* PyObjectCallMethO.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +/* DictGetItem.proto */ +#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); +#define __Pyx_PyObject_Dict_GetItem(obj, name)\ + (likely(PyDict_CheckExact(obj)) ?\ + __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name)) +#else +#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) +#define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name) #endif -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - /* PyIntBinop.proto */ #if !CYTHON_COMPILING_IN_PYPY static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); @@ -1084,45 +1179,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); @@ -1131,23 +1187,6 @@ static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floa (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) #endif -/* ListAppend.proto */ -#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS -static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { - PyListObject* L = (PyListObject*) list; - Py_ssize_t len = Py_SIZE(list); - if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { - Py_INCREF(x); - PyList_SET_ITEM(list, len, x); - __Pyx_SET_SIZE(list, len + 1); - return 0; - } - return PyList_Append(list, x); -} -#else -#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) -#endif - /* GetTopmostException.proto */ #if CYTHON_USE_EXC_INFO_STACK static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); @@ -1208,9 +1247,6 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /* ImportFrom.proto */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); -/* CalculateMetaclass.proto */ -static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases); - /* FetchCommonType.proto */ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); @@ -1285,12 +1321,18 @@ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, #define __Pyx_SetNameInClass(ns, name, value) PyObject_SetItem(ns, name, value) #endif +/* CalculateMetaclass.proto */ +static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases); + /* Py3ClassCreate.proto */ static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc); static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict, PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass); +/* CyFunctionClassCell.proto */ +static int __Pyx_CyFunction_InitClassCell(PyObject *cyfunctions, PyObject *classobj); + /* CLineInTraceback.proto */ #ifdef CYTHON_CLINE_IN_TRACEBACK #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) @@ -1317,11 +1359,6 @@ 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); -/* GCCDiagnostics.proto */ -#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) -#define __Pyx_HAS_GCC_DIAGNOSTIC -#endif - /* CppExceptionConversion.proto */ #ifndef __Pyx_CppExn2PyErr #include @@ -1364,6 +1401,11 @@ static void __Pyx_CppExn2PyErr() { } #endif +/* GCCDiagnostics.proto */ +#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#define __Pyx_HAS_GCC_DIAGNOSTIC +#endif + 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 */ @@ -1402,14 +1444,16 @@ 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 'libc.stdint' */ /* Module declarations from 'libcpp' */ /* Module declarations from 'cpython.mem' */ -/* Module declarations from 'libc.string' */ - /* Module declarations from 'DracoPy' */ static std::vector __pyx_convert_vector_from_py_float(PyObject *); /*proto*/ static std::vector __pyx_convert_vector_from_py_uint32_t(PyObject *); /*proto*/ @@ -1417,89 +1461,158 @@ static PyObject *__pyx_convert_vector_to_py_unsigned_char(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 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*/ #define __Pyx_MODULE_NAME "DracoPy" extern int __pyx_module_is_main_DracoPy; int __pyx_module_is_main_DracoPy = 0; /* Implementation of 'DracoPy' */ +static PyObject *__pyx_builtin_staticmethod; static PyObject *__pyx_builtin_object; static PyObject *__pyx_builtin_property; -static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_super; static PyObject *__pyx_builtin_range; +static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_TypeError; +static const char __pyx_k__27[] = "_"; +static const char __pyx_k_big[] = "big"; static const char __pyx_k_dim[] = "dim"; static const char __pyx_k_doc[] = "__doc__"; +static const char __pyx_k_end[] = "end"; +static const char __pyx_k_int[] = "int"; +static const char __pyx_k_pos[] = "_pos"; +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_bool[] = "bool"; 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_self[] = "self"; static const char __pyx_k_test[] = "__test__"; +static const char __pyx_k_bytes[] = "bytes"; +static const char __pyx_k_count[] = "count"; 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_super[] = "super"; static const char __pyx_k_value[] = "value"; +static const char __pyx_k_Reader[] = "_Reader"; +static const char __pyx_k_append[] = "append"; static const char __pyx_k_buffer[] = "buffer"; +static const char __pyx_k_decode[] = "decode"; static const char __pyx_k_import[] = "__import__"; +static const char __pyx_k_is_end[] = "is_end"; +static const char __pyx_k_little[] = "little"; 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_points[] = "points"; -static const char __pyx_k_struct[] = "struct"; +static const char __pyx_k_reader[] = "reader"; +static const char __pyx_k_return[] = "return"; +static const char __pyx_k_signed[] = "signed"; +static const char __pyx_k_typing[] = "typing"; static const char __pyx_k_DracoPy[] = "DracoPy"; +static const char __pyx_k_entries[] = "entries"; static const char __pyx_k_normals[] = "normals"; static const char __pyx_k_prepare[] = "__prepare__"; +static const char __pyx_k_unicode[] = "unicode"; +static const char __pyx_k_attr_len[] = "attr_len"; +static const char __pyx_k_in_bytes[] = "in_bytes"; +static const char __pyx_k_metadata[] = "metadata"; 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_qualname[] = "__qualname__"; +static const char __pyx_k_read_str[] = "read_str"; static const char __pyx_k_DracoMesh[] = "DracoMesh"; static const char __pyx_k_TypeError[] = "TypeError"; +static const char __pyx_k_byteorder[] = "byteorder"; static const char __pyx_k_metaclass[] = "__metaclass__"; +static const char __pyx_k_read_uint[] = "read_uint"; static const char __pyx_k_ValueError[] = "ValueError"; static const char __pyx_k_difference[] = "difference"; +static const char __pyx_k_from_bytes[] = "from_bytes"; +static const char __pyx_k_get_endian[] = "__get_endian"; +static const char __pyx_k_in_bytes_2[] = "_in_bytes"; +static const char __pyx_k_read_bytes[] = "read_bytes"; static const char __pyx_k_data_struct[] = "data_struct"; 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_endian_order[] = "endian_order"; static const char __pyx_k_quant_origin[] = "quant_origin"; +static const char __pyx_k_read_bytes_2[] = "__read_bytes"; +static const char __pyx_k_result_bytes[] = "result_bytes"; +static const char __pyx_k_staticmethod[] = "staticmethod"; +static const char __pyx_k_sub_metadata[] = "sub_metadata"; static const char __pyx_k_Input_invalid[] = "Input invalid"; +static const char __pyx_k_Reader___init[] = "_Reader.__init__"; +static const char __pyx_k_Reader_is_end[] = "_Reader.is_end"; static const char __pyx_k_decode_status[] = "decode_status"; static const char __pyx_k_encoded_point[] = "encoded_point"; static const char __pyx_k_inverse_alpha[] = "inverse_alpha"; +static const char __pyx_k_sub_metadatas[] = "sub_metadatas"; +static const char __pyx_k_MetadataObject[] = "MetadataObject"; 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_Reader_read_str[] = "_Reader.read_str"; +static const char __pyx_k_binary_metadata[] = "binary_metadata"; static const char __pyx_k_create_metadata[] = "create_metadata"; static const char __pyx_k_decoding_status[] = "decoding_status"; 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_src_DracoPy_pyx[] = "src\\DracoPy.pyx"; +static const char __pyx_k_Reader_read_uint[] = "_Reader.read_uint"; static const char __pyx_k_encoding_options[] = "encoding_options"; static const char __pyx_k_DracoMesh_normals[] = "DracoMesh.normals"; static const char __pyx_k_FileTypeException[] = "FileTypeException"; +static const char __pyx_k_Reader_read_bytes[] = "_Reader.read_bytes"; 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_sub_metadatas_len[] = "sub_metadatas_len"; +static const char __pyx_k_Reader__get_endian[] = "_Reader__get_endian"; +static const char __pyx_k_Reader__read_bytes[] = "_Reader__read_bytes"; +static const char __pyx_k_attribute_metadata[] = "attribute_metadata"; static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; 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_to_parse_metadatas[] = "to_parse_metadatas"; static const char __pyx_k_Invalid_point_cloud[] = "Invalid point cloud"; +static const char __pyx_k_Reader___get_endian[] = "_Reader.__get_endian"; +static const char __pyx_k_Reader___read_bytes[] = "_Reader.__read_bytes"; +static const char __pyx_k_attribute_metadatas[] = "attribute_metadatas"; static const char __pyx_k_encoded_point_cloud[] = "encoded_point_cloud"; static const char __pyx_k_quantization_origin[] = "quantization_origin"; 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_unknown_endian_order[] = "unknown endian order"; +static const char __pyx_k_MetadataObject___init[] = "MetadataObject.__init__"; 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_parse_binary_metadata[] = "_parse_binary_metadata"; 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_GeometryMetadataObject[] = "GeometryMetadataObject"; static const char __pyx_k_get_encoded_coordinate[] = "get_encoded_coordinate"; +static const char __pyx_k_to_parse_metadata_next[] = "to_parse_metadata_next"; static const char __pyx_k_EncodingFailedException[] = "EncodingFailedException"; +static const char __pyx_k_attribute_metadatas_len[] = "attribute_metadatas_len"; +static const char __pyx_k_not_read_bytes_detected[] = "not read bytes detected"; 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_decode_point_cloud_buffer[] = "decode_point_cloud_buffer"; static const char __pyx_k_encode_point_cloud_to_buffer[] = "encode_point_cloud_to_buffer"; +static const char __pyx_k_GeometryMetadataObject___init[] = "GeometryMetadataObject.__init__"; static const char __pyx_k_Input_mesh_is_not_draco_encoded[] = "Input mesh is not draco encoded"; 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"; @@ -1508,6 +1621,7 @@ static const char __pyx_k_EncodingOptions_get_encoded_coor[] = "EncodingOptions. 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_Specified_value_out_of_encoded_r[] = "Specified value out of encoded range"; +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; @@ -1527,19 +1641,49 @@ static PyObject *__pyx_n_s_EncodingOptions_get_encoded_poin; static PyObject *__pyx_n_s_EncodingOptions_num_axes; static PyObject *__pyx_kp_u_Failed_to_decode_input_mesh_Data; static PyObject *__pyx_n_s_FileTypeException; +static PyObject *__pyx_n_s_GeometryMetadataObject; +static PyObject *__pyx_n_s_GeometryMetadataObject___init; 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_List; +static PyObject *__pyx_n_s_MetadataObject; +static PyObject *__pyx_n_u_MetadataObject; +static PyObject *__pyx_n_s_MetadataObject___init; +static PyObject *__pyx_n_s_Reader; +static PyObject *__pyx_n_s_Reader___get_endian; +static PyObject *__pyx_n_s_Reader___init; +static PyObject *__pyx_n_s_Reader___read_bytes; +static PyObject *__pyx_n_s_Reader__get_endian; +static PyObject *__pyx_n_s_Reader__read_bytes; +static PyObject *__pyx_n_s_Reader_is_end; +static PyObject *__pyx_n_s_Reader_read_bytes; +static PyObject *__pyx_n_s_Reader_read_str; +static PyObject *__pyx_n_s_Reader_read_uint; static PyObject *__pyx_kp_u_Specified_value_out_of_encoded_r; static PyObject *__pyx_n_s_TypeError; static PyObject *__pyx_n_s_ValueError; +static PyObject *__pyx_n_s__27; +static PyObject *__pyx_n_s_append; +static PyObject *__pyx_n_s_attr_len; +static PyObject *__pyx_n_s_attribute_metadata; +static PyObject *__pyx_n_s_attribute_metadatas; +static PyObject *__pyx_n_s_attribute_metadatas_len; static PyObject *__pyx_n_s_axis; +static PyObject *__pyx_n_u_big; +static PyObject *__pyx_n_s_binary_metadata; +static PyObject *__pyx_n_u_binary_metadata; +static PyObject *__pyx_n_u_bool; static PyObject *__pyx_n_s_buffer; +static PyObject *__pyx_n_s_byteorder; +static PyObject *__pyx_n_u_bytes; static PyObject *__pyx_n_s_cline_in_traceback; static PyObject *__pyx_n_s_compression_level; +static PyObject *__pyx_n_s_count; static PyObject *__pyx_n_s_create_metadata; static PyObject *__pyx_n_s_data_struct; +static PyObject *__pyx_n_s_decode; 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; @@ -1555,29 +1699,45 @@ static PyObject *__pyx_n_s_encoded_point_cloud; 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_end; +static PyObject *__pyx_n_s_endian_order; +static PyObject *__pyx_n_s_entries; static PyObject *__pyx_n_s_faces; static PyObject *__pyx_n_u_faces; static PyObject *__pyx_n_s_floor; +static PyObject *__pyx_n_s_from_bytes; +static PyObject *__pyx_n_s_geometry_metadata; static PyObject *__pyx_n_s_get_encoded_coordinate; static PyObject *__pyx_n_s_get_encoded_point; +static PyObject *__pyx_n_s_get_endian; static PyObject *__pyx_n_s_import; +static PyObject *__pyx_n_s_in_bytes; +static PyObject *__pyx_n_s_in_bytes_2; static PyObject *__pyx_n_s_init; +static PyObject *__pyx_n_u_int; static PyObject *__pyx_n_s_inverse_alpha; +static PyObject *__pyx_n_s_is_end; +static PyObject *__pyx_n_u_little; static PyObject *__pyx_n_s_main; static PyObject *__pyx_n_s_math; static PyObject *__pyx_n_s_mesh_struct; static PyObject *__pyx_n_s_metaclass; +static PyObject *__pyx_n_s_metadata; static PyObject *__pyx_n_s_module; static PyObject *__pyx_n_s_name; +static PyObject *__pyx_n_s_name_2; static PyObject *__pyx_n_s_normals; static PyObject *__pyx_n_u_normals; +static PyObject *__pyx_kp_u_not_read_bytes_detected; 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_parse_binary_metadata; 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_pos; static PyObject *__pyx_n_s_prepare; static PyObject *__pyx_n_s_property; static PyObject *__pyx_n_s_qualname; @@ -1591,11 +1751,38 @@ 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_read_bytes; +static PyObject *__pyx_n_s_read_bytes_2; +static PyObject *__pyx_n_s_read_str; +static PyObject *__pyx_n_s_read_uint; +static PyObject *__pyx_n_s_reader; +static PyObject *__pyx_n_s_result_bytes; +static PyObject *__pyx_n_s_return; static PyObject *__pyx_n_s_self; +static PyObject *__pyx_n_s_signed; static PyObject *__pyx_kp_s_src_DracoPy_pyx; -static PyObject *__pyx_n_s_struct; +static PyObject *__pyx_n_s_staticmethod; +static PyObject *__pyx_n_s_sub_metadata; +static PyObject *__pyx_n_s_sub_metadatas; +static PyObject *__pyx_n_s_sub_metadatas_len; +static PyObject *__pyx_n_s_super; static PyObject *__pyx_n_s_test; +static PyObject *__pyx_n_s_to_parse_metadata_next; +static PyObject *__pyx_n_s_to_parse_metadatas; +static PyObject *__pyx_n_s_typing; +static PyObject *__pyx_n_u_unicode; +static PyObject *__pyx_kp_u_unknown_endian_order; static PyObject *__pyx_n_s_value; +static PyObject *__pyx_pf_7DracoPy_7_Reader___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_in_bytes); /* proto */ +static PyObject *__pyx_pf_7DracoPy_7_Reader_2__get_endian(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_7DracoPy_7_Reader_4__read_bytes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_count); /* proto */ +static PyObject *__pyx_pf_7DracoPy_7_Reader_6read_uint(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7DracoPy_7_Reader_8read_str(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7DracoPy_7_Reader_10read_bytes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7DracoPy_7_Reader_12is_end(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7DracoPy_14MetadataObject___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_entries, PyObject *__pyx_v_sub_metadatas); /* proto */ +static PyObject *__pyx_pf_7DracoPy_22GeometryMetadataObject___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_entries, PyObject *__pyx_v_sub_metadatas, PyObject *__pyx_v_attribute_metadatas); /* proto */ +static PyObject *__pyx_pf_7DracoPy__parse_binary_metadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_binary_metadata); /* 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 */ @@ -1607,15 +1794,17 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions___init__(CYTHON_UNUSED PyOb 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_2encode_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_4encode_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_6raise_decoding_error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_decoding_status); /* proto */ +static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer); /* proto */ +static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer); /* 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_4; static PyObject *__pyx_int_14; static PyObject *__pyx_int_neg_1; static PyObject *__pyx_tuple_; @@ -1624,54 +1813,78 @@ static PyObject *__pyx_tuple__3; static PyObject *__pyx_tuple__4; static PyObject *__pyx_tuple__5; static PyObject *__pyx_tuple__6; -static PyObject *__pyx_tuple__8; -static PyObject *__pyx_tuple__10; -static PyObject *__pyx_tuple__12; -static PyObject *__pyx_tuple__14; -static PyObject *__pyx_tuple__16; -static PyObject *__pyx_tuple__18; -static PyObject *__pyx_tuple__20; +static PyObject *__pyx_tuple__7; +static PyObject *__pyx_tuple__9; +static PyObject *__pyx_tuple__11; +static PyObject *__pyx_tuple__13; +static PyObject *__pyx_tuple__15; +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; -static PyObject *__pyx_tuple__27; -static PyObject *__pyx_tuple__29; +static PyObject *__pyx_tuple__24; +static PyObject *__pyx_tuple__26; +static PyObject *__pyx_tuple__28; +static PyObject *__pyx_tuple__30; 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__39; +static PyObject *__pyx_tuple__41; +static PyObject *__pyx_tuple__43; +static PyObject *__pyx_tuple__45; +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__62; +static PyObject *__pyx_codeobj__8; +static PyObject *__pyx_codeobj__10; +static PyObject *__pyx_codeobj__12; +static PyObject *__pyx_codeobj__14; +static PyObject *__pyx_codeobj__16; +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; -static PyObject *__pyx_codeobj__28; -static PyObject *__pyx_codeobj__30; +static PyObject *__pyx_codeobj__25; +static PyObject *__pyx_codeobj__29; static PyObject *__pyx_codeobj__32; static PyObject *__pyx_codeobj__34; static PyObject *__pyx_codeobj__36; static PyObject *__pyx_codeobj__38; +static PyObject *__pyx_codeobj__40; +static PyObject *__pyx_codeobj__42; +static PyObject *__pyx_codeobj__44; +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__61; +static PyObject *__pyx_codeobj__63; /* Late includes */ -/* "DracoPy.pyx":10 +/* "DracoPy.pyx":11 * - * class DracoPointCloud(object): - * def __init__(self, data_struct): # <<<<<<<<<<<<<< - * self.data_struct = data_struct - * if data_struct['encoding_options_set']: + * class _Reader: + * def __init__(self, in_bytes: bytes): # <<<<<<<<<<<<<< + * self._in_bytes = in_bytes + * self._pos = 0 */ /* 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) { +static PyObject *__pyx_pw_7DracoPy_7_Reader_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_7_Reader_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_7_Reader_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_7DracoPy_7_Reader_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_data_struct = 0; + PyObject *__pyx_v_in_bytes = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -1679,7 +1892,7 @@ static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_1__init__(PyObject *__pyx_s __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_data_struct,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_in_bytes,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -1699,13 +1912,13 @@ static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_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_data_struct)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_in_bytes)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 10, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 11, __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, "__init__") < 0)) __PYX_ERR(0, 11, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -1714,192 +1927,203 @@ static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_1__init__(PyObject *__pyx_s values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_self = values[0]; - __pyx_v_data_struct = values[1]; + __pyx_v_in_bytes = ((PyObject*)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("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 11, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("DracoPy.DracoPointCloud.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("DracoPy._Reader.__init__", __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); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_bytes), (&PyBytes_Type), 1, "in_bytes", 1))) __PYX_ERR(0, 11, __pyx_L1_error) + __pyx_r = __pyx_pf_7DracoPy_7_Reader___init__(__pyx_self, __pyx_v_self, __pyx_v_in_bytes); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; __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_7_Reader___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_in_bytes) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - 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); + /* "DracoPy.pyx":12 + * class _Reader: + * def __init__(self, in_bytes: bytes): + * self._in_bytes = in_bytes # <<<<<<<<<<<<<< + * self._pos = 0 + * + */ + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_in_bytes_2, __pyx_v_in_bytes) < 0) __PYX_ERR(0, 12, __pyx_L1_error) + + /* "DracoPy.pyx":13 + * def __init__(self, in_bytes: bytes): + * self._in_bytes = in_bytes + * self._pos = 0 # <<<<<<<<<<<<<< + * + * @staticmethod + */ + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_pos, __pyx_int_0) < 0) __PYX_ERR(0, 13, __pyx_L1_error) + /* "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'], + * + * class _Reader: + * def __init__(self, in_bytes: bytes): # <<<<<<<<<<<<<< + * self._in_bytes = in_bytes + * self._pos = 0 */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_data_struct, __pyx_v_data_struct) < 0) __PYX_ERR(0, 11, __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']) + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("DracoPy._Reader.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "DracoPy.pyx":16 + * + * @staticmethod + * def __get_endian() -> str: # <<<<<<<<<<<<<< + * endian_order = get_endian_order() + * if endian_order == DracoPy.endian_order.little_endian: */ - __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: +/* Python wrapper */ +static PyObject *__pyx_pw_7DracoPy_7_Reader_3__get_endian(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_7_Reader_3__get_endian = {"__get_endian", (PyCFunction)__pyx_pw_7DracoPy_7_Reader_3__get_endian, METH_NOARGS, 0}; +static PyObject *__pyx_pw_7DracoPy_7_Reader_3__get_endian(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get_endian (wrapper)", 0); + __pyx_r = __pyx_pf_7DracoPy_7_Reader_2__get_endian(__pyx_self); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7DracoPy_7_Reader_2__get_endian(CYTHON_UNUSED PyObject *__pyx_self) { + enum DracoFunctions::endian_order __pyx_v_endian_order; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + enum DracoFunctions::endian_order __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get_endian", 0); + + /* "DracoPy.pyx":17 + * @staticmethod + * def __get_endian() -> str: + * endian_order = get_endian_order() # <<<<<<<<<<<<<< + * if endian_order == DracoPy.endian_order.little_endian: + * return "little" */ - __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); + try { + __pyx_t_1 = DracoFunctions::get_endian_order(); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 17, __pyx_L1_error) + } + __pyx_v_endian_order = __pyx_t_1; - /* "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":18 + * def __get_endian() -> str: + * endian_order = get_endian_order() + * if endian_order == DracoPy.endian_order.little_endian: # <<<<<<<<<<<<<< + * return "little" + * elif endian_order == DracoPy.endian_order.big_endian: */ - __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; - } - } - #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; - } - __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; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + switch (__pyx_v_endian_order) { + case DracoFunctions::little_endian: - /* "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']) + /* "DracoPy.pyx":19 + * endian_order = get_endian_order() + * if endian_order == DracoPy.endian_order.little_endian: + * return "little" # <<<<<<<<<<<<<< + * elif endian_order == DracoPy.endian_order.big_endian: + * return "big" + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_n_u_little); + __pyx_r = __pyx_n_u_little; + goto __pyx_L0; + + /* "DracoPy.pyx":18 + * def __get_endian() -> str: + * endian_order = get_endian_order() + * if endian_order == DracoPy.endian_order.little_endian: # <<<<<<<<<<<<<< + * return "little" + * elif endian_order == DracoPy.endian_order.big_endian: + */ + break; + case DracoFunctions::big_endian: + + /* "DracoPy.pyx":21 + * return "little" + * elif endian_order == DracoPy.endian_order.big_endian: + * return "big" # <<<<<<<<<<<<<< * else: + * raise Exception("unknown endian order") */ - 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; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_n_u_big); + __pyx_r = __pyx_n_u_big; + goto __pyx_L0; - /* "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":20 + * if endian_order == DracoPy.endian_order.little_endian: + * return "little" + * elif endian_order == DracoPy.endian_order.big_endian: # <<<<<<<<<<<<<< + * return "big" + * else: */ - goto __pyx_L3; - } + break; + default: - /* "DracoPy.pyx":16 - * data_struct['quantization_range'], data_struct['quantization_origin']) + /* "DracoPy.pyx":23 + * return "big" * else: - * self.encoding_options = None # <<<<<<<<<<<<<< + * raise Exception("unknown endian order") # <<<<<<<<<<<<<< * - * def get_encoded_coordinate(self, value, axis): + * def __read_bytes(self, count: int) -> bytes: */ - /*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_2 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __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, 23, __pyx_L1_error) + break; } - __pyx_L3:; - /* "DracoPy.pyx":10 + /* "DracoPy.pyx":16 * - * class DracoPointCloud(object): - * def __init__(self, data_struct): # <<<<<<<<<<<<<< - * self.data_struct = data_struct - * if data_struct['encoding_options_set']: + * @staticmethod + * def __get_endian() -> str: # <<<<<<<<<<<<<< + * endian_order = get_endian_order() + * if endian_order == DracoPy.endian_order.little_endian: */ /* 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_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("DracoPy._Reader.__get_endian", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1907,36 +2131,33 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyOb return __pyx_r; } -/* "DracoPy.pyx":18 - * self.encoding_options = None +/* "DracoPy.pyx":25 + * raise Exception("unknown endian order") * - * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< - * if self.encoding_options is not None: - * return self.encoding_options.get_encoded_coordinate(value, axis) + * def __read_bytes(self, count: int) -> bytes: # <<<<<<<<<<<<<< + * end = self._pos + count + * result_bytes = self._in_bytes[self._pos:end] */ /* 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) { +static PyObject *__pyx_pw_7DracoPy_7_Reader_5__read_bytes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_7_Reader_5__read_bytes = {"__read_bytes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_7_Reader_5__read_bytes, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_7DracoPy_7_Reader_5__read_bytes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_value = 0; - PyObject *__pyx_v_axis = 0; + PyObject *__pyx_v_count = 0; 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("__read_bytes (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_self,&__pyx_n_s_count,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 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); @@ -1951,588 +2172,597 @@ static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_3get_encoded_coordinate(PyO 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, 18, __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[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_count)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, 2); __PYX_ERR(0, 18, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__read_bytes", 1, 2, 2, 1); __PYX_ERR(0, 25, __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, "__read_bytes") < 0)) __PYX_ERR(0, 25, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + } 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); } __pyx_v_self = values[0]; - __pyx_v_value = values[1]; - __pyx_v_axis = values[2]; + __pyx_v_count = values[1]; } 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("__read_bytes", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 25, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("DracoPy.DracoPointCloud.get_encoded_coordinate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("DracoPy._Reader.__read_bytes", __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_7_Reader_4__read_bytes(__pyx_self, __pyx_v_self, __pyx_v_count); /* 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_7_Reader_4__read_bytes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_count) { + PyObject *__pyx_v_end = NULL; + PyObject *__pyx_v_result_bytes = NULL; 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; + 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("get_encoded_coordinate", 0); + __Pyx_RefNannySetupContext("__read_bytes", 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":26 * + * def __read_bytes(self, count: int) -> bytes: + * end = self._pos + count # <<<<<<<<<<<<<< + * result_bytes = self._in_bytes[self._pos:end] + * self._pos = end */ - __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_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_pos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = (__pyx_t_1 != Py_None); + __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_count); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { + __pyx_v_end = __pyx_t_2; + __pyx_t_2 = 0; - /* "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) # <<<<<<<<<<<<<< + /* "DracoPy.pyx":27 + * def __read_bytes(self, count: int) -> bytes: + * end = self._pos + count + * result_bytes = self._in_bytes[self._pos:end] # <<<<<<<<<<<<<< + * self._pos = end + * return result_bytes + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_in_bytes_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_pos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_t_2, 0, 0, &__pyx_t_1, &__pyx_v_end, NULL, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 27, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_result_bytes = __pyx_t_3; + __pyx_t_3 = 0; + + /* "DracoPy.pyx":28 + * end = self._pos + count + * result_bytes = self._in_bytes[self._pos:end] + * self._pos = end # <<<<<<<<<<<<<< + * return result_bytes * - * 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; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_pos, __pyx_v_end) < 0) __PYX_ERR(0, 28, __pyx_L1_error) - /* "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":29 + * result_bytes = self._in_bytes[self._pos:end] + * self._pos = end + * return result_bytes # <<<<<<<<<<<<<< * + * def read_uint(self) -> int: */ - } + __Pyx_XDECREF(__pyx_r); + if (!(likely(PyBytes_CheckExact(__pyx_v_result_bytes))||((__pyx_v_result_bytes) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_result_bytes)->tp_name), 0))) __PYX_ERR(0, 29, __pyx_L1_error) + __Pyx_INCREF(__pyx_v_result_bytes); + __pyx_r = ((PyObject*)__pyx_v_result_bytes); + goto __pyx_L0; - /* "DracoPy.pyx":18 - * self.encoding_options = None + /* "DracoPy.pyx":25 + * raise Exception("unknown endian order") * - * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< - * if self.encoding_options is not None: - * return self.encoding_options.get_encoded_coordinate(value, axis) + * def __read_bytes(self, count: int) -> bytes: # <<<<<<<<<<<<<< + * end = self._pos + count + * result_bytes = self._in_bytes[self._pos:end] */ /* 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_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("DracoPy._Reader.__read_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_end); + __Pyx_XDECREF(__pyx_v_result_bytes); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "DracoPy.pyx":22 - * return self.encoding_options.get_encoded_coordinate(value, axis) +/* "DracoPy.pyx":31 + * return result_bytes * - * def get_encoded_point(self, point): # <<<<<<<<<<<<<< - * if self.encoding_options is not None: - * return self.encoding_options.get_encoded_point(point) + * def read_uint(self) -> int: # <<<<<<<<<<<<<< + * value = int.from_bytes(self.__read_bytes(4), + * byteorder=self.__get_endian(), signed=False) */ /* 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) { - 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_7_Reader_7read_uint(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_7_Reader_7read_uint = {"read_uint", (PyCFunction)__pyx_pw_7DracoPy_7_Reader_7read_uint, METH_O, 0}; +static PyObject *__pyx_pw_7DracoPy_7_Reader_7read_uint(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, 22, __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) - } - } 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, 22, __pyx_L3_error) - __pyx_L3_error:; - __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_15DracoPointCloud_4get_encoded_point(__pyx_self, __pyx_v_self, __pyx_v_point); + __Pyx_RefNannySetupContext("read_uint (wrapper)", 0); + __pyx_r = __pyx_pf_7DracoPy_7_Reader_6read_uint(__pyx_self, ((PyObject *)__pyx_v_self)); /* 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_7_Reader_6read_uint(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_v_value = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; + 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_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_encoded_point", 0); + __Pyx_RefNannySetupContext("read_uint", 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":32 * + * def read_uint(self) -> int: + * value = int.from_bytes(self.__read_bytes(4), # <<<<<<<<<<<<<< + * byteorder=self.__get_endian(), signed=False) + * return value */ - __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_GetAttrStr(((PyObject *)(&PyInt_Type)), __pyx_n_s_from_bytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __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_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_Reader__read_bytes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_int_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_int_4); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __pyx_t_2 = 0; - /* "DracoPy.pyx":24 - * def get_encoded_point(self, point): - * if self.encoding_options is not None: - * return self.encoding_options.get_encoded_point(point) # <<<<<<<<<<<<<< + /* "DracoPy.pyx":33 + * def read_uint(self) -> int: + * value = int.from_bytes(self.__read_bytes(4), + * byteorder=self.__get_endian(), signed=False) # <<<<<<<<<<<<<< + * return value * - * @property */ - __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_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) - __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_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_Reader__get_endian); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && likely(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_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; + } + __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_byteorder, __pyx_t_4) < 0) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_signed, Py_False) < 0) __PYX_ERR(0, 33, __pyx_L1_error) - /* "DracoPy.pyx":23 + /* "DracoPy.pyx":32 * - * def get_encoded_point(self, point): - * if self.encoding_options is not None: # <<<<<<<<<<<<<< - * return self.encoding_options.get_encoded_point(point) + * def read_uint(self) -> int: + * value = int.from_bytes(self.__read_bytes(4), # <<<<<<<<<<<<<< + * byteorder=self.__get_endian(), signed=False) + * return value + */ + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_value = __pyx_t_4; + __pyx_t_4 = 0; + + /* "DracoPy.pyx":34 + * value = int.from_bytes(self.__read_bytes(4), + * byteorder=self.__get_endian(), signed=False) + * return value # <<<<<<<<<<<<<< * + * def read_str(self) -> str: */ - } + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_value); + __pyx_r = __pyx_v_value; + goto __pyx_L0; - /* "DracoPy.pyx":22 - * return self.encoding_options.get_encoded_coordinate(value, axis) + /* "DracoPy.pyx":31 + * return result_bytes * - * def get_encoded_point(self, point): # <<<<<<<<<<<<<< - * if self.encoding_options is not None: - * return self.encoding_options.get_encoded_point(point) + * def read_uint(self) -> int: # <<<<<<<<<<<<<< + * value = int.from_bytes(self.__read_bytes(4), + * byteorder=self.__get_endian(), signed=False) */ /* 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_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("DracoPy.DracoPointCloud.get_encoded_point", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("DracoPy._Reader.read_uint", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_value); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "DracoPy.pyx":27 - * - * @property - * def num_axes(self): # <<<<<<<<<<<<<< - * return 3 +/* "DracoPy.pyx":36 + * return value * + * def read_str(self) -> str: # <<<<<<<<<<<<<< + * count = self.read_uint() + * return self.__read_bytes(count).decode() */ /* 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) { +static PyObject *__pyx_pw_7DracoPy_7_Reader_9read_str(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_7_Reader_9read_str = {"read_str", (PyCFunction)__pyx_pw_7DracoPy_7_Reader_9read_str, METH_O, 0}; +static PyObject *__pyx_pw_7DracoPy_7_Reader_9read_str(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)); + __Pyx_RefNannySetupContext("read_str (wrapper)", 0); + __pyx_r = __pyx_pf_7DracoPy_7_Reader_8read_str(__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) { +static PyObject *__pyx_pf_7DracoPy_7_Reader_8read_str(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_v_count = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("num_axes", 0); + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("read_str", 0); - /* "DracoPy.pyx":28 - * @property - * def num_axes(self): - * return 3 # <<<<<<<<<<<<<< + /* "DracoPy.pyx":37 + * + * def read_str(self) -> str: + * count = self.read_uint() # <<<<<<<<<<<<<< + * return self.__read_bytes(count).decode() * - * @property */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_int_3); - __pyx_r = __pyx_int_3; - goto __pyx_L0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_read_uint); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + 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_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, 37, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_count = __pyx_t_1; + __pyx_t_1 = 0; - /* "DracoPy.pyx":27 - * - * @property - * def num_axes(self): # <<<<<<<<<<<<<< - * return 3 + /* "DracoPy.pyx":38 + * def read_str(self) -> str: + * count = self.read_uint() + * return self.__read_bytes(count).decode() # <<<<<<<<<<<<<< * - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "DracoPy.pyx":31 - * - * @property - * def points(self): # <<<<<<<<<<<<<< - * 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 - 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("points", 0); - - /* "DracoPy.pyx":32 - * @property - * def points(self): - * return self.data_struct['points'] # <<<<<<<<<<<<<< - * - * class DracoMesh(DracoPointCloud): + * def read_bytes(self) -> bytes: */ __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_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_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_Reader__read_bytes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_count) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_count); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_decode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __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(0, 38, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 38, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; goto __pyx_L0; - /* "DracoPy.pyx":31 - * - * @property - * def points(self): # <<<<<<<<<<<<<< - * return self.data_struct['points'] + /* "DracoPy.pyx":36 + * return value * + * def read_str(self) -> str: # <<<<<<<<<<<<<< + * count = self.read_uint() + * return self.__read_bytes(count).decode() */ /* 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_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("DracoPy._Reader.read_str", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_count); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "DracoPy.pyx":36 - * class DracoMesh(DracoPointCloud): - * @property - * def faces(self): # <<<<<<<<<<<<<< - * return self.data_struct['faces'] +/* "DracoPy.pyx":40 + * return self.__read_bytes(count).decode() * + * def read_bytes(self) -> bytes: # <<<<<<<<<<<<<< + * count = self.read_uint() + * return self.__read_bytes(count) */ /* 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) { +static PyObject *__pyx_pw_7DracoPy_7_Reader_11read_bytes(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_7_Reader_11read_bytes = {"read_bytes", (PyCFunction)__pyx_pw_7DracoPy_7_Reader_11read_bytes, METH_O, 0}; +static PyObject *__pyx_pw_7DracoPy_7_Reader_11read_bytes(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)); + __Pyx_RefNannySetupContext("read_bytes (wrapper)", 0); + __pyx_r = __pyx_pf_7DracoPy_7_Reader_10read_bytes(__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) { +static PyObject *__pyx_pf_7DracoPy_7_Reader_10read_bytes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_v_count = NULL; 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("faces", 0); + __Pyx_RefNannySetupContext("read_bytes", 0); - /* "DracoPy.pyx":37 - * @property - * def faces(self): - * return self.data_struct['faces'] # <<<<<<<<<<<<<< + /* "DracoPy.pyx":41 + * + * def read_bytes(self) -> bytes: + * count = self.read_uint() # <<<<<<<<<<<<<< + * return self.__read_bytes(count) * - * @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_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_read_uint); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + 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_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, 41, __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_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_count = __pyx_t_1; + __pyx_t_1 = 0; + + /* "DracoPy.pyx":42 + * def read_bytes(self) -> bytes: + * count = self.read_uint() + * return self.__read_bytes(count) # <<<<<<<<<<<<<< + * + * def is_end(self) -> bool: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_Reader__read_bytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __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_t_3 = NULL; + 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_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_count) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_count); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 42, __pyx_L1_error) + __pyx_r = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; goto __pyx_L0; - /* "DracoPy.pyx":36 - * class DracoMesh(DracoPointCloud): - * @property - * def faces(self): # <<<<<<<<<<<<<< - * return self.data_struct['faces'] + /* "DracoPy.pyx":40 + * return self.__read_bytes(count).decode() * + * def read_bytes(self) -> bytes: # <<<<<<<<<<<<<< + * count = self.read_uint() + * return self.__read_bytes(count) */ /* 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_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("DracoPy._Reader.read_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_count); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "DracoPy.pyx":40 +/* "DracoPy.pyx":44 + * return self.__read_bytes(count) * - * @property - * def normals(self): # <<<<<<<<<<<<<< - * return self.data_struct['normals'] + * def is_end(self) -> bool: # <<<<<<<<<<<<<< + * return len(self._in_bytes) == self._pos * */ /* 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) { +static PyObject *__pyx_pw_7DracoPy_7_Reader_13is_end(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_7_Reader_13is_end = {"is_end", (PyCFunction)__pyx_pw_7DracoPy_7_Reader_13is_end, METH_O, 0}; +static PyObject *__pyx_pw_7DracoPy_7_Reader_13is_end(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)); + __Pyx_RefNannySetupContext("is_end (wrapper)", 0); + __pyx_r = __pyx_pf_7DracoPy_7_Reader_12is_end(__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) { +static PyObject *__pyx_pf_7DracoPy_7_Reader_12is_end(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_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("normals", 0); + __Pyx_RefNannySetupContext("is_end", 0); - /* "DracoPy.pyx":41 - * @property - * def normals(self): - * return self.data_struct['normals'] # <<<<<<<<<<<<<< + /* "DracoPy.pyx":45 + * + * def is_end(self) -> bool: + * return len(self._in_bytes) == self._pos # <<<<<<<<<<<<<< + * * - * 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_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_in_bytes_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __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_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_pos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; goto __pyx_L0; - /* "DracoPy.pyx":40 + /* "DracoPy.pyx":44 + * return self.__read_bytes(count) * - * @property - * def normals(self): # <<<<<<<<<<<<<< - * return self.data_struct['normals'] + * def is_end(self) -> bool: # <<<<<<<<<<<<<< + * return len(self._in_bytes) == self._pos * */ /* 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_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("DracoPy._Reader.is_end", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2540,22 +2770,21 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_2normals(CYTHON_UNUSED PyObject *_ return __pyx_r; } -/* "DracoPy.pyx":44 +/* "DracoPy.pyx":49 * - * class EncodingOptions(object): - * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< - * self.quantization_bits = quantization_bits - * self.quantization_range = quantization_range + * class MetadataObject: + * def __init__(self, entries: typing.Dict[str, bytes] = None, # <<<<<<<<<<<<<< + * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None): + * self.entries = entries if entries else {} */ /* 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_14MetadataObject_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_14MetadataObject_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_14MetadataObject_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_7DracoPy_14MetadataObject_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_quantization_range = 0; - PyObject *__pyx_v_quantization_origin = 0; + PyObject *__pyx_v_entries = 0; + PyObject *__pyx_v_sub_metadatas = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -2563,14 +2792,22 @@ static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_1__init__(PyObject *__pyx_s __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (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_entries,&__pyx_n_s_sub_metadatas,0}; + PyObject* values[3] = {0,0,0}; + values[1] = ((PyObject *)((PyObject *)Py_None)); + + /* "DracoPy.pyx":50 + * class MetadataObject: + * def __init__(self, entries: typing.Dict[str, bytes] = None, + * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None): # <<<<<<<<<<<<<< + * self.entries = entries if entries else {} + * self.sub_metadatas = sub_metadatas if sub_metadatas else {} + */ + 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 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); @@ -2587,115 +2824,115 @@ 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) + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_entries); + if (value) { values[1] = value; kw_args--; } } 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--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 3); __PYX_ERR(0, 44, __pyx_L3_error) + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sub_metadatas); + if (value) { values[2] = value; kw_args--; } } } 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, "__init__") < 0)) __PYX_ERR(0, 49, __pyx_L3_error) } - } 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); + 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); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } } __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_entries = values[1]; + __pyx_v_sub_metadatas = values[2]; } 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("__init__", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 49, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("DracoPy.EncodingOptions.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("DracoPy.MetadataObject.__init__", __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_14MetadataObject___init__(__pyx_self, __pyx_v_self, __pyx_v_entries, __pyx_v_sub_metadatas); + + /* "DracoPy.pyx":49 + * + * class MetadataObject: + * def __init__(self, entries: typing.Dict[str, bytes] = None, # <<<<<<<<<<<<<< + * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None): + * self.entries = entries if entries else {} + */ /* 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_14MetadataObject___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_entries, PyObject *__pyx_v_sub_metadatas) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = 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("__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) + /* "DracoPy.pyx":51 + * def __init__(self, entries: typing.Dict[str, bytes] = None, + * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None): + * self.entries = entries if entries else {} # <<<<<<<<<<<<<< + * self.sub_metadatas = sub_metadatas if sub_metadatas else {} + * */ - 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_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_entries); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 51, __pyx_L1_error) + if (__pyx_t_2) { + __Pyx_INCREF(__pyx_v_entries); + __pyx_t_1 = __pyx_v_entries; + } else { + __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_entries, __pyx_t_1) < 0) __PYX_ERR(0, 51, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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":52 + * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None): + * self.entries = entries if entries else {} + * self.sub_metadatas = sub_metadatas if sub_metadatas else {} # <<<<<<<<<<<<<< + * * */ - 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_2 = __Pyx_PyObject_IsTrue(__pyx_v_sub_metadatas); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 52, __pyx_L1_error) + if (__pyx_t_2) { + __Pyx_INCREF(__pyx_v_sub_metadatas); + __pyx_t_1 = __pyx_v_sub_metadatas; + } else { + __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_sub_metadatas, __pyx_t_1) < 0) __PYX_ERR(0, 52, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":48 - * self.quantization_range = quantization_range - * self.quantization_origin = quantization_origin - * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) # <<<<<<<<<<<<<< + /* "DracoPy.pyx":49 * - * def get_encoded_coordinate(self, value, axis): - */ - __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; - - /* "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 + * class MetadataObject: + * def __init__(self, entries: typing.Dict[str, bytes] = None, # <<<<<<<<<<<<<< + * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None): + * self.entries = entries if entries else {} */ /* function exit code */ @@ -2703,8 +2940,8 @@ 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_3); + __Pyx_AddTraceback("DracoPy.MetadataObject.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2712,34 +2949,56 @@ 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":56 * - * 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') + * class GeometryMetadataObject(MetadataObject): + * def __init__(self, entries: typing.Dict[str, bytes] = None, # <<<<<<<<<<<<<< + * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None, + * attribute_metadatas: typing.List['MetadataObject'] = None): */ /* 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) { +static PyObject *__pyx_pw_7DracoPy_22GeometryMetadataObject_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_22GeometryMetadataObject_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_22GeometryMetadataObject_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_7DracoPy_22GeometryMetadataObject_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_value = 0; - PyObject *__pyx_v_axis = 0; + PyObject *__pyx_v_entries = 0; + PyObject *__pyx_v_sub_metadatas = 0; + PyObject *__pyx_v_attribute_metadatas = 0; 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("__init__ (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_self,&__pyx_n_s_entries,&__pyx_n_s_sub_metadatas,&__pyx_n_s_attribute_metadatas,0}; + PyObject* values[4] = {0,0,0,0}; + values[1] = ((PyObject *)((PyObject *)Py_None)); + + /* "DracoPy.pyx":57 + * class GeometryMetadataObject(MetadataObject): + * def __init__(self, entries: typing.Dict[str, bytes] = None, + * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None, # <<<<<<<<<<<<<< + * attribute_metadatas: typing.List['MetadataObject'] = None): + * super().__init__(entries, sub_metadatas) + */ + values[2] = ((PyObject *)((PyObject *)Py_None)); + + /* "DracoPy.pyx":58 + * def __init__(self, entries: typing.Dict[str, bytes] = None, + * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None, + * attribute_metadatas: typing.List['MetadataObject'] = None): # <<<<<<<<<<<<<< + * super().__init__(entries, sub_metadatas) + * self.attribute_metadatas = attribute_metadatas if attribute_metadatas \ + */ + values[3] = ((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 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); @@ -2756,599 +3015,988 @@ static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_3get_encoded_coordinate(PyO 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) + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_entries); + if (value) { values[1] = value; kw_args--; } } 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 (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sub_metadatas); + 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_attribute_metadatas); + if (value) { values[3] = value; kw_args--; } } } 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) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 56, __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); + switch (PyTuple_GET_SIZE(__pyx_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); + break; + default: goto __pyx_L5_argtuple_error; + } } __pyx_v_self = values[0]; - __pyx_v_value = values[1]; - __pyx_v_axis = values[2]; + __pyx_v_entries = values[1]; + __pyx_v_sub_metadatas = values[2]; + __pyx_v_attribute_metadatas = values[3]; } 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_RaiseArgtupleInvalid("__init__", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 56, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("DracoPy.EncodingOptions.get_encoded_coordinate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("DracoPy.GeometryMetadataObject.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __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); + __pyx_r = __pyx_pf_7DracoPy_22GeometryMetadataObject___init__(__pyx_self, __pyx_v_self, __pyx_v_entries, __pyx_v_sub_metadatas, __pyx_v_attribute_metadatas); + + /* "DracoPy.pyx":56 + * + * class GeometryMetadataObject(MetadataObject): + * def __init__(self, entries: typing.Dict[str, bytes] = None, # <<<<<<<<<<<<<< + * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None, + * attribute_metadatas: typing.List['MetadataObject'] = None): + */ /* function exit code */ __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; +static PyObject *__pyx_pf_7DracoPy_22GeometryMetadataObject___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_entries, PyObject *__pyx_v_sub_metadatas, PyObject *__pyx_v_attribute_metadatas) { 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_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_encoded_coordinate", 0); + __Pyx_RefNannySetupContext("__init__", 0); - /* "DracoPy.pyx":51 - * - * 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_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) + /* "DracoPy.pyx":59 + * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None, + * attribute_metadatas: typing.List['MetadataObject'] = None): + * super().__init__(entries, sub_metadatas) # <<<<<<<<<<<<<< + * self.attribute_metadatas = attribute_metadatas if attribute_metadatas \ + * else [] + */ + __pyx_t_2 = __Pyx_CyFunction_GetClassObj(__pyx_self); + if (!__pyx_t_2) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 59, __pyx_L1_error) } + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __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_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_INCREF(__pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __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_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __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_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_t_2 = NULL; + __pyx_t_4 = 0; + 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_4 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_entries, __pyx_v_sub_metadatas}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_entries, __pyx_v_sub_metadatas}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + { + __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 59, __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_v_entries); + __Pyx_GIVEREF(__pyx_v_entries); + PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_entries); + __Pyx_INCREF(__pyx_v_sub_metadatas); + __Pyx_GIVEREF(__pyx_v_sub_metadatas); + PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_sub_metadatas); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __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; - __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; - /* "DracoPy.pyx":51 + /* "DracoPy.pyx":60 + * attribute_metadatas: typing.List['MetadataObject'] = None): + * super().__init__(entries, sub_metadatas) + * self.attribute_metadatas = attribute_metadatas if attribute_metadatas \ # <<<<<<<<<<<<<< + * else [] * - * 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) */ - __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_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_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; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_attribute_metadatas); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 60, __pyx_L1_error) + if (__pyx_t_6) { + __Pyx_INCREF(__pyx_v_attribute_metadatas); + __pyx_t_1 = __pyx_v_attribute_metadatas; + } else { - /* "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":61 + * super().__init__(entries, sub_metadatas) + * self.attribute_metadatas = attribute_metadatas if attribute_metadatas \ + * else [] # <<<<<<<<<<<<<< + * * */ - __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_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; } - __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) # <<<<<<<<<<<<<< + /* "DracoPy.pyx":60 + * attribute_metadatas: typing.List['MetadataObject'] = None): + * super().__init__(entries, sub_metadatas) + * self.attribute_metadatas = attribute_metadatas if attribute_metadatas \ # <<<<<<<<<<<<<< + * else [] * - * 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_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; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_attribute_metadatas, __pyx_t_1) < 0) __PYX_ERR(0, 60, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":50 - * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) + /* "DracoPy.pyx":56 * - * 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') + * class GeometryMetadataObject(MetadataObject): + * def __init__(self, entries: typing.Dict[str, bytes] = None, # <<<<<<<<<<<<<< + * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None, + * attribute_metadatas: typing.List['MetadataObject'] = None): */ /* 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_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.GeometryMetadataObject.__init__", __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":64 * - * def get_encoded_point(self, point): # <<<<<<<<<<<<<< - * encoded_point = [] - * for axis in range(self.num_axes): + * + * def _parse_binary_metadata(binary_metadata: bytes) -> MetadataObject: # <<<<<<<<<<<<<< + * reader = _Reader(binary_metadata) + * geometry_metadata = GeometryMetadataObject() */ /* 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; +static PyObject *__pyx_pw_7DracoPy_1_parse_binary_metadata(PyObject *__pyx_self, PyObject *__pyx_v_binary_metadata); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_1_parse_binary_metadata = {"_parse_binary_metadata", (PyCFunction)__pyx_pw_7DracoPy_1_parse_binary_metadata, METH_O, 0}; +static PyObject *__pyx_pw_7DracoPy_1_parse_binary_metadata(PyObject *__pyx_self, PyObject *__pyx_v_binary_metadata) { 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; - } - 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("_parse_binary_metadata (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_binary_metadata), (&PyBytes_Type), 1, "binary_metadata", 1))) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_r = __pyx_pf_7DracoPy__parse_binary_metadata(__pyx_self, ((PyObject*)__pyx_v_binary_metadata)); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; __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__parse_binary_metadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_binary_metadata) { + PyObject *__pyx_v_reader = NULL; + PyObject *__pyx_v_geometry_metadata = NULL; + PyObject *__pyx_v_to_parse_metadatas = NULL; + PyObject *__pyx_v_attribute_metadatas_len = NULL; + CYTHON_UNUSED PyObject *__pyx_v__ = NULL; + PyObject *__pyx_v_attribute_metadata = NULL; + PyObject *__pyx_v_to_parse_metadata_next = NULL; + PyObject *__pyx_v_metadata = NULL; + PyObject *__pyx_v_attr_len = NULL; + PyObject *__pyx_v_name = NULL; + PyObject *__pyx_v_value = NULL; + PyObject *__pyx_v_sub_metadatas_len = NULL; + PyObject *__pyx_v_sub_metadata = NULL; 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_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; + int __pyx_t_7; int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - int __pyx_t_10; + Py_ssize_t __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_encoded_point", 0); + __Pyx_RefNannySetupContext("_parse_binary_metadata", 0); - /* "DracoPy.pyx":58 + /* "DracoPy.pyx":65 * - * 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)) + * def _parse_binary_metadata(binary_metadata: bytes) -> MetadataObject: + * reader = _Reader(binary_metadata) # <<<<<<<<<<<<<< + * geometry_metadata = GeometryMetadataObject() + * to_parse_metadatas = [geometry_metadata] */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __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_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_binary_metadata) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_binary_metadata); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_v_encoded_point = ((PyObject*)__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_reader = __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 + /* "DracoPy.pyx":66 + * def _parse_binary_metadata(binary_metadata: bytes) -> MetadataObject: + * reader = _Reader(binary_metadata) + * geometry_metadata = GeometryMetadataObject() # <<<<<<<<<<<<<< + * to_parse_metadatas = [geometry_metadata] + * # parse attribute metadatas + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_GeometryMetadataObject); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __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, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_geometry_metadata = __pyx_t_1; + __pyx_t_1 = 0; + + /* "DracoPy.pyx":67 + * reader = _Reader(binary_metadata) + * geometry_metadata = GeometryMetadataObject() + * to_parse_metadatas = [geometry_metadata] # <<<<<<<<<<<<<< + * # parse attribute metadatas + * attribute_metadatas_len = reader.read_uint() */ - __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_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __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_INCREF(__pyx_v_geometry_metadata); + __Pyx_GIVEREF(__pyx_v_geometry_metadata); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_geometry_metadata); + __pyx_v_to_parse_metadatas = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "DracoPy.pyx":69 + * to_parse_metadatas = [geometry_metadata] + * # parse attribute metadatas + * attribute_metadatas_len = reader.read_uint() # <<<<<<<<<<<<<< + * for _ in range(attribute_metadatas_len): + * attribute_metadata = MetadataObject() + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_reader, __pyx_n_s_read_uint); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __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_t_3 = NULL; + 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_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, 69, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_attribute_metadatas_len = __pyx_t_1; + __pyx_t_1 = 0; + + /* "DracoPy.pyx":70 + * # parse attribute metadatas + * attribute_metadatas_len = reader.read_uint() + * for _ in range(attribute_metadatas_len): # <<<<<<<<<<<<<< + * attribute_metadata = MetadataObject() + * geometry_metadata.attribute_metadatas.append(attribute_metadata) + */ + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_attribute_metadatas_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 70, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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 (likely(!__pyx_t_5)) { + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) 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) + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 70, __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); + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); #endif } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) 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) + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 70, __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); + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); #endif } } else { - __pyx_t_2 = __pyx_t_4(__pyx_t_1); - if (unlikely(!__pyx_t_2)) { + __pyx_t_1 = __pyx_t_5(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { 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) + else __PYX_ERR(0, 70, __pyx_L1_error) } break; } - __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_1); } - __Pyx_XDECREF_SET(__pyx_v_axis, __pyx_t_2); - __pyx_t_2 = 0; + __Pyx_XDECREF_SET(__pyx_v__, __pyx_t_1); + __pyx_t_1 = 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 - * + /* "DracoPy.pyx":71 + * attribute_metadatas_len = reader.read_uint() + * for _ in range(attribute_metadatas_len): + * attribute_metadata = MetadataObject() # <<<<<<<<<<<<<< + * geometry_metadata.attribute_metadatas.append(attribute_metadata) + * to_parse_metadatas.append(attribute_metadata) */ - __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_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_MetadataObject); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_6); __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_DECREF_SET(__pyx_t_3, function); } - __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; + __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF_SET(__pyx_v_attribute_metadata, __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 + /* "DracoPy.pyx":72 + * for _ in range(attribute_metadatas_len): + * attribute_metadata = MetadataObject() + * geometry_metadata.attribute_metadatas.append(attribute_metadata) # <<<<<<<<<<<<<< + * to_parse_metadatas.append(attribute_metadata) + * # parse metadatas level by level */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geometry_metadata, __pyx_n_s_attribute_metadatas); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = __Pyx_PyObject_Append(__pyx_t_1, __pyx_v_attribute_metadata); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 72, __pyx_L1_error) + __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 + /* "DracoPy.pyx":73 + * attribute_metadata = MetadataObject() + * geometry_metadata.attribute_metadatas.append(attribute_metadata) + * to_parse_metadatas.append(attribute_metadata) # <<<<<<<<<<<<<< + * # parse metadatas level by level + * while to_parse_metadatas: */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_encoded_point); - __pyx_r = __pyx_v_encoded_point; - goto __pyx_L0; + __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_to_parse_metadatas, __pyx_v_attribute_metadata); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 73, __pyx_L1_error) - /* "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":70 + * # parse attribute metadatas + * attribute_metadatas_len = reader.read_uint() + * for _ in range(attribute_metadatas_len): # <<<<<<<<<<<<<< + * attribute_metadata = MetadataObject() + * geometry_metadata.attribute_metadatas.append(attribute_metadata) */ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* 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":75 + * to_parse_metadatas.append(attribute_metadata) + * # parse metadatas level by level + * while to_parse_metadatas: # <<<<<<<<<<<<<< + * to_parse_metadata_next = [] + * for metadata in to_parse_metadatas: + */ + while (1) { + __pyx_t_8 = (PyList_GET_SIZE(__pyx_v_to_parse_metadatas) != 0); + if (!__pyx_t_8) break; + + /* "DracoPy.pyx":76 + * # parse metadatas level by level + * while to_parse_metadatas: + * to_parse_metadata_next = [] # <<<<<<<<<<<<<< + * for metadata in to_parse_metadatas: + * # parse entries + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_to_parse_metadata_next, ((PyObject*)__pyx_t_2)); + __pyx_t_2 = 0; -/* "DracoPy.pyx":64 - * - * @property - * def num_axes(self): # <<<<<<<<<<<<<< - * return 3 - * - */ + /* "DracoPy.pyx":77 + * while to_parse_metadatas: + * to_parse_metadata_next = [] + * for metadata in to_parse_metadatas: # <<<<<<<<<<<<<< + * # parse entries + * attr_len = reader.read_uint() + */ + __pyx_t_2 = __pyx_v_to_parse_metadatas; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0; + for (;;) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 77, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 77, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + __Pyx_XDECREF_SET(__pyx_v_metadata, __pyx_t_1); + __pyx_t_1 = 0; + + /* "DracoPy.pyx":79 + * for metadata in to_parse_metadatas: + * # parse entries + * attr_len = reader.read_uint() # <<<<<<<<<<<<<< + * for _ in range(attr_len): + * name = reader.read_str() + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_reader, __pyx_n_s_read_uint); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF_SET(__pyx_v_attr_len, __pyx_t_1); + __pyx_t_1 = 0; + + /* "DracoPy.pyx":80 + * # parse entries + * attr_len = reader.read_uint() + * for _ in range(attr_len): # <<<<<<<<<<<<<< + * name = reader.read_str() + * value = reader.read_bytes() + */ + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_attr_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_9 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 80, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 80, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(!__pyx_t_5)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 80, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } else { + if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 80, __pyx_L1_error) + #else + __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + #endif + } + } else { + __pyx_t_1 = __pyx_t_5(__pyx_t_3); + if (unlikely(!__pyx_t_1)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 80, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __Pyx_XDECREF_SET(__pyx_v__, __pyx_t_1); + __pyx_t_1 = 0; -/* 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)); + /* "DracoPy.pyx":81 + * attr_len = reader.read_uint() + * for _ in range(attr_len): + * name = reader.read_str() # <<<<<<<<<<<<<< + * value = reader.read_bytes() + * metadata.entries[name] = value + */ + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_reader, __pyx_n_s_read_str); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_10 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_10)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_10) : __Pyx_PyObject_CallNoArg(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_1); + __pyx_t_1 = 0; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "DracoPy.pyx":82 + * for _ in range(attr_len): + * name = reader.read_str() + * value = reader.read_bytes() # <<<<<<<<<<<<<< + * metadata.entries[name] = value + * sub_metadatas_len = reader.read_uint() + */ + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_reader, __pyx_n_s_read_bytes); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 82, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_10 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_10)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_10) : __Pyx_PyObject_CallNoArg(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_1); + __pyx_t_1 = 0; + + /* "DracoPy.pyx":83 + * name = reader.read_str() + * value = reader.read_bytes() + * metadata.entries[name] = value # <<<<<<<<<<<<<< + * sub_metadatas_len = reader.read_uint() + * for _ in range(sub_metadatas_len): + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_entries); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_name, __pyx_v_value) < 0)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "DracoPy.pyx":80 + * # parse entries + * attr_len = reader.read_uint() + * for _ in range(attr_len): # <<<<<<<<<<<<<< + * name = reader.read_str() + * value = reader.read_bytes() + */ + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; -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":84 + * value = reader.read_bytes() + * metadata.entries[name] = value + * sub_metadatas_len = reader.read_uint() # <<<<<<<<<<<<<< + * for _ in range(sub_metadatas_len): + * name = reader.read_str() + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_reader, __pyx_n_s_read_uint); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + } + } + __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF_SET(__pyx_v_sub_metadatas_len, __pyx_t_3); + __pyx_t_3 = 0; - /* "DracoPy.pyx":65 - * @property - * def num_axes(self): - * return 3 # <<<<<<<<<<<<<< + /* "DracoPy.pyx":85 + * metadata.entries[name] = value + * sub_metadatas_len = reader.read_uint() + * for _ in range(sub_metadatas_len): # <<<<<<<<<<<<<< + * name = reader.read_str() + * sub_metadata = MetadataObject() + */ + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_sub_metadatas_len); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { + __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_9 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_9 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 85, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + for (;;) { + if (likely(!__pyx_t_5)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 85, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + } else { + if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 85, __pyx_L1_error) + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + #endif + } + } else { + __pyx_t_3 = __pyx_t_5(__pyx_t_1); + if (unlikely(!__pyx_t_3)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 85, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_XDECREF_SET(__pyx_v__, __pyx_t_3); + __pyx_t_3 = 0; + + /* "DracoPy.pyx":86 + * sub_metadatas_len = reader.read_uint() + * for _ in range(sub_metadatas_len): + * name = reader.read_str() # <<<<<<<<<<<<<< + * sub_metadata = MetadataObject() + * metadata.sub_metadatas[name] = sub_metadata + */ + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_reader, __pyx_n_s_read_str); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_10 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_10)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + __pyx_t_3 = (__pyx_t_10) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_10) : __Pyx_PyObject_CallNoArg(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_3); + __pyx_t_3 = 0; + + /* "DracoPy.pyx":87 + * for _ in range(sub_metadatas_len): + * name = reader.read_str() + * sub_metadata = MetadataObject() # <<<<<<<<<<<<<< + * metadata.sub_metadatas[name] = sub_metadata + * to_parse_metadata_next.append(sub_metadata) + */ + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_MetadataObject); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_10 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_10)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + __pyx_t_3 = (__pyx_t_10) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_10) : __Pyx_PyObject_CallNoArg(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF_SET(__pyx_v_sub_metadata, __pyx_t_3); + __pyx_t_3 = 0; + + /* "DracoPy.pyx":88 + * name = reader.read_str() + * sub_metadata = MetadataObject() + * metadata.sub_metadatas[name] = sub_metadata # <<<<<<<<<<<<<< + * to_parse_metadata_next.append(sub_metadata) + * to_parse_metadatas = to_parse_metadata_next + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_sub_metadatas); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely(PyObject_SetItem(__pyx_t_3, __pyx_v_name, __pyx_v_sub_metadata) < 0)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "DracoPy.pyx":89 + * sub_metadata = MetadataObject() + * metadata.sub_metadatas[name] = sub_metadata + * to_parse_metadata_next.append(sub_metadata) # <<<<<<<<<<<<<< + * to_parse_metadatas = to_parse_metadata_next + * if not reader.is_end(): + */ + __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_to_parse_metadata_next, __pyx_v_sub_metadata); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 89, __pyx_L1_error) + + /* "DracoPy.pyx":85 + * metadata.entries[name] = value + * sub_metadatas_len = reader.read_uint() + * for _ in range(sub_metadatas_len): # <<<<<<<<<<<<<< + * name = reader.read_str() + * sub_metadata = MetadataObject() + */ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "DracoPy.pyx":77 + * while to_parse_metadatas: + * to_parse_metadata_next = [] + * for metadata in to_parse_metadatas: # <<<<<<<<<<<<<< + * # parse entries + * attr_len = reader.read_uint() + */ + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":90 + * metadata.sub_metadatas[name] = sub_metadata + * to_parse_metadata_next.append(sub_metadata) + * to_parse_metadatas = to_parse_metadata_next # <<<<<<<<<<<<<< + * if not reader.is_end(): + * raise Exception("not read bytes detected") + */ + __Pyx_INCREF(__pyx_v_to_parse_metadata_next); + __Pyx_DECREF_SET(__pyx_v_to_parse_metadatas, __pyx_v_to_parse_metadata_next); + } + + /* "DracoPy.pyx":91 + * to_parse_metadata_next.append(sub_metadata) + * to_parse_metadatas = to_parse_metadata_next + * if not reader.is_end(): # <<<<<<<<<<<<<< + * raise Exception("not read bytes detected") + * return geometry_metadata + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_reader, __pyx_n_s_is_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + } + } + __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_11 = ((!__pyx_t_8) != 0); + if (unlikely(__pyx_t_11)) { + + /* "DracoPy.pyx":92 + * to_parse_metadatas = to_parse_metadata_next + * if not reader.is_end(): + * raise Exception("not read bytes detected") # <<<<<<<<<<<<<< + * return geometry_metadata + * + */ + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__2, 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":91 + * to_parse_metadata_next.append(sub_metadata) + * to_parse_metadatas = to_parse_metadata_next + * if not reader.is_end(): # <<<<<<<<<<<<<< + * raise Exception("not read bytes detected") + * return geometry_metadata + */ + } + + /* "DracoPy.pyx":93 + * if not reader.is_end(): + * raise Exception("not read bytes detected") + * return geometry_metadata # <<<<<<<<<<<<<< + * * - * class FileTypeException(Exception): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_int_3); - __pyx_r = __pyx_int_3; + __Pyx_INCREF(__pyx_v_geometry_metadata); + __pyx_r = __pyx_v_geometry_metadata; goto __pyx_L0; /* "DracoPy.pyx":64 * - * @property - * def num_axes(self): # <<<<<<<<<<<<<< - * return 3 * + * def _parse_binary_metadata(binary_metadata: bytes) -> MetadataObject: # <<<<<<<<<<<<<< + * reader = _Reader(binary_metadata) + * geometry_metadata = GeometryMetadataObject() */ /* 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_6); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("DracoPy._parse_binary_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_reader); + __Pyx_XDECREF(__pyx_v_geometry_metadata); + __Pyx_XDECREF(__pyx_v_to_parse_metadatas); + __Pyx_XDECREF(__pyx_v_attribute_metadatas_len); + __Pyx_XDECREF(__pyx_v__); + __Pyx_XDECREF(__pyx_v_attribute_metadata); + __Pyx_XDECREF(__pyx_v_to_parse_metadata_next); + __Pyx_XDECREF(__pyx_v_metadata); + __Pyx_XDECREF(__pyx_v_attr_len); + __Pyx_XDECREF(__pyx_v_name); + __Pyx_XDECREF(__pyx_v_value); + __Pyx_XDECREF(__pyx_v_sub_metadatas_len); + __Pyx_XDECREF(__pyx_v_sub_metadata); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "DracoPy.pyx":73 - * pass +/* "DracoPy.pyx":97 * - * 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 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_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; - 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_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; 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_data_struct,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 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); @@ -3359,159 +4007,1853 @@ 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_data_struct)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 2, 7, 1); __PYX_ERR(0, 73, __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--; } + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 97, __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, 97, __pyx_L3_error) } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + 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); } - __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_data_struct = values[1]; } 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, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 97, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("DracoPy.encode_mesh_to_buffer", __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_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_15DracoPointCloud___init__(__pyx_self, __pyx_v_self, __pyx_v_data_struct); /* 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_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; - PyObject *__pyx_t_2 = NULL; + int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; + PyObject *__pyx_t_4 = NULL; + 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; - 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_t_8; + PyObject *__pyx_t_9 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("encode_mesh_to_buffer", 0); + __Pyx_RefNannySetupContext("__init__", 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 + /* "DracoPy.pyx":98 + * 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'], */ - __pyx_v_quant_origin = NULL; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_data_struct, __pyx_v_data_struct) < 0) __PYX_ERR(0, 98, __pyx_L1_error) - /* "DracoPy.pyx":84 - * """ - * cdef float* quant_origin = NULL - * try: # <<<<<<<<<<<<<< - * num_dims = 3 - * if quantization_origin is not None: + /* "DracoPy.pyx":99 + * 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_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:*/ { + __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, 99, __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, 99, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { - /* "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) + /* "DracoPy.pyx":100 + * 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, 100, __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, 100, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + + /* "DracoPy.pyx":101 + * 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, 101, __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, 101, __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; + } + } + #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, 100, __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, 100, __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, 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_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, 100, __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":100 + * 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, 100, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "DracoPy.pyx":99 + * 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":103 + * data_struct['quantization_range'], data_struct['quantization_origin']) + * else: + * self.encoding_options = None # <<<<<<<<<<<<<< + * self.metadata = _parse_binary_metadata(data_struct["binary_metadata"]) + * + */ + /*else*/ { + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options, Py_None) < 0) __PYX_ERR(0, 103, __pyx_L1_error) + } + __pyx_L3:; + + /* "DracoPy.pyx":104 + * else: + * self.encoding_options = None + * self.metadata = _parse_binary_metadata(data_struct["binary_metadata"]) # <<<<<<<<<<<<<< + * + * def get_encoded_coordinate(self, value, axis): + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_parse_binary_metadata); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data_struct, __pyx_n_u_binary_metadata); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_9); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_metadata, __pyx_t_1) < 0) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "DracoPy.pyx":97 + * + * 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":106 + * self.metadata = _parse_binary_metadata(data_struct["binary_metadata"]) + * + * 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_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("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, 106, __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, 106, __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, 106, __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, 106, __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_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; + 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("get_encoded_coordinate", 0); + + /* "DracoPy.pyx":107 + * + * 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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __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":108 + * 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, 108, __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, 108, __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, 108, __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, 108, __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, 108, __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, 108, __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":107 + * + * 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":106 + * self.metadata = _parse_binary_metadata(data_struct["binary_metadata"]) + * + * 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_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_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "DracoPy.pyx":110 + * 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) + */ + +/* 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) { + 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; + } + 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, 110, __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, 110, __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, 110, __pyx_L3_error) + __pyx_L3_error:; + __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_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_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; + 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("get_encoded_point", 0); + + /* "DracoPy.pyx":111 + * + * def get_encoded_point(self, point): + * if self.encoding_options is not None: # <<<<<<<<<<<<<< + * return self.encoding_options.get_encoded_point(point) + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __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":112 + * def get_encoded_point(self, point): + * if self.encoding_options is not None: + * return self.encoding_options.get_encoded_point(point) # <<<<<<<<<<<<<< + * + * @property + */ + __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, 112, __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, 112, __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, 112, __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":111 + * + * def get_encoded_point(self, point): + * if self.encoding_options is not None: # <<<<<<<<<<<<<< + * return self.encoding_options.get_encoded_point(point) + * + */ + } + + /* "DracoPy.pyx":110 + * 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; +} + +/* "DracoPy.pyx":115 + * + * @property + * def num_axes(self): # <<<<<<<<<<<<<< + * return 3 + * + */ + +/* 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":116 + * @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":115 + * + * @property + * def num_axes(self): # <<<<<<<<<<<<<< + * return 3 + * + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "DracoPy.pyx":119 + * + * @property + * def points(self): # <<<<<<<<<<<<<< + * 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 + 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("points", 0); + + /* "DracoPy.pyx":120 + * @property + * def points(self): + * return self.data_struct['points'] # <<<<<<<<<<<<<< + * + * + */ + __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, 120, __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, 120, __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":119 + * + * @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; +} + +/* "DracoPy.pyx":125 + * class DracoMesh(DracoPointCloud): + * @property + * def faces(self): # <<<<<<<<<<<<<< + * return self.data_struct['faces'] + * + */ + +/* 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":126 + * @property + * def faces(self): + * return self.data_struct['faces'] # <<<<<<<<<<<<<< + * + * @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, 126, __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, 126, __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":125 + * class DracoMesh(DracoPointCloud): + * @property + * def faces(self): # <<<<<<<<<<<<<< + * return self.data_struct['faces'] + * + */ + + /* 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":129 + * + * @property + * def normals(self): # <<<<<<<<<<<<<< + * return self.data_struct['normals'] + * + */ + +/* 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":130 + * @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, 130, __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, 130, __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":129 + * + * @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_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "DracoPy.pyx":133 + * + * 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_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_quantization_range = 0; + PyObject *__pyx_v_quantization_origin = 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); + { + 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 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_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_quantization_bits)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); __PYX_ERR(0, 133, __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, 133, __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("__init__", 1, 4, 4, 3); __PYX_ERR(0, 133, __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, 133, __pyx_L3_error) + } + } 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_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("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 133, __pyx_L3_error) + __pyx_L3_error:; + __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_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_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; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "DracoPy.pyx":134 + * 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, 134, __pyx_L1_error) + + /* "DracoPy.pyx":135 + * 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, 135, __pyx_L1_error) + + /* "DracoPy.pyx":136 + * 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_origin, __pyx_v_quantization_origin) < 0) __PYX_ERR(0, 136, __pyx_L1_error) + + /* "DracoPy.pyx":137 + * 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): + */ + __pyx_t_1 = __Pyx_PyNumber_PowerOf2(__pyx_int_2, __pyx_v_quantization_bits, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 137, __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, 137, __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, 137, __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, 137, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "DracoPy.pyx":133 + * + * 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_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("DracoPy.EncodingOptions.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "DracoPy.pyx":139 + * 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') + */ + +/* 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; + 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, 139, __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, 139, __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, 139, __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, 139, __pyx_L3_error) + __pyx_L3_error:; + __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_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_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 + int __pyx_t_1; + 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); + + /* "DracoPy.pyx":140 + * + * 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_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 140, __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, 140, __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, 140, __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, 140, __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, 140, __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, 140, __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, 140, __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, 140, __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, 140, __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, 140, __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":141 + * 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__3, 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) + + /* "DracoPy.pyx":140 + * + * 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":142 + * 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_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __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, 142, __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, 142, __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":143 + * 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_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_floor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 143, __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, 143, __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, 143, __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, 143, __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, 143, __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":144 + * 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): + */ + __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, 144, __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, 144, __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, 144, __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, 144, __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, 144, __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":139 + * 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') + */ + + /* 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":146 + * 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): + */ + +/* 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; + } + 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, 146, __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, 146, __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, 146, __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); + + /* 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; + 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); + + /* "DracoPy.pyx":147 + * + * 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, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_encoded_point = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "DracoPy.pyx":148 + * 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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_num_axes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __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, 148, __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, 148, __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, 148, __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, 148, __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, 148, __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, 148, __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, 148, __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, 148, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_XDECREF_SET(__pyx_v_axis, __pyx_t_2); + __pyx_t_2 = 0; + + /* "DracoPy.pyx":149 + * 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, 149, __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, 149, __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, 149, __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, 149, __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, 149, __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, 149, __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, 149, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":148 + * 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":150 + * 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; + goto __pyx_L0; + + /* "DracoPy.pyx":146 + * 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): + */ + + /* 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":153 + * + * @property + * def num_axes(self): # <<<<<<<<<<<<<< + * return 3 + * + */ + +/* 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":154 + * @property + * def num_axes(self): + * return 3 # <<<<<<<<<<<<<< + * + * class FileTypeException(Exception): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_int_3); + __pyx_r = __pyx_int_3; + goto __pyx_L0; + + /* "DracoPy.pyx":153 + * + * @property + * def num_axes(self): # <<<<<<<<<<<<<< + * return 3 + * + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "DracoPy.pyx":162 + * 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. + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7DracoPy_2encode_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_3encode_mesh_to_buffer = {"encode_mesh_to_buffer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_3encode_mesh_to_buffer, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7DracoPy_2encode_mesh_to_buffer}; +static PyObject *__pyx_pw_7DracoPy_3encode_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; + 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); + values[5] = ((PyObject *)Py_None); + 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, 162, __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, 162, __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]; + } + 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, 162, __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_2encode_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); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7DracoPy_2encode_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; + 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":172 + * 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":173 + * """ + * 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":174 + * 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 + /* "DracoPy.pyx":175 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -3522,38 +5864,38 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_5 = (__pyx_t_4 != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":87 + /* "DracoPy.pyx":176 * 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_t_6 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 176, __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_t_7 = PyNumber_Multiply(__pyx_t_6, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 176, __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_t_8 = __Pyx_PyInt_As_size_t(__pyx_t_7); if (unlikely((__pyx_t_8 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 176, __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 + /* "DracoPy.pyx":177 * 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_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 177, __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_t_9 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 177, __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_t_10 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 177, __pyx_L3_error) } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; for (;;) { @@ -3561,17 +5903,17 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject 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) + __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, 177, __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_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 177, __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) + __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, 177, __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_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 177, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_7); #endif } @@ -3581,7 +5923,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject 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) + else __PYX_ERR(0, 177, __pyx_L3_error) } break; } @@ -3590,21 +5932,21 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_7); __pyx_t_7 = 0; - /* "DracoPy.pyx":89 + /* "DracoPy.pyx":178 * 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_t_7 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 178, __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_t_11 = __pyx_PyFloat_AsFloat(__pyx_t_7); if (unlikely((__pyx_t_11 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 178, __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_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 178, __pyx_L3_error) (__pyx_v_quant_origin[__pyx_t_12]) = __pyx_t_11; - /* "DracoPy.pyx":88 + /* "DracoPy.pyx":177 * if quantization_origin is not None: * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) * for dim in range(num_dims): # <<<<<<<<<<<<<< @@ -3614,7 +5956,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "DracoPy.pyx":86 + /* "DracoPy.pyx":175 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -3623,28 +5965,28 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":90 + /* "DracoPy.pyx":179 * 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) + __pyx_t_13 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 179, __pyx_L3_error) + __pyx_t_14 = __pyx_convert_vector_from_py_uint32_t(__pyx_v_faces); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 179, __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, 179, __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, 179, __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, 179, __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, 179, __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_ERR(0, 179, __pyx_L3_error) } __pyx_v_encoded_mesh = __pyx_t_18; - /* "DracoPy.pyx":91 + /* "DracoPy.pyx":180 * 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: # <<<<<<<<<<<<<< @@ -3654,7 +5996,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_5 = ((__pyx_v_quant_origin != NULL) != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":92 + /* "DracoPy.pyx":181 * 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) # <<<<<<<<<<<<<< @@ -3663,7 +6005,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":91 + /* "DracoPy.pyx":180 * 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: # <<<<<<<<<<<<<< @@ -3672,7 +6014,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":93 + /* "DracoPy.pyx":182 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -3682,7 +6024,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject switch (__pyx_v_encoded_mesh.encode_status) { case DracoFunctions::successful_encoding: - /* "DracoPy.pyx":94 + /* "DracoPy.pyx":183 * PyMem_Free(quant_origin) * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: * return bytes(encoded_mesh.buffer) # <<<<<<<<<<<<<< @@ -3690,16 +6032,16 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject * 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_t_6 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_encoded_mesh.buffer); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 183, __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_t_7 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 183, __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 + /* "DracoPy.pyx":182 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -3709,14 +6051,14 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject break; case DracoFunctions::failed_during_encoding: - /* "DracoPy.pyx":96 + /* "DracoPy.pyx":185 * 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_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 185, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_19 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -3730,14 +6072,14 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject } __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) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 185, __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) + __PYX_ERR(0, 185, __pyx_L3_error) - /* "DracoPy.pyx":95 + /* "DracoPy.pyx":184 * 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: # <<<<<<<<<<<<<< @@ -3748,7 +6090,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject default: break; } - /* "DracoPy.pyx":84 + /* "DracoPy.pyx":173 * """ * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -3765,7 +6107,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "DracoPy.pyx":97 + /* "DracoPy.pyx":186 * elif encoded_mesh.encode_status == DracoPy.encoding_status.failed_during_encoding: * raise EncodingFailedException('Invalid mesh') * except EncodingFailedException: # <<<<<<<<<<<<<< @@ -3773,7 +6115,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject * 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_GetModuleGlobalName(__pyx_t_20, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 186, __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; @@ -3781,19 +6123,19 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __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) + if (__Pyx_GetException(&__pyx_t_19, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 186, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_19); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); - /* "DracoPy.pyx":98 + /* "DracoPy.pyx":187 * 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_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 187, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_21); __pyx_t_22 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_21))) { @@ -3807,15 +6149,15 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject } __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) + if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 187, __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_ERR(0, 187, __pyx_L5_except_error) } - /* "DracoPy.pyx":99 + /* "DracoPy.pyx":188 * except EncodingFailedException: * raise EncodingFailedException('Invalid mesh') * except: # <<<<<<<<<<<<<< @@ -3824,12 +6166,12 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ /*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) + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_19) < 0) __PYX_ERR(0, 188, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_19); - /* "DracoPy.pyx":100 + /* "DracoPy.pyx":189 * raise EncodingFailedException('Invalid mesh') * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -3839,7 +6181,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_5 = ((__pyx_v_quant_origin != NULL) != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":101 + /* "DracoPy.pyx":190 * except: * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -3848,7 +6190,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":100 + /* "DracoPy.pyx":189 * raise EncodingFailedException('Invalid mesh') * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -3857,22 +6199,22 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":102 + /* "DracoPy.pyx":191 * 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): */ - __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_t_20 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 191, __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_ERR(0, 191, __pyx_L5_except_error) } __pyx_L5_except_error:; - /* "DracoPy.pyx":84 + /* "DracoPy.pyx":173 * """ * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -3893,7 +6235,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_L8_try_end:; } - /* "DracoPy.pyx":73 + /* "DracoPy.pyx":162 * pass * * def encode_mesh_to_buffer(points, faces, quantization_bits=14, compression_level=1, quantization_range=-1, quantization_origin=None, create_metadata=False): # <<<<<<<<<<<<<< @@ -3921,7 +6263,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject return __pyx_r; } -/* "DracoPy.pyx":104 +/* "DracoPy.pyx":193 * 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): # <<<<<<<<<<<<<< @@ -3930,10 +6272,10 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ /* 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) { +static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7DracoPy_4encode_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_5encode_point_cloud_to_buffer = {"encode_point_cloud_to_buffer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7DracoPy_4encode_point_cloud_to_buffer}; +static PyObject *__pyx_pw_7DracoPy_5encode_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; @@ -4010,7 +6352,7 @@ static PyObject *__pyx_pw_7DracoPy_3encode_point_cloud_to_buffer(PyObject *__pyx } } 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, "encode_point_cloud_to_buffer") < 0)) __PYX_ERR(0, 193, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -4038,20 +6380,20 @@ static PyObject *__pyx_pw_7DracoPy_3encode_point_cloud_to_buffer(PyObject *__pyx } 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("encode_point_cloud_to_buffer", 0, 1, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 193, __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_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_4encode_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); /* 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) { +static PyObject *__pyx_pf_7DracoPy_4encode_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; @@ -4084,7 +6426,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P int __pyx_clineno = 0; __Pyx_RefNannySetupContext("encode_point_cloud_to_buffer", 0); - /* "DracoPy.pyx":114 + /* "DracoPy.pyx":203 * a point where each coordinate is the minimum of that coordinate among the input vertices. * """ * cdef float* quant_origin = NULL # <<<<<<<<<<<<<< @@ -4093,7 +6435,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ __pyx_v_quant_origin = NULL; - /* "DracoPy.pyx":115 + /* "DracoPy.pyx":204 * """ * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -4109,7 +6451,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { - /* "DracoPy.pyx":116 + /* "DracoPy.pyx":205 * cdef float* quant_origin = NULL * try: * num_dims = 3 # <<<<<<<<<<<<<< @@ -4119,7 +6461,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_INCREF(__pyx_int_3); __pyx_v_num_dims = __pyx_int_3; - /* "DracoPy.pyx":117 + /* "DracoPy.pyx":206 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -4130,38 +6472,38 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_5 = (__pyx_t_4 != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":118 + /* "DracoPy.pyx":207 * 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_t_6 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 207, __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_t_7 = PyNumber_Multiply(__pyx_t_6, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 207, __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_t_8 = __Pyx_PyInt_As_size_t(__pyx_t_7); if (unlikely((__pyx_t_8 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 207, __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 + /* "DracoPy.pyx":208 * 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_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 208, __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_t_9 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 208, __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_t_10 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 208, __pyx_L3_error) } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; for (;;) { @@ -4169,17 +6511,17 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P 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) + __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, 208, __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_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 208, __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) + __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, 208, __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_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 208, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_7); #endif } @@ -4189,7 +6531,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P 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) + else __PYX_ERR(0, 208, __pyx_L3_error) } break; } @@ -4198,21 +6540,21 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_7); __pyx_t_7 = 0; - /* "DracoPy.pyx":120 + /* "DracoPy.pyx":209 * 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: */ - __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_t_7 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 209, __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_t_11 = __pyx_PyFloat_AsFloat(__pyx_t_7); if (unlikely((__pyx_t_11 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 209, __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_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 209, __pyx_L3_error) (__pyx_v_quant_origin[__pyx_t_12]) = __pyx_t_11; - /* "DracoPy.pyx":119 + /* "DracoPy.pyx":208 * if quantization_origin is not None: * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) * for dim in range(num_dims): # <<<<<<<<<<<<<< @@ -4222,7 +6564,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "DracoPy.pyx":117 + /* "DracoPy.pyx":206 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -4231,27 +6573,27 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ } - /* "DracoPy.pyx":121 + /* "DracoPy.pyx":210 * 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) */ - __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) + __pyx_t_13 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 210, __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, 210, __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, 210, __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, 210, __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, 210, __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_ERR(0, 210, __pyx_L3_error) } __pyx_v_encoded_point_cloud = __pyx_t_17; - /* "DracoPy.pyx":122 + /* "DracoPy.pyx":211 * 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: # <<<<<<<<<<<<<< @@ -4261,7 +6603,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_5 = ((__pyx_v_quant_origin != NULL) != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":123 + /* "DracoPy.pyx":212 * 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) # <<<<<<<<<<<<<< @@ -4270,7 +6612,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":122 + /* "DracoPy.pyx":211 * 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: # <<<<<<<<<<<<<< @@ -4279,7 +6621,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ } - /* "DracoPy.pyx":124 + /* "DracoPy.pyx":213 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -4289,7 +6631,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P switch (__pyx_v_encoded_point_cloud.encode_status) { case DracoFunctions::successful_encoding: - /* "DracoPy.pyx":125 + /* "DracoPy.pyx":214 * PyMem_Free(quant_origin) * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: * return bytes(encoded_point_cloud.buffer) # <<<<<<<<<<<<<< @@ -4297,16 +6639,16 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P * raise EncodingFailedException('Invalid point cloud') */ __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_t_6 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_encoded_point_cloud.buffer); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 214, __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_t_7 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 214, __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 + /* "DracoPy.pyx":213 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -4316,14 +6658,14 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P break; case DracoFunctions::failed_during_encoding: - /* "DracoPy.pyx":127 + /* "DracoPy.pyx":216 * 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_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 216, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_18 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -4337,14 +6679,14 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P } __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) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 216, __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) + __PYX_ERR(0, 216, __pyx_L3_error) - /* "DracoPy.pyx":126 + /* "DracoPy.pyx":215 * 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: # <<<<<<<<<<<<<< @@ -4355,7 +6697,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P default: break; } - /* "DracoPy.pyx":115 + /* "DracoPy.pyx":204 * """ * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -4372,7 +6714,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "DracoPy.pyx":128 + /* "DracoPy.pyx":217 * elif encoded_point_cloud.encode_status == DracoPy.encoding_status.failed_during_encoding: * raise EncodingFailedException('Invalid point cloud') * except EncodingFailedException: # <<<<<<<<<<<<<< @@ -4380,7 +6722,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P * 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_GetModuleGlobalName(__pyx_t_19, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 217, __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; @@ -4388,19 +6730,19 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __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) + if (__Pyx_GetException(&__pyx_t_18, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 217, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_18); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); - /* "DracoPy.pyx":129 + /* "DracoPy.pyx":218 * 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_GetModuleGlobalName(__pyx_t_20, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 218, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_20); __pyx_t_21 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) { @@ -4414,15 +6756,15 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P } __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) + if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 218, __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) + __PYX_ERR(0, 218, __pyx_L5_except_error) } - /* "DracoPy.pyx":130 + /* "DracoPy.pyx":219 * except EncodingFailedException: * raise EncodingFailedException('Invalid point cloud') * except: # <<<<<<<<<<<<<< @@ -4431,12 +6773,12 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ /*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) + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_18) < 0) __PYX_ERR(0, 219, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_18); - /* "DracoPy.pyx":131 + /* "DracoPy.pyx":220 * raise EncodingFailedException('Invalid point cloud') * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -4446,7 +6788,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_5 = ((__pyx_v_quant_origin != NULL) != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":132 + /* "DracoPy.pyx":221 * except: * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -4455,7 +6797,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":131 + /* "DracoPy.pyx":220 * raise EncodingFailedException('Invalid point cloud') * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -4464,22 +6806,22 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ } - /* "DracoPy.pyx":133 + /* "DracoPy.pyx":222 * 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_t_19 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 222, __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) + __PYX_ERR(0, 222, __pyx_L5_except_error) } __pyx_L5_except_error:; - /* "DracoPy.pyx":115 + /* "DracoPy.pyx":204 * """ * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -4500,7 +6842,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_L8_try_end:; } - /* "DracoPy.pyx":104 + /* "DracoPy.pyx":193 * 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): # <<<<<<<<<<<<<< @@ -4528,7 +6870,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P return __pyx_r; } -/* "DracoPy.pyx":135 +/* "DracoPy.pyx":224 * raise ValueError("Input invalid") * * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< @@ -4537,20 +6879,20 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ /* 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) { +static PyObject *__pyx_pw_7DracoPy_7raise_decoding_error(PyObject *__pyx_self, PyObject *__pyx_v_decoding_status); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_7raise_decoding_error = {"raise_decoding_error", (PyCFunction)__pyx_pw_7DracoPy_7raise_decoding_error, METH_O, 0}; +static PyObject *__pyx_pw_7DracoPy_7raise_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)); + __pyx_r = __pyx_pf_7DracoPy_6raise_decoding_error(__pyx_self, ((PyObject *)__pyx_v_decoding_status)); /* 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_6raise_decoding_error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_decoding_status) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4562,29 +6904,29 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject int __pyx_clineno = 0; __Pyx_RefNannySetupContext("raise_decoding_error", 0); - /* "DracoPy.pyx":136 + /* "DracoPy.pyx":225 * * 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, 136, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::not_draco_encoded); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 225, __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_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, 225, __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_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 225, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":137 + /* "DracoPy.pyx":226 * 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, 137, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FileTypeException); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 226, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { @@ -4598,14 +6940,14 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject } __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) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 226, __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_ERR(0, 226, __pyx_L1_error) - /* "DracoPy.pyx":136 + /* "DracoPy.pyx":225 * * def raise_decoding_error(decoding_status): * if decoding_status == DracoPy.decoding_status.not_draco_encoded: # <<<<<<<<<<<<<< @@ -4614,35 +6956,35 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":138 + /* "DracoPy.pyx":227 * 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, 138, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::failed_during_decoding); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 227, __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_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, 227, __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_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 227, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":139 + /* "DracoPy.pyx":228 * 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__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __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_ERR(0, 228, __pyx_L1_error) - /* "DracoPy.pyx":138 + /* "DracoPy.pyx":227 * 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: # <<<<<<<<<<<<<< @@ -4651,35 +6993,35 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":140 + /* "DracoPy.pyx":229 * 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, 140, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::no_position_attribute); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 229, __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_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, 229, __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_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 229, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":141 + /* "DracoPy.pyx":230 * 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): */ - __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_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 230, __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_ERR(0, 230, __pyx_L1_error) - /* "DracoPy.pyx":140 + /* "DracoPy.pyx":229 * 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: # <<<<<<<<<<<<<< @@ -4688,7 +7030,7 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":135 + /* "DracoPy.pyx":224 * raise ValueError("Input invalid") * * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< @@ -4711,7 +7053,7 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject return __pyx_r; } -/* "DracoPy.pyx":143 +/* "DracoPy.pyx":232 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer): # <<<<<<<<<<<<<< @@ -4720,20 +7062,20 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject */ /* 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_9decode_buffer_to_mesh(PyObject *__pyx_self, PyObject *__pyx_v_buffer); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_9decode_buffer_to_mesh = {"decode_buffer_to_mesh", (PyCFunction)__pyx_pw_7DracoPy_9decode_buffer_to_mesh, METH_O, 0}; +static PyObject *__pyx_pw_7DracoPy_9decode_buffer_to_mesh(PyObject *__pyx_self, PyObject *__pyx_v_buffer) { 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_r = __pyx_pf_7DracoPy_8decode_buffer_to_mesh(__pyx_self, ((PyObject *)__pyx_v_buffer)); /* 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) { +static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer) { struct DracoFunctions::MeshObject __pyx_v_mesh_struct; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -4750,24 +7092,24 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject int __pyx_clineno = 0; __Pyx_RefNannySetupContext("decode_buffer_to_mesh", 0); - /* "DracoPy.pyx":144 + /* "DracoPy.pyx":233 * * 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) */ - __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) + __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 233, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 233, __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_ERR(0, 233, __pyx_L1_error) } __pyx_v_mesh_struct = __pyx_t_3; - /* "DracoPy.pyx":145 + /* "DracoPy.pyx":234 * def decode_buffer_to_mesh(buffer): * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< @@ -4777,7 +7119,7 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject __pyx_t_4 = ((__pyx_v_mesh_struct.decode_status == DracoFunctions::successful) != 0); if (__pyx_t_4) { - /* "DracoPy.pyx":146 + /* "DracoPy.pyx":235 * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: * return DracoMesh(mesh_struct) # <<<<<<<<<<<<<< @@ -4785,9 +7127,9 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject * 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_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_DracoMesh); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 235, __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_t_7 = __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(__pyx_v_mesh_struct); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -4802,14 +7144,14 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject __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) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 235, __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 + /* "DracoPy.pyx":234 * def decode_buffer_to_mesh(buffer): * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< @@ -4818,7 +7160,7 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":148 + /* "DracoPy.pyx":237 * return DracoMesh(mesh_struct) * else: * raise_decoding_error(mesh_struct.decode_status) # <<<<<<<<<<<<<< @@ -4826,9 +7168,9 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject * 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_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_raise_decoding_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 237, __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_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, 237, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -4843,13 +7185,13 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject __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) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 237, __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; } - /* "DracoPy.pyx":143 + /* "DracoPy.pyx":232 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer): # <<<<<<<<<<<<<< @@ -4873,7 +7215,7 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject return __pyx_r; } -/* "DracoPy.pyx":150 +/* "DracoPy.pyx":239 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer): # <<<<<<<<<<<<<< @@ -4882,20 +7224,20 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject */ /* 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) { +static PyObject *__pyx_pw_7DracoPy_11decode_point_cloud_buffer(PyObject *__pyx_self, PyObject *__pyx_v_buffer); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_11decode_point_cloud_buffer = {"decode_point_cloud_buffer", (PyCFunction)__pyx_pw_7DracoPy_11decode_point_cloud_buffer, METH_O, 0}; +static PyObject *__pyx_pw_7DracoPy_11decode_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)); + __pyx_r = __pyx_pf_7DracoPy_10decode_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) { +static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer) { struct DracoFunctions::PointCloudObject __pyx_v_point_cloud_struct; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -4912,24 +7254,24 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb int __pyx_clineno = 0; __Pyx_RefNannySetupContext("decode_point_cloud_buffer", 0); - /* "DracoPy.pyx":151 + /* "DracoPy.pyx":240 * * 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) */ - __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) + __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 240, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 240, __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_ERR(0, 240, __pyx_L1_error) } __pyx_v_point_cloud_struct = __pyx_t_3; - /* "DracoPy.pyx":152 + /* "DracoPy.pyx":241 * 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: # <<<<<<<<<<<<<< @@ -4939,7 +7281,7 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb __pyx_t_4 = ((__pyx_v_point_cloud_struct.decode_status == DracoFunctions::successful) != 0); if (__pyx_t_4) { - /* "DracoPy.pyx":153 + /* "DracoPy.pyx":242 * 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) # <<<<<<<<<<<<<< @@ -4947,9 +7289,9 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb * raise_decoding_error(point_cloud_struct.decode_status) */ __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_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 242, __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_t_7 = __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointCloudObject(__pyx_v_point_cloud_struct); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 242, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -4964,14 +7306,14 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb __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, 153, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 242, __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 + /* "DracoPy.pyx":241 * 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: # <<<<<<<<<<<<<< @@ -4980,15 +7322,15 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb */ } - /* "DracoPy.pyx":155 + /* "DracoPy.pyx":244 * return DracoPointCloud(point_cloud_struct) * 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_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_raise_decoding_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 244, __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_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(__pyx_v_point_cloud_struct.decode_status); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 244, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -5003,13 +7345,13 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb __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, 155, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 244, __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; } - /* "DracoPy.pyx":150 + /* "DracoPy.pyx":239 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer): # <<<<<<<<<<<<<< @@ -5413,34 +7755,291 @@ 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_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; +} + +/* "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_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())] + /* "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_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_unsigned_int", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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); @@ -5448,56 +8047,48 @@ static PyObject *__pyx_convert_vector_to_py_unsigned_int(const std::vector &__pyx_v_v) { - size_t __pyx_v_i; +/* "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; - 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); + __Pyx_RefNannySetupContext("__pyx_convert_PyByteArray_string_to_py_std__in_string", 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())] # <<<<<<<<<<<<<< - * + /* "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 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L1_error) + __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_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 + /* "string.to_py":55 * - * @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())] + * @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_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_double", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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); @@ -5551,6 +8142,7 @@ static struct PyModuleDef __pyx_moduledef = { #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__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}, @@ -5570,19 +8162,49 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_n_s_GeometryMetadataObject, __pyx_k_GeometryMetadataObject, sizeof(__pyx_k_GeometryMetadataObject), 0, 0, 1, 1}, + {&__pyx_n_s_GeometryMetadataObject___init, __pyx_k_GeometryMetadataObject___init, sizeof(__pyx_k_GeometryMetadataObject___init), 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_n_s_List, __pyx_k_List, sizeof(__pyx_k_List), 0, 0, 1, 1}, + {&__pyx_n_s_MetadataObject, __pyx_k_MetadataObject, sizeof(__pyx_k_MetadataObject), 0, 0, 1, 1}, + {&__pyx_n_u_MetadataObject, __pyx_k_MetadataObject, sizeof(__pyx_k_MetadataObject), 0, 1, 0, 1}, + {&__pyx_n_s_MetadataObject___init, __pyx_k_MetadataObject___init, sizeof(__pyx_k_MetadataObject___init), 0, 0, 1, 1}, + {&__pyx_n_s_Reader, __pyx_k_Reader, sizeof(__pyx_k_Reader), 0, 0, 1, 1}, + {&__pyx_n_s_Reader___get_endian, __pyx_k_Reader___get_endian, sizeof(__pyx_k_Reader___get_endian), 0, 0, 1, 1}, + {&__pyx_n_s_Reader___init, __pyx_k_Reader___init, sizeof(__pyx_k_Reader___init), 0, 0, 1, 1}, + {&__pyx_n_s_Reader___read_bytes, __pyx_k_Reader___read_bytes, sizeof(__pyx_k_Reader___read_bytes), 0, 0, 1, 1}, + {&__pyx_n_s_Reader__get_endian, __pyx_k_Reader__get_endian, sizeof(__pyx_k_Reader__get_endian), 0, 0, 1, 1}, + {&__pyx_n_s_Reader__read_bytes, __pyx_k_Reader__read_bytes, sizeof(__pyx_k_Reader__read_bytes), 0, 0, 1, 1}, + {&__pyx_n_s_Reader_is_end, __pyx_k_Reader_is_end, sizeof(__pyx_k_Reader_is_end), 0, 0, 1, 1}, + {&__pyx_n_s_Reader_read_bytes, __pyx_k_Reader_read_bytes, sizeof(__pyx_k_Reader_read_bytes), 0, 0, 1, 1}, + {&__pyx_n_s_Reader_read_str, __pyx_k_Reader_read_str, sizeof(__pyx_k_Reader_read_str), 0, 0, 1, 1}, + {&__pyx_n_s_Reader_read_uint, __pyx_k_Reader_read_uint, sizeof(__pyx_k_Reader_read_uint), 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_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__27, __pyx_k__27, sizeof(__pyx_k__27), 0, 0, 1, 1}, + {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1}, + {&__pyx_n_s_attr_len, __pyx_k_attr_len, sizeof(__pyx_k_attr_len), 0, 0, 1, 1}, + {&__pyx_n_s_attribute_metadata, __pyx_k_attribute_metadata, sizeof(__pyx_k_attribute_metadata), 0, 0, 1, 1}, + {&__pyx_n_s_attribute_metadatas, __pyx_k_attribute_metadatas, sizeof(__pyx_k_attribute_metadatas), 0, 0, 1, 1}, + {&__pyx_n_s_attribute_metadatas_len, __pyx_k_attribute_metadatas_len, sizeof(__pyx_k_attribute_metadatas_len), 0, 0, 1, 1}, {&__pyx_n_s_axis, __pyx_k_axis, sizeof(__pyx_k_axis), 0, 0, 1, 1}, + {&__pyx_n_u_big, __pyx_k_big, sizeof(__pyx_k_big), 0, 1, 0, 1}, + {&__pyx_n_s_binary_metadata, __pyx_k_binary_metadata, sizeof(__pyx_k_binary_metadata), 0, 0, 1, 1}, + {&__pyx_n_u_binary_metadata, __pyx_k_binary_metadata, sizeof(__pyx_k_binary_metadata), 0, 1, 0, 1}, + {&__pyx_n_u_bool, __pyx_k_bool, sizeof(__pyx_k_bool), 0, 1, 0, 1}, {&__pyx_n_s_buffer, __pyx_k_buffer, sizeof(__pyx_k_buffer), 0, 0, 1, 1}, + {&__pyx_n_s_byteorder, __pyx_k_byteorder, sizeof(__pyx_k_byteorder), 0, 0, 1, 1}, + {&__pyx_n_u_bytes, __pyx_k_bytes, sizeof(__pyx_k_bytes), 0, 1, 0, 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_count, __pyx_k_count, sizeof(__pyx_k_count), 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, __pyx_k_decode, sizeof(__pyx_k_decode), 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}, @@ -5598,29 +8220,45 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1}, + {&__pyx_n_s_endian_order, __pyx_k_endian_order, sizeof(__pyx_k_endian_order), 0, 0, 1, 1}, + {&__pyx_n_s_entries, __pyx_k_entries, sizeof(__pyx_k_entries), 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_from_bytes, __pyx_k_from_bytes, sizeof(__pyx_k_from_bytes), 0, 0, 1, 1}, + {&__pyx_n_s_geometry_metadata, __pyx_k_geometry_metadata, sizeof(__pyx_k_geometry_metadata), 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_get_endian, __pyx_k_get_endian, sizeof(__pyx_k_get_endian), 0, 0, 1, 1}, {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, + {&__pyx_n_s_in_bytes, __pyx_k_in_bytes, sizeof(__pyx_k_in_bytes), 0, 0, 1, 1}, + {&__pyx_n_s_in_bytes_2, __pyx_k_in_bytes_2, sizeof(__pyx_k_in_bytes_2), 0, 0, 1, 1}, {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, + {&__pyx_n_u_int, __pyx_k_int, sizeof(__pyx_k_int), 0, 1, 0, 1}, {&__pyx_n_s_inverse_alpha, __pyx_k_inverse_alpha, sizeof(__pyx_k_inverse_alpha), 0, 0, 1, 1}, + {&__pyx_n_s_is_end, __pyx_k_is_end, sizeof(__pyx_k_is_end), 0, 0, 1, 1}, + {&__pyx_n_u_little, __pyx_k_little, sizeof(__pyx_k_little), 0, 1, 0, 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_metadata, __pyx_k_metadata, sizeof(__pyx_k_metadata), 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_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 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_kp_u_not_read_bytes_detected, __pyx_k_not_read_bytes_detected, sizeof(__pyx_k_not_read_bytes_detected), 0, 1, 0, 0}, {&__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_parse_binary_metadata, __pyx_k_parse_binary_metadata, sizeof(__pyx_k_parse_binary_metadata), 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_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 0, 1, 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}, @@ -5634,19 +8272,38 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_read_bytes, __pyx_k_read_bytes, sizeof(__pyx_k_read_bytes), 0, 0, 1, 1}, + {&__pyx_n_s_read_bytes_2, __pyx_k_read_bytes_2, sizeof(__pyx_k_read_bytes_2), 0, 0, 1, 1}, + {&__pyx_n_s_read_str, __pyx_k_read_str, sizeof(__pyx_k_read_str), 0, 0, 1, 1}, + {&__pyx_n_s_read_uint, __pyx_k_read_uint, sizeof(__pyx_k_read_uint), 0, 0, 1, 1}, + {&__pyx_n_s_reader, __pyx_k_reader, sizeof(__pyx_k_reader), 0, 0, 1, 1}, + {&__pyx_n_s_result_bytes, __pyx_k_result_bytes, sizeof(__pyx_k_result_bytes), 0, 0, 1, 1}, + {&__pyx_n_s_return, __pyx_k_return, sizeof(__pyx_k_return), 0, 0, 1, 1}, {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, + {&__pyx_n_s_signed, __pyx_k_signed, sizeof(__pyx_k_signed), 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_staticmethod, __pyx_k_staticmethod, sizeof(__pyx_k_staticmethod), 0, 0, 1, 1}, + {&__pyx_n_s_sub_metadata, __pyx_k_sub_metadata, sizeof(__pyx_k_sub_metadata), 0, 0, 1, 1}, + {&__pyx_n_s_sub_metadatas, __pyx_k_sub_metadatas, sizeof(__pyx_k_sub_metadatas), 0, 0, 1, 1}, + {&__pyx_n_s_sub_metadatas_len, __pyx_k_sub_metadatas_len, sizeof(__pyx_k_sub_metadatas_len), 0, 0, 1, 1}, + {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1}, {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_to_parse_metadata_next, __pyx_k_to_parse_metadata_next, sizeof(__pyx_k_to_parse_metadata_next), 0, 0, 1, 1}, + {&__pyx_n_s_to_parse_metadatas, __pyx_k_to_parse_metadatas, sizeof(__pyx_k_to_parse_metadatas), 0, 0, 1, 1}, + {&__pyx_n_s_typing, __pyx_k_typing, sizeof(__pyx_k_typing), 0, 0, 1, 1}, + {&__pyx_n_u_unicode, __pyx_k_unicode, sizeof(__pyx_k_unicode), 0, 1, 0, 1}, + {&__pyx_kp_u_unknown_endian_order, __pyx_k_unknown_endian_order, sizeof(__pyx_k_unknown_endian_order), 0, 1, 0, 0}, {&__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) + __pyx_builtin_staticmethod = __Pyx_GetBuiltinName(__pyx_n_s_staticmethod); if (!__pyx_builtin_staticmethod) __PYX_ERR(0, 15, __pyx_L1_error) + __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 96, __pyx_L1_error) + __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) __PYX_ERR(0, 114, __pyx_L1_error) + __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 59, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 141, __pyx_L1_error) + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 228, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -5656,263 +8313,411 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "DracoPy.pyx":52 + /* "DracoPy.pyx":23 + * return "big" + * else: + * raise Exception("unknown endian order") # <<<<<<<<<<<<<< + * + * def __read_bytes(self, count: int) -> bytes: + */ + __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_unknown_endian_order); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple_); + __Pyx_GIVEREF(__pyx_tuple_); + + /* "DracoPy.pyx":92 + * to_parse_metadatas = to_parse_metadata_next + * if not reader.is_end(): + * raise Exception("not read bytes detected") # <<<<<<<<<<<<<< + * return geometry_metadata + * + */ + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_not_read_bytes_detected); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 92, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__2); + __Pyx_GIVEREF(__pyx_tuple__2); + + /* "DracoPy.pyx":141 * 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_ = 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_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_Specified_value_out_of_encoded_r); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__3); + __Pyx_GIVEREF(__pyx_tuple__3); - /* "DracoPy.pyx":102 + /* "DracoPy.pyx":191 * 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): */ - __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); + __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_Input_invalid); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 191, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__4); + __Pyx_GIVEREF(__pyx_tuple__4); - /* "DracoPy.pyx":139 + /* "DracoPy.pyx":228 * 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_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_Failed_to_decode_input_mesh_Data); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 228, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__5); + __Pyx_GIVEREF(__pyx_tuple__5); - /* "DracoPy.pyx":141 + /* "DracoPy.pyx":230 * 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): */ - __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_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_DracoPy_only_supports_meshes_wit); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 230, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__6); + __Pyx_GIVEREF(__pyx_tuple__6); - /* "DracoPy.pyx":9 - * from libc.string cimport memcmp + /* "DracoPy.pyx":11 + * + * class _Reader: + * def __init__(self, in_bytes: bytes): # <<<<<<<<<<<<<< + * self._in_bytes = in_bytes + * self._pos = 0 + */ + __pyx_tuple__7 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_in_bytes); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__7); + __Pyx_GIVEREF(__pyx_tuple__7); + __pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__7, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_init, 11, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__8)) __PYX_ERR(0, 11, __pyx_L1_error) + + /* "DracoPy.pyx":16 + * + * @staticmethod + * def __get_endian() -> str: # <<<<<<<<<<<<<< + * endian_order = get_endian_order() + * if endian_order == DracoPy.endian_order.little_endian: + */ + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_n_s_endian_order); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__9); + __Pyx_GIVEREF(__pyx_tuple__9); + __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_get_endian, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 16, __pyx_L1_error) + + /* "DracoPy.pyx":25 + * raise Exception("unknown endian order") + * + * def __read_bytes(self, count: int) -> bytes: # <<<<<<<<<<<<<< + * end = self._pos + count + * result_bytes = self._in_bytes[self._pos:end] + */ + __pyx_tuple__11 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_count, __pyx_n_s_end, __pyx_n_s_result_bytes); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__11); + __Pyx_GIVEREF(__pyx_tuple__11); + __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_read_bytes_2, 25, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 25, __pyx_L1_error) + + /* "DracoPy.pyx":31 + * return result_bytes + * + * def read_uint(self) -> int: # <<<<<<<<<<<<<< + * value = int.from_bytes(self.__read_bytes(4), + * byteorder=self.__get_endian(), signed=False) + */ + __pyx_tuple__13 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_value); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__13); + __Pyx_GIVEREF(__pyx_tuple__13); + __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_read_uint, 31, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 31, __pyx_L1_error) + + /* "DracoPy.pyx":36 + * return value + * + * def read_str(self) -> str: # <<<<<<<<<<<<<< + * count = self.read_uint() + * return self.__read_bytes(count).decode() + */ + __pyx_tuple__15 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_count); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__15); + __Pyx_GIVEREF(__pyx_tuple__15); + __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_read_str, 36, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 36, __pyx_L1_error) + + /* "DracoPy.pyx":40 + * return self.__read_bytes(count).decode() + * + * def read_bytes(self) -> bytes: # <<<<<<<<<<<<<< + * count = self.read_uint() + * return self.__read_bytes(count) + */ + __pyx_tuple__17 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_count); 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(1, 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_read_bytes, 40, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 40, __pyx_L1_error) + + /* "DracoPy.pyx":44 + * return self.__read_bytes(count) + * + * def is_end(self) -> bool: # <<<<<<<<<<<<<< + * return len(self._in_bytes) == self._pos + * + */ + __pyx_tuple__19 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__19); + __Pyx_GIVEREF(__pyx_tuple__19); + __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_is_end, 44, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 44, __pyx_L1_error) + + /* "DracoPy.pyx":49 + * + * class MetadataObject: + * def __init__(self, entries: typing.Dict[str, bytes] = None, # <<<<<<<<<<<<<< + * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None): + * self.entries = entries if entries else {} + */ + __pyx_tuple__21 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_entries, __pyx_n_s_sub_metadatas); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__21); + __Pyx_GIVEREF(__pyx_tuple__21); + __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 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, 49, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 49, __pyx_L1_error) + __pyx_tuple__23 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__23); + __Pyx_GIVEREF(__pyx_tuple__23); + + /* "DracoPy.pyx":56 + * + * class GeometryMetadataObject(MetadataObject): + * def __init__(self, entries: typing.Dict[str, bytes] = None, # <<<<<<<<<<<<<< + * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None, + * attribute_metadatas: typing.List['MetadataObject'] = None): + */ + __pyx_tuple__24 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_entries, __pyx_n_s_sub_metadatas, __pyx_n_s_attribute_metadatas); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__24); + __Pyx_GIVEREF(__pyx_tuple__24); + __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_init, 56, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 56, __pyx_L1_error) + __pyx_tuple__26 = PyTuple_Pack(3, ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__26); + __Pyx_GIVEREF(__pyx_tuple__26); + + /* "DracoPy.pyx":64 + * + * + * def _parse_binary_metadata(binary_metadata: bytes) -> MetadataObject: # <<<<<<<<<<<<<< + * reader = _Reader(binary_metadata) + * geometry_metadata = GeometryMetadataObject() + */ + __pyx_tuple__28 = PyTuple_Pack(14, __pyx_n_s_binary_metadata, __pyx_n_s_reader, __pyx_n_s_geometry_metadata, __pyx_n_s_to_parse_metadatas, __pyx_n_s_attribute_metadatas_len, __pyx_n_s__27, __pyx_n_s_attribute_metadata, __pyx_n_s_to_parse_metadata_next, __pyx_n_s_metadata, __pyx_n_s_attr_len, __pyx_n_s_name_2, __pyx_n_s_value, __pyx_n_s_sub_metadatas_len, __pyx_n_s_sub_metadata); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__28); + __Pyx_GIVEREF(__pyx_tuple__28); + __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(1, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_parse_binary_metadata, 64, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 64, __pyx_L1_error) + + /* "DracoPy.pyx":96 + * * * class DracoPointCloud(object): # <<<<<<<<<<<<<< * def __init__(self, data_struct): * self.data_struct = data_struct */ - __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); + __pyx_tuple__30 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 96, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__30); + __Pyx_GIVEREF(__pyx_tuple__30); - /* "DracoPy.pyx":10 + /* "DracoPy.pyx":97 * * class DracoPointCloud(object): * def __init__(self, data_struct): # <<<<<<<<<<<<<< * self.data_struct = data_struct * if data_struct['encoding_options_set']: */ - __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_tuple__31 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_data_struct); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__31); + __Pyx_GIVEREF(__pyx_tuple__31); + __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 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_init, 97, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 97, __pyx_L1_error) - /* "DracoPy.pyx":18 - * self.encoding_options = None + /* "DracoPy.pyx":106 + * self.metadata = _parse_binary_metadata(data_struct["binary_metadata"]) * * 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__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) + __pyx_tuple__33 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_value, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 106, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__33); + __Pyx_GIVEREF(__pyx_tuple__33); + __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 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_get_encoded_coordinate, 106, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 106, __pyx_L1_error) - /* "DracoPy.pyx":22 + /* "DracoPy.pyx":110 * 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__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_tuple__35 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_point); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__35); + __Pyx_GIVEREF(__pyx_tuple__35); + __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(2, 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_get_encoded_point, 110, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 110, __pyx_L1_error) - /* "DracoPy.pyx":27 + /* "DracoPy.pyx":115 * * @property * def num_axes(self): # <<<<<<<<<<<<<< * return 3 * */ - __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_tuple__37 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 115, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__37); + __Pyx_GIVEREF(__pyx_tuple__37); + __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_num_axes, 115, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 115, __pyx_L1_error) - /* "DracoPy.pyx":31 + /* "DracoPy.pyx":119 * * @property * def points(self): # <<<<<<<<<<<<<< * return self.data_struct['points'] * */ - __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) + __pyx_tuple__39 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__39); + __Pyx_GIVEREF(__pyx_tuple__39); + __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_points, 119, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 119, __pyx_L1_error) - /* "DracoPy.pyx":36 + /* "DracoPy.pyx":125 * class DracoMesh(DracoPointCloud): * @property * def faces(self): # <<<<<<<<<<<<<< * return self.data_struct['faces'] * */ - __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_tuple__41 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__41); + __Pyx_GIVEREF(__pyx_tuple__41); + __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_faces, 125, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 125, __pyx_L1_error) - /* "DracoPy.pyx":40 + /* "DracoPy.pyx":129 * * @property * def normals(self): # <<<<<<<<<<<<<< * return self.data_struct['normals'] * */ - __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) + __pyx_tuple__43 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__43); + __Pyx_GIVEREF(__pyx_tuple__43); + __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_normals, 129, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 129, __pyx_L1_error) - /* "DracoPy.pyx":43 + /* "DracoPy.pyx":132 * return self.data_struct['normals'] * * class EncodingOptions(object): # <<<<<<<<<<<<<< * def __init__(self, quantization_bits, quantization_range, quantization_origin): * self.quantization_bits = quantization_bits */ - __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_tuple__45 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__45); + __Pyx_GIVEREF(__pyx_tuple__45); - /* "DracoPy.pyx":44 + /* "DracoPy.pyx":133 * * class EncodingOptions(object): * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< * self.quantization_bits = quantization_bits * self.quantization_range = quantization_range */ - __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_tuple__46 = 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__46)) __PYX_ERR(0, 133, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__46); + __Pyx_GIVEREF(__pyx_tuple__46); + __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 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_init, 133, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 133, __pyx_L1_error) - /* "DracoPy.pyx":50 + /* "DracoPy.pyx":139 * 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__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_tuple__48 = 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__48)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__48); + __Pyx_GIVEREF(__pyx_tuple__48); + __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_get_encoded_coordinate, 139, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 139, __pyx_L1_error) - /* "DracoPy.pyx":57 + /* "DracoPy.pyx":146 * 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__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_tuple__50 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_point, __pyx_n_s_encoded_point, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__50); + __Pyx_GIVEREF(__pyx_tuple__50); + __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 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_get_encoded_point, 146, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 146, __pyx_L1_error) - /* "DracoPy.pyx":64 + /* "DracoPy.pyx":153 * * @property * def num_axes(self): # <<<<<<<<<<<<<< * return 3 * */ - __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_tuple__52 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 153, __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_num_axes, 153, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 153, __pyx_L1_error) - /* "DracoPy.pyx":73 + /* "DracoPy.pyx":162 * 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. */ - __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_tuple__54 = 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__54)) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__54); + __Pyx_GIVEREF(__pyx_tuple__54); + __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(7, 0, 11, 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_encode_mesh_to_buffer, 162, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 162, __pyx_L1_error) - /* "DracoPy.pyx":104 + /* "DracoPy.pyx":193 * 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. */ - __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) + __pyx_tuple__56 = 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__56)) __PYX_ERR(0, 193, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__56); + __Pyx_GIVEREF(__pyx_tuple__56); + __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(6, 0, 10, 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_encode_point_cloud_to_buffer, 193, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 193, __pyx_L1_error) - /* "DracoPy.pyx":135 + /* "DracoPy.pyx":224 * 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__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) + __pyx_tuple__58 = PyTuple_Pack(1, __pyx_n_s_decoding_status); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__58); + __Pyx_GIVEREF(__pyx_tuple__58); + __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_src_DracoPy_pyx, __pyx_n_s_raise_decoding_error, 224, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(0, 224, __pyx_L1_error) - /* "DracoPy.pyx":143 + /* "DracoPy.pyx":232 * 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: */ - __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) + __pyx_tuple__60 = PyTuple_Pack(2, __pyx_n_s_buffer, __pyx_n_s_mesh_struct); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 232, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__60); + __Pyx_GIVEREF(__pyx_tuple__60); + __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_buffer_to_mesh, 232, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 232, __pyx_L1_error) - /* "DracoPy.pyx":150 + /* "DracoPy.pyx":239 * 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_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_tuple__62 = PyTuple_Pack(2, __pyx_n_s_buffer, __pyx_n_s_point_cloud_struct); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(0, 239, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__62); + __Pyx_GIVEREF(__pyx_tuple__62); + __pyx_codeobj__63 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__62, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_point_cloud_buffer, 239, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__63)) __PYX_ERR(0, 239, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -5923,9 +8728,11 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { 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_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __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; @@ -6096,6 +8903,9 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec_DracoPy(PyObject *__pyx_pyinit_mod 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; + PyObject *__pyx_t_8 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -6146,11 +8956,9 @@ if (!__Pyx_RefNanny) { #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? */ + #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS PyEval_InitThreads(); #endif - #endif /*--- Module creation code ---*/ #if CYTHON_PEP489_MULTI_PHASE_INIT __pyx_m = __pyx_pyinit_module; @@ -6203,435 +9011,824 @@ if (!__Pyx_RefNanny) { if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif - /* "DracoPy.pyx":5 + /* "DracoPy.pyx":2 + * # distutils: language = c++ + * import typing # <<<<<<<<<<<<<< + * + * from cpython.mem cimport PyMem_Malloc, PyMem_Free + */ + __pyx_t_1 = __Pyx_Import(__pyx_n_s_typing, 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_typing, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "DracoPy.pyx":6 * from cpython.mem cimport PyMem_Malloc, PyMem_Free * cimport DracoPy - * import struct # <<<<<<<<<<<<<< - * from math import floor + * from math import floor # <<<<<<<<<<<<<< * from libc.string cimport memcmp + * + */ + __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_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; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":10 + * + * + * class _Reader: # <<<<<<<<<<<<<< + * def __init__(self, in_bytes: bytes): + * self._in_bytes = in_bytes + */ + __pyx_t_2 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_Reader, __pyx_n_s_Reader, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "DracoPy.pyx":11 + * + * class _Reader: + * def __init__(self, in_bytes: bytes): # <<<<<<<<<<<<<< + * self._in_bytes = in_bytes + * self._pos = 0 + */ + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_in_bytes, __pyx_n_u_bytes) < 0) __PYX_ERR(0, 11, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_7_Reader_1__init__, 0, __pyx_n_s_Reader___init, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__8)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 11, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "DracoPy.pyx":16 + * + * @staticmethod + * def __get_endian() -> str: # <<<<<<<<<<<<<< + * endian_order = get_endian_order() + * if endian_order == DracoPy.endian_order.little_endian: + */ + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 16, __pyx_L1_error) + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_7_Reader_3__get_endian, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_Reader___get_endian, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__10)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "DracoPy.pyx":15 + * self._pos = 0 + * + * @staticmethod # <<<<<<<<<<<<<< + * def __get_endian() -> str: + * endian_order = get_endian_order() + */ + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_Reader__get_endian, __pyx_t_3) < 0) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "DracoPy.pyx":25 + * raise Exception("unknown endian order") + * + * def __read_bytes(self, count: int) -> bytes: # <<<<<<<<<<<<<< + * end = self._pos + count + * result_bytes = self._in_bytes[self._pos:end] + */ + __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_count, __pyx_n_u_int) < 0) __PYX_ERR(0, 25, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_u_bytes) < 0) __PYX_ERR(0, 25, __pyx_L1_error) + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_7_Reader_5__read_bytes, 0, __pyx_n_s_Reader___read_bytes, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__12)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_Reader__read_bytes, __pyx_t_1) < 0) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "DracoPy.pyx":31 + * return result_bytes + * + * def read_uint(self) -> int: # <<<<<<<<<<<<<< + * value = int.from_bytes(self.__read_bytes(4), + * byteorder=self.__get_endian(), signed=False) + */ + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_int) < 0) __PYX_ERR(0, 31, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_7_Reader_7read_uint, 0, __pyx_n_s_Reader_read_uint, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__14)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_read_uint, __pyx_t_3) < 0) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "DracoPy.pyx":36 + * return value + * + * def read_str(self) -> str: # <<<<<<<<<<<<<< + * count = self.read_uint() + * return self.__read_bytes(count).decode() + */ + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 36, __pyx_L1_error) + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_7_Reader_9read_str, 0, __pyx_n_s_Reader_read_str, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__16)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_read_str, __pyx_t_1) < 0) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "DracoPy.pyx":40 + * return self.__read_bytes(count).decode() + * + * def read_bytes(self) -> bytes: # <<<<<<<<<<<<<< + * count = self.read_uint() + * return self.__read_bytes(count) + */ + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_bytes) < 0) __PYX_ERR(0, 40, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_7_Reader_11read_bytes, 0, __pyx_n_s_Reader_read_bytes, 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); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_read_bytes, __pyx_t_3) < 0) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "DracoPy.pyx":44 + * return self.__read_bytes(count) + * + * def is_end(self) -> bool: # <<<<<<<<<<<<<< + * return len(self._in_bytes) == self._pos + * */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_u_bool) < 0) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_7_Reader_13is_end, 0, __pyx_n_s_Reader_is_end, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__20)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __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_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_is_end, __pyx_t_1) < 0) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":6 - * cimport DracoPy - * import struct - * from math import floor # <<<<<<<<<<<<<< - * from libc.string cimport memcmp + /* "DracoPy.pyx":10 * + * + * class _Reader: # <<<<<<<<<<<<<< + * def __init__(self, in_bytes: bytes): + * self._in_bytes = in_bytes */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error) + __pyx_t_1 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_Reader, __pyx_empty_tuple, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __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) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Reader, __pyx_t_1) < 0) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":48 + * + * + * class MetadataObject: # <<<<<<<<<<<<<< + * def __init__(self, entries: typing.Dict[str, bytes] = None, + * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None): + */ + __pyx_t_2 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_MetadataObject, __pyx_n_s_MetadataObject, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); + + /* "DracoPy.pyx":49 + * + * class MetadataObject: + * def __init__(self, entries: typing.Dict[str, bytes] = None, # <<<<<<<<<<<<<< + * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None): + * self.entries = entries if entries else {} + */ + __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_typing); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Dict); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)(&PyUnicode_Type))); + __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)(&PyUnicode_Type))); + __Pyx_INCREF(((PyObject *)(&PyBytes_Type))); + __Pyx_GIVEREF(((PyObject *)(&PyBytes_Type))); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)(&PyBytes_Type))); + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_entries, __pyx_t_5) < 0) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "DracoPy.pyx":50 + * class MetadataObject: + * def __init__(self, entries: typing.Dict[str, bytes] = None, + * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None): # <<<<<<<<<<<<<< + * self.entries = entries if entries else {} + * self.sub_metadatas = sub_metadatas if sub_metadatas else {} + */ + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_typing); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_Dict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)(&PyUnicode_Type))); + __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)(&PyUnicode_Type))); + __Pyx_INCREF(__pyx_n_u_MetadataObject); + __Pyx_GIVEREF(__pyx_n_u_MetadataObject); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_n_u_MetadataObject); + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_sub_metadatas, __pyx_t_4) < 0) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "DracoPy.pyx":49 + * + * class MetadataObject: + * def __init__(self, entries: typing.Dict[str, bytes] = None, # <<<<<<<<<<<<<< + * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None): + * self.entries = entries if entries else {} + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_14MetadataObject_1__init__, 0, __pyx_n_s_MetadataObject___init, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__22)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__23); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_1); __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) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_4) < 0) __PYX_ERR(0, 49, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "DracoPy.pyx":48 + * + * + * class MetadataObject: # <<<<<<<<<<<<<< + * def __init__(self, entries: typing.Dict[str, bytes] = None, + * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None): + */ + __pyx_t_4 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_MetadataObject, __pyx_empty_tuple, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_MetadataObject, __pyx_t_4) < 0) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":55 + * + * + * class GeometryMetadataObject(MetadataObject): # <<<<<<<<<<<<<< + * def __init__(self, entries: typing.Dict[str, bytes] = None, + * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None, + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_MetadataObject); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 55, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_4, __pyx_n_s_GeometryMetadataObject, __pyx_n_s_GeometryMetadataObject, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __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_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 55, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + + /* "DracoPy.pyx":56 + * + * class GeometryMetadataObject(MetadataObject): + * def __init__(self, entries: typing.Dict[str, bytes] = None, # <<<<<<<<<<<<<< + * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None, + * attribute_metadatas: typing.List['MetadataObject'] = None): + */ + __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_typing); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_Dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(((PyObject *)(&PyUnicode_Type))); + __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)(&PyUnicode_Type))); + __Pyx_INCREF(((PyObject *)(&PyBytes_Type))); + __Pyx_GIVEREF(((PyObject *)(&PyBytes_Type))); + PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)(&PyBytes_Type))); + __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_entries, __pyx_t_8) < 0) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + + /* "DracoPy.pyx":57 + * class GeometryMetadataObject(MetadataObject): + * def __init__(self, entries: typing.Dict[str, bytes] = None, + * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None, # <<<<<<<<<<<<<< + * attribute_metadatas: typing.List['MetadataObject'] = None): + * super().__init__(entries, sub_metadatas) + */ + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_typing); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_Dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(((PyObject *)(&PyUnicode_Type))); + __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); + PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)(&PyUnicode_Type))); + __Pyx_INCREF(__pyx_n_u_MetadataObject); + __Pyx_GIVEREF(__pyx_n_u_MetadataObject); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_n_u_MetadataObject); + __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_sub_metadatas, __pyx_t_7) < 0) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "DracoPy.pyx":58 + * def __init__(self, entries: typing.Dict[str, bytes] = None, + * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None, + * attribute_metadatas: typing.List['MetadataObject'] = None): # <<<<<<<<<<<<<< + * super().__init__(entries, sub_metadatas) + * self.attribute_metadatas = attribute_metadatas if attribute_metadatas \ + */ + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_typing); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_List); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_t_8, __pyx_n_u_MetadataObject); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_attribute_metadatas, __pyx_t_7) < 0) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "DracoPy.pyx":56 + * + * class GeometryMetadataObject(MetadataObject): + * def __init__(self, entries: typing.Dict[str, bytes] = None, # <<<<<<<<<<<<<< + * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None, + * attribute_metadatas: typing.List['MetadataObject'] = None): + */ + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_22GeometryMetadataObject_1__init__, 0, __pyx_n_s_GeometryMetadataObject___init, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__25)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_INCREF(__pyx_t_7); + PyList_Append(__pyx_t_5, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__26); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_7) < 0) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + + /* "DracoPy.pyx":55 + * + * + * class GeometryMetadataObject(MetadataObject): # <<<<<<<<<<<<<< + * def __init__(self, entries: typing.Dict[str, bytes] = None, + * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None, + */ + __pyx_t_7 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_GeometryMetadataObject, __pyx_t_4, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 55, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_CyFunction_InitClassCell(__pyx_t_5, __pyx_t_7) < 0) __PYX_ERR(0, 55, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_GeometryMetadataObject, __pyx_t_7) < 0) __PYX_ERR(0, 55, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "DracoPy.pyx":9 - * from libc.string cimport memcmp + /* "DracoPy.pyx":64 + * + * + * def _parse_binary_metadata(binary_metadata: bytes) -> MetadataObject: # <<<<<<<<<<<<<< + * reader = _Reader(binary_metadata) + * geometry_metadata = GeometryMetadataObject() + */ + __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_1_parse_binary_metadata, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_parse_binary_metadata, __pyx_t_4) < 0) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "DracoPy.pyx":96 + * * * class DracoPointCloud(object): # <<<<<<<<<<<<<< * def __init__(self, data_struct): * self.data_struct = data_struct */ - __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error) + __pyx_t_4 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__30); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 96, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_4, __pyx_tuple__30, __pyx_n_s_DracoPointCloud, __pyx_n_s_DracoPointCloud, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __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); - /* "DracoPy.pyx":10 + /* "DracoPy.pyx":97 * * 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__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_1 = __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__32)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_1) < 0) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":18 - * self.encoding_options = None + /* "DracoPy.pyx":106 + * self.metadata = _parse_binary_metadata(data_struct["binary_metadata"]) * * 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__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_1 = __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__34)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_get_encoded_coordinate, __pyx_t_1) < 0) __PYX_ERR(0, 106, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":22 + /* "DracoPy.pyx":110 * 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__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_1 = __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__36)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_get_encoded_point, __pyx_t_1) < 0) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":27 + /* "DracoPy.pyx":115 * * @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__13)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 27, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __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__38)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 115, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); - /* "DracoPy.pyx":26 + /* "DracoPy.pyx":114 * 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, 26, __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_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 114, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_num_axes, __pyx_t_7) < 0) __PYX_ERR(0, 115, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "DracoPy.pyx":31 + /* "DracoPy.pyx":119 * * @property * def points(self): # <<<<<<<<<<<<<< * return self.data_struct['points'] * */ - __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_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_9points, 0, __pyx_n_s_DracoPointCloud_points, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__40)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); - /* "DracoPy.pyx":30 + /* "DracoPy.pyx":118 * return 3 * * @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_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; + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_points, __pyx_t_1) < 0) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":9 - * from libc.string cimport memcmp + /* "DracoPy.pyx":96 + * * * class DracoPointCloud(object): # <<<<<<<<<<<<<< * def __init__(self, data_struct): * self.data_struct = data_struct */ - __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_1 = __Pyx_Py3ClassCreate(__pyx_t_4, __pyx_n_s_DracoPointCloud, __pyx_tuple__30, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoPointCloud, __pyx_t_1) < 0) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "DracoPy.pyx":34 - * return self.data_struct['points'] + /* "DracoPy.pyx":123 + * * * class DracoMesh(DracoPointCloud): # <<<<<<<<<<<<<< * @property * def faces(self): */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 123, __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_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_4, __pyx_t_2, __pyx_n_s_DracoMesh, __pyx_n_s_DracoMesh, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __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); - /* "DracoPy.pyx":36 + /* "DracoPy.pyx":125 * class DracoMesh(DracoPointCloud): * @property * def faces(self): # <<<<<<<<<<<<<< * return self.data_struct['faces'] * */ - __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_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_9DracoMesh_1faces, 0, __pyx_n_s_DracoMesh_faces, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__42)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); - /* "DracoPy.pyx":35 + /* "DracoPy.pyx":124 * * class DracoMesh(DracoPointCloud): * @property # <<<<<<<<<<<<<< * def faces(self): * return self.data_struct['faces'] */ - __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_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 124, __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_7); __pyx_t_7 = 0; + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_faces, __pyx_t_5) < 0) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "DracoPy.pyx":40 + /* "DracoPy.pyx":129 * * @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__19)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 40, __pyx_L1_error) + __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__44)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 129, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - /* "DracoPy.pyx":39 + /* "DracoPy.pyx":128 * return self.data_struct['faces'] * * @property # <<<<<<<<<<<<<< * def normals(self): * return self.data_struct['normals'] */ - __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_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); __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; + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_normals, __pyx_t_7) < 0) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "DracoPy.pyx":34 - * return self.data_struct['points'] + /* "DracoPy.pyx":123 + * * * class DracoMesh(DracoPointCloud): # <<<<<<<<<<<<<< * @property * def faces(self): */ - __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_t_7 = __Pyx_Py3ClassCreate(__pyx_t_4, __pyx_n_s_DracoMesh, __pyx_t_2, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoMesh, __pyx_t_7) < 0) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __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 + /* "DracoPy.pyx":132 * return self.data_struct['normals'] * * class EncodingOptions(object): # <<<<<<<<<<<<<< * def __init__(self, quantization_bits, quantization_range, quantization_origin): * self.quantization_bits = quantization_bits */ - __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_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__45); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_tuple__45, __pyx_n_s_EncodingOptions, __pyx_n_s_EncodingOptions, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); - /* "DracoPy.pyx":44 + /* "DracoPy.pyx":133 * * class EncodingOptions(object): * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< * self.quantization_bits = quantization_bits * self.quantization_range = quantization_range */ - __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_t_1 = __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__47)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_SetNameInClass(__pyx_t_4, __pyx_n_s_init, __pyx_t_1) < 0) __PYX_ERR(0, 133, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":50 + /* "DracoPy.pyx":139 * 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_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; + __pyx_t_1 = __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__49)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_SetNameInClass(__pyx_t_4, __pyx_n_s_get_encoded_coordinate, __pyx_t_1) < 0) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":57 + /* "DracoPy.pyx":146 * 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_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_t_1 = __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__51)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_SetNameInClass(__pyx_t_4, __pyx_n_s_get_encoded_point, __pyx_t_1) < 0) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":64 + /* "DracoPy.pyx":153 * * @property * def num_axes(self): # <<<<<<<<<<<<<< * return 3 * */ - __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_t_1 = __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__53)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); - /* "DracoPy.pyx":63 + /* "DracoPy.pyx":152 * return encoded_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, 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_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 152, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__Pyx_SetNameInClass(__pyx_t_4, __pyx_n_s_num_axes, __pyx_t_7) < 0) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "DracoPy.pyx":43 + /* "DracoPy.pyx":132 * return self.data_struct['normals'] * * 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_t_7 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_EncodingOptions, __pyx_tuple__45, __pyx_t_4, NULL, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingOptions, __pyx_t_7) < 0) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 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":67 + /* "DracoPy.pyx":156 * return 3 * * class FileTypeException(Exception): # <<<<<<<<<<<<<< * pass * */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 156, __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_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) + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + __pyx_t_4 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 156, __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_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_4, __pyx_t_2, __pyx_n_s_FileTypeException, __pyx_n_s_FileTypeException, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_4, __pyx_n_s_FileTypeException, __pyx_t_2, __pyx_t_7, NULL, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_FileTypeException, __pyx_t_1) < 0) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 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 + /* "DracoPy.pyx":159 * pass * * class EncodingFailedException(Exception): # <<<<<<<<<<<<<< * pass * */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __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_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) + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + __pyx_t_4 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 159, __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_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_4, __pyx_t_2, __pyx_n_s_EncodingFailedException, __pyx_n_s_EncodingFailedException, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_4, __pyx_n_s_EncodingFailedException, __pyx_t_2, __pyx_t_7, NULL, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingFailedException, __pyx_t_1) < 0) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 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":73 + /* "DracoPy.pyx":162 * 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. */ - __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; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_3encode_mesh_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __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, 162, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":104 + /* "DracoPy.pyx":193 * 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. */ - __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_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_5encode_point_cloud_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __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, 193, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":135 + /* "DracoPy.pyx":224 * 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_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; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_7raise_decoding_error, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_raise_decoding_error, __pyx_t_2) < 0) __PYX_ERR(0, 224, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":143 + /* "DracoPy.pyx":232 * 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: */ - __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; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_9decode_buffer_to_mesh, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 232, __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, 232, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":150 + /* "DracoPy.pyx":239 * 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_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; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_11decode_point_cloud_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 239, __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, 239, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "DracoPy.pyx":1 * # distutils: language = c++ # <<<<<<<<<<<<<< + * import typing * - * 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_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; - /* "vector.to_py":60 + /* "string.to_py":55 * - * @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())] + * @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()) * */ @@ -6644,6 +9841,9 @@ 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_7); + __Pyx_XDECREF(__pyx_t_8); if (__pyx_m) { if (__pyx_d) { __Pyx_AddTraceback("init DracoPy", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -6851,6 +10051,27 @@ static int __Pyx_ParseOptionalKeywords( return -1; } +/* 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; +} + /* PyObjectSetAttrStr */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { @@ -6865,91 +10086,329 @@ static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr } #endif -/* DictGetItem */ -#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY -static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { - PyObject *value; - value = PyDict_GetItemWithError(d, key); - if (unlikely(!value)) { - if (!PyErr_Occurred()) { - if (unlikely(PyTuple_Check(key))) { - PyObject* args = PyTuple_Pack(1, key); - if (likely(args)) { - PyErr_SetObject(PyExc_KeyError, args); - Py_DECREF(args); - } - } else { - PyErr_SetObject(PyExc_KeyError, key); - } - } +/* 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"); } - Py_INCREF(value); - return value; + return result; } #endif -/* PyDictVersioning */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { - PyObject **dictptr = NULL; - Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; - if (offset) { -#if CYTHON_COMPILING_IN_CPYTHON - dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); -#else - dictptr = _PyObject_GetDictPtr(obj); -#endif - } - return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +/* 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 int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) - return 0; - return obj_dict_version == __Pyx_get_object_dict_version(obj); +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 -/* GetModuleGlobalName */ -#if CYTHON_USE_DICT_VERSIONS -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) -#else -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) +/* 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 -{ - PyObject *result; -#if !CYTHON_AVOID_BORROWED_REFS -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 - result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } else if (unlikely(PyErr_Occurred())) { - return NULL; + 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 - result = PyDict_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); +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 + +/* SliceObject */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj, + Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, + int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { +#if CYTHON_USE_TYPE_SLOTS + PyMappingMethods* mp; +#if PY_MAJOR_VERSION < 3 + PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence; + if (likely(ms && ms->sq_slice)) { + if (!has_cstart) { + if (_py_start && (*_py_start != Py_None)) { + cstart = __Pyx_PyIndex_AsSsize_t(*_py_start); + if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; + } else + cstart = 0; + } + if (!has_cstop) { + if (_py_stop && (*_py_stop != Py_None)) { + cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop); + if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; + } else + cstop = PY_SSIZE_T_MAX; + } + if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) { + Py_ssize_t l = ms->sq_length(obj); + if (likely(l >= 0)) { + if (cstop < 0) { + cstop += l; + if (cstop < 0) cstop = 0; + } + if (cstart < 0) { + cstart += l; + if (cstart < 0) cstart = 0; + } + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + goto bad; + PyErr_Clear(); + } + } + return ms->sq_slice(obj, cstart, cstop); } #endif + mp = Py_TYPE(obj)->tp_as_mapping; + if (likely(mp && mp->mp_subscript)) +#endif + { + PyObject* result; + PyObject *py_slice, *py_start, *py_stop; + if (_py_slice) { + py_slice = *_py_slice; + } else { + PyObject* owned_start = NULL; + PyObject* owned_stop = NULL; + if (_py_start) { + py_start = *_py_start; + } else { + if (has_cstart) { + owned_start = py_start = PyInt_FromSsize_t(cstart); + if (unlikely(!py_start)) goto bad; + } else + py_start = Py_None; + } + if (_py_stop) { + py_stop = *_py_stop; + } else { + if (has_cstop) { + owned_stop = py_stop = PyInt_FromSsize_t(cstop); + if (unlikely(!py_stop)) { + Py_XDECREF(owned_start); + goto bad; + } + } else + py_stop = Py_None; + } + py_slice = PySlice_New(py_start, py_stop, Py_None); + Py_XDECREF(owned_start); + Py_XDECREF(owned_stop); + if (unlikely(!py_slice)) goto bad; + } +#if CYTHON_USE_TYPE_SLOTS + result = mp->mp_subscript(obj, py_slice); #else - result = PyObject_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } - PyErr_Clear(); + result = PyObject_GetItem(obj, py_slice); #endif - return __Pyx_GetBuiltinName(name); + if (!_py_slice) { + Py_DECREF(py_slice); + } + return result; + } + PyErr_Format(PyExc_TypeError, + "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name); +bad: + return NULL; } +/* PyCFunctionFastCall */ +#if CYTHON_FAST_PYCCALL +static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { + PyCFunctionObject *func = (PyCFunctionObject*)func_obj; + PyCFunction meth = PyCFunction_GET_FUNCTION(func); + PyObject *self = PyCFunction_GET_SELF(func); + int flags = PyCFunction_GET_FLAGS(func); + assert(PyCFunction_Check(func)); + assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); + assert(nargs >= 0); + assert(nargs == 0 || args != NULL); + /* _PyCFunction_FastCallDict() must not be called with an exception set, + because it may clear it (directly or indirectly) and so the + caller loses its exception */ + assert(!PyErr_Occurred()); + if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { + return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); + } else { + return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); + } +} +#endif + /* PyFunctionFastCall */ #if CYTHON_FAST_PYCALL static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, @@ -7069,135 +10528,326 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #endif #endif -/* PyCFunctionFastCall */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - int flags = PyCFunction_GET_FLAGS(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { - return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); - } else { - return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); +/* PyObjectCall2Args */ +static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { + PyObject *args, *result = NULL; + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(function)) { + PyObject *args[2] = {arg1, arg2}; + return __Pyx_PyFunction_FastCall(function, args, 2); + } + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(function)) { + PyObject *args[2] = {arg1, arg2}; + return __Pyx_PyCFunction_FastCall(function, args, 2); } + #endif + args = PyTuple_New(2); + if (unlikely(!args)) goto done; + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 0, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 1, arg2); + Py_INCREF(function); + result = __Pyx_PyObject_Call(function, args, NULL); + Py_DECREF(args); + Py_DECREF(function); +done: + return result; } -#endif -/* PyObjectCall */ +/* PyObjectCallMethO */ #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); +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = PyCFunction_GET_FUNCTION(func); + self = PyCFunction_GET_SELF(func); if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) return NULL; - result = (*call)(func, arg, kw); + result = cfunc(self, arg); Py_LeaveRecursiveCall(); if (unlikely(!result) && unlikely(!PyErr_Occurred())) { PyErr_SetString( PyExc_SystemError, "NULL result without error in PyObject_Call"); } - return result; -} + return result; +} +#endif + +/* PyObjectCallOneArg */ +#if CYTHON_COMPILING_IN_CPYTHON +static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_New(1); + if (unlikely(!args)) return NULL; + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 0, arg); + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { +#if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCall(func, &arg, 1); + } +#endif + if (likely(PyCFunction_Check(func))) { + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, arg); +#if CYTHON_FAST_PYCCALL + } else if (__Pyx_PyFastCFunction_Check(func)) { + return __Pyx_PyCFunction_FastCall(func, &arg, 1); +#endif + } + } + return __Pyx__PyObject_CallOneArg(func, arg); +} +#else +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_Pack(1, arg); + if (unlikely(!args)) return NULL; + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; +} +#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 + +/* PyDictVersioning */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { +#if CYTHON_COMPILING_IN_CPYTHON + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); +#endif + } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +} +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); +} +#endif + +/* GetModuleGlobalName */ +#if CYTHON_USE_DICT_VERSIONS +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) +#else +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) +#endif +{ + PyObject *result; +#if !CYTHON_AVOID_BORROWED_REFS +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 + result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } else if (unlikely(PyErr_Occurred())) { + return NULL; + } +#else + result = PyDict_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } +#endif +#else + result = PyObject_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } + PyErr_Clear(); +#endif + return __Pyx_GetBuiltinName(name); +} + +/* 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; +} -/* PyObjectCall2Args */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { - PyObject *args, *result = NULL; - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyFunction_FastCall(function, args, 2); - } - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyCFunction_FastCall(function, args, 2); - } - #endif - args = PyTuple_New(2); - if (unlikely(!args)) goto done; - Py_INCREF(arg1); - PyTuple_SET_ITEM(args, 0, arg1); - Py_INCREF(arg2); - PyTuple_SET_ITEM(args, 1, arg2); - Py_INCREF(function); - result = __Pyx_PyObject_Call(function, args, NULL); - Py_DECREF(args); - Py_DECREF(function); -done: +/* PyObjectCallMethod1 */ +static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) { + PyObject *result = __Pyx_PyObject_CallOneArg(method, arg); + Py_DECREF(method); return result; } - -/* PyObjectCallMethO */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { + PyObject *method = NULL, *result; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_Call2Args(method, obj, arg); + Py_DECREF(method); + return result; } - return result; + if (unlikely(!method)) return NULL; + return __Pyx__PyObject_CallMethod1(method, arg); } -#endif -/* PyObjectCallOneArg */ -#if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); +/* append */ +static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) { + if (likely(PyList_CheckExact(L))) { + if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1; + } else { + PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x); + if (unlikely(!retval)) + return -1; + Py_DECREF(retval); } -#endif - if (likely(PyCFunction_Check(func))) { - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (__Pyx_PyFastCFunction_Check(func)) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); -#endif + return 0; +} + +/* DictGetItem */ +#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { + PyObject *value; + value = PyDict_GetItemWithError(d, key); + if (unlikely(!value)) { + if (!PyErr_Occurred()) { + if (unlikely(PyTuple_Check(key))) { + PyObject* args = PyTuple_Pack(1, key); + if (likely(args)) { + PyErr_SetObject(PyExc_KeyError, args); + Py_DECREF(args); + } + } else { + PyErr_SetObject(PyExc_KeyError, key); + } } + return NULL; } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; + Py_INCREF(value); + return value; } #endif @@ -7412,266 +11062,83 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize } if ((!boundscheck) || likely(__Pyx_is_valid_index(wrapped_i, PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, wrapped_i); - Py_INCREF(r); - return r; - } - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -#else - return PySequence_GetItem(o, i); -#endif -} -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, - CYTHON_NCP_UNUSED int wraparound, - CYTHON_NCP_UNUSED int boundscheck) { -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS - if (is_list || PyList_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); - if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { - PyObject *r = PyList_GET_ITEM(o, n); - Py_INCREF(r); - return r; - } - } - else if (PyTuple_CheckExact(o)) { - Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); - if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, n); - Py_INCREF(r); - return r; - } - } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); - if (likely(l >= 0)) { - i += l; - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return NULL; - PyErr_Clear(); - } - } - return m->sq_item(o, i); - } - } -#else - if (is_list || PySequence_Check(o)) { - return PySequence_GetItem(o, i); - } -#endif - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -} - -/* ObjectGetItem */ -#if CYTHON_USE_TYPE_SLOTS -static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { - PyObject *runerr; - Py_ssize_t key_value; - PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence; - if (unlikely(!(m && m->sq_item))) { - PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name); - return NULL; - } - key_value = __Pyx_PyIndex_AsSsize_t(index); - if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { - return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); - } - if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { - PyErr_Clear(); - PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name); - } - return NULL; -} -static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { - PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping; - if (likely(m && m->mp_subscript)) { - return m->mp_subscript(obj, key); - } - return __Pyx_PyObject_GetIndex(obj, 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; - } + Py_INCREF(r); + return r; } - __Pyx_PyThreadState_assign - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); #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; + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, + CYTHON_NCP_UNUSED int wraparound, + CYTHON_NCP_UNUSED int boundscheck) { +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((!boundscheck) || (likely(__Pyx_is_valid_index(n, PyList_GET_SIZE(o))))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } } - 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; + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely(__Pyx_is_valid_index(n, PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; } - 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 { + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (likely(l >= 0)) { + i += l; } else { - type = instance_class; + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); } } + return m->sq_item(o, i); } - 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); - } + if (is_list || PySequence_Check(o)) { + return PySequence_GetItem(o, i); + } #endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +/* ObjectGetItem */ +#if CYTHON_USE_TYPE_SLOTS +static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { + PyObject *runerr; + Py_ssize_t key_value; + PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence; + if (unlikely(!(m && m->sq_item))) { + PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name); + return NULL; } -bad: - Py_XDECREF(owned_instance); - return; + key_value = __Pyx_PyIndex_AsSsize_t(index); + if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { + return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); + } + if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { + PyErr_Clear(); + PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name); + } + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { + PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping; + if (likely(m && m->mp_subscript)) { + return m->mp_subscript(obj, key); + } + return __Pyx_PyObject_GetIndex(obj, key); } #endif @@ -8061,45 +11528,6 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) return value; } -/* CalculateMetaclass */ - static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { - Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases); - for (i=0; i < nbases; i++) { - PyTypeObject *tmptype; - PyObject *tmp = PyTuple_GET_ITEM(bases, i); - tmptype = Py_TYPE(tmp); -#if PY_MAJOR_VERSION < 3 - if (tmptype == &PyClass_Type) - continue; -#endif - if (!metaclass) { - metaclass = tmptype; - continue; - } - if (PyType_IsSubtype(metaclass, tmptype)) - continue; - if (PyType_IsSubtype(tmptype, metaclass)) { - metaclass = tmptype; - continue; - } - PyErr_SetString(PyExc_TypeError, - "metaclass conflict: " - "the metaclass of a derived class " - "must be a (non-strict) subclass " - "of the metaclasses of all its bases"); - return NULL; - } - if (!metaclass) { -#if PY_MAJOR_VERSION < 3 - metaclass = &PyClass_Type; -#else - metaclass = &PyType_Type; -#endif - } - Py_INCREF((PyObject*) metaclass); - return (PyObject*) metaclass; -} - /* FetchCommonType */ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { PyObject* fake_module; @@ -8432,7 +11860,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 @@ -8756,6 +12185,45 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, Py return op; } +/* CalculateMetaclass */ + static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { + Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases); + for (i=0; i < nbases; i++) { + PyTypeObject *tmptype; + PyObject *tmp = PyTuple_GET_ITEM(bases, i); + tmptype = Py_TYPE(tmp); +#if PY_MAJOR_VERSION < 3 + if (tmptype == &PyClass_Type) + continue; +#endif + if (!metaclass) { + metaclass = tmptype; + continue; + } + if (PyType_IsSubtype(metaclass, tmptype)) + continue; + if (PyType_IsSubtype(tmptype, metaclass)) { + metaclass = tmptype; + continue; + } + PyErr_SetString(PyExc_TypeError, + "metaclass conflict: " + "the metaclass of a derived class " + "must be a (non-strict) subclass " + "of the metaclasses of all its bases"); + return NULL; + } + if (!metaclass) { +#if PY_MAJOR_VERSION < 3 + metaclass = &PyClass_Type; +#else + metaclass = &PyType_Type; +#endif + } + Py_INCREF((PyObject*) metaclass); + return (PyObject*) metaclass; +} + /* Py3ClassCreate */ static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) { @@ -8823,6 +12291,27 @@ static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObj return result; } +/* CyFunctionClassCell */ + static int __Pyx_CyFunction_InitClassCell(PyObject *cyfunctions, PyObject *classobj) { + Py_ssize_t i, count = PyList_GET_SIZE(cyfunctions); + for (i = 0; i < count; i++) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + PyList_GET_ITEM(cyfunctions, i); +#else + PySequence_ITEM(cyfunctions, i); + if (unlikely(!m)) + return -1; +#endif + Py_INCREF(classobj); + m->func_classobj = classobj; +#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF((PyObject*)m); +#endif + } + return 0; +} + /* CLineInTraceback */ #ifndef CYTHON_CLINE_IN_TRACEBACK static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) { @@ -9055,7 +12544,7 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(struct DracoFunctions::MeshObject s) { PyObject* res; PyObject* member; - res = __Pyx_PyDict_NewPresized(8); if (unlikely(!res)) return NULL; + res = __Pyx_PyDict_NewPresized(9); 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 +12569,9 @@ 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_PyObject_string_to_py_std__in_string(s.binary_metadata); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_binary_metadata, member) < 0)) goto bad; + Py_DECREF(member); return res; bad: Py_XDECREF(member); @@ -9089,7 +12581,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(7); 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 +12600,9 @@ 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_PyObject_string_to_py_std__in_string(s.binary_metadata); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_binary_metadata, member) < 0)) goto bad; + Py_DECREF(member); return res; bad: Py_XDECREF(member); diff --git a/src/DracoPy.h b/src/DracoPy.h index 39211a8..f67a928 100644 --- a/src/DracoPy.h +++ b/src/DracoPy.h @@ -1,5 +1,8 @@ #include #include +#include +#include + #include "draco/compression/decode.h" #include "draco/compression/encode.h" #include "draco/core/encoder_buffer.h" @@ -7,11 +10,45 @@ #include "draco/mesh/triangle_soup_mesh_builder.h" #include "draco/point_cloud/point_cloud_builder.h" +namespace { + void encode(std::ostream& o_stream, const uint32_t& value) + { + o_stream.write(reinterpret_cast(&value), 4); + } + + void encode(std::ostream& o_stream, const uint8_t* data, uint32_t data_len) + { + encode(o_stream, data_len); + if (data_len > 0) + o_stream.write(reinterpret_cast(data), data_len); + } + + template + void encode(std::ostream& o_stream, const std::vector& v) + { + encode(o_stream, reinterpret_cast(v.data()), + static_cast(v.size() * sizeof(Item))); + } + + void encode(std::ostream& o_stream, const std::string& s) + { + encode(o_stream, reinterpret_cast(s.data()), + static_cast(s.size())); + } +} + namespace DracoFunctions { + using namespace draco; enum decoding_status { successful, not_draco_encoded, no_position_attribute, failed_during_decoding }; enum encoding_status { successful_encoding, failed_during_encoding }; + enum endian_order : uint32_t { + little_endian = 0x00000001, + big_endian = 0x01000000, + unknown_endian = 0xFFFFFFFF + }; + struct PointCloudObject { std::vector points; @@ -22,6 +59,9 @@ namespace DracoFunctions { std::vector quantization_origin; decoding_status decode_status; + + // not parsed metadata + std::string binary_metadata; }; struct MeshObject : PointCloudObject { @@ -34,11 +74,59 @@ namespace DracoFunctions { encoding_status encode_status; }; + /** + * A simple function that can be used to help determine a program's endianness + * at compile-time. + */ + constexpr endian_order get_endian_order() { + return + ((0xFFFFFFFF & 1) == little_endian) + ? little_endian + : ((0xFFFFFFFF & 1) == big_endian) + ? big_endian + : unknown_endian; + } + + std::string encodeDracoMetadata(const GeometryMetadata& geometry_metadata) { + std::stringstream ss; + std::vector to_parse_metadata = + { {static_cast(&geometry_metadata)} }; + // consider attribute metadatas + const auto& attribute_metadatas = geometry_metadata.attribute_metadatas(); + encode(ss, static_cast(attribute_metadatas.size())); + for (const auto& attribute_metadata: attribute_metadatas) + to_parse_metadata.push_back( + static_cast(attribute_metadata.get())); + // encode metadatas level by level + for (std::vector to_parse_metadatas_next; + !to_parse_metadata.empty(); + to_parse_metadata = std::move(to_parse_metadatas_next)) { + for (const auto* draco_metadata: to_parse_metadata) { + // encode entries + const auto& entries = draco_metadata->entries(); + encode(ss, static_cast(entries.size())); + for (const auto& [name, value]: draco_metadata->entries()) { + encode(ss, name); + encode(ss, value.data()); + } + // consider sub metadatas + const auto& sub_metadatas = draco_metadata->sub_metadatas(); + encode(ss, static_cast(sub_metadatas.size())); + for (const auto& [name, draco_sub_metadata]: sub_metadatas) { + encode(ss, name); + to_parse_metadatas_next.push_back(draco_sub_metadata.get()); + } + } + } + return ss.str(); + } + + MeshObject decode_buffer(const char *buffer, std::size_t buffer_len) { MeshObject meshObject; - draco::DecoderBuffer decoderBuffer; + DecoderBuffer decoderBuffer; decoderBuffer.Init(buffer, buffer_len); - draco::Decoder decoder; + Decoder decoder; auto statusor = decoder.DecodeMeshFromBuffer(&decoderBuffer); if (!statusor.ok()) { std::string status_string = statusor.status().error_msg_string(); @@ -50,9 +138,9 @@ namespace DracoFunctions { } return meshObject; } - std::unique_ptr in_mesh = std::move(statusor).value(); - draco::Mesh *mesh = in_mesh.get(); - const int pos_att_id = mesh->GetNamedAttributeId(draco::GeometryAttribute::POSITION); + std::unique_ptr in_mesh = std::move(statusor).value(); + Mesh *mesh = in_mesh.get(); + const int pos_att_id = mesh->GetNamedAttributeId(GeometryAttribute::POSITION); if (pos_att_id < 0) { meshObject.decode_status = no_position_attribute; return meshObject; @@ -61,7 +149,7 @@ namespace DracoFunctions { meshObject.faces.reserve(3 * mesh->num_faces()); const auto *const pos_att = mesh->attribute(pos_att_id); std::array pos_val; - for (draco::PointIndex v(0); v < mesh->num_points(); ++v) { + for (PointIndex v(0); v < mesh->num_points(); ++v) { if (!pos_att->ConvertValue(pos_att->mapped_index(v), &pos_val[0])) { meshObject.decode_status = no_position_attribute; return meshObject; @@ -70,13 +158,13 @@ namespace DracoFunctions { meshObject.points.push_back(pos_val[1]); meshObject.points.push_back(pos_val[2]); } - for (draco::FaceIndex i(0); i < mesh->num_faces(); ++i) { + for (FaceIndex i(0); i < mesh->num_faces(); ++i) { const auto &f = mesh->face(i); meshObject.faces.push_back(*(reinterpret_cast(&(f[0])))); meshObject.faces.push_back(*(reinterpret_cast(&(f[1])))); meshObject.faces.push_back(*(reinterpret_cast(&(f[2])))); } - const draco::GeometryMetadata *metadata = mesh->GetMetadata(); + const GeometryMetadata *metadata = mesh->GetMetadata(); meshObject.encoding_options_set = false; if (metadata) { metadata->GetEntryInt("quantization_bits", &(meshObject.quantization_bits)); @@ -84,6 +172,7 @@ namespace DracoFunctions { metadata->GetEntryDoubleArray("quantization_origin", &(meshObject.quantization_origin))) { meshObject.encoding_options_set = true; } + meshObject.binary_metadata = encodeDracoMetadata(*metadata); } meshObject.decode_status = successful; return meshObject; @@ -91,9 +180,9 @@ namespace DracoFunctions { PointCloudObject decode_buffer_to_point_cloud(const char *buffer, std::size_t buffer_len) { PointCloudObject pointCloudObject; - draco::DecoderBuffer decoderBuffer; + DecoderBuffer decoderBuffer; decoderBuffer.Init(buffer, buffer_len); - draco::Decoder decoder; + Decoder decoder; auto statusor = decoder.DecodePointCloudFromBuffer(&decoderBuffer); if (!statusor.ok()) { std::string status_string = statusor.status().error_msg_string(); @@ -105,9 +194,9 @@ namespace DracoFunctions { } return pointCloudObject; } - std::unique_ptr in_point_cloud = std::move(statusor).value(); - draco::PointCloud *point_cloud = in_point_cloud.get(); - const int pos_att_id = point_cloud->GetNamedAttributeId(draco::GeometryAttribute::POSITION); + std::unique_ptr in_point_cloud = std::move(statusor).value(); + PointCloud *point_cloud = in_point_cloud.get(); + const int pos_att_id = point_cloud->GetNamedAttributeId(GeometryAttribute::POSITION); if (pos_att_id < 0) { pointCloudObject.decode_status = no_position_attribute; return pointCloudObject; @@ -115,7 +204,7 @@ namespace DracoFunctions { pointCloudObject.points.reserve(3 * point_cloud->num_points()); const auto *const pos_att = point_cloud->attribute(pos_att_id); std::array pos_val; - for (draco::PointIndex v(0); v < point_cloud->num_points(); ++v) { + for (PointIndex v(0); v < point_cloud->num_points(); ++v) { if (!pos_att->ConvertValue(pos_att->mapped_index(v), &pos_val[0])) { pointCloudObject.decode_status = no_position_attribute; return pointCloudObject; @@ -124,7 +213,7 @@ namespace DracoFunctions { pointCloudObject.points.push_back(pos_val[1]); pointCloudObject.points.push_back(pos_val[2]); } - const draco::GeometryMetadata *metadata = point_cloud->GetMetadata(); + const GeometryMetadata *metadata = point_cloud->GetMetadata(); pointCloudObject.encoding_options_set = false; if (metadata) { metadata->GetEntryInt("quantization_bits", &(pointCloudObject.quantization_bits)); @@ -132,20 +221,21 @@ namespace DracoFunctions { metadata->GetEntryDoubleArray("quantization_origin", &(pointCloudObject.quantization_origin))) { pointCloudObject.encoding_options_set = true; } + pointCloudObject.binary_metadata = encodeDracoMetadata(*metadata); } 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) { + void setup_encoder_and_metadata(PointCloud *point_cloud_or_mesh, 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()); + std::unique_ptr metadata = std::unique_ptr(new GeometryMetadata()); if (quantization_origin == NULL || quantization_range == -1) { - encoder.SetAttributeQuantization(draco::GeometryAttribute::POSITION, quantization_bits); + encoder.SetAttributeQuantization(GeometryAttribute::POSITION, quantization_bits); } else { - encoder.SetAttributeExplicitQuantization(draco::GeometryAttribute::POSITION, quantization_bits, 3, quantization_origin, quantization_range); + encoder.SetAttributeExplicitQuantization(GeometryAttribute::POSITION, quantization_bits, 3, quantization_origin, quantization_range); if (create_metadata) { metadata->AddEntryDouble("quantization_range", quantization_range); std::vector quantization_origin_vec; @@ -163,24 +253,24 @@ namespace DracoFunctions { 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) { - draco::TriangleSoupMeshBuilder mb; + TriangleSoupMeshBuilder mb; mb.Start(faces.size()); const int pos_att_id = - mb.AddAttribute(draco::GeometryAttribute::POSITION, 3, draco::DataType::DT_FLOAT32); + mb.AddAttribute(GeometryAttribute::POSITION, 3, 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, FaceIndex(i), Vector3f(points[point1Index], points[point1Index+1], points[point1Index+2]).data(), Vector3f(points[point2Index], points[point2Index+1], points[point2Index+2]).data(), 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; + std::unique_ptr ptr_mesh = mb.Finalize(); + Mesh *mesh = ptr_mesh.get(); + Encoder encoder; setup_encoder_and_metadata(mesh, encoder, compression_level, quantization_bits, quantization_range, quantization_origin, create_metadata); - draco::EncoderBuffer buffer; - const draco::Status status = encoder.EncodeMeshToBuffer(*mesh, &buffer); + EncoderBuffer buffer; + const Status status = encoder.EncodeMeshToBuffer(*mesh, &buffer); EncodedObject encodedMeshObject; encodedMeshObject.buffer = *((std::vector *)buffer.buffer()); if (status.ok()) { @@ -195,21 +285,21 @@ namespace DracoFunctions { EncodedObject encode_point_cloud(const std::vector &points, int quantization_bits, int compression_level, float quantization_range, const float *quantization_origin, bool create_metadata) { int num_points = points.size() / 3; - draco::PointCloudBuilder pcb; + PointCloudBuilder pcb; pcb.Start(num_points); const int pos_att_id = - pcb.AddAttribute(draco::GeometryAttribute::POSITION, 3, draco::DataType::DT_FLOAT32); + pcb.AddAttribute(GeometryAttribute::POSITION, 3, DataType::DT_FLOAT32); - for (draco::PointIndex i(0); i < num_points; i++) { + for (PointIndex i(0); i < num_points; i++) { pcb.SetAttributeValueForPoint(pos_att_id, i, points.data() + 3 * i.value()); } - std::unique_ptr ptr_point_cloud = pcb.Finalize(true); - draco::PointCloud *point_cloud = ptr_point_cloud.get(); - draco::Encoder encoder; + std::unique_ptr ptr_point_cloud = pcb.Finalize(true); + PointCloud *point_cloud = ptr_point_cloud.get(); + Encoder encoder; setup_encoder_and_metadata(point_cloud, encoder, compression_level, quantization_bits, quantization_range, quantization_origin, create_metadata); - draco::EncoderBuffer buffer; - const draco::Status status = encoder.EncodePointCloudToBuffer(*point_cloud, &buffer); + EncoderBuffer buffer; + const Status status = encoder.EncodePointCloudToBuffer(*point_cloud, &buffer); EncodedObject encodedPointCloudObject; encodedPointCloudObject.buffer = *((std::vector *)buffer.buffer()); if (status.ok()) { diff --git a/src/DracoPy.pxd b/src/DracoPy.pxd index 511522e..48b471a 100644 --- a/src/DracoPy.pxd +++ b/src/DracoPy.pxd @@ -1,7 +1,9 @@ from libcpp.vector cimport vector +from libcpp.string cimport string from libc.stdint cimport uint32_t from libcpp cimport bool + cdef extern from "DracoPy.h" namespace "DracoFunctions": cdef enum decoding_status: @@ -11,6 +13,11 @@ cdef extern from "DracoPy.h" namespace "DracoFunctions": cdef enum encoding_status: successful_encoding, failed_during_encoding + cdef enum endian_order: + little_endian + big_endian + unknown_endian + cdef struct PointCloudObject: vector[float] points @@ -23,6 +30,8 @@ cdef extern from "DracoPy.h" namespace "DracoFunctions": # Represents the decoding success or error message decoding_status decode_status + string binary_metadata + cdef struct MeshObject: vector[float] points vector[unsigned int] faces @@ -39,10 +48,14 @@ cdef extern from "DracoPy.h" namespace "DracoFunctions": # Represents the decoding success or error message decoding_status decode_status + string binary_metadata + cdef struct EncodedObject: vector[unsigned char] buffer encoding_status encode_status + endian_order get_endian_order() except + + MeshObject decode_buffer(const char *buffer, size_t buffer_len) except + PointCloudObject decode_buffer_to_point_cloud(const char *buffer, size_t buffer_len) except + diff --git a/src/DracoPy.pyx b/src/DracoPy.pyx index 68e66a4..9b0aeda 100644 --- a/src/DracoPy.pyx +++ b/src/DracoPy.pyx @@ -1,11 +1,98 @@ # distutils: language = c++ +import typing from cpython.mem cimport PyMem_Malloc, PyMem_Free cimport DracoPy -import struct from math import floor from libc.string cimport memcmp + +class _Reader: + def __init__(self, in_bytes: bytes): + self._in_bytes = in_bytes + self._pos = 0 + + @staticmethod + def __get_endian() -> str: + endian_order = get_endian_order() + if endian_order == DracoPy.endian_order.little_endian: + return "little" + elif endian_order == DracoPy.endian_order.big_endian: + return "big" + else: + raise Exception("unknown endian order") + + def __read_bytes(self, count: int) -> bytes: + end = self._pos + count + result_bytes = self._in_bytes[self._pos:end] + self._pos = end + return result_bytes + + def read_uint(self) -> int: + value = int.from_bytes(self.__read_bytes(4), + byteorder=self.__get_endian(), signed=False) + return value + + def read_str(self) -> str: + count = self.read_uint() + return self.__read_bytes(count).decode() + + def read_bytes(self) -> bytes: + count = self.read_uint() + return self.__read_bytes(count) + + def is_end(self) -> bool: + return len(self._in_bytes) == self._pos + + +class MetadataObject: + def __init__(self, entries: typing.Dict[str, bytes] = None, + sub_metadatas: typing.Dict[str, 'MetadataObject'] = None): + self.entries = entries if entries else {} + self.sub_metadatas = sub_metadatas if sub_metadatas else {} + + +class GeometryMetadataObject(MetadataObject): + def __init__(self, entries: typing.Dict[str, bytes] = None, + sub_metadatas: typing.Dict[str, 'MetadataObject'] = None, + attribute_metadatas: typing.List['MetadataObject'] = None): + super().__init__(entries, sub_metadatas) + self.attribute_metadatas = attribute_metadatas if attribute_metadatas \ + else [] + + +def _parse_binary_metadata(binary_metadata: bytes) -> MetadataObject: + reader = _Reader(binary_metadata) + geometry_metadata = GeometryMetadataObject() + to_parse_metadatas = [geometry_metadata] + # parse attribute metadatas + attribute_metadatas_len = reader.read_uint() + for _ in range(attribute_metadatas_len): + attribute_metadata = MetadataObject() + geometry_metadata.attribute_metadatas.append(attribute_metadata) + to_parse_metadatas.append(attribute_metadata) + # parse metadatas level by level + while to_parse_metadatas: + to_parse_metadata_next = [] + for metadata in to_parse_metadatas: + # parse entries + attr_len = reader.read_uint() + for _ in range(attr_len): + name = reader.read_str() + value = reader.read_bytes() + metadata.entries[name] = value + sub_metadatas_len = reader.read_uint() + for _ in range(sub_metadatas_len): + name = reader.read_str() + sub_metadata = MetadataObject() + metadata.sub_metadatas[name] = sub_metadata + to_parse_metadata_next.append(sub_metadata) + to_parse_metadatas = to_parse_metadata_next + if not reader.is_end(): + raise Exception("not read bytes detected") + return geometry_metadata + + class DracoPointCloud(object): def __init__(self, data_struct): self.data_struct = data_struct @@ -14,7 +101,8 @@ class DracoPointCloud(object): data_struct['quantization_range'], data_struct['quantization_origin']) else: self.encoding_options = None - + self.metadata = _parse_binary_metadata(data_struct["binary_metadata"]) + def get_encoded_coordinate(self, value, axis): if self.encoding_options is not None: return self.encoding_options.get_encoded_coordinate(value, axis) @@ -31,6 +119,7 @@ class DracoPointCloud(object): def points(self): return self.data_struct['points'] + class DracoMesh(DracoPointCloud): @property def faces(self): @@ -46,7 +135,7 @@ class EncodingOptions(object): 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,7 +148,7 @@ 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 From 0b1b46bb1d0243c0f06169d9ddc808af0fc7bd57 Mon Sep 17 00:00:00 2001 From: Andrey Romanov Date: Wed, 20 Oct 2021 19:30:51 +0300 Subject: [PATCH 02/21] support metadata encoding + refactoring --- src/DracoPy.cpp | 12283 ++++++++++++++++++++++++---------------------- src/DracoPy.h | 169 +- src/DracoPy.pxd | 37 +- src/DracoPy.pyx | 137 +- 4 files changed, 6502 insertions(+), 6124 deletions(-) diff --git a/src/DracoPy.cpp b/src/DracoPy.cpp index 520ad33..b71c882 100644 --- a/src/DracoPy.cpp +++ b/src/DracoPy.cpp @@ -637,6 +637,7 @@ static CYTHON_INLINE float __PYX_NAN() { #include #include #include +#include #include "DracoPy.h" #ifdef _OPENMP #include @@ -926,10 +927,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject /* GetBuiltinName.proto */ static PyObject *__Pyx_GetBuiltinName(PyObject *name); -/* RaiseArgTupleInvalid.proto */ -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); - /* RaiseDoubleKeywords.proto */ static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); @@ -938,11 +935,9 @@ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ const char* function_name); -/* 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); +/* RaiseArgTupleInvalid.proto */ +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); /* PyObjectSetAttrStr.proto */ #if CYTHON_USE_TYPE_SLOTS @@ -960,58 +955,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg #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); - -/* SliceObject.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( - PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, - PyObject** py_start, PyObject** py_stop, PyObject** py_slice, - int has_cstart, int has_cstop, int wraparound); - -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); -#else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) -#endif - /* PyFunctionFastCall.proto */ #if CYTHON_FAST_PYCALL #define __Pyx_PyFunction_FastCall(func, args, nargs)\ @@ -1035,24 +978,19 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) #endif -/* PyObjectCall2Args.proto */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); - -/* PyObjectCallMethO.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); -#endif - -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - -/* PyObjectCallNoArg.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); +/* PyCFunctionFastCall.proto */ +#if CYTHON_FAST_PYCCALL +static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); #else -#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) +#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), 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); + /* PyDictVersioning.proto */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) @@ -1100,6 +1038,24 @@ static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_ve static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); #endif +/* PyObjectCallMethO.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +#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 + +/* PyObjectCallOneArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + +/* PyObjectCall2Args.proto */ +static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); + /* ListAppend.proto */ #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { @@ -1126,6 +1082,45 @@ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name /* append.proto */ static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x); +/* IterFinish.proto */ +static CYTHON_INLINE int __Pyx_IterFinish(void); + +/* 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); + /* DictGetItem.proto */ #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); @@ -1179,6 +1174,45 @@ 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); @@ -1408,12 +1442,18 @@ static void __Pyx_CppExn2PyErr() { 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 *); +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value); /* CIntFromPy.proto */ static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *); +/* CIntFromPy.proto */ +static CYTHON_INLINE uint8_t __Pyx_PyInt_As_uint8_t(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *); + /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); @@ -1455,164 +1495,141 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'cpython.mem' */ /* Module declarations from 'DracoPy' */ +static std::string __pyx_convert_string_from_py_std__in_string(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 std::vector __pyx_convert_vector_from_py_uint8_t(PyObject *); /*proto*/ static std::vector __pyx_convert_vector_from_py_float(PyObject *); /*proto*/ static std::vector __pyx_convert_vector_from_py_uint32_t(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 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*/ #define __Pyx_MODULE_NAME "DracoPy" extern int __pyx_module_is_main_DracoPy; int __pyx_module_is_main_DracoPy = 0; /* Implementation of 'DracoPy' */ -static PyObject *__pyx_builtin_staticmethod; static PyObject *__pyx_builtin_object; static PyObject *__pyx_builtin_property; static PyObject *__pyx_builtin_super; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_TypeError; -static const char __pyx_k__27[] = "_"; -static const char __pyx_k_big[] = "big"; +static const char __pyx_k_[] = ""; +static const char __pyx_k_s[] = "s"; +static const char __pyx_k_ss[] = "ss"; +static const char __pyx_k__15[] = "_"; static const char __pyx_k_dim[] = "dim"; static const char __pyx_k_doc[] = "__doc__"; -static const char __pyx_k_end[] = "end"; static const char __pyx_k_int[] = "int"; -static const char __pyx_k_pos[] = "_pos"; 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_bool[] = "bool"; 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_self[] = "self"; static const char __pyx_k_test[] = "__test__"; -static const char __pyx_k_bytes[] = "bytes"; -static const char __pyx_k_count[] = "count"; static const char __pyx_k_faces[] = "faces"; static const char __pyx_k_floor[] = "floor"; +static const char __pyx_k_items[] = "items"; static const char __pyx_k_point[] = "point"; static const char __pyx_k_range[] = "range"; static const char __pyx_k_super[] = "super"; static const char __pyx_k_value[] = "value"; -static const char __pyx_k_Reader[] = "_Reader"; static const char __pyx_k_append[] = "append"; static const char __pyx_k_buffer[] = "buffer"; -static const char __pyx_k_decode[] = "decode"; static const char __pyx_k_import[] = "__import__"; -static const char __pyx_k_is_end[] = "is_end"; -static const char __pyx_k_little[] = "little"; 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_points[] = "points"; static const char __pyx_k_reader[] = "reader"; -static const char __pyx_k_return[] = "return"; -static const char __pyx_k_signed[] = "signed"; static const char __pyx_k_typing[] = "typing"; +static const char __pyx_k_writer[] = "writer"; static const char __pyx_k_DracoPy[] = "DracoPy"; static const char __pyx_k_entries[] = "entries"; static const char __pyx_k_normals[] = "normals"; static const char __pyx_k_prepare[] = "__prepare__"; -static const char __pyx_k_unicode[] = "unicode"; -static const char __pyx_k_attr_len[] = "attr_len"; -static const char __pyx_k_in_bytes[] = "in_bytes"; static const char __pyx_k_metadata[] = "metadata"; 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_qualname[] = "__qualname__"; -static const char __pyx_k_read_str[] = "read_str"; static const char __pyx_k_DracoMesh[] = "DracoMesh"; static const char __pyx_k_TypeError[] = "TypeError"; -static const char __pyx_k_byteorder[] = "byteorder"; static const char __pyx_k_metaclass[] = "__metaclass__"; -static const char __pyx_k_read_uint[] = "read_uint"; +static const char __pyx_k_unique_id[] = "unique_id"; static const char __pyx_k_ValueError[] = "ValueError"; static const char __pyx_k_difference[] = "difference"; -static const char __pyx_k_from_bytes[] = "from_bytes"; -static const char __pyx_k_get_endian[] = "__get_endian"; -static const char __pyx_k_in_bytes_2[] = "_in_bytes"; -static const char __pyx_k_read_bytes[] = "read_bytes"; static const char __pyx_k_data_struct[] = "data_struct"; +static const char __pyx_k_entries_len[] = "entries_len"; 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_endian_order[] = "endian_order"; static const char __pyx_k_quant_origin[] = "quant_origin"; -static const char __pyx_k_read_bytes_2[] = "__read_bytes"; -static const char __pyx_k_result_bytes[] = "result_bytes"; -static const char __pyx_k_staticmethod[] = "staticmethod"; static const char __pyx_k_sub_metadata[] = "sub_metadata"; static const char __pyx_k_Input_invalid[] = "Input invalid"; -static const char __pyx_k_Reader___init[] = "_Reader.__init__"; -static const char __pyx_k_Reader_is_end[] = "_Reader.is_end"; static const char __pyx_k_decode_status[] = "decode_status"; static const char __pyx_k_encoded_point[] = "encoded_point"; static const char __pyx_k_inverse_alpha[] = "inverse_alpha"; static const char __pyx_k_sub_metadatas[] = "sub_metadatas"; static const char __pyx_k_MetadataObject[] = "MetadataObject"; +static const char __pyx_k_draco_metadata[] = "draco_metadata"; 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_Reader_read_str[] = "_Reader.read_str"; static const char __pyx_k_binary_metadata[] = "binary_metadata"; static const char __pyx_k_create_metadata[] = "create_metadata"; +static const char __pyx_k_decode_metadata[] = "decode_metadata"; static const char __pyx_k_decoding_status[] = "decoding_status"; +static const char __pyx_k_encode_metadata[] = "encode_metadata"; 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_Reader_read_uint[] = "_Reader.read_uint"; static const char __pyx_k_encoding_options[] = "encoding_options"; static const char __pyx_k_DracoMesh_normals[] = "DracoMesh.normals"; static const char __pyx_k_FileTypeException[] = "FileTypeException"; -static const char __pyx_k_Reader_read_bytes[] = "_Reader.read_bytes"; 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_sub_metadatas_len[] = "sub_metadatas_len"; -static const char __pyx_k_Reader__get_endian[] = "_Reader__get_endian"; -static const char __pyx_k_Reader__read_bytes[] = "_Reader__read_bytes"; +static const char __pyx_k_to_parse_metadata[] = "to_parse_metadata"; static const char __pyx_k_attribute_metadata[] = "attribute_metadata"; static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; +static const char __pyx_k_draco_sub_metadata[] = "draco_sub_metadata"; 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_to_parse_metadatas[] = "to_parse_metadatas"; static const char __pyx_k_Invalid_point_cloud[] = "Invalid point cloud"; -static const char __pyx_k_Reader___get_endian[] = "_Reader.__get_endian"; -static const char __pyx_k_Reader___read_bytes[] = "_Reader.__read_bytes"; static const char __pyx_k_attribute_metadatas[] = "attribute_metadatas"; static const char __pyx_k_encoded_point_cloud[] = "encoded_point_cloud"; static const char __pyx_k_quantization_origin[] = "quantization_origin"; 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_unknown_endian_order[] = "unknown endian order"; static const char __pyx_k_MetadataObject___init[] = "MetadataObject.__init__"; 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_parse_binary_metadata[] = "_parse_binary_metadata"; 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_GeometryMetadataObject[] = "GeometryMetadataObject"; static const char __pyx_k_get_encoded_coordinate[] = "get_encoded_coordinate"; static const char __pyx_k_to_parse_metadata_next[] = "to_parse_metadata_next"; +static const char __pyx_k_AttributeMetadataObject[] = "AttributeMetadataObject"; static const char __pyx_k_EncodingFailedException[] = "EncodingFailedException"; static const char __pyx_k_attribute_metadatas_len[] = "attribute_metadatas_len"; -static const char __pyx_k_not_read_bytes_detected[] = "not read bytes detected"; 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_decode_point_cloud_buffer[] = "decode_point_cloud_buffer"; static const char __pyx_k_encode_point_cloud_to_buffer[] = "encode_point_cloud_to_buffer"; static const char __pyx_k_GeometryMetadataObject___init[] = "GeometryMetadataObject.__init__"; +static const char __pyx_k_AttributeMetadataObject___init[] = "AttributeMetadataObject.__init__"; static const char __pyx_k_Input_mesh_is_not_draco_encoded[] = "Input mesh is not draco encoded"; 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"; @@ -1621,6 +1638,9 @@ static const char __pyx_k_EncodingOptions_get_encoded_coor[] = "EncodingOptions. 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_Specified_value_out_of_encoded_r[] = "Specified value out of encoded range"; +static PyObject *__pyx_n_s_AttributeMetadataObject; +static PyObject *__pyx_n_u_AttributeMetadataObject; +static PyObject *__pyx_n_s_AttributeMetadataObject___init; static PyObject *__pyx_n_s_Dict; static PyObject *__pyx_n_s_DracoMesh; static PyObject *__pyx_n_s_DracoMesh_faces; @@ -1651,47 +1671,34 @@ static PyObject *__pyx_n_s_List; static PyObject *__pyx_n_s_MetadataObject; static PyObject *__pyx_n_u_MetadataObject; static PyObject *__pyx_n_s_MetadataObject___init; -static PyObject *__pyx_n_s_Reader; -static PyObject *__pyx_n_s_Reader___get_endian; -static PyObject *__pyx_n_s_Reader___init; -static PyObject *__pyx_n_s_Reader___read_bytes; -static PyObject *__pyx_n_s_Reader__get_endian; -static PyObject *__pyx_n_s_Reader__read_bytes; -static PyObject *__pyx_n_s_Reader_is_end; -static PyObject *__pyx_n_s_Reader_read_bytes; -static PyObject *__pyx_n_s_Reader_read_str; -static PyObject *__pyx_n_s_Reader_read_uint; static PyObject *__pyx_kp_u_Specified_value_out_of_encoded_r; static PyObject *__pyx_n_s_TypeError; static PyObject *__pyx_n_s_ValueError; -static PyObject *__pyx_n_s__27; +static PyObject *__pyx_n_s__15; static PyObject *__pyx_n_s_append; -static PyObject *__pyx_n_s_attr_len; static PyObject *__pyx_n_s_attribute_metadata; static PyObject *__pyx_n_s_attribute_metadatas; static PyObject *__pyx_n_s_attribute_metadatas_len; static PyObject *__pyx_n_s_axis; -static PyObject *__pyx_n_u_big; static PyObject *__pyx_n_s_binary_metadata; static PyObject *__pyx_n_u_binary_metadata; -static PyObject *__pyx_n_u_bool; static PyObject *__pyx_n_s_buffer; -static PyObject *__pyx_n_s_byteorder; -static PyObject *__pyx_n_u_bytes; static PyObject *__pyx_n_s_cline_in_traceback; static PyObject *__pyx_n_s_compression_level; -static PyObject *__pyx_n_s_count; static PyObject *__pyx_n_s_create_metadata; static PyObject *__pyx_n_s_data_struct; -static PyObject *__pyx_n_s_decode; static PyObject *__pyx_n_s_decode_buffer_to_mesh; +static PyObject *__pyx_n_s_decode_metadata; static PyObject *__pyx_n_s_decode_point_cloud_buffer; static PyObject *__pyx_n_s_decode_status; static PyObject *__pyx_n_s_decoding_status; static PyObject *__pyx_n_s_difference; static PyObject *__pyx_n_s_dim; static PyObject *__pyx_n_s_doc; +static PyObject *__pyx_n_s_draco_metadata; +static PyObject *__pyx_n_s_draco_sub_metadata; static PyObject *__pyx_n_s_encode_mesh_to_buffer; +static PyObject *__pyx_n_s_encode_metadata; static PyObject *__pyx_n_s_encode_point_cloud_to_buffer; static PyObject *__pyx_n_s_encoded_mesh; static PyObject *__pyx_n_s_encoded_point; @@ -1699,25 +1706,19 @@ static PyObject *__pyx_n_s_encoded_point_cloud; 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_end; -static PyObject *__pyx_n_s_endian_order; static PyObject *__pyx_n_s_entries; +static PyObject *__pyx_n_s_entries_len; static PyObject *__pyx_n_s_faces; static PyObject *__pyx_n_u_faces; static PyObject *__pyx_n_s_floor; -static PyObject *__pyx_n_s_from_bytes; static PyObject *__pyx_n_s_geometry_metadata; static PyObject *__pyx_n_s_get_encoded_coordinate; static PyObject *__pyx_n_s_get_encoded_point; -static PyObject *__pyx_n_s_get_endian; static PyObject *__pyx_n_s_import; -static PyObject *__pyx_n_s_in_bytes; -static PyObject *__pyx_n_s_in_bytes_2; static PyObject *__pyx_n_s_init; static PyObject *__pyx_n_u_int; static PyObject *__pyx_n_s_inverse_alpha; -static PyObject *__pyx_n_s_is_end; -static PyObject *__pyx_n_u_little; +static PyObject *__pyx_n_s_items; static PyObject *__pyx_n_s_main; static PyObject *__pyx_n_s_math; static PyObject *__pyx_n_s_mesh_struct; @@ -1728,16 +1729,13 @@ static PyObject *__pyx_n_s_name; static PyObject *__pyx_n_s_name_2; static PyObject *__pyx_n_s_normals; static PyObject *__pyx_n_u_normals; -static PyObject *__pyx_kp_u_not_read_bytes_detected; 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_parse_binary_metadata; 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_pos; static PyObject *__pyx_n_s_prepare; static PyObject *__pyx_n_s_property; static PyObject *__pyx_n_s_qualname; @@ -1751,38 +1749,28 @@ 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_read_bytes; -static PyObject *__pyx_n_s_read_bytes_2; -static PyObject *__pyx_n_s_read_str; -static PyObject *__pyx_n_s_read_uint; static PyObject *__pyx_n_s_reader; -static PyObject *__pyx_n_s_result_bytes; -static PyObject *__pyx_n_s_return; +static PyObject *__pyx_n_s_s; static PyObject *__pyx_n_s_self; -static PyObject *__pyx_n_s_signed; static PyObject *__pyx_kp_s_src_DracoPy_pyx; -static PyObject *__pyx_n_s_staticmethod; +static PyObject *__pyx_n_s_ss; static PyObject *__pyx_n_s_sub_metadata; static PyObject *__pyx_n_s_sub_metadatas; static PyObject *__pyx_n_s_sub_metadatas_len; static PyObject *__pyx_n_s_super; static PyObject *__pyx_n_s_test; +static PyObject *__pyx_n_s_to_parse_metadata; static PyObject *__pyx_n_s_to_parse_metadata_next; static PyObject *__pyx_n_s_to_parse_metadatas; static PyObject *__pyx_n_s_typing; -static PyObject *__pyx_n_u_unicode; -static PyObject *__pyx_kp_u_unknown_endian_order; +static PyObject *__pyx_n_s_unique_id; static PyObject *__pyx_n_s_value; -static PyObject *__pyx_pf_7DracoPy_7_Reader___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_in_bytes); /* proto */ -static PyObject *__pyx_pf_7DracoPy_7_Reader_2__get_endian(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_7DracoPy_7_Reader_4__read_bytes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_count); /* proto */ -static PyObject *__pyx_pf_7DracoPy_7_Reader_6read_uint(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7DracoPy_7_Reader_8read_str(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7DracoPy_7_Reader_10read_bytes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7DracoPy_7_Reader_12is_end(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_n_s_writer; static PyObject *__pyx_pf_7DracoPy_14MetadataObject___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_entries, PyObject *__pyx_v_sub_metadatas); /* proto */ +static PyObject *__pyx_pf_7DracoPy_23AttributeMetadataObject___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_unique_id, PyObject *__pyx_v_entries, PyObject *__pyx_v_sub_metadatas); /* proto */ static PyObject *__pyx_pf_7DracoPy_22GeometryMetadataObject___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_entries, PyObject *__pyx_v_sub_metadatas, PyObject *__pyx_v_attribute_metadatas); /* proto */ -static PyObject *__pyx_pf_7DracoPy__parse_binary_metadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_binary_metadata); /* proto */ +static PyObject *__pyx_pf_7DracoPy_decode_metadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_binary_metadata); /* proto */ +static PyObject *__pyx_pf_7DracoPy_2encode_metadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_geometry_metadata); /* 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 */ @@ -1794,97 +1782,85 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions___init__(CYTHON_UNUSED PyOb 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_2encode_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_4encode_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_6raise_decoding_error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_decoding_status); /* proto */ -static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer); /* proto */ -static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer); /* 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_metadata, 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_metadata, 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_8raise_decoding_error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_decoding_status); /* proto */ +static PyObject *__pyx_pf_7DracoPy_10decode_buffer_to_mesh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer); /* proto */ +static PyObject *__pyx_pf_7DracoPy_12decode_point_cloud_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer); /* 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_4; static PyObject *__pyx_int_14; static PyObject *__pyx_int_neg_1; -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__11; -static PyObject *__pyx_tuple__13; -static PyObject *__pyx_tuple__15; -static PyObject *__pyx_tuple__17; -static PyObject *__pyx_tuple__19; +static PyObject *__pyx_tuple__12; +static PyObject *__pyx_tuple__14; +static PyObject *__pyx_tuple__16; +static PyObject *__pyx_tuple__18; +static PyObject *__pyx_tuple__20; static PyObject *__pyx_tuple__21; static PyObject *__pyx_tuple__23; -static PyObject *__pyx_tuple__24; -static PyObject *__pyx_tuple__26; -static PyObject *__pyx_tuple__28; -static PyObject *__pyx_tuple__30; +static PyObject *__pyx_tuple__25; +static PyObject *__pyx_tuple__27; +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_tuple__39; -static PyObject *__pyx_tuple__41; -static PyObject *__pyx_tuple__43; -static PyObject *__pyx_tuple__45; +static PyObject *__pyx_tuple__36; +static PyObject *__pyx_tuple__38; +static PyObject *__pyx_tuple__40; +static PyObject *__pyx_tuple__42; +static PyObject *__pyx_tuple__44; 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__62; -static PyObject *__pyx_codeobj__8; +static PyObject *__pyx_codeobj__7; static PyObject *__pyx_codeobj__10; -static PyObject *__pyx_codeobj__12; -static PyObject *__pyx_codeobj__14; -static PyObject *__pyx_codeobj__16; -static PyObject *__pyx_codeobj__18; -static PyObject *__pyx_codeobj__20; +static PyObject *__pyx_codeobj__13; +static PyObject *__pyx_codeobj__17; +static PyObject *__pyx_codeobj__19; static PyObject *__pyx_codeobj__22; -static PyObject *__pyx_codeobj__25; -static PyObject *__pyx_codeobj__29; +static PyObject *__pyx_codeobj__24; +static PyObject *__pyx_codeobj__26; +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__40; -static PyObject *__pyx_codeobj__42; -static PyObject *__pyx_codeobj__44; +static PyObject *__pyx_codeobj__37; +static PyObject *__pyx_codeobj__39; +static PyObject *__pyx_codeobj__41; +static PyObject *__pyx_codeobj__43; +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__61; -static PyObject *__pyx_codeobj__63; /* Late includes */ -/* "DracoPy.pyx":11 +/* "DracoPy.pyx":10 * - * class _Reader: - * def __init__(self, in_bytes: bytes): # <<<<<<<<<<<<<< - * self._in_bytes = in_bytes - * self._pos = 0 + * class MetadataObject: + * def __init__(self, entries: Dict[str, bytes] = None, # <<<<<<<<<<<<<< + * sub_metadatas: Dict[str, 'MetadataObject'] = None): + * self.entries = entries if entries else {} */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_7_Reader_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_7_Reader_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_7_Reader_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_7DracoPy_7_Reader_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7DracoPy_14MetadataObject_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_14MetadataObject_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_14MetadataObject_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_7DracoPy_14MetadataObject_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_in_bytes = 0; + PyObject *__pyx_v_entries = 0; + PyObject *__pyx_v_sub_metadatas = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -1892,12 +1868,24 @@ static PyObject *__pyx_pw_7DracoPy_7_Reader_1__init__(PyObject *__pyx_self, PyOb __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_in_bytes,0}; - PyObject* values[2] = {0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_entries,&__pyx_n_s_sub_metadatas,0}; + PyObject* values[3] = {0,0,0}; + values[1] = ((PyObject *)((PyObject *)Py_None)); + + /* "DracoPy.pyx":11 + * class MetadataObject: + * def __init__(self, entries: Dict[str, bytes] = None, + * sub_metadatas: Dict[str, 'MetadataObject'] = None): # <<<<<<<<<<<<<< + * self.entries = entries if entries else {} + * self.sub_metadatas = sub_metadatas if sub_metadatas else {} + */ + 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); @@ -1912,218 +1900,124 @@ static PyObject *__pyx_pw_7DracoPy_7_Reader_1__init__(PyObject *__pyx_self, PyOb else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_in_bytes)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 11, __pyx_L3_error) + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_entries); + 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_sub_metadatas); + if (value) { values[2] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 11, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 10, __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); + 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); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } } __pyx_v_self = values[0]; - __pyx_v_in_bytes = ((PyObject*)values[1]); + __pyx_v_entries = values[1]; + __pyx_v_sub_metadatas = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 11, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 10, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("DracoPy._Reader.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("DracoPy.MetadataObject.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_in_bytes), (&PyBytes_Type), 1, "in_bytes", 1))) __PYX_ERR(0, 11, __pyx_L1_error) - __pyx_r = __pyx_pf_7DracoPy_7_Reader___init__(__pyx_self, __pyx_v_self, __pyx_v_in_bytes); + __pyx_r = __pyx_pf_7DracoPy_14MetadataObject___init__(__pyx_self, __pyx_v_self, __pyx_v_entries, __pyx_v_sub_metadatas); + + /* "DracoPy.pyx":10 + * + * class MetadataObject: + * def __init__(self, entries: Dict[str, bytes] = None, # <<<<<<<<<<<<<< + * sub_metadatas: Dict[str, 'MetadataObject'] = None): + * self.entries = entries if entries else {} + */ /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_7_Reader___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_in_bytes) { +static PyObject *__pyx_pf_7DracoPy_14MetadataObject___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_entries, PyObject *__pyx_v_sub_metadatas) { 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("__init__", 0); /* "DracoPy.pyx":12 - * class _Reader: - * def __init__(self, in_bytes: bytes): - * self._in_bytes = in_bytes # <<<<<<<<<<<<<< - * self._pos = 0 + * def __init__(self, entries: Dict[str, bytes] = None, + * sub_metadatas: Dict[str, 'MetadataObject'] = None): + * self.entries = entries if entries else {} # <<<<<<<<<<<<<< + * self.sub_metadatas = sub_metadatas if sub_metadatas else {} * */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_in_bytes_2, __pyx_v_in_bytes) < 0) __PYX_ERR(0, 12, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_entries); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 12, __pyx_L1_error) + if (__pyx_t_2) { + __Pyx_INCREF(__pyx_v_entries); + __pyx_t_1 = __pyx_v_entries; + } else { + __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 12, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_entries, __pyx_t_1) < 0) __PYX_ERR(0, 12, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "DracoPy.pyx":13 - * def __init__(self, in_bytes: bytes): - * self._in_bytes = in_bytes - * self._pos = 0 # <<<<<<<<<<<<<< + * sub_metadatas: Dict[str, 'MetadataObject'] = None): + * self.entries = entries if entries else {} + * self.sub_metadatas = sub_metadatas if sub_metadatas else {} # <<<<<<<<<<<<<< + * * - * @staticmethod */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_pos, __pyx_int_0) < 0) __PYX_ERR(0, 13, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_sub_metadatas); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 13, __pyx_L1_error) + if (__pyx_t_2) { + __Pyx_INCREF(__pyx_v_sub_metadatas); + __pyx_t_1 = __pyx_v_sub_metadatas; + } else { + __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_sub_metadatas, __pyx_t_1) < 0) __PYX_ERR(0, 13, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":11 + /* "DracoPy.pyx":10 * - * class _Reader: - * def __init__(self, in_bytes: bytes): # <<<<<<<<<<<<<< - * self._in_bytes = in_bytes - * self._pos = 0 + * class MetadataObject: + * def __init__(self, entries: Dict[str, bytes] = None, # <<<<<<<<<<<<<< + * sub_metadatas: Dict[str, 'MetadataObject'] = None): + * self.entries = entries if entries else {} */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("DracoPy._Reader.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "DracoPy.pyx":16 - * - * @staticmethod - * def __get_endian() -> str: # <<<<<<<<<<<<<< - * endian_order = get_endian_order() - * if endian_order == DracoPy.endian_order.little_endian: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_7_Reader_3__get_endian(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_7_Reader_3__get_endian = {"__get_endian", (PyCFunction)__pyx_pw_7DracoPy_7_Reader_3__get_endian, METH_NOARGS, 0}; -static PyObject *__pyx_pw_7DracoPy_7_Reader_3__get_endian(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__get_endian (wrapper)", 0); - __pyx_r = __pyx_pf_7DracoPy_7_Reader_2__get_endian(__pyx_self); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_7DracoPy_7_Reader_2__get_endian(CYTHON_UNUSED PyObject *__pyx_self) { - enum DracoFunctions::endian_order __pyx_v_endian_order; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - enum DracoFunctions::endian_order __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__get_endian", 0); - - /* "DracoPy.pyx":17 - * @staticmethod - * def __get_endian() -> str: - * endian_order = get_endian_order() # <<<<<<<<<<<<<< - * if endian_order == DracoPy.endian_order.little_endian: - * return "little" - */ - try { - __pyx_t_1 = DracoFunctions::get_endian_order(); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 17, __pyx_L1_error) - } - __pyx_v_endian_order = __pyx_t_1; - - /* "DracoPy.pyx":18 - * def __get_endian() -> str: - * endian_order = get_endian_order() - * if endian_order == DracoPy.endian_order.little_endian: # <<<<<<<<<<<<<< - * return "little" - * elif endian_order == DracoPy.endian_order.big_endian: - */ - switch (__pyx_v_endian_order) { - case DracoFunctions::little_endian: - - /* "DracoPy.pyx":19 - * endian_order = get_endian_order() - * if endian_order == DracoPy.endian_order.little_endian: - * return "little" # <<<<<<<<<<<<<< - * elif endian_order == DracoPy.endian_order.big_endian: - * return "big" - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_n_u_little); - __pyx_r = __pyx_n_u_little; - goto __pyx_L0; - - /* "DracoPy.pyx":18 - * def __get_endian() -> str: - * endian_order = get_endian_order() - * if endian_order == DracoPy.endian_order.little_endian: # <<<<<<<<<<<<<< - * return "little" - * elif endian_order == DracoPy.endian_order.big_endian: - */ - break; - case DracoFunctions::big_endian: - - /* "DracoPy.pyx":21 - * return "little" - * elif endian_order == DracoPy.endian_order.big_endian: - * return "big" # <<<<<<<<<<<<<< - * else: - * raise Exception("unknown endian order") - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_n_u_big); - __pyx_r = __pyx_n_u_big; - goto __pyx_L0; - - /* "DracoPy.pyx":20 - * if endian_order == DracoPy.endian_order.little_endian: - * return "little" - * elif endian_order == DracoPy.endian_order.big_endian: # <<<<<<<<<<<<<< - * return "big" - * else: - */ - break; - default: - - /* "DracoPy.pyx":23 - * return "big" - * else: - * raise Exception("unknown endian order") # <<<<<<<<<<<<<< - * - * def __read_bytes(self, count: int) -> bytes: - */ - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __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, 23, __pyx_L1_error) - break; - } - - /* "DracoPy.pyx":16 - * - * @staticmethod - * def __get_endian() -> str: # <<<<<<<<<<<<<< - * endian_order = get_endian_order() - * if endian_order == DracoPy.endian_order.little_endian: - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("DracoPy._Reader.__get_endian", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("DracoPy.MetadataObject.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2131,33 +2025,57 @@ static PyObject *__pyx_pf_7DracoPy_7_Reader_2__get_endian(CYTHON_UNUSED PyObject return __pyx_r; } -/* "DracoPy.pyx":25 - * raise Exception("unknown endian order") +/* "DracoPy.pyx":17 * - * def __read_bytes(self, count: int) -> bytes: # <<<<<<<<<<<<<< - * end = self._pos + count - * result_bytes = self._in_bytes[self._pos:end] + * class AttributeMetadataObject(MetadataObject): + * def __init__(self, unique_id: int, # <<<<<<<<<<<<<< + * entries: Dict[str, bytes] = None, + * sub_metadatas: Dict[str, 'MetadataObject'] = None): */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_7_Reader_5__read_bytes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_7_Reader_5__read_bytes = {"__read_bytes", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_7_Reader_5__read_bytes, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_7DracoPy_7_Reader_5__read_bytes(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7DracoPy_23AttributeMetadataObject_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_23AttributeMetadataObject_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_23AttributeMetadataObject_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_7DracoPy_23AttributeMetadataObject_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_count = 0; + PyObject *__pyx_v_unique_id = 0; + PyObject *__pyx_v_entries = 0; + PyObject *__pyx_v_sub_metadatas = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__read_bytes (wrapper)", 0); + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_count,0}; - PyObject* values[2] = {0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_unique_id,&__pyx_n_s_entries,&__pyx_n_s_sub_metadatas,0}; + PyObject* values[4] = {0,0,0,0}; + + /* "DracoPy.pyx":18 + * class AttributeMetadataObject(MetadataObject): + * def __init__(self, unique_id: int, + * entries: Dict[str, bytes] = None, # <<<<<<<<<<<<<< + * sub_metadatas: Dict[str, 'MetadataObject'] = None): + * super().__init__(entries, sub_metadatas) + */ + values[2] = ((PyObject *)((PyObject *)Py_None)); + + /* "DracoPy.pyx":19 + * def __init__(self, unique_id: int, + * entries: Dict[str, bytes] = None, + * sub_metadatas: Dict[str, 'MetadataObject'] = None): # <<<<<<<<<<<<<< + * super().__init__(entries, sub_metadatas) + * self.unique_id = unique_id + */ + values[3] = ((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 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); @@ -2172,371 +2090,350 @@ static PyObject *__pyx_pw_7DracoPy_7_Reader_5__read_bytes(PyObject *__pyx_self, else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_count)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_unique_id)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__read_bytes", 1, 2, 2, 1); __PYX_ERR(0, 25, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, 1); __PYX_ERR(0, 17, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_entries); + 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_sub_metadatas); + if (value) { values[3] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__read_bytes") < 0)) __PYX_ERR(0, 25, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 17, __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); + switch (PyTuple_GET_SIZE(__pyx_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); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } } __pyx_v_self = values[0]; - __pyx_v_count = values[1]; + __pyx_v_unique_id = values[1]; + __pyx_v_entries = values[2]; + __pyx_v_sub_metadatas = values[3]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__read_bytes", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 25, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 17, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("DracoPy._Reader.__read_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("DracoPy.AttributeMetadataObject.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7DracoPy_7_Reader_4__read_bytes(__pyx_self, __pyx_v_self, __pyx_v_count); + __pyx_r = __pyx_pf_7DracoPy_23AttributeMetadataObject___init__(__pyx_self, __pyx_v_self, __pyx_v_unique_id, __pyx_v_entries, __pyx_v_sub_metadatas); + + /* "DracoPy.pyx":17 + * + * class AttributeMetadataObject(MetadataObject): + * def __init__(self, unique_id: int, # <<<<<<<<<<<<<< + * entries: Dict[str, bytes] = None, + * sub_metadatas: Dict[str, 'MetadataObject'] = None): + */ /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_7_Reader_4__read_bytes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_count) { - PyObject *__pyx_v_end = NULL; - PyObject *__pyx_v_result_bytes = NULL; +static PyObject *__pyx_pf_7DracoPy_23AttributeMetadataObject___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_unique_id, PyObject *__pyx_v_entries, PyObject *__pyx_v_sub_metadatas) { 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; + PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__read_bytes", 0); + __Pyx_RefNannySetupContext("__init__", 0); - /* "DracoPy.pyx":26 + /* "DracoPy.pyx":20 + * entries: Dict[str, bytes] = None, + * sub_metadatas: Dict[str, 'MetadataObject'] = None): + * super().__init__(entries, sub_metadatas) # <<<<<<<<<<<<<< + * self.unique_id = unique_id * - * def __read_bytes(self, count: int) -> bytes: - * end = self._pos + count # <<<<<<<<<<<<<< - * result_bytes = self._in_bytes[self._pos:end] - * self._pos = end */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_pos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 26, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_count); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_end = __pyx_t_2; + __pyx_t_2 = __Pyx_CyFunction_GetClassObj(__pyx_self); + if (!__pyx_t_2) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 20, __pyx_L1_error) } + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_INCREF(__pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self); __pyx_t_2 = 0; - - /* "DracoPy.pyx":27 - * def __read_bytes(self, count: int) -> bytes: - * end = self._pos + count - * result_bytes = self._in_bytes[self._pos:end] # <<<<<<<<<<<<<< - * self._pos = end - * return result_bytes - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_in_bytes_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_pos); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_t_2, 0, 0, &__pyx_t_1, &__pyx_v_end, NULL, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 27, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 20, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + __pyx_t_4 = 0; + 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_4 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_entries, __pyx_v_sub_metadatas}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_entries, __pyx_v_sub_metadatas}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + { + __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 20, __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_v_entries); + __Pyx_GIVEREF(__pyx_v_entries); + PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_entries); + __Pyx_INCREF(__pyx_v_sub_metadatas); + __Pyx_GIVEREF(__pyx_v_sub_metadatas); + PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_sub_metadatas); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __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; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_result_bytes = __pyx_t_3; - __pyx_t_3 = 0; - /* "DracoPy.pyx":28 - * end = self._pos + count - * result_bytes = self._in_bytes[self._pos:end] - * self._pos = end # <<<<<<<<<<<<<< - * return result_bytes + /* "DracoPy.pyx":21 + * sub_metadatas: Dict[str, 'MetadataObject'] = None): + * super().__init__(entries, sub_metadatas) + * self.unique_id = unique_id # <<<<<<<<<<<<<< * - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_pos, __pyx_v_end) < 0) __PYX_ERR(0, 28, __pyx_L1_error) - - /* "DracoPy.pyx":29 - * result_bytes = self._in_bytes[self._pos:end] - * self._pos = end - * return result_bytes # <<<<<<<<<<<<<< * - * def read_uint(self) -> int: */ - __Pyx_XDECREF(__pyx_r); - if (!(likely(PyBytes_CheckExact(__pyx_v_result_bytes))||((__pyx_v_result_bytes) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_v_result_bytes)->tp_name), 0))) __PYX_ERR(0, 29, __pyx_L1_error) - __Pyx_INCREF(__pyx_v_result_bytes); - __pyx_r = ((PyObject*)__pyx_v_result_bytes); - goto __pyx_L0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_unique_id, __pyx_v_unique_id) < 0) __PYX_ERR(0, 21, __pyx_L1_error) - /* "DracoPy.pyx":25 - * raise Exception("unknown endian order") + /* "DracoPy.pyx":17 * - * def __read_bytes(self, count: int) -> bytes: # <<<<<<<<<<<<<< - * end = self._pos + count - * result_bytes = self._in_bytes[self._pos:end] + * class AttributeMetadataObject(MetadataObject): + * def __init__(self, unique_id: int, # <<<<<<<<<<<<<< + * entries: Dict[str, bytes] = None, + * sub_metadatas: Dict[str, 'MetadataObject'] = None): */ /* 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_3); - __Pyx_AddTraceback("DracoPy._Reader.__read_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("DracoPy.AttributeMetadataObject.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_end); - __Pyx_XDECREF(__pyx_v_result_bytes); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "DracoPy.pyx":31 - * return result_bytes +/* "DracoPy.pyx":25 * - * def read_uint(self) -> int: # <<<<<<<<<<<<<< - * value = int.from_bytes(self.__read_bytes(4), - * byteorder=self.__get_endian(), signed=False) + * class GeometryMetadataObject(MetadataObject): + * def __init__(self, entries: Dict[str, bytes] = None, # <<<<<<<<<<<<<< + * sub_metadatas: Dict[str, 'MetadataObject'] = None, + * attribute_metadatas: List['AttributeMetadataObject'] = None): */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_7_Reader_7read_uint(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_7_Reader_7read_uint = {"read_uint", (PyCFunction)__pyx_pw_7DracoPy_7_Reader_7read_uint, METH_O, 0}; -static PyObject *__pyx_pw_7DracoPy_7_Reader_7read_uint(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("read_uint (wrapper)", 0); - __pyx_r = __pyx_pf_7DracoPy_7_Reader_6read_uint(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_7DracoPy_7_Reader_6read_uint(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_v_value = NULL; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - 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; +static PyObject *__pyx_pw_7DracoPy_22GeometryMetadataObject_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_22GeometryMetadataObject_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_22GeometryMetadataObject_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_7DracoPy_22GeometryMetadataObject_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_entries = 0; + PyObject *__pyx_v_sub_metadatas = 0; + PyObject *__pyx_v_attribute_metadatas = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_uint", 0); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_entries,&__pyx_n_s_sub_metadatas,&__pyx_n_s_attribute_metadatas,0}; + PyObject* values[4] = {0,0,0,0}; + values[1] = ((PyObject *)((PyObject *)Py_None)); - /* "DracoPy.pyx":32 - * - * def read_uint(self) -> int: - * value = int.from_bytes(self.__read_bytes(4), # <<<<<<<<<<<<<< - * byteorder=self.__get_endian(), signed=False) - * return value + /* "DracoPy.pyx":26 + * class GeometryMetadataObject(MetadataObject): + * def __init__(self, entries: Dict[str, bytes] = None, + * sub_metadatas: Dict[str, 'MetadataObject'] = None, # <<<<<<<<<<<<<< + * attribute_metadatas: List['AttributeMetadataObject'] = None): + * super().__init__(entries, sub_metadatas) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)(&PyInt_Type)), __pyx_n_s_from_bytes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_Reader__read_bytes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_int_4) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_int_4); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __pyx_t_2 = 0; + values[2] = ((PyObject *)((PyObject *)Py_None)); - /* "DracoPy.pyx":33 - * def read_uint(self) -> int: - * value = int.from_bytes(self.__read_bytes(4), - * byteorder=self.__get_endian(), signed=False) # <<<<<<<<<<<<<< - * return value - * + /* "DracoPy.pyx":27 + * def __init__(self, entries: Dict[str, bytes] = None, + * sub_metadatas: Dict[str, 'MetadataObject'] = None, + * attribute_metadatas: List['AttributeMetadataObject'] = None): # <<<<<<<<<<<<<< + * super().__init__(entries, sub_metadatas) + * self.attribute_metadatas = attribute_metadatas if attribute_metadatas \ */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 33, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_Reader__get_endian); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 33, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(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); + values[3] = ((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 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_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_entries); + 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_sub_metadatas); + 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_attribute_metadatas); + if (value) { values[3] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 25, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_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); + break; + default: goto __pyx_L5_argtuple_error; + } } + __pyx_v_self = values[0]; + __pyx_v_entries = values[1]; + __pyx_v_sub_metadatas = values[2]; + __pyx_v_attribute_metadatas = values[3]; } - __pyx_t_4 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 33, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_byteorder, __pyx_t_4) < 0) __PYX_ERR(0, 33, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_signed, Py_False) < 0) __PYX_ERR(0, 33, __pyx_L1_error) - - /* "DracoPy.pyx":32 - * - * def read_uint(self) -> int: - * value = int.from_bytes(self.__read_bytes(4), # <<<<<<<<<<<<<< - * byteorder=self.__get_endian(), signed=False) - * return value - */ - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_value = __pyx_t_4; - __pyx_t_4 = 0; - - /* "DracoPy.pyx":34 - * value = int.from_bytes(self.__read_bytes(4), - * byteorder=self.__get_endian(), signed=False) - * return value # <<<<<<<<<<<<<< - * - * def read_str(self) -> str: - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_value); - __pyx_r = __pyx_v_value; - goto __pyx_L0; - - /* "DracoPy.pyx":31 - * return result_bytes - * - * def read_uint(self) -> int: # <<<<<<<<<<<<<< - * value = int.from_bytes(self.__read_bytes(4), - * byteorder=self.__get_endian(), signed=False) - */ - - /* 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_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("DracoPy._Reader.read_uint", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_value); - __Pyx_XGIVEREF(__pyx_r); + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 25, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("DracoPy.GeometryMetadataObject.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7DracoPy_22GeometryMetadataObject___init__(__pyx_self, __pyx_v_self, __pyx_v_entries, __pyx_v_sub_metadatas, __pyx_v_attribute_metadatas); -/* "DracoPy.pyx":36 - * return value + /* "DracoPy.pyx":25 * - * def read_str(self) -> str: # <<<<<<<<<<<<<< - * count = self.read_uint() - * return self.__read_bytes(count).decode() + * class GeometryMetadataObject(MetadataObject): + * def __init__(self, entries: Dict[str, bytes] = None, # <<<<<<<<<<<<<< + * sub_metadatas: Dict[str, 'MetadataObject'] = None, + * attribute_metadatas: List['AttributeMetadataObject'] = None): */ -/* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_7_Reader_9read_str(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_7_Reader_9read_str = {"read_str", (PyCFunction)__pyx_pw_7DracoPy_7_Reader_9read_str, METH_O, 0}; -static PyObject *__pyx_pw_7DracoPy_7_Reader_9read_str(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("read_str (wrapper)", 0); - __pyx_r = __pyx_pf_7DracoPy_7_Reader_8read_str(__pyx_self, ((PyObject *)__pyx_v_self)); - /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_7_Reader_8read_str(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_v_count = NULL; +static PyObject *__pyx_pf_7DracoPy_22GeometryMetadataObject___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_entries, PyObject *__pyx_v_sub_metadatas, PyObject *__pyx_v_attribute_metadatas) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_str", 0); - - /* "DracoPy.pyx":37 - * - * def read_str(self) -> str: - * count = self.read_uint() # <<<<<<<<<<<<<< - * return self.__read_bytes(count).decode() - * - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_read_uint); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - 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_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, 37, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_count = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_RefNannySetupContext("__init__", 0); - /* "DracoPy.pyx":38 - * def read_str(self) -> str: - * count = self.read_uint() - * return self.__read_bytes(count).decode() # <<<<<<<<<<<<<< - * - * def read_bytes(self) -> bytes: + /* "DracoPy.pyx":28 + * sub_metadatas: Dict[str, 'MetadataObject'] = None, + * attribute_metadatas: List['AttributeMetadataObject'] = None): + * super().__init__(entries, sub_metadatas) # <<<<<<<<<<<<<< + * self.attribute_metadatas = attribute_metadatas if attribute_metadatas \ + * else [] */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_Reader__read_bytes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error) + __pyx_t_2 = __Pyx_CyFunction_GetClassObj(__pyx_self); + if (!__pyx_t_2) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 28, __pyx_L1_error) } + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_4, __pyx_v_count) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_count); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_INCREF(__pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_decode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = NULL; + __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); if (likely(__pyx_t_2)) { @@ -2544,247 +2441,1117 @@ static PyObject *__pyx_pf_7DracoPy_7_Reader_8read_str(CYTHON_UNUSED PyObject *__ __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_4 = 1; } } - __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(0, 38, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_entries, __pyx_v_sub_metadatas}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_entries, __pyx_v_sub_metadatas}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + { + __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 28, __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_v_entries); + __Pyx_GIVEREF(__pyx_v_entries); + PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_entries); + __Pyx_INCREF(__pyx_v_sub_metadatas); + __Pyx_GIVEREF(__pyx_v_sub_metadatas); + PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_sub_metadatas); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __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; - if (!(likely(PyUnicode_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "unicode", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 38, __pyx_L1_error) - __pyx_r = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - goto __pyx_L0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":36 - * return value + /* "DracoPy.pyx":29 + * attribute_metadatas: List['AttributeMetadataObject'] = None): + * super().__init__(entries, sub_metadatas) + * self.attribute_metadatas = attribute_metadatas if attribute_metadatas \ # <<<<<<<<<<<<<< + * else [] + * + */ + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_attribute_metadatas); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 29, __pyx_L1_error) + if (__pyx_t_6) { + __Pyx_INCREF(__pyx_v_attribute_metadatas); + __pyx_t_1 = __pyx_v_attribute_metadatas; + } else { + + /* "DracoPy.pyx":30 + * super().__init__(entries, sub_metadatas) + * self.attribute_metadatas = attribute_metadatas if attribute_metadatas \ + * else [] # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __pyx_t_3; + __pyx_t_3 = 0; + } + + /* "DracoPy.pyx":29 + * attribute_metadatas: List['AttributeMetadataObject'] = None): + * super().__init__(entries, sub_metadatas) + * self.attribute_metadatas = attribute_metadatas if attribute_metadatas \ # <<<<<<<<<<<<<< + * else [] + * + */ + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_attribute_metadatas, __pyx_t_1) < 0) __PYX_ERR(0, 29, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "DracoPy.pyx":25 * - * def read_str(self) -> str: # <<<<<<<<<<<<<< - * count = self.read_uint() - * return self.__read_bytes(count).decode() + * class GeometryMetadataObject(MetadataObject): + * def __init__(self, entries: Dict[str, bytes] = None, # <<<<<<<<<<<<<< + * sub_metadatas: Dict[str, 'MetadataObject'] = None, + * attribute_metadatas: List['AttributeMetadataObject'] = None): */ /* 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_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("DracoPy._Reader.read_str", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("DracoPy.GeometryMetadataObject.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_count); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "DracoPy.pyx":40 - * return self.__read_bytes(count).decode() +/* "DracoPy.pyx":33 * - * def read_bytes(self) -> bytes: # <<<<<<<<<<<<<< - * count = self.read_uint() - * return self.__read_bytes(count) + * + * def decode_metadata(binary_metadata: bytes) -> MetadataObject: # <<<<<<<<<<<<<< + * ss = new stringstream(binary_metadata) + * reader = new DracoPy.MetadataReader(ss) */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_7_Reader_11read_bytes(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_7_Reader_11read_bytes = {"read_bytes", (PyCFunction)__pyx_pw_7DracoPy_7_Reader_11read_bytes, METH_O, 0}; -static PyObject *__pyx_pw_7DracoPy_7_Reader_11read_bytes(PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_7DracoPy_1decode_metadata(PyObject *__pyx_self, PyObject *__pyx_v_binary_metadata); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_1decode_metadata = {"decode_metadata", (PyCFunction)__pyx_pw_7DracoPy_1decode_metadata, METH_O, 0}; +static PyObject *__pyx_pw_7DracoPy_1decode_metadata(PyObject *__pyx_self, PyObject *__pyx_v_binary_metadata) { + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("read_bytes (wrapper)", 0); - __pyx_r = __pyx_pf_7DracoPy_7_Reader_10read_bytes(__pyx_self, ((PyObject *)__pyx_v_self)); + __Pyx_RefNannySetupContext("decode_metadata (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_binary_metadata), (&PyBytes_Type), 1, "binary_metadata", 1))) __PYX_ERR(0, 33, __pyx_L1_error) + __pyx_r = __pyx_pf_7DracoPy_decode_metadata(__pyx_self, ((PyObject*)__pyx_v_binary_metadata)); /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_7_Reader_10read_bytes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_v_count = NULL; +static PyObject *__pyx_pf_7DracoPy_decode_metadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_binary_metadata) { + std::stringstream *__pyx_v_ss; + DracoFunctions::MetadataReader *__pyx_v_reader; + PyObject *__pyx_v_geometry_metadata = NULL; + PyObject *__pyx_v_to_parse_metadatas = NULL; + uint32_t __pyx_v_attribute_metadatas_len; + CYTHON_UNUSED uint32_t __pyx_v__; + uint32_t __pyx_v_unique_id; + PyObject *__pyx_v_attribute_metadata = NULL; + PyObject *__pyx_v_to_parse_metadata_next = NULL; + PyObject *__pyx_v_metadata = NULL; + uint32_t __pyx_v_entries_len; + std::string __pyx_v_name; + std::string __pyx_v_value; + uint32_t __pyx_v_sub_metadatas_len; + PyObject *__pyx_v_sub_metadata = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + std::string __pyx_t_1; + DracoFunctions::MetadataReader *__pyx_t_2; PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + uint32_t __pyx_t_6; + uint32_t __pyx_t_7; + uint32_t __pyx_t_8; + uint32_t __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + int __pyx_t_11; + int __pyx_t_12; + Py_ssize_t __pyx_t_13; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("read_bytes", 0); + __Pyx_RefNannySetupContext("decode_metadata", 0); - /* "DracoPy.pyx":41 - * - * def read_bytes(self) -> bytes: - * count = self.read_uint() # <<<<<<<<<<<<<< - * return self.__read_bytes(count) + /* "DracoPy.pyx":34 * + * def decode_metadata(binary_metadata: bytes) -> MetadataObject: + * ss = new stringstream(binary_metadata) # <<<<<<<<<<<<<< + * reader = new DracoPy.MetadataReader(ss) + * geometry_metadata = GeometryMetadataObject() */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_read_uint); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - 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_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_v_binary_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 34, __pyx_L1_error) + __pyx_v_ss = new std::stringstream(__pyx_t_1); + + /* "DracoPy.pyx":35 + * def decode_metadata(binary_metadata: bytes) -> MetadataObject: + * ss = new stringstream(binary_metadata) + * reader = new DracoPy.MetadataReader(ss) # <<<<<<<<<<<<<< + * geometry_metadata = GeometryMetadataObject() + * to_parse_metadatas = [geometry_metadata] + */ + try { + __pyx_t_2 = new DracoFunctions::MetadataReader(__pyx_v_ss); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 35, __pyx_L1_error) + } + __pyx_v_reader = __pyx_t_2; + + /* "DracoPy.pyx":36 + * ss = new stringstream(binary_metadata) + * reader = new DracoPy.MetadataReader(ss) + * geometry_metadata = GeometryMetadataObject() # <<<<<<<<<<<<<< + * to_parse_metadatas = [geometry_metadata] + * # consider attribute metadatas + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_GeometryMetadataObject); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); + __Pyx_DECREF_SET(__pyx_t_4, 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, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_count = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_geometry_metadata = __pyx_t_3; + __pyx_t_3 = 0; - /* "DracoPy.pyx":42 - * def read_bytes(self) -> bytes: - * count = self.read_uint() - * return self.__read_bytes(count) # <<<<<<<<<<<<<< - * - * def is_end(self) -> bool: + /* "DracoPy.pyx":37 + * reader = new DracoPy.MetadataReader(ss) + * geometry_metadata = GeometryMetadataObject() + * to_parse_metadatas = [geometry_metadata] # <<<<<<<<<<<<<< + * # consider attribute metadatas + * attribute_metadatas_len = reader.read_uint() */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_Reader__read_bytes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - 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_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 37, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_geometry_metadata); + __Pyx_GIVEREF(__pyx_v_geometry_metadata); + PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_geometry_metadata); + __pyx_v_to_parse_metadatas = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "DracoPy.pyx":39 + * to_parse_metadatas = [geometry_metadata] + * # consider attribute metadatas + * attribute_metadatas_len = reader.read_uint() # <<<<<<<<<<<<<< + * for _ in range(attribute_metadatas_len): + * unique_id = reader.read_uint() + */ + try { + __pyx_t_6 = __pyx_v_reader->read_uint(); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 39, __pyx_L1_error) + } + __pyx_v_attribute_metadatas_len = __pyx_t_6; + + /* "DracoPy.pyx":40 + * # consider attribute metadatas + * attribute_metadatas_len = reader.read_uint() + * for _ in range(attribute_metadatas_len): # <<<<<<<<<<<<<< + * unique_id = reader.read_uint() + * attribute_metadata = AttributeMetadataObject(unique_id) + */ + __pyx_t_6 = __pyx_v_attribute_metadatas_len; + __pyx_t_7 = __pyx_t_6; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + __pyx_v__ = __pyx_t_8; + + /* "DracoPy.pyx":41 + * attribute_metadatas_len = reader.read_uint() + * for _ in range(attribute_metadatas_len): + * unique_id = reader.read_uint() # <<<<<<<<<<<<<< + * attribute_metadata = AttributeMetadataObject(unique_id) + * geometry_metadata.attribute_metadatas.append(attribute_metadata) + */ + try { + __pyx_t_9 = __pyx_v_reader->read_uint(); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 41, __pyx_L1_error) + } + __pyx_v_unique_id = __pyx_t_9; + + /* "DracoPy.pyx":42 + * for _ in range(attribute_metadatas_len): + * unique_id = reader.read_uint() + * attribute_metadata = AttributeMetadataObject(unique_id) # <<<<<<<<<<<<<< + * geometry_metadata.attribute_metadatas.append(attribute_metadata) + * to_parse_metadatas.append(attribute_metadata) + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_AttributeMetadataObject); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyInt_From_uint32_t(__pyx_v_unique_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_10 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_10)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } } + __pyx_t_3 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_10, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF_SET(__pyx_v_attribute_metadata, __pyx_t_3); + __pyx_t_3 = 0; + + /* "DracoPy.pyx":43 + * unique_id = reader.read_uint() + * attribute_metadata = AttributeMetadataObject(unique_id) + * geometry_metadata.attribute_metadatas.append(attribute_metadata) # <<<<<<<<<<<<<< + * to_parse_metadatas.append(attribute_metadata) + * # parse metadatas level by level + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_geometry_metadata, __pyx_n_s_attribute_metadatas); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_11 = __Pyx_PyObject_Append(__pyx_t_3, __pyx_v_attribute_metadata); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "DracoPy.pyx":44 + * attribute_metadata = AttributeMetadataObject(unique_id) + * geometry_metadata.attribute_metadatas.append(attribute_metadata) + * to_parse_metadatas.append(attribute_metadata) # <<<<<<<<<<<<<< + * # parse metadatas level by level + * while to_parse_metadatas: + */ + __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_to_parse_metadatas, __pyx_v_attribute_metadata); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 44, __pyx_L1_error) } - __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_count) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_count); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(PyBytes_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_1)->tp_name), 0))) __PYX_ERR(0, 42, __pyx_L1_error) - __pyx_r = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + + /* "DracoPy.pyx":46 + * to_parse_metadatas.append(attribute_metadata) + * # parse metadatas level by level + * while to_parse_metadatas: # <<<<<<<<<<<<<< + * to_parse_metadata_next = [] + * for metadata in to_parse_metadatas: + */ + while (1) { + __pyx_t_12 = (PyList_GET_SIZE(__pyx_v_to_parse_metadatas) != 0); + if (!__pyx_t_12) break; + + /* "DracoPy.pyx":47 + * # parse metadatas level by level + * while to_parse_metadatas: + * to_parse_metadata_next = [] # <<<<<<<<<<<<<< + * for metadata in to_parse_metadatas: + * # parse entries + */ + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_to_parse_metadata_next, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; + + /* "DracoPy.pyx":48 + * while to_parse_metadatas: + * to_parse_metadata_next = [] + * for metadata in to_parse_metadatas: # <<<<<<<<<<<<<< + * # parse entries + * entries_len = reader.read_uint() + */ + __pyx_t_3 = __pyx_v_to_parse_metadatas; __Pyx_INCREF(__pyx_t_3); __pyx_t_13 = 0; + for (;;) { + if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_13); __Pyx_INCREF(__pyx_t_4); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 48, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + __Pyx_XDECREF_SET(__pyx_v_metadata, __pyx_t_4); + __pyx_t_4 = 0; + + /* "DracoPy.pyx":50 + * for metadata in to_parse_metadatas: + * # parse entries + * entries_len = reader.read_uint() # <<<<<<<<<<<<<< + * for _ in range(entries_len): + * name = reader.read_bytes() + */ + try { + __pyx_t_6 = __pyx_v_reader->read_uint(); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 50, __pyx_L1_error) + } + __pyx_v_entries_len = __pyx_t_6; + + /* "DracoPy.pyx":51 + * # parse entries + * entries_len = reader.read_uint() + * for _ in range(entries_len): # <<<<<<<<<<<<<< + * name = reader.read_bytes() + * value = reader.read_bytes() + */ + __pyx_t_6 = __pyx_v_entries_len; + __pyx_t_7 = __pyx_t_6; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + __pyx_v__ = __pyx_t_8; + + /* "DracoPy.pyx":52 + * entries_len = reader.read_uint() + * for _ in range(entries_len): + * name = reader.read_bytes() # <<<<<<<<<<<<<< + * value = reader.read_bytes() + * metadata.entries[name] = value + */ + try { + __pyx_t_1 = __pyx_v_reader->read_bytes(); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 52, __pyx_L1_error) + } + __pyx_v_name = __pyx_t_1; + + /* "DracoPy.pyx":53 + * for _ in range(entries_len): + * name = reader.read_bytes() + * value = reader.read_bytes() # <<<<<<<<<<<<<< + * metadata.entries[name] = value + * sub_metadatas_len = reader.read_uint() + */ + try { + __pyx_t_1 = __pyx_v_reader->read_bytes(); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 53, __pyx_L1_error) + } + __pyx_v_value = __pyx_t_1; + + /* "DracoPy.pyx":54 + * name = reader.read_bytes() + * value = reader.read_bytes() + * metadata.entries[name] = value # <<<<<<<<<<<<<< + * sub_metadatas_len = reader.read_uint() + * # consider sub metadatas + */ + __pyx_t_4 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_entries); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_10 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_name); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (unlikely(PyObject_SetItem(__pyx_t_5, __pyx_t_10, __pyx_t_4) < 0)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + + /* "DracoPy.pyx":55 + * value = reader.read_bytes() + * metadata.entries[name] = value + * sub_metadatas_len = reader.read_uint() # <<<<<<<<<<<<<< + * # consider sub metadatas + * for _ in range(sub_metadatas_len): + */ + try { + __pyx_t_6 = __pyx_v_reader->read_uint(); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 55, __pyx_L1_error) + } + __pyx_v_sub_metadatas_len = __pyx_t_6; + + /* "DracoPy.pyx":57 + * sub_metadatas_len = reader.read_uint() + * # consider sub metadatas + * for _ in range(sub_metadatas_len): # <<<<<<<<<<<<<< + * name = reader.read_bytes() + * sub_metadata = MetadataObject() + */ + __pyx_t_6 = __pyx_v_sub_metadatas_len; + __pyx_t_7 = __pyx_t_6; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + __pyx_v__ = __pyx_t_8; + + /* "DracoPy.pyx":58 + * # consider sub metadatas + * for _ in range(sub_metadatas_len): + * name = reader.read_bytes() # <<<<<<<<<<<<<< + * sub_metadata = MetadataObject() + * metadata.sub_metadatas[name] = sub_metadata + */ + try { + __pyx_t_1 = __pyx_v_reader->read_bytes(); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 58, __pyx_L1_error) + } + __pyx_v_name = __pyx_t_1; + + /* "DracoPy.pyx":59 + * for _ in range(sub_metadatas_len): + * name = reader.read_bytes() + * sub_metadata = MetadataObject() # <<<<<<<<<<<<<< + * metadata.sub_metadatas[name] = sub_metadata + * to_parse_metadata_next.append(sub_metadata) + */ + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_MetadataObject); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_10); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_10, function); + } + } + __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF_SET(__pyx_v_sub_metadata, __pyx_t_4); + __pyx_t_4 = 0; + + /* "DracoPy.pyx":60 + * name = reader.read_bytes() + * sub_metadata = MetadataObject() + * metadata.sub_metadatas[name] = sub_metadata # <<<<<<<<<<<<<< + * to_parse_metadata_next.append(sub_metadata) + * to_parse_metadatas = to_parse_metadata_next + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_sub_metadatas); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 60, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_10 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_name); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 60, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + if (unlikely(PyObject_SetItem(__pyx_t_4, __pyx_t_10, __pyx_v_sub_metadata) < 0)) __PYX_ERR(0, 60, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "DracoPy.pyx":61 + * sub_metadata = MetadataObject() + * metadata.sub_metadatas[name] = sub_metadata + * to_parse_metadata_next.append(sub_metadata) # <<<<<<<<<<<<<< + * to_parse_metadatas = to_parse_metadata_next + * del reader + */ + __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_to_parse_metadata_next, __pyx_v_sub_metadata); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 61, __pyx_L1_error) + } + + /* "DracoPy.pyx":48 + * while to_parse_metadatas: + * to_parse_metadata_next = [] + * for metadata in to_parse_metadatas: # <<<<<<<<<<<<<< + * # parse entries + * entries_len = reader.read_uint() + */ + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "DracoPy.pyx":62 + * metadata.sub_metadatas[name] = sub_metadata + * to_parse_metadata_next.append(sub_metadata) + * to_parse_metadatas = to_parse_metadata_next # <<<<<<<<<<<<<< + * del reader + * del ss + */ + __Pyx_INCREF(__pyx_v_to_parse_metadata_next); + __Pyx_DECREF_SET(__pyx_v_to_parse_metadatas, __pyx_v_to_parse_metadata_next); + } + + /* "DracoPy.pyx":63 + * to_parse_metadata_next.append(sub_metadata) + * to_parse_metadatas = to_parse_metadata_next + * del reader # <<<<<<<<<<<<<< + * del ss + * return geometry_metadata + */ + delete __pyx_v_reader; + + /* "DracoPy.pyx":64 + * to_parse_metadatas = to_parse_metadata_next + * del reader + * del ss # <<<<<<<<<<<<<< + * return geometry_metadata + * + */ + delete __pyx_v_ss; + + /* "DracoPy.pyx":65 + * del reader + * del ss + * return geometry_metadata # <<<<<<<<<<<<<< + * + * def encode_metadata(geometry_metadata: GeometryMetadataObject) -> bytes: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_geometry_metadata); + __pyx_r = __pyx_v_geometry_metadata; goto __pyx_L0; - /* "DracoPy.pyx":40 - * return self.__read_bytes(count).decode() + /* "DracoPy.pyx":33 + * * - * def read_bytes(self) -> bytes: # <<<<<<<<<<<<<< - * count = self.read_uint() - * return self.__read_bytes(count) + * def decode_metadata(binary_metadata: bytes) -> MetadataObject: # <<<<<<<<<<<<<< + * ss = new stringstream(binary_metadata) + * reader = new DracoPy.MetadataReader(ss) */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("DracoPy._Reader.read_bytes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_AddTraceback("DracoPy.decode_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_count); + __Pyx_XDECREF(__pyx_v_geometry_metadata); + __Pyx_XDECREF(__pyx_v_to_parse_metadatas); + __Pyx_XDECREF(__pyx_v_attribute_metadata); + __Pyx_XDECREF(__pyx_v_to_parse_metadata_next); + __Pyx_XDECREF(__pyx_v_metadata); + __Pyx_XDECREF(__pyx_v_sub_metadata); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "DracoPy.pyx":44 - * return self.__read_bytes(count) - * - * def is_end(self) -> bool: # <<<<<<<<<<<<<< - * return len(self._in_bytes) == self._pos +/* "DracoPy.pyx":67 + * return geometry_metadata * + * def encode_metadata(geometry_metadata: GeometryMetadataObject) -> bytes: # <<<<<<<<<<<<<< + * ss = new stringstream(b"") + * writer = new DracoPy.MetadataWriter(ss) */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_7_Reader_13is_end(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_7_Reader_13is_end = {"is_end", (PyCFunction)__pyx_pw_7DracoPy_7_Reader_13is_end, METH_O, 0}; -static PyObject *__pyx_pw_7DracoPy_7_Reader_13is_end(PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_7DracoPy_3encode_metadata(PyObject *__pyx_self, PyObject *__pyx_v_geometry_metadata); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_3encode_metadata = {"encode_metadata", (PyCFunction)__pyx_pw_7DracoPy_3encode_metadata, METH_O, 0}; +static PyObject *__pyx_pw_7DracoPy_3encode_metadata(PyObject *__pyx_self, PyObject *__pyx_v_geometry_metadata) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("is_end (wrapper)", 0); - __pyx_r = __pyx_pf_7DracoPy_7_Reader_12is_end(__pyx_self, ((PyObject *)__pyx_v_self)); + __Pyx_RefNannySetupContext("encode_metadata (wrapper)", 0); + __pyx_r = __pyx_pf_7DracoPy_2encode_metadata(__pyx_self, ((PyObject *)__pyx_v_geometry_metadata)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_7_Reader_12is_end(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_7DracoPy_2encode_metadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_geometry_metadata) { + std::stringstream *__pyx_v_ss; + DracoFunctions::MetadataWriter *__pyx_v_writer; + PyObject *__pyx_v_to_parse_metadata = NULL; + PyObject *__pyx_v_attribute_metadata = NULL; + PyObject *__pyx_v_to_parse_metadata_next = NULL; + PyObject *__pyx_v_draco_metadata = NULL; + PyObject *__pyx_v_name = NULL; + PyObject *__pyx_v_value = NULL; + PyObject *__pyx_v_draco_sub_metadata = NULL; + std::string __pyx_v_s; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; + DracoFunctions::MetadataWriter *__pyx_t_1; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; PyObject *__pyx_t_4 = NULL; + PyObject *(*__pyx_t_5)(PyObject *); + uint32_t __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + Py_ssize_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + int __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + int __pyx_t_14; + std::string __pyx_t_15; + std::vector __pyx_t_16; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("is_end", 0); + __Pyx_RefNannySetupContext("encode_metadata", 0); - /* "DracoPy.pyx":45 - * - * def is_end(self) -> bool: - * return len(self._in_bytes) == self._pos # <<<<<<<<<<<<<< - * + /* "DracoPy.pyx":68 * + * def encode_metadata(geometry_metadata: GeometryMetadataObject) -> bytes: + * ss = new stringstream(b"") # <<<<<<<<<<<<<< + * writer = new DracoPy.MetadataWriter(ss) + * to_parse_metadata = [geometry_metadata] */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_in_bytes_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_pos); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 45, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L0; + __pyx_v_ss = new std::stringstream(__pyx_k_); - /* "DracoPy.pyx":44 - * return self.__read_bytes(count) - * - * def is_end(self) -> bool: # <<<<<<<<<<<<<< - * return len(self._in_bytes) == self._pos - * + /* "DracoPy.pyx":69 + * def encode_metadata(geometry_metadata: GeometryMetadataObject) -> bytes: + * ss = new stringstream(b"") + * writer = new DracoPy.MetadataWriter(ss) # <<<<<<<<<<<<<< + * to_parse_metadata = [geometry_metadata] + * # consider attribute metadatas + */ + try { + __pyx_t_1 = new DracoFunctions::MetadataWriter(__pyx_v_ss); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 69, __pyx_L1_error) + } + __pyx_v_writer = __pyx_t_1; + + /* "DracoPy.pyx":70 + * ss = new stringstream(b"") + * writer = new DracoPy.MetadataWriter(ss) + * to_parse_metadata = [geometry_metadata] # <<<<<<<<<<<<<< + * # consider attribute metadatas + * writer.write_uint(len(geometry_metadata.attribute_metadatas)) + */ + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_geometry_metadata); + __Pyx_GIVEREF(__pyx_v_geometry_metadata); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_geometry_metadata); + __pyx_v_to_parse_metadata = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "DracoPy.pyx":72 + * to_parse_metadata = [geometry_metadata] + * # consider attribute metadatas + * writer.write_uint(len(geometry_metadata.attribute_metadatas)) # <<<<<<<<<<<<<< + * for attribute_metadata in geometry_metadata.attribute_metadatas: + * writer.write_uint(attribute_metadata.unique_id) + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_geometry_metadata, __pyx_n_s_attribute_metadatas); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 72, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + try { + __pyx_v_writer->write_uint(__pyx_t_3); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 72, __pyx_L1_error) + } + + /* "DracoPy.pyx":73 + * # consider attribute metadatas + * writer.write_uint(len(geometry_metadata.attribute_metadatas)) + * for attribute_metadata in geometry_metadata.attribute_metadatas: # <<<<<<<<<<<<<< + * writer.write_uint(attribute_metadata.unique_id) + * to_parse_metadata.append(attribute_metadata) + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_geometry_metadata, __pyx_n_s_attribute_metadatas); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4); __pyx_t_3 = 0; + __pyx_t_5 = NULL; + } else { + __pyx_t_3 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 73, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (likely(!__pyx_t_5)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 73, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } else { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 73, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } + } else { + __pyx_t_2 = __pyx_t_5(__pyx_t_4); + if (unlikely(!__pyx_t_2)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(0, 73, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_XDECREF_SET(__pyx_v_attribute_metadata, __pyx_t_2); + __pyx_t_2 = 0; + + /* "DracoPy.pyx":74 + * writer.write_uint(len(geometry_metadata.attribute_metadatas)) + * for attribute_metadata in geometry_metadata.attribute_metadatas: + * writer.write_uint(attribute_metadata.unique_id) # <<<<<<<<<<<<<< + * to_parse_metadata.append(attribute_metadata) + * # encode metadatas level by level + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_attribute_metadata, __pyx_n_s_unique_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 74, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyInt_As_uint32_t(__pyx_t_2); if (unlikely((__pyx_t_6 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 74, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + try { + __pyx_v_writer->write_uint(__pyx_t_6); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 74, __pyx_L1_error) + } + + /* "DracoPy.pyx":75 + * for attribute_metadata in geometry_metadata.attribute_metadatas: + * writer.write_uint(attribute_metadata.unique_id) + * to_parse_metadata.append(attribute_metadata) # <<<<<<<<<<<<<< + * # encode metadatas level by level + * while to_parse_metadata: + */ + __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_to_parse_metadata, __pyx_v_attribute_metadata); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 75, __pyx_L1_error) + + /* "DracoPy.pyx":73 + * # consider attribute metadatas + * writer.write_uint(len(geometry_metadata.attribute_metadatas)) + * for attribute_metadata in geometry_metadata.attribute_metadatas: # <<<<<<<<<<<<<< + * writer.write_uint(attribute_metadata.unique_id) + * to_parse_metadata.append(attribute_metadata) + */ + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "DracoPy.pyx":77 + * to_parse_metadata.append(attribute_metadata) + * # encode metadatas level by level + * while to_parse_metadata: # <<<<<<<<<<<<<< + * to_parse_metadata_next = [] + * for draco_metadata in to_parse_metadata: + */ + while (1) { + __pyx_t_8 = (PyList_GET_SIZE(__pyx_v_to_parse_metadata) != 0); + if (!__pyx_t_8) break; + + /* "DracoPy.pyx":78 + * # encode metadatas level by level + * while to_parse_metadata: + * to_parse_metadata_next = [] # <<<<<<<<<<<<<< + * for draco_metadata in to_parse_metadata: + * # encode entries + */ + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF_SET(__pyx_v_to_parse_metadata_next, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "DracoPy.pyx":79 + * while to_parse_metadata: + * to_parse_metadata_next = [] + * for draco_metadata in to_parse_metadata: # <<<<<<<<<<<<<< + * # encode entries + * writer.write_uint(len(draco_metadata.entries)) + */ + __pyx_t_4 = __pyx_v_to_parse_metadata; __Pyx_INCREF(__pyx_t_4); __pyx_t_3 = 0; + for (;;) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 79, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + __Pyx_XDECREF_SET(__pyx_v_draco_metadata, __pyx_t_2); + __pyx_t_2 = 0; + + /* "DracoPy.pyx":81 + * for draco_metadata in to_parse_metadata: + * # encode entries + * writer.write_uint(len(draco_metadata.entries)) # <<<<<<<<<<<<<< + * for name, value in draco_metadata.entries.items(): + * writer.write_bytes_from_str(name) + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_draco_metadata, __pyx_n_s_entries); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + try { + __pyx_v_writer->write_uint(__pyx_t_9); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 81, __pyx_L1_error) + } + + /* "DracoPy.pyx":82 + * # encode entries + * writer.write_uint(len(draco_metadata.entries)) + * for name, value in draco_metadata.entries.items(): # <<<<<<<<<<<<<< + * writer.write_bytes_from_str(name) + * writer.write_bytes_from_vec(value) + */ + __pyx_t_9 = 0; + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_draco_metadata, __pyx_n_s_entries); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 82, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + if (unlikely(__pyx_t_12 == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); + __PYX_ERR(0, 82, __pyx_L1_error) + } + __pyx_t_13 = __Pyx_dict_iterator(__pyx_t_12, 0, __pyx_n_s_items, (&__pyx_t_10), (&__pyx_t_11)); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 82, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_2); + __pyx_t_2 = __pyx_t_13; + __pyx_t_13 = 0; + while (1) { + __pyx_t_14 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_10, &__pyx_t_9, &__pyx_t_13, &__pyx_t_12, NULL, __pyx_t_11); + if (unlikely(__pyx_t_14 == 0)) break; + if (unlikely(__pyx_t_14 == -1)) __PYX_ERR(0, 82, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_GOTREF(__pyx_t_12); + __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_13); + __pyx_t_13 = 0; + __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_12); + __pyx_t_12 = 0; + + /* "DracoPy.pyx":83 + * writer.write_uint(len(draco_metadata.entries)) + * for name, value in draco_metadata.entries.items(): + * writer.write_bytes_from_str(name) # <<<<<<<<<<<<<< + * writer.write_bytes_from_vec(value) + * # consider sub metadatas + */ + __pyx_t_15 = __pyx_convert_string_from_py_std__in_string(__pyx_v_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 83, __pyx_L1_error) + try { + __pyx_v_writer->write_bytes_from_str(__pyx_t_15); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 83, __pyx_L1_error) + } + + /* "DracoPy.pyx":84 + * for name, value in draco_metadata.entries.items(): + * writer.write_bytes_from_str(name) + * writer.write_bytes_from_vec(value) # <<<<<<<<<<<<<< + * # consider sub metadatas + * writer.write_uint(len(draco_metadata.sub_metadatas)) + */ + __pyx_t_16 = __pyx_convert_vector_from_py_uint8_t(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 84, __pyx_L1_error) + try { + __pyx_v_writer->write_bytes_from_vec(__pyx_t_16); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 84, __pyx_L1_error) + } + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":86 + * writer.write_bytes_from_vec(value) + * # consider sub metadatas + * writer.write_uint(len(draco_metadata.sub_metadatas)) # <<<<<<<<<<<<<< + * for name, draco_sub_metadata in draco_metadata.sub_metadatas.items(): + * writer.write_bytes_from_str(name) + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_draco_metadata, __pyx_n_s_sub_metadatas); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 86, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + try { + __pyx_v_writer->write_uint(__pyx_t_10); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 86, __pyx_L1_error) + } + + /* "DracoPy.pyx":87 + * # consider sub metadatas + * writer.write_uint(len(draco_metadata.sub_metadatas)) + * for name, draco_sub_metadata in draco_metadata.sub_metadatas.items(): # <<<<<<<<<<<<<< + * writer.write_bytes_from_str(name) + * to_parse_metadata_next.append(draco_sub_metadata) + */ + __pyx_t_10 = 0; + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_draco_metadata, __pyx_n_s_sub_metadatas); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + if (unlikely(__pyx_t_12 == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); + __PYX_ERR(0, 87, __pyx_L1_error) + } + __pyx_t_13 = __Pyx_dict_iterator(__pyx_t_12, 0, __pyx_n_s_items, (&__pyx_t_9), (&__pyx_t_11)); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF(__pyx_t_2); + __pyx_t_2 = __pyx_t_13; + __pyx_t_13 = 0; + while (1) { + __pyx_t_14 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_9, &__pyx_t_10, &__pyx_t_13, &__pyx_t_12, NULL, __pyx_t_11); + if (unlikely(__pyx_t_14 == 0)) break; + if (unlikely(__pyx_t_14 == -1)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_GOTREF(__pyx_t_12); + __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_13); + __pyx_t_13 = 0; + __Pyx_XDECREF_SET(__pyx_v_draco_sub_metadata, __pyx_t_12); + __pyx_t_12 = 0; + + /* "DracoPy.pyx":88 + * writer.write_uint(len(draco_metadata.sub_metadatas)) + * for name, draco_sub_metadata in draco_metadata.sub_metadatas.items(): + * writer.write_bytes_from_str(name) # <<<<<<<<<<<<<< + * to_parse_metadata_next.append(draco_sub_metadata) + * del writer + */ + __pyx_t_15 = __pyx_convert_string_from_py_std__in_string(__pyx_v_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 88, __pyx_L1_error) + try { + __pyx_v_writer->write_bytes_from_str(__pyx_t_15); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 88, __pyx_L1_error) + } + + /* "DracoPy.pyx":89 + * for name, draco_sub_metadata in draco_metadata.sub_metadatas.items(): + * writer.write_bytes_from_str(name) + * to_parse_metadata_next.append(draco_sub_metadata) # <<<<<<<<<<<<<< + * del writer + * s = ss.to_string() + */ + __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_to_parse_metadata_next, __pyx_v_draco_sub_metadata); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 89, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":79 + * while to_parse_metadata: + * to_parse_metadata_next = [] + * for draco_metadata in to_parse_metadata: # <<<<<<<<<<<<<< + * # encode entries + * writer.write_uint(len(draco_metadata.entries)) + */ + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + + /* "DracoPy.pyx":90 + * writer.write_bytes_from_str(name) + * to_parse_metadata_next.append(draco_sub_metadata) + * del writer # <<<<<<<<<<<<<< + * s = ss.to_string() + * del ss + */ + delete __pyx_v_writer; + + /* "DracoPy.pyx":91 + * to_parse_metadata_next.append(draco_sub_metadata) + * del writer + * s = ss.to_string() # <<<<<<<<<<<<<< + * del ss + * return s + */ + __pyx_v_s = __pyx_v_ss->str(); + + /* "DracoPy.pyx":92 + * del writer + * s = ss.to_string() + * del ss # <<<<<<<<<<<<<< + * return s + * + */ + delete __pyx_v_ss; + + /* "DracoPy.pyx":93 + * s = ss.to_string() + * del ss + * return s # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_s); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 93, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_r = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; + goto __pyx_L0; + + /* "DracoPy.pyx":67 + * return geometry_metadata + * + * def encode_metadata(geometry_metadata: GeometryMetadataObject) -> bytes: # <<<<<<<<<<<<<< + * ss = new stringstream(b"") + * writer = new DracoPy.MetadataWriter(ss) */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("DracoPy._Reader.is_end", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_AddTraceback("DracoPy.encode_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF(__pyx_v_to_parse_metadata); + __Pyx_XDECREF(__pyx_v_attribute_metadata); + __Pyx_XDECREF(__pyx_v_to_parse_metadata_next); + __Pyx_XDECREF(__pyx_v_draco_metadata); + __Pyx_XDECREF(__pyx_v_name); + __Pyx_XDECREF(__pyx_v_value); + __Pyx_XDECREF(__pyx_v_draco_sub_metadata); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "DracoPy.pyx":49 +/* "DracoPy.pyx":97 * - * class MetadataObject: - * def __init__(self, entries: typing.Dict[str, bytes] = None, # <<<<<<<<<<<<<< - * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None): - * self.entries = entries if entries else {} + * 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_14MetadataObject_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_14MetadataObject_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_14MetadataObject_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_7DracoPy_14MetadataObject_1__init__(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_entries = 0; - PyObject *__pyx_v_sub_metadatas = 0; + PyObject *__pyx_v_data_struct = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -2792,24 +3559,12 @@ static PyObject *__pyx_pw_7DracoPy_14MetadataObject_1__init__(PyObject *__pyx_se __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_entries,&__pyx_n_s_sub_metadatas,0}; - PyObject* values[3] = {0,0,0}; - values[1] = ((PyObject *)((PyObject *)Py_None)); - - /* "DracoPy.pyx":50 - * class MetadataObject: - * def __init__(self, entries: typing.Dict[str, bytes] = None, - * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None): # <<<<<<<<<<<<<< - * self.entries = entries if entries else {} - * self.sub_metadatas = sub_metadatas if sub_metadatas else {} - */ - values[2] = ((PyObject *)((PyObject *)Py_None)); + 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; 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); @@ -2824,115 +3579,223 @@ static PyObject *__pyx_pw_7DracoPy_14MetadataObject_1__init__(PyObject *__pyx_se else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_entries); - 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_sub_metadatas); - if (value) { values[2] = value; kw_args--; } + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data_struct)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 97, __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, 49, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 97, __pyx_L3_error) } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_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); - 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); } __pyx_v_self = values[0]; - __pyx_v_entries = values[1]; - __pyx_v_sub_metadatas = values[2]; + __pyx_v_data_struct = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 49, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 97, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("DracoPy.MetadataObject.__init__", __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_14MetadataObject___init__(__pyx_self, __pyx_v_self, __pyx_v_entries, __pyx_v_sub_metadatas); - - /* "DracoPy.pyx":49 - * - * class MetadataObject: - * def __init__(self, entries: typing.Dict[str, bytes] = None, # <<<<<<<<<<<<<< - * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None): - * self.entries = entries if entries else {} - */ + __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_14MetadataObject___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_entries, PyObject *__pyx_v_sub_metadatas) { +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; 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); - /* "DracoPy.pyx":51 - * def __init__(self, entries: typing.Dict[str, bytes] = None, - * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None): - * self.entries = entries if entries else {} # <<<<<<<<<<<<<< - * self.sub_metadatas = sub_metadatas if sub_metadatas else {} - * + /* "DracoPy.pyx":98 + * 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'], */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_entries); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 51, __pyx_L1_error) - if (__pyx_t_2) { - __Pyx_INCREF(__pyx_v_entries); - __pyx_t_1 = __pyx_v_entries; - } else { - __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __pyx_t_3; - __pyx_t_3 = 0; - } - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_entries, __pyx_t_1) < 0) __PYX_ERR(0, 51, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_data_struct, __pyx_v_data_struct) < 0) __PYX_ERR(0, 98, __pyx_L1_error) - /* "DracoPy.pyx":52 - * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None): - * self.entries = entries if entries else {} - * self.sub_metadatas = sub_metadatas if sub_metadatas else {} # <<<<<<<<<<<<<< - * - * + /* "DracoPy.pyx":99 + * 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_2 = __Pyx_PyObject_IsTrue(__pyx_v_sub_metadatas); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 52, __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, 99, __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, 99, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - __Pyx_INCREF(__pyx_v_sub_metadatas); - __pyx_t_1 = __pyx_v_sub_metadatas; - } else { - __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error) + + /* "DracoPy.pyx":100 + * 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, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data_struct, __pyx_n_u_quantization_bits); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 100, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + + /* "DracoPy.pyx":101 + * 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, 101, __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, 101, __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; + } + } + #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, 100, __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, 100, __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, 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_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, 100, __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":100 + * 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, 100, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "DracoPy.pyx":99 + * 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":103 + * data_struct['quantization_range'], data_struct['quantization_origin']) + * else: + * self.encoding_options = None # <<<<<<<<<<<<<< + * self.metadata = decode_metadata(data_struct["binary_metadata"]) + * + */ + /*else*/ { + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options, Py_None) < 0) __PYX_ERR(0, 103, __pyx_L1_error) + } + __pyx_L3:; + + /* "DracoPy.pyx":104 + * else: + * self.encoding_options = None + * self.metadata = decode_metadata(data_struct["binary_metadata"]) # <<<<<<<<<<<<<< + * + * def get_encoded_coordinate(self, value, axis): + */ + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_decode_metadata); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data_struct, __pyx_n_u_binary_metadata); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } } - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_sub_metadatas, __pyx_t_1) < 0) __PYX_ERR(0, 52, __pyx_L1_error) + __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_9); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_metadata, __pyx_t_1) < 0) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":49 + /* "DracoPy.pyx":97 * - * class MetadataObject: - * def __init__(self, entries: typing.Dict[str, bytes] = None, # <<<<<<<<<<<<<< - * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None): - * self.entries = entries if entries else {} + * class DracoPointCloud(object): + * def __init__(self, data_struct): # <<<<<<<<<<<<<< + * self.data_struct = data_struct + * if data_struct['encoding_options_set']: */ /* function exit code */ @@ -2941,7 +3804,12 @@ static PyObject *__pyx_pf_7DracoPy_14MetadataObject___init__(CYTHON_UNUSED PyObj __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("DracoPy.MetadataObject.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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); @@ -2949,56 +3817,34 @@ static PyObject *__pyx_pf_7DracoPy_14MetadataObject___init__(CYTHON_UNUSED PyObj return __pyx_r; } -/* "DracoPy.pyx":56 +/* "DracoPy.pyx":106 + * self.metadata = decode_metadata(data_struct["binary_metadata"]) * - * class GeometryMetadataObject(MetadataObject): - * def __init__(self, entries: typing.Dict[str, bytes] = None, # <<<<<<<<<<<<<< - * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None, - * attribute_metadatas: typing.List['MetadataObject'] = 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_22GeometryMetadataObject_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_22GeometryMetadataObject_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_22GeometryMetadataObject_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_7DracoPy_22GeometryMetadataObject_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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_entries = 0; - PyObject *__pyx_v_sub_metadatas = 0; - PyObject *__pyx_v_attribute_metadatas = 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("__init__ (wrapper)", 0); + __Pyx_RefNannySetupContext("get_encoded_coordinate (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_entries,&__pyx_n_s_sub_metadatas,&__pyx_n_s_attribute_metadatas,0}; - PyObject* values[4] = {0,0,0,0}; - values[1] = ((PyObject *)((PyObject *)Py_None)); - - /* "DracoPy.pyx":57 - * class GeometryMetadataObject(MetadataObject): - * def __init__(self, entries: typing.Dict[str, bytes] = None, - * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None, # <<<<<<<<<<<<<< - * attribute_metadatas: typing.List['MetadataObject'] = None): - * super().__init__(entries, sub_metadatas) - */ - values[2] = ((PyObject *)((PyObject *)Py_None)); - - /* "DracoPy.pyx":58 - * def __init__(self, entries: typing.Dict[str, bytes] = None, - * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None, - * attribute_metadatas: typing.List['MetadataObject'] = None): # <<<<<<<<<<<<<< - * super().__init__(entries, sub_metadatas) - * self.attribute_metadatas = attribute_metadatas if attribute_metadatas \ - */ - values[3] = ((PyObject *)((PyObject *)Py_None)); + 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 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); @@ -3015,194 +3861,152 @@ static PyObject *__pyx_pw_7DracoPy_22GeometryMetadataObject_1__init__(PyObject * else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_entries); - 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, 106, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sub_metadatas); - 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_attribute_metadatas); - if (value) { values[3] = 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, 106, __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, 56, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_encoded_coordinate") < 0)) __PYX_ERR(0, 106, __pyx_L3_error) } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; } else { - switch (PyTuple_GET_SIZE(__pyx_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); - 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_self = values[0]; - __pyx_v_entries = values[1]; - __pyx_v_sub_metadatas = values[2]; - __pyx_v_attribute_metadatas = values[3]; + __pyx_v_value = values[1]; + __pyx_v_axis = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 56, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 106, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("DracoPy.GeometryMetadataObject.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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_22GeometryMetadataObject___init__(__pyx_self, __pyx_v_self, __pyx_v_entries, __pyx_v_sub_metadatas, __pyx_v_attribute_metadatas); - - /* "DracoPy.pyx":56 - * - * class GeometryMetadataObject(MetadataObject): - * def __init__(self, entries: typing.Dict[str, bytes] = None, # <<<<<<<<<<<<<< - * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None, - * attribute_metadatas: typing.List['MetadataObject'] = None): - */ + __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_22GeometryMetadataObject___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_entries, PyObject *__pyx_v_sub_metadatas, PyObject *__pyx_v_attribute_metadatas) { +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; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; + 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("__init__", 0); + __Pyx_RefNannySetupContext("get_encoded_coordinate", 0); - /* "DracoPy.pyx":59 - * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None, - * attribute_metadatas: typing.List['MetadataObject'] = None): - * super().__init__(entries, sub_metadatas) # <<<<<<<<<<<<<< - * self.attribute_metadatas = attribute_metadatas if attribute_metadatas \ - * else [] + /* "DracoPy.pyx":107 + * + * 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_2 = __Pyx_CyFunction_GetClassObj(__pyx_self); - if (!__pyx_t_2) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 59, __pyx_L1_error) } - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_INCREF(__pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - __pyx_t_4 = 0; - 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_4 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_entries, __pyx_v_sub_metadatas}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_entries, __pyx_v_sub_metadatas}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 59, __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_v_entries); - __Pyx_GIVEREF(__pyx_v_entries); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_entries); - __Pyx_INCREF(__pyx_v_sub_metadatas); - __Pyx_GIVEREF(__pyx_v_sub_metadatas); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_sub_metadatas); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __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; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __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":60 - * attribute_metadatas: typing.List['MetadataObject'] = None): - * super().__init__(entries, sub_metadatas) - * self.attribute_metadatas = attribute_metadatas if attribute_metadatas \ # <<<<<<<<<<<<<< - * else [] + /* "DracoPy.pyx":108 + * 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_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_attribute_metadatas); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 60, __pyx_L1_error) - if (__pyx_t_6) { - __Pyx_INCREF(__pyx_v_attribute_metadatas); - __pyx_t_1 = __pyx_v_attribute_metadatas; - } 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, 108, __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, 108, __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, 108, __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, 108, __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, 108, __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, 108, __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":61 - * super().__init__(entries, sub_metadatas) - * self.attribute_metadatas = attribute_metadatas if attribute_metadatas \ - * else [] # <<<<<<<<<<<<<< + /* "DracoPy.pyx":107 * + * 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 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 61, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __pyx_t_3; - __pyx_t_3 = 0; } - /* "DracoPy.pyx":60 - * attribute_metadatas: typing.List['MetadataObject'] = None): - * super().__init__(entries, sub_metadatas) - * self.attribute_metadatas = attribute_metadatas if attribute_metadatas \ # <<<<<<<<<<<<<< - * else [] - * - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_attribute_metadatas, __pyx_t_1) < 0) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "DracoPy.pyx":56 + /* "DracoPy.pyx":106 + * self.metadata = decode_metadata(data_struct["binary_metadata"]) * - * class GeometryMetadataObject(MetadataObject): - * def __init__(self, entries: typing.Dict[str, bytes] = None, # <<<<<<<<<<<<<< - * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None, - * attribute_metadatas: typing.List['MetadataObject'] = None): + * 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 */ @@ -3210,10 +4014,10 @@ static PyObject *__pyx_pf_7DracoPy_22GeometryMetadataObject___init__(CYTHON_UNUS 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_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("DracoPy.GeometryMetadataObject.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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); @@ -3221,1027 +4025,424 @@ static PyObject *__pyx_pf_7DracoPy_22GeometryMetadataObject___init__(CYTHON_UNUS return __pyx_r; } -/* "DracoPy.pyx":64 - * +/* "DracoPy.pyx":110 + * return self.encoding_options.get_encoded_coordinate(value, axis) * - * def _parse_binary_metadata(binary_metadata: bytes) -> MetadataObject: # <<<<<<<<<<<<<< - * reader = _Reader(binary_metadata) - * geometry_metadata = GeometryMetadataObject() + * 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_1_parse_binary_metadata(PyObject *__pyx_self, PyObject *__pyx_v_binary_metadata); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_1_parse_binary_metadata = {"_parse_binary_metadata", (PyCFunction)__pyx_pw_7DracoPy_1_parse_binary_metadata, METH_O, 0}; -static PyObject *__pyx_pw_7DracoPy_1_parse_binary_metadata(PyObject *__pyx_self, PyObject *__pyx_v_binary_metadata) { +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_point = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("_parse_binary_metadata (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_binary_metadata), (&PyBytes_Type), 1, "binary_metadata", 1))) __PYX_ERR(0, 64, __pyx_L1_error) - __pyx_r = __pyx_pf_7DracoPy__parse_binary_metadata(__pyx_self, ((PyObject*)__pyx_v_binary_metadata)); + __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, 110, __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, 110, __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, 110, __pyx_L3_error) + __pyx_L3_error:; + __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_15DracoPointCloud_4get_encoded_point(__pyx_self, __pyx_v_self, __pyx_v_point); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy__parse_binary_metadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_binary_metadata) { - PyObject *__pyx_v_reader = NULL; - PyObject *__pyx_v_geometry_metadata = NULL; - PyObject *__pyx_v_to_parse_metadatas = NULL; - PyObject *__pyx_v_attribute_metadatas_len = NULL; - CYTHON_UNUSED PyObject *__pyx_v__ = NULL; - PyObject *__pyx_v_attribute_metadata = NULL; - PyObject *__pyx_v_to_parse_metadata_next = NULL; - PyObject *__pyx_v_metadata = NULL; - PyObject *__pyx_v_attr_len = NULL; - PyObject *__pyx_v_name = NULL; - PyObject *__pyx_v_value = NULL; - PyObject *__pyx_v_sub_metadatas_len = NULL; - PyObject *__pyx_v_sub_metadata = NULL; +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; - PyObject *__pyx_t_3 = NULL; - Py_ssize_t __pyx_t_4; - PyObject *(*__pyx_t_5)(PyObject *); - PyObject *__pyx_t_6 = NULL; - int __pyx_t_7; - int __pyx_t_8; - Py_ssize_t __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - int __pyx_t_11; + 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("_parse_binary_metadata", 0); + __Pyx_RefNannySetupContext("get_encoded_point", 0); - /* "DracoPy.pyx":65 + /* "DracoPy.pyx":111 + * + * def get_encoded_point(self, point): + * if self.encoding_options is not None: # <<<<<<<<<<<<<< + * return self.encoding_options.get_encoded_point(point) * - * def _parse_binary_metadata(binary_metadata: bytes) -> MetadataObject: - * reader = _Reader(binary_metadata) # <<<<<<<<<<<<<< - * geometry_metadata = GeometryMetadataObject() - * to_parse_metadatas = [geometry_metadata] */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_Reader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __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_Call2Args(__pyx_t_2, __pyx_t_3, __pyx_v_binary_metadata) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_binary_metadata); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __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, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_reader = __pyx_t_1; - __pyx_t_1 = 0; - - /* "DracoPy.pyx":66 - * def _parse_binary_metadata(binary_metadata: bytes) -> MetadataObject: - * reader = _Reader(binary_metadata) - * geometry_metadata = GeometryMetadataObject() # <<<<<<<<<<<<<< - * to_parse_metadatas = [geometry_metadata] - * # parse attribute metadatas - */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_GeometryMetadataObject); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __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, 66, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_geometry_metadata = __pyx_t_1; - __pyx_t_1 = 0; - - /* "DracoPy.pyx":67 - * reader = _Reader(binary_metadata) - * geometry_metadata = GeometryMetadataObject() - * to_parse_metadatas = [geometry_metadata] # <<<<<<<<<<<<<< - * # parse attribute metadatas - * attribute_metadatas_len = reader.read_uint() - */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_geometry_metadata); - __Pyx_GIVEREF(__pyx_v_geometry_metadata); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_geometry_metadata); - __pyx_v_to_parse_metadatas = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "DracoPy.pyx":69 - * to_parse_metadatas = [geometry_metadata] - * # parse attribute metadatas - * attribute_metadatas_len = reader.read_uint() # <<<<<<<<<<<<<< - * for _ in range(attribute_metadatas_len): - * attribute_metadata = MetadataObject() - */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_reader, __pyx_n_s_read_uint); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = NULL; - 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_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, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_attribute_metadatas_len = __pyx_t_1; - __pyx_t_1 = 0; - - /* "DracoPy.pyx":70 - * # parse attribute metadatas - * attribute_metadatas_len = reader.read_uint() - * for _ in range(attribute_metadatas_len): # <<<<<<<<<<<<<< - * attribute_metadata = MetadataObject() - * geometry_metadata.attribute_metadatas.append(attribute_metadata) - */ - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_attribute_metadatas_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0; - __pyx_t_5 = NULL; - } else { - __pyx_t_4 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 70, __pyx_L1_error) - } + __pyx_t_2 = (__pyx_t_1 != Py_None); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_5)) { - if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 70, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 70, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_5(__pyx_t_2); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 70, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v__, __pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { - /* "DracoPy.pyx":71 - * attribute_metadatas_len = reader.read_uint() - * for _ in range(attribute_metadatas_len): - * attribute_metadata = MetadataObject() # <<<<<<<<<<<<<< - * geometry_metadata.attribute_metadatas.append(attribute_metadata) - * to_parse_metadatas.append(attribute_metadata) + /* "DracoPy.pyx":112 + * def get_encoded_point(self, point): + * if self.encoding_options is not None: + * return self.encoding_options.get_encoded_point(point) # <<<<<<<<<<<<<< + * + * @property */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_MetadataObject); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_6); + __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, 112, __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, 112, __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_3, function); + __Pyx_DECREF_SET(__pyx_t_5, function); } } - __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error) + __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, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF_SET(__pyx_v_attribute_metadata, __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":72 - * for _ in range(attribute_metadatas_len): - * attribute_metadata = MetadataObject() - * geometry_metadata.attribute_metadatas.append(attribute_metadata) # <<<<<<<<<<<<<< - * to_parse_metadatas.append(attribute_metadata) - * # parse metadatas level by level - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geometry_metadata, __pyx_n_s_attribute_metadatas); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_PyObject_Append(__pyx_t_1, __pyx_v_attribute_metadata); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "DracoPy.pyx":73 - * attribute_metadata = MetadataObject() - * geometry_metadata.attribute_metadatas.append(attribute_metadata) - * to_parse_metadatas.append(attribute_metadata) # <<<<<<<<<<<<<< - * # parse metadatas level by level - * while to_parse_metadatas: - */ - __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_to_parse_metadatas, __pyx_v_attribute_metadata); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 73, __pyx_L1_error) - - /* "DracoPy.pyx":70 - * # parse attribute metadatas - * attribute_metadatas_len = reader.read_uint() - * for _ in range(attribute_metadatas_len): # <<<<<<<<<<<<<< - * attribute_metadata = MetadataObject() - * geometry_metadata.attribute_metadatas.append(attribute_metadata) + /* "DracoPy.pyx":111 + * + * def get_encoded_point(self, point): + * if self.encoding_options is not None: # <<<<<<<<<<<<<< + * return self.encoding_options.get_encoded_point(point) + * */ } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":75 - * to_parse_metadatas.append(attribute_metadata) - * # parse metadatas level by level - * while to_parse_metadatas: # <<<<<<<<<<<<<< - * to_parse_metadata_next = [] - * for metadata in to_parse_metadatas: + /* "DracoPy.pyx":110 + * 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) */ - while (1) { - __pyx_t_8 = (PyList_GET_SIZE(__pyx_v_to_parse_metadatas) != 0); - if (!__pyx_t_8) break; - /* "DracoPy.pyx":76 - * # parse metadatas level by level - * while to_parse_metadatas: - * to_parse_metadata_next = [] # <<<<<<<<<<<<<< - * for metadata in to_parse_metadatas: - * # parse entries - */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_XDECREF_SET(__pyx_v_to_parse_metadata_next, ((PyObject*)__pyx_t_2)); - __pyx_t_2 = 0; + /* 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; +} - /* "DracoPy.pyx":77 - * while to_parse_metadatas: - * to_parse_metadata_next = [] - * for metadata in to_parse_metadatas: # <<<<<<<<<<<<<< - * # parse entries - * attr_len = reader.read_uint() +/* "DracoPy.pyx":115 + * + * @property + * def num_axes(self): # <<<<<<<<<<<<<< + * return 3 + * */ - __pyx_t_2 = __pyx_v_to_parse_metadatas; __Pyx_INCREF(__pyx_t_2); __pyx_t_4 = 0; - for (;;) { - if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_2)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_4); __Pyx_INCREF(__pyx_t_1); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 77, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - __Pyx_XDECREF_SET(__pyx_v_metadata, __pyx_t_1); - __pyx_t_1 = 0; - /* "DracoPy.pyx":79 - * for metadata in to_parse_metadatas: - * # parse entries - * attr_len = reader.read_uint() # <<<<<<<<<<<<<< - * for _ in range(attr_len): - * name = reader.read_str() - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_reader, __pyx_n_s_read_uint); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 79, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF_SET(__pyx_v_attr_len, __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)); - /* "DracoPy.pyx":80 - * # parse entries - * attr_len = reader.read_uint() - * for _ in range(attr_len): # <<<<<<<<<<<<<< - * name = reader.read_str() - * value = reader.read_bytes() - */ - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_attr_len); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_9 = 0; - __pyx_t_5 = NULL; - } else { - __pyx_t_9 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 80, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 80, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_5)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 80, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_9); __Pyx_INCREF(__pyx_t_1); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 80, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_5(__pyx_t_3); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 80, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v__, __pyx_t_1); - __pyx_t_1 = 0; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "DracoPy.pyx":81 - * attr_len = reader.read_uint() - * for _ in range(attr_len): - * name = reader.read_str() # <<<<<<<<<<<<<< - * value = reader.read_bytes() - * metadata.entries[name] = value - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_reader, __pyx_n_s_read_str); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_10 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_10) : __Pyx_PyObject_CallNoArg(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_1); - __pyx_t_1 = 0; - - /* "DracoPy.pyx":82 - * for _ in range(attr_len): - * name = reader.read_str() - * value = reader.read_bytes() # <<<<<<<<<<<<<< - * metadata.entries[name] = value - * sub_metadatas_len = reader.read_uint() - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_reader, __pyx_n_s_read_bytes); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_10 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_1 = (__pyx_t_10) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_10) : __Pyx_PyObject_CallNoArg(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_1); - __pyx_t_1 = 0; +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":83 - * name = reader.read_str() - * value = reader.read_bytes() - * metadata.entries[name] = value # <<<<<<<<<<<<<< - * sub_metadatas_len = reader.read_uint() - * for _ in range(sub_metadatas_len): + /* "DracoPy.pyx":116 + * @property + * def num_axes(self): + * return 3 # <<<<<<<<<<<<<< + * + * @property */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_entries); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (unlikely(PyObject_SetItem(__pyx_t_1, __pyx_v_name, __pyx_v_value) < 0)) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_int_3); + __pyx_r = __pyx_int_3; + goto __pyx_L0; - /* "DracoPy.pyx":80 - * # parse entries - * attr_len = reader.read_uint() - * for _ in range(attr_len): # <<<<<<<<<<<<<< - * name = reader.read_str() - * value = reader.read_bytes() + /* "DracoPy.pyx":115 + * + * @property + * def num_axes(self): # <<<<<<<<<<<<<< + * return 3 + * */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":84 - * value = reader.read_bytes() - * metadata.entries[name] = value - * sub_metadatas_len = reader.read_uint() # <<<<<<<<<<<<<< - * for _ in range(sub_metadatas_len): - * name = reader.read_str() - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_reader, __pyx_n_s_read_uint); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_3 = (__pyx_t_6) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_6) : __Pyx_PyObject_CallNoArg(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF_SET(__pyx_v_sub_metadatas_len, __pyx_t_3); - __pyx_t_3 = 0; - - /* "DracoPy.pyx":85 - * metadata.entries[name] = value - * sub_metadatas_len = reader.read_uint() - * for _ in range(sub_metadatas_len): # <<<<<<<<<<<<<< - * name = reader.read_str() - * sub_metadata = MetadataObject() - */ - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_sub_metadatas_len); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_9 = 0; - __pyx_t_5 = NULL; - } else { - __pyx_t_9 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 85, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (likely(!__pyx_t_5)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 85, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } else { - if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_9); __Pyx_INCREF(__pyx_t_3); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 85, __pyx_L1_error) - #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - #endif - } - } else { - __pyx_t_3 = __pyx_t_5(__pyx_t_1); - if (unlikely(!__pyx_t_3)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 85, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - __Pyx_XDECREF_SET(__pyx_v__, __pyx_t_3); - __pyx_t_3 = 0; - - /* "DracoPy.pyx":86 - * sub_metadatas_len = reader.read_uint() - * for _ in range(sub_metadatas_len): - * name = reader.read_str() # <<<<<<<<<<<<<< - * sub_metadata = MetadataObject() - * metadata.sub_metadatas[name] = sub_metadata - */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_v_reader, __pyx_n_s_read_str); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_10 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_3 = (__pyx_t_10) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_10) : __Pyx_PyObject_CallNoArg(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_3); - __pyx_t_3 = 0; - - /* "DracoPy.pyx":87 - * for _ in range(sub_metadatas_len): - * name = reader.read_str() - * sub_metadata = MetadataObject() # <<<<<<<<<<<<<< - * metadata.sub_metadatas[name] = sub_metadata - * to_parse_metadata_next.append(sub_metadata) - */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_MetadataObject); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 87, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_10 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_3 = (__pyx_t_10) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_10) : __Pyx_PyObject_CallNoArg(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 87, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF_SET(__pyx_v_sub_metadata, __pyx_t_3); - __pyx_t_3 = 0; - - /* "DracoPy.pyx":88 - * name = reader.read_str() - * sub_metadata = MetadataObject() - * metadata.sub_metadatas[name] = sub_metadata # <<<<<<<<<<<<<< - * to_parse_metadata_next.append(sub_metadata) - * to_parse_metadatas = to_parse_metadata_next - */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_sub_metadatas); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 88, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (unlikely(PyObject_SetItem(__pyx_t_3, __pyx_v_name, __pyx_v_sub_metadata) < 0)) __PYX_ERR(0, 88, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "DracoPy.pyx":89 - * sub_metadata = MetadataObject() - * metadata.sub_metadatas[name] = sub_metadata - * to_parse_metadata_next.append(sub_metadata) # <<<<<<<<<<<<<< - * to_parse_metadatas = to_parse_metadata_next - * if not reader.is_end(): - */ - __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_to_parse_metadata_next, __pyx_v_sub_metadata); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 89, __pyx_L1_error) - - /* "DracoPy.pyx":85 - * metadata.entries[name] = value - * sub_metadatas_len = reader.read_uint() - * for _ in range(sub_metadatas_len): # <<<<<<<<<<<<<< - * name = reader.read_str() - * sub_metadata = MetadataObject() - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "DracoPy.pyx":77 - * while to_parse_metadatas: - * to_parse_metadata_next = [] - * for metadata in to_parse_metadatas: # <<<<<<<<<<<<<< - * # parse entries - * attr_len = reader.read_uint() - */ - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "DracoPy.pyx":90 - * metadata.sub_metadatas[name] = sub_metadata - * to_parse_metadata_next.append(sub_metadata) - * to_parse_metadatas = to_parse_metadata_next # <<<<<<<<<<<<<< - * if not reader.is_end(): - * raise Exception("not read bytes detected") +/* "DracoPy.pyx":119 + * + * @property + * def points(self): # <<<<<<<<<<<<<< + * return self.data_struct['points'] + * */ - __Pyx_INCREF(__pyx_v_to_parse_metadata_next); - __Pyx_DECREF_SET(__pyx_v_to_parse_metadatas, __pyx_v_to_parse_metadata_next); - } - /* "DracoPy.pyx":91 - * to_parse_metadata_next.append(sub_metadata) - * to_parse_metadatas = to_parse_metadata_next - * if not reader.is_end(): # <<<<<<<<<<<<<< - * raise Exception("not read bytes detected") - * return geometry_metadata - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_reader, __pyx_n_s_is_end); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - } - } - __pyx_t_2 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_11 = ((!__pyx_t_8) != 0); - if (unlikely(__pyx_t_11)) { +/* 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)); - /* "DracoPy.pyx":92 - * to_parse_metadatas = to_parse_metadata_next - * if not reader.is_end(): - * raise Exception("not read bytes detected") # <<<<<<<<<<<<<< - * return geometry_metadata - * - */ - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__2, 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) + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "DracoPy.pyx":91 - * to_parse_metadata_next.append(sub_metadata) - * to_parse_metadatas = to_parse_metadata_next - * if not reader.is_end(): # <<<<<<<<<<<<<< - * raise Exception("not read bytes detected") - * return geometry_metadata - */ - } +static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_8points(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("points", 0); - /* "DracoPy.pyx":93 - * if not reader.is_end(): - * raise Exception("not read bytes detected") - * return geometry_metadata # <<<<<<<<<<<<<< + /* "DracoPy.pyx":120 + * @property + * def points(self): + * return self.data_struct['points'] # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_geometry_metadata); - __pyx_r = __pyx_v_geometry_metadata; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_data_struct); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __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, 120, __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":119 * + * @property + * def points(self): # <<<<<<<<<<<<<< + * return self.data_struct['points'] * - * def _parse_binary_metadata(binary_metadata: bytes) -> MetadataObject: # <<<<<<<<<<<<<< - * reader = _Reader(binary_metadata) - * geometry_metadata = GeometryMetadataObject() */ /* 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_6); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("DracoPy._parse_binary_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("DracoPy.DracoPointCloud.points", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_reader); - __Pyx_XDECREF(__pyx_v_geometry_metadata); - __Pyx_XDECREF(__pyx_v_to_parse_metadatas); - __Pyx_XDECREF(__pyx_v_attribute_metadatas_len); - __Pyx_XDECREF(__pyx_v__); - __Pyx_XDECREF(__pyx_v_attribute_metadata); - __Pyx_XDECREF(__pyx_v_to_parse_metadata_next); - __Pyx_XDECREF(__pyx_v_metadata); - __Pyx_XDECREF(__pyx_v_attr_len); - __Pyx_XDECREF(__pyx_v_name); - __Pyx_XDECREF(__pyx_v_value); - __Pyx_XDECREF(__pyx_v_sub_metadatas_len); - __Pyx_XDECREF(__pyx_v_sub_metadata); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "DracoPy.pyx":97 +/* "DracoPy.pyx":125 + * class DracoMesh(DracoPointCloud): + * @property + * def faces(self): # <<<<<<<<<<<<<< + * return self.data_struct['faces'] * - * 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; - 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("__init__ (wrapper)", 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; - 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_data_struct)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 97, __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, 97, __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_data_struct = 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, 97, __pyx_L3_error) - __pyx_L3_error:; - __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___init__(__pyx_self, __pyx_v_self, __pyx_v_data_struct); + __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_15DracoPointCloud___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data_struct) { +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; - 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; + PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); - - /* "DracoPy.pyx":98 - * 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, 98, __pyx_L1_error) + __Pyx_RefNannySetupContext("faces", 0); - /* "DracoPy.pyx":99 - * 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":126 + * @property + * def faces(self): + * return self.data_struct['faces'] # <<<<<<<<<<<<<< + * + * @property */ - __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, 99, __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, 126, __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, 99, __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, 126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "DracoPy.pyx":100 - * 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: + /* "DracoPy.pyx":125 + * class DracoMesh(DracoPointCloud): + * @property + * def faces(self): # <<<<<<<<<<<<<< + * return self.data_struct['faces'] + * */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_EncodingOptions); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 100, __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, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - /* "DracoPy.pyx":101 - * 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, 101, __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, 101, __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; - } - } - #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, 100, __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, 100, __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, 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_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, 100, __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; + /* 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":100 - * 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: +/* "DracoPy.pyx":129 + * + * @property + * def normals(self): # <<<<<<<<<<<<<< + * return self.data_struct['normals'] + * */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options, __pyx_t_1) < 0) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":99 - * 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; - } +/* 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)); - /* "DracoPy.pyx":103 - * data_struct['quantization_range'], data_struct['quantization_origin']) - * else: - * self.encoding_options = None # <<<<<<<<<<<<<< - * self.metadata = _parse_binary_metadata(data_struct["binary_metadata"]) - * - */ - /*else*/ { - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options, Py_None) < 0) __PYX_ERR(0, 103, __pyx_L1_error) - } - __pyx_L3:; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "DracoPy.pyx":104 - * else: - * self.encoding_options = None - * self.metadata = _parse_binary_metadata(data_struct["binary_metadata"]) # <<<<<<<<<<<<<< +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":130 + * @property + * def normals(self): + * return self.data_struct['normals'] # <<<<<<<<<<<<<< * - * def get_encoded_coordinate(self, value, axis): + * class EncodingOptions(object): */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_parse_binary_metadata); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 104, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data_struct, __pyx_n_u_binary_metadata); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 104, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_9); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __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, 130, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_metadata, __pyx_t_1) < 0) __PYX_ERR(0, 104, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_normals); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 130, __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":97 + /* "DracoPy.pyx":129 + * + * @property + * def normals(self): # <<<<<<<<<<<<<< + * return self.data_struct['normals'] * - * 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_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("DracoPy.DracoMesh.normals", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4249,34 +4450,37 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyOb return __pyx_r; } -/* "DracoPy.pyx":106 - * self.metadata = _parse_binary_metadata(data_struct["binary_metadata"]) +/* "DracoPy.pyx":133 * - * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< - * if self.encoding_options is not None: - * 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 */ /* 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) { +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_value = 0; - PyObject *__pyx_v_axis = 0; + PyObject *__pyx_v_quantization_bits = 0; + PyObject *__pyx_v_quantization_range = 0; + PyObject *__pyx_v_quantization_origin = 0; 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("__init__ (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_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 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); @@ -4293,152 +4497,115 @@ static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_3get_encoded_coordinate(PyO 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, 106, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); __PYX_ERR(0, 133, __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("get_encoded_coordinate", 1, 3, 3, 2); __PYX_ERR(0, 106, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 2); __PYX_ERR(0, 133, __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("__init__", 1, 4, 4, 3); __PYX_ERR(0, 133, __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, 106, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 133, __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_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("get_encoded_coordinate", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 106, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 133, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("DracoPy.DracoPointCloud.get_encoded_coordinate", __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_15DracoPointCloud_2get_encoded_coordinate(__pyx_self, __pyx_v_self, __pyx_v_value, __pyx_v_axis); + __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_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_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; - 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; + PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_encoded_coordinate", 0); + __Pyx_RefNannySetupContext("__init__", 0); - /* "DracoPy.pyx":107 - * - * 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":134 + * 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 */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __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) { + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_quantization_bits, __pyx_v_quantization_bits) < 0) __PYX_ERR(0, 134, __pyx_L1_error) - /* "DracoPy.pyx":108 - * 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":135 + * 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, 135, __pyx_L1_error) + + /* "DracoPy.pyx":136 + * 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_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, 108, __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, 108, __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, 108, __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, 108, __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, 108, __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, 108, __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; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin, __pyx_v_quantization_origin) < 0) __PYX_ERR(0, 136, __pyx_L1_error) - /* "DracoPy.pyx":107 + /* "DracoPy.pyx":137 + * 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 self.encoding_options is not None: # <<<<<<<<<<<<<< - * return self.encoding_options.get_encoded_coordinate(value, axis) - * */ - } + __pyx_t_1 = __Pyx_PyNumber_PowerOf2(__pyx_int_2, __pyx_v_quantization_bits, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 137, __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, 137, __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, 137, __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, 137, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":106 - * self.metadata = _parse_binary_metadata(data_struct["binary_metadata"]) + /* "DracoPy.pyx":133 * - * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< - * if self.encoding_options is not None: - * 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 */ /* function exit code */ @@ -4446,10 +4613,8 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_2get_encoded_coordinate(CYT 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_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("DracoPy.EncodingOptions.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4457,33 +4622,36 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_2get_encoded_coordinate(CYT return __pyx_r; } -/* "DracoPy.pyx":110 - * return self.encoding_options.get_encoded_coordinate(value, axis) +/* "DracoPy.pyx":139 + * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) * - * 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): # <<<<<<<<<<<<<< + * 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_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_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_point = 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("get_encoded_point (wrapper)", 0); + __Pyx_RefNannySetupContext("get_encoded_coordinate (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_point,0}; - PyObject* values[2] = {0,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); @@ -4498,419 +4666,615 @@ 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_value)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("get_encoded_point", 1, 2, 2, 1); __PYX_ERR(0, 110, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, 1); __PYX_ERR(0, 139, __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, 139, __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, 110, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_encoded_coordinate") < 0)) __PYX_ERR(0, 139, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + } 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_point = values[1]; + __pyx_v_value = values[1]; + __pyx_v_axis = values[2]; } 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, 110, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 139, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("DracoPy.DracoPointCloud.get_encoded_point", __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_15DracoPointCloud_4get_encoded_point(__pyx_self, __pyx_v_self, __pyx_v_point); + __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_15DracoPointCloud_4get_encoded_point(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_point) { +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_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; + int __pyx_t_1; + 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_point", 0); + __Pyx_RefNannySetupContext("get_encoded_coordinate", 0); - /* "DracoPy.pyx":111 - * - * def get_encoded_point(self, point): - * if self.encoding_options is not None: # <<<<<<<<<<<<<< - * return self.encoding_options.get_encoded_point(point) + /* "DracoPy.pyx":140 * + * 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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __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_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 140, __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, 140, __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, 140, __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, 140, __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, 140, __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, 140, __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, 140, __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, 140, __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, 140, __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, 140, __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":112 - * def get_encoded_point(self, point): - * if self.encoding_options is not None: - * return self.encoding_options.get_encoded_point(point) # <<<<<<<<<<<<<< + /* "DracoPy.pyx":141 + * 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__2, 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) + + /* "DracoPy.pyx":140 * - * @property + * 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_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, 112, __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, 112, __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); - } + } + + /* "DracoPy.pyx":142 + * 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_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __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, 142, __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, 142, __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":143 + * 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_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_floor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 143, __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, 143, __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, 143, __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, 143, __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_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, 112, __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; + } + __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, 143, __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":111 + /* "DracoPy.pyx":144 + * 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): - * if self.encoding_options is not None: # <<<<<<<<<<<<<< - * return self.encoding_options.get_encoded_point(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, 144, __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, 144, __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, 144, __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, 144, __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, 144, __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":110 - * return self.encoding_options.get_encoded_coordinate(value, axis) + /* "DracoPy.pyx":139 + * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) * - * 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): # <<<<<<<<<<<<<< + * 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_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_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("DracoPy.DracoPointCloud.get_encoded_point", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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":115 - * - * @property - * def num_axes(self): # <<<<<<<<<<<<<< - * return 3 +/* "DracoPy.pyx":146 + * 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): */ /* 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) { +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("num_axes (wrapper)", 0); - __pyx_r = __pyx_pf_7DracoPy_15DracoPointCloud_6num_axes(__pyx_self, ((PyObject *)__pyx_v_self)); + __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, 146, __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, 146, __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, 146, __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); /* 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) { +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 - __Pyx_RefNannySetupContext("num_axes", 0); + 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); - /* "DracoPy.pyx":116 - * @property - * def num_axes(self): - * return 3 # <<<<<<<<<<<<<< + /* "DracoPy.pyx":147 + * + * 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, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_encoded_point = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "DracoPy.pyx":148 + * 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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_num_axes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __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, 148, __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, 148, __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, 148, __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, 148, __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, 148, __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, 148, __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, 148, __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, 148, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_XDECREF_SET(__pyx_v_axis, __pyx_t_2); + __pyx_t_2 = 0; + + /* "DracoPy.pyx":149 + * 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, 149, __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, 149, __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, 149, __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, 149, __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, 149, __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, 149, __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, 149, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":148 + * 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":150 + * 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_int_3); - __pyx_r = __pyx_int_3; + __Pyx_INCREF(__pyx_v_encoded_point); + __pyx_r = __pyx_v_encoded_point; goto __pyx_L0; - /* "DracoPy.pyx":115 - * - * @property - * def num_axes(self): # <<<<<<<<<<<<<< - * return 3 + /* "DracoPy.pyx":146 + * 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): */ /* 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":119 +/* "DracoPy.pyx":153 * * @property - * def points(self): # <<<<<<<<<<<<<< - * return self.data_struct['points'] + * def num_axes(self): # <<<<<<<<<<<<<< + * return 3 * */ /* 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_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("points (wrapper)", 0); - __pyx_r = __pyx_pf_7DracoPy_15DracoPointCloud_8points(__pyx_self, ((PyObject *)__pyx_v_self)); + __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_15DracoPointCloud_8points(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { +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 - 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("points", 0); + __Pyx_RefNannySetupContext("num_axes", 0); - /* "DracoPy.pyx":120 + /* "DracoPy.pyx":154 * @property - * def points(self): - * return self.data_struct['points'] # <<<<<<<<<<<<<< - * + * def num_axes(self): + * return 3 # <<<<<<<<<<<<<< * + * class FileTypeException(Exception): */ __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, 120, __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, 120, __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_INCREF(__pyx_int_3); + __pyx_r = __pyx_int_3; goto __pyx_L0; - /* "DracoPy.pyx":119 + /* "DracoPy.pyx":153 * * @property - * def points(self): # <<<<<<<<<<<<<< - * return self.data_struct['points'] + * def num_axes(self): # <<<<<<<<<<<<<< + * return 3 * */ /* 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":125 - * class DracoMesh(DracoPointCloud): - * @property - * def faces(self): # <<<<<<<<<<<<<< - * return self.data_struct['faces'] +/* "DracoPy.pyx":162 + * pass * + * def encode_mesh_to_buffer(points, faces, metadata: GeometryMetadataObject = None, # <<<<<<<<<<<<<< + * quantization_bits=14, compression_level=1, + * quantization_range=-1, quantization_origin=None, */ /* 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":126 - * @property - * def faces(self): - * return self.data_struct['faces'] # <<<<<<<<<<<<<< - * - * @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, 126, __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, 126, __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":125 - * class DracoMesh(DracoPointCloud): - * @property - * def faces(self): # <<<<<<<<<<<<<< - * return self.data_struct['faces'] - * - */ - - /* 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":129 - * - * @property - * def normals(self): # <<<<<<<<<<<<<< - * return self.data_struct['normals'] - * - */ - -/* 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":130 - * @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, 130, __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, 130, __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":129 - * - * @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_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "DracoPy.pyx":133 - * - * 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_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; +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 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_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_metadata = 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("__init__ (wrapper)", 0); + __Pyx_RefNannySetupContext("encode_mesh_to_buffer (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_points,&__pyx_n_s_faces,&__pyx_n_s_metadata,&__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[8] = {0,0,0,0,0,0,0,0}; + values[2] = ((PyObject *)Py_None); + values[3] = ((PyObject *)__pyx_int_14); + values[4] = ((PyObject *)__pyx_int_1); + values[5] = ((PyObject *)__pyx_int_neg_1); + + /* "DracoPy.pyx":164 + * def encode_mesh_to_buffer(points, faces, metadata: GeometryMetadataObject = None, + * quantization_bits=14, compression_level=1, + * quantization_range=-1, quantization_origin=None, # <<<<<<<<<<<<<< + * create_metadata=False): + * """ + */ + values[6] = ((PyObject *)Py_None); + + /* "DracoPy.pyx":165 + * 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. + */ + values[7] = ((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 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + CYTHON_FALLTHROUGH; + 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); @@ -4925,739 +5289,712 @@ static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_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_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_quantization_bits)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_faces)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); __PYX_ERR(0, 133, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 2, 8, 1); __PYX_ERR(0, 162, __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, 133, __pyx_L3_error) + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_metadata); + if (value) { values[2] = value; kw_args--; } } CYTHON_FALLTHROUGH; case 3: - 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, 133, __pyx_L3_error) + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_bits); + 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_compression_level); + 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_range); + 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_quantization_origin); + if (value) { values[6] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 7: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_create_metadata); + if (value) { values[7] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 133, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode_mesh_to_buffer") < 0)) __PYX_ERR(0, 162, __pyx_L3_error) } - } 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); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + CYTHON_FALLTHROUGH; + 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_self = values[0]; - __pyx_v_quantization_bits = values[1]; - __pyx_v_quantization_range = values[2]; - __pyx_v_quantization_origin = values[3]; + __pyx_v_points = values[0]; + __pyx_v_faces = values[1]; + __pyx_v_metadata = values[2]; + __pyx_v_quantization_bits = values[3]; + __pyx_v_compression_level = values[4]; + __pyx_v_quantization_range = values[5]; + __pyx_v_quantization_origin = values[6]; + __pyx_v_create_metadata = values[7]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 133, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 2, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 162, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("DracoPy.EncodingOptions.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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_15EncodingOptions___init__(__pyx_self, __pyx_v_self, __pyx_v_quantization_bits, __pyx_v_quantization_range, __pyx_v_quantization_origin); + __pyx_r = __pyx_pf_7DracoPy_4encode_mesh_to_buffer(__pyx_self, __pyx_v_points, __pyx_v_faces, __pyx_v_metadata, __pyx_v_quantization_bits, __pyx_v_compression_level, __pyx_v_quantization_range, __pyx_v_quantization_origin, __pyx_v_create_metadata); + + /* "DracoPy.pyx":162 + * pass + * + * def encode_mesh_to_buffer(points, faces, metadata: GeometryMetadataObject = None, # <<<<<<<<<<<<<< + * quantization_bits=14, compression_level=1, + * quantization_range=-1, quantization_origin=None, + */ /* 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_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_points, PyObject *__pyx_v_faces, PyObject *__pyx_v_metadata, 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; + PyObject *__pyx_v_binary_metadata = NULL; + struct DracoFunctions::EncodedObject __pyx_v_encoded_mesh; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = 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; + PyObject *__pyx_t_8 = NULL; + size_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + PyObject *(*__pyx_t_11)(PyObject *); + float __pyx_t_12; + Py_ssize_t __pyx_t_13; + std::vector __pyx_t_14; + std::vector __pyx_t_15; + std::string __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + bool __pyx_t_19; + struct DracoFunctions::EncodedObject __pyx_t_20; + PyObject *__pyx_t_21 = NULL; + PyObject *__pyx_t_22 = NULL; + PyObject *__pyx_t_23 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); + __Pyx_RefNannySetupContext("encode_mesh_to_buffer", 0); + __Pyx_INCREF(__pyx_v_metadata); - /* "DracoPy.pyx":134 - * 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 + /* "DracoPy.pyx":175 + * a point where each coordinate is the minimum of that coordinate among the input vertices. + * """ + * if metadata is None: # <<<<<<<<<<<<<< + * metadata = GeometryMetadataObject() + * cdef float* quant_origin = NULL */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_quantization_bits, __pyx_v_quantization_bits) < 0) __PYX_ERR(0, 134, __pyx_L1_error) + __pyx_t_1 = (__pyx_v_metadata == Py_None); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { - /* "DracoPy.pyx":135 - * 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) + /* "DracoPy.pyx":176 + * """ + * if metadata is None: + * metadata = GeometryMetadataObject() # <<<<<<<<<<<<<< + * cdef float* quant_origin = NULL + * try: */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_quantization_range, __pyx_v_quantization_range) < 0) __PYX_ERR(0, 135, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_GeometryMetadataObject); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 176, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 176, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF_SET(__pyx_v_metadata, __pyx_t_3); + __pyx_t_3 = 0; - /* "DracoPy.pyx":136 - * 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":175 + * a point where each coordinate is the minimum of that coordinate among the input vertices. + * """ + * if metadata is None: # <<<<<<<<<<<<<< + * metadata = GeometryMetadataObject() + * cdef float* quant_origin = NULL */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin, __pyx_v_quantization_origin) < 0) __PYX_ERR(0, 136, __pyx_L1_error) + } - /* "DracoPy.pyx":137 - * 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): + /* "DracoPy.pyx":177 + * if metadata is None: + * metadata = GeometryMetadataObject() + * cdef float* quant_origin = NULL # <<<<<<<<<<<<<< + * try: + * num_dims = 3 */ - __pyx_t_1 = __Pyx_PyNumber_PowerOf2(__pyx_int_2, __pyx_v_quantization_bits, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 137, __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, 137, __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, 137, __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, 137, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_quant_origin = NULL; - /* "DracoPy.pyx":133 - * - * class EncodingOptions(object): - * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< - * self.quantization_bits = quantization_bits - * self.quantization_range = quantization_range + /* "DracoPy.pyx":178 + * metadata = GeometryMetadataObject() + * 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_6, &__pyx_t_7, &__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); + /*try:*/ { - /* 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_AddTraceback("DracoPy.EncodingOptions.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "DracoPy.pyx":179 + * 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":139 - * 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":180 + * 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_2 = (__pyx_v_quantization_origin != Py_None); + __pyx_t_1 = (__pyx_t_2 != 0); + if (__pyx_t_1) { -/* 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; - 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, 139, __pyx_L3_error) + /* "DracoPy.pyx":181 + * 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_3 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 181, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 181, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_PyInt_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 181, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_quant_origin = ((float *)PyMem_Malloc(__pyx_t_9)); + + /* "DracoPy.pyx":182 + * 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] + * binary_metadata = encode_metadata(metadata) + */ + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 182, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_4); + if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { + __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_10 = 0; + __pyx_t_11 = NULL; + } else { + __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 182, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 182, __pyx_L4_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, 139, __pyx_L3_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + for (;;) { + if (likely(!__pyx_t_11)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 182, __pyx_L4_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 182, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } else { + if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 182, __pyx_L4_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 182, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } + } else { + __pyx_t_4 = __pyx_t_11(__pyx_t_3); + 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(0, 182, __pyx_L4_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_4); + __pyx_t_4 = 0; + + /* "DracoPy.pyx":183 + * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) + * for dim in range(num_dims): + * quant_origin[dim] = quantization_origin[dim] # <<<<<<<<<<<<<< + * binary_metadata = encode_metadata(metadata) + * encoded_mesh = DracoPy.encode_mesh(points, faces, binary_metadata, + */ + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 183, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L4_error) + (__pyx_v_quant_origin[__pyx_t_13]) = __pyx_t_12; + + /* "DracoPy.pyx":182 + * 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] + * binary_metadata = encode_metadata(metadata) + */ } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "DracoPy.pyx":180 + * try: + * num_dims = 3 + * if quantization_origin is not None: # <<<<<<<<<<<<<< + * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) + * for dim in range(num_dims): + */ } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_encoded_coordinate") < 0)) __PYX_ERR(0, 139, __pyx_L3_error) + + /* "DracoPy.pyx":184 + * for dim in range(num_dims): + * quant_origin[dim] = quantization_origin[dim] + * binary_metadata = encode_metadata(metadata) # <<<<<<<<<<<<<< + * encoded_mesh = DracoPy.encode_mesh(points, faces, binary_metadata, + * quantization_bits, compression_level, + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_encode_metadata); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 184, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } } - } 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, 139, __pyx_L3_error) - __pyx_L3_error:; - __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_15EncodingOptions_2get_encoded_coordinate(__pyx_self, __pyx_v_self, __pyx_v_value, __pyx_v_axis); + __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_metadata) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_metadata); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_binary_metadata = __pyx_t_3; + __pyx_t_3 = 0; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "DracoPy.pyx":185 + * quant_origin[dim] = quantization_origin[dim] + * binary_metadata = encode_metadata(metadata) + * encoded_mesh = DracoPy.encode_mesh(points, faces, binary_metadata, # <<<<<<<<<<<<<< + * quantization_bits, compression_level, + * quantization_range, quant_origin, + */ + __pyx_t_14 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L4_error) + __pyx_t_15 = __pyx_convert_vector_from_py_uint32_t(__pyx_v_faces); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L4_error) + __pyx_t_16 = __pyx_convert_string_from_py_std__in_string(__pyx_v_binary_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L4_error) -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 - int __pyx_t_1; - 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); + /* "DracoPy.pyx":186 + * binary_metadata = encode_metadata(metadata) + * encoded_mesh = DracoPy.encode_mesh(points, faces, binary_metadata, + * quantization_bits, compression_level, # <<<<<<<<<<<<<< + * quantization_range, quant_origin, + * create_metadata) + */ + __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 186, __pyx_L4_error) + __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 186, __pyx_L4_error) - /* "DracoPy.pyx":140 - * - * 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":187 + * encoded_mesh = DracoPy.encode_mesh(points, faces, binary_metadata, + * quantization_bits, compression_level, + * quantization_range, quant_origin, # <<<<<<<<<<<<<< + * create_metadata) + * if quant_origin != NULL: */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 140, __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, 140, __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, 140, __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, 140, __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, 140, __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, 140, __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, 140, __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, 140, __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, 140, __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, 140, __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)) { + __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 187, __pyx_L4_error) - /* "DracoPy.pyx":141 - * 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":188 + * quantization_bits, compression_level, + * quantization_range, quant_origin, + * create_metadata) # <<<<<<<<<<<<<< + * if quant_origin != NULL: + * PyMem_Free(quant_origin) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, 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_t_19 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_19 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 188, __pyx_L4_error) - /* "DracoPy.pyx":140 - * - * 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":185 + * quant_origin[dim] = quantization_origin[dim] + * binary_metadata = encode_metadata(metadata) + * encoded_mesh = DracoPy.encode_mesh(points, faces, binary_metadata, # <<<<<<<<<<<<<< + * quantization_bits, compression_level, + * quantization_range, quant_origin, */ - } + try { + __pyx_t_20 = DracoFunctions::encode_mesh(__pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_12, __pyx_v_quant_origin, __pyx_t_19); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 185, __pyx_L4_error) + } + __pyx_v_encoded_mesh = __pyx_t_20; - /* "DracoPy.pyx":142 - * 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) + /* "DracoPy.pyx":189 + * 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_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __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, 142, __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, 142, __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; + __pyx_t_1 = ((__pyx_v_quant_origin != NULL) != 0); + if (__pyx_t_1) { - /* "DracoPy.pyx":143 - * 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":190 + * 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) */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_floor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 143, __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, 143, __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, 143, __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, 143, __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, 143, __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; + PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":144 - * 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): + /* "DracoPy.pyx":189 + * 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_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, 144, __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, 144, __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, 144, __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, 144, __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, 144, __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":139 - * 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":191 + * 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: - /* 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":192 + * 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_3 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_encoded_mesh.buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 192, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 192, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L8_try_return; -/* "DracoPy.pyx":146 - * 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":191 + * 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: -/* 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; - } - 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, 146, __pyx_L3_error) + /* "DracoPy.pyx":194 + * 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_3, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 194, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } } + __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_u_Invalid_mesh) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u_Invalid_mesh); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 194, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 194, __pyx_L4_error) + + /* "DracoPy.pyx":193 + * 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; } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_encoded_point") < 0)) __PYX_ERR(0, 146, __pyx_L3_error) + + /* "DracoPy.pyx":178 + * metadata = GeometryMetadataObject() + * cdef float* quant_origin = NULL + * try: # <<<<<<<<<<<<<< + * num_dims = 3 + * if quantization_origin is not None: + */ + } + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L9_try_end; + __pyx_L4_error:; + __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; + + /* "DracoPy.pyx":195 + * 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_4, &__pyx_t_3, &__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 195, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_21); + __pyx_t_18 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_4, __pyx_t_21); + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __Pyx_ErrRestore(__pyx_t_4, __pyx_t_3, __pyx_t_5); + __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_5 = 0; + if (__pyx_t_18) { + __Pyx_AddTraceback("DracoPy.encode_mesh_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 195, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_4); + + /* "DracoPy.pyx":196 + * raise EncodingFailedException('Invalid mesh') + * except EncodingFailedException: + * raise EncodingFailedException('Invalid mesh') # <<<<<<<<<<<<<< + * except: + * if quant_origin != NULL: + */ + __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 196, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_22); + __pyx_t_23 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_22))) { + __pyx_t_23 = PyMethod_GET_SELF(__pyx_t_22); + if (likely(__pyx_t_23)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_22); + __Pyx_INCREF(__pyx_t_23); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_22, function); + } } - } 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_t_21 = (__pyx_t_23) ? __Pyx_PyObject_Call2Args(__pyx_t_22, __pyx_t_23, __pyx_kp_u_Invalid_mesh) : __Pyx_PyObject_CallOneArg(__pyx_t_22, __pyx_kp_u_Invalid_mesh); + __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0; + if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 196, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_21); + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + __Pyx_Raise(__pyx_t_21, 0, 0, 0); + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __PYX_ERR(0, 196, __pyx_L6_except_error) } - __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, 146, __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); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "DracoPy.pyx":197 + * except EncodingFailedException: + * raise EncodingFailedException('Invalid mesh') + * except: # <<<<<<<<<<<<<< + * if quant_origin != NULL: + * PyMem_Free(quant_origin) + */ + /*except:*/ { + __Pyx_AddTraceback("DracoPy.encode_mesh_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5) < 0) __PYX_ERR(0, 197, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_5); -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; - 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); + /* "DracoPy.pyx":198 + * raise EncodingFailedException('Invalid mesh') + * 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":147 + /* "DracoPy.pyx":199 + * except: + * if quant_origin != NULL: + * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< + * raise ValueError("Input invalid") * - * 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, 147, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_encoded_point = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":148 - * 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 + /* "DracoPy.pyx":198 + * raise EncodingFailedException('Invalid mesh') + * except: + * if quant_origin != NULL: # <<<<<<<<<<<<<< + * PyMem_Free(quant_origin) + * raise ValueError("Input invalid") */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_num_axes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __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, 148, __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, 148, __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, 148, __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, 148, __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, 148, __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, 148, __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, 148, __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, 148, __pyx_L1_error) - } - break; } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_XDECREF_SET(__pyx_v_axis, __pyx_t_2); - __pyx_t_2 = 0; - /* "DracoPy.pyx":149 - * encoded_point = [] - * for axis in range(self.num_axes): - * encoded_point.append(self.get_encoded_coordinate(point[axis], axis)) # <<<<<<<<<<<<<< - * return encoded_point + /* "DracoPy.pyx":200 + * if quant_origin != NULL: + * PyMem_Free(quant_origin) + * raise ValueError("Input invalid") # <<<<<<<<<<<<<< * + * def encode_point_cloud_to_buffer(points, metadata: GeometryMetadataObject = None, */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_encoded_coordinate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 149, __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, 149, __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, 149, __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, 149, __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, 149, __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, 149, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_21 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 200, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_21); + __Pyx_Raise(__pyx_t_21, 0, 0, 0); + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __PYX_ERR(0, 200, __pyx_L6_except_error) } - __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, 149, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_L6_except_error:; - /* "DracoPy.pyx":148 - * 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 + /* "DracoPy.pyx":178 + * metadata = GeometryMetadataObject() + * cdef float* quant_origin = NULL + * try: # <<<<<<<<<<<<<< + * num_dims = 3 + * if quantization_origin is not None: */ + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); + goto __pyx_L1_error; + __pyx_L8_try_return:; + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); + goto __pyx_L0; + __pyx_L9_try_end:; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":150 - * for axis in range(self.num_axes): - * encoded_point.append(self.get_encoded_coordinate(point[axis], axis)) - * return encoded_point # <<<<<<<<<<<<<< + /* "DracoPy.pyx":162 + * pass * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_encoded_point); - __pyx_r = __pyx_v_encoded_point; - goto __pyx_L0; - - /* "DracoPy.pyx":146 - * 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): + * def encode_mesh_to_buffer(points, faces, metadata: GeometryMetadataObject = None, # <<<<<<<<<<<<<< + * quantization_bits=14, compression_level=1, + * quantization_range=-1, quantization_origin=None, */ /* 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_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.EncodingOptions.get_encoded_point", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_21); + __Pyx_XDECREF(__pyx_t_22); + __Pyx_XDECREF(__pyx_t_23); + __Pyx_AddTraceback("DracoPy.encode_mesh_to_buffer", __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":153 - * - * @property - * def num_axes(self): # <<<<<<<<<<<<<< - * return 3 - * - */ - -/* 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":154 - * @property - * def num_axes(self): - * return 3 # <<<<<<<<<<<<<< - * - * class FileTypeException(Exception): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_int_3); - __pyx_r = __pyx_int_3; - goto __pyx_L0; - - /* "DracoPy.pyx":153 - * - * @property - * def num_axes(self): # <<<<<<<<<<<<<< - * return 3 - * - */ - - /* function exit code */ - __pyx_L0:; + __Pyx_XDECREF(__pyx_v_num_dims); + __Pyx_XDECREF(__pyx_v_dim); + __Pyx_XDECREF(__pyx_v_binary_metadata); + __Pyx_XDECREF(__pyx_v_metadata); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "DracoPy.pyx":162 - * pass +/* "DracoPy.pyx":202 + * raise ValueError("Input invalid") * - * 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. + * def encode_point_cloud_to_buffer(points, metadata: GeometryMetadataObject = None, # <<<<<<<<<<<<<< + * quantization_bits=14, compression_level=1, + * quantization_range=-1, quantization_origin=None, */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7DracoPy_2encode_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_3encode_mesh_to_buffer = {"encode_mesh_to_buffer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_3encode_mesh_to_buffer, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7DracoPy_2encode_mesh_to_buffer}; -static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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 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_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_faces = 0; + PyObject *__pyx_v_metadata = 0; PyObject *__pyx_v_quantization_bits = 0; PyObject *__pyx_v_compression_level = 0; PyObject *__pyx_v_quantization_range = 0; @@ -5668,14 +6005,31 @@ static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("encode_mesh_to_buffer (wrapper)", 0); + __Pyx_RefNannySetupContext("encode_point_cloud_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}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_points,&__pyx_n_s_metadata,&__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[1] = ((PyObject *)Py_None); values[2] = ((PyObject *)__pyx_int_14); values[3] = ((PyObject *)__pyx_int_1); values[4] = ((PyObject *)__pyx_int_neg_1); + + /* "DracoPy.pyx":204 + * def encode_point_cloud_to_buffer(points, metadata: GeometryMetadataObject = None, + * quantization_bits=14, compression_level=1, + * quantization_range=-1, quantization_origin=None, # <<<<<<<<<<<<<< + * create_metadata=False): + * """ + */ values[5] = ((PyObject *)Py_None); + + /* "DracoPy.pyx":205 + * 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. + */ values[6] = ((PyObject *)Py_False); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -5705,9 +6059,9 @@ static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, 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, 162, __pyx_L3_error) + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_metadata); + if (value) { values[1] = value; kw_args--; } } CYTHON_FALLTHROUGH; case 2: @@ -5741,7 +6095,7 @@ static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, } } 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, 162, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode_point_cloud_to_buffer") < 0)) __PYX_ERR(0, 202, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -5756,13 +6110,14 @@ static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, 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); + 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_metadata = values[1]; __pyx_v_quantization_bits = values[2]; __pyx_v_compression_level = values[3]; __pyx_v_quantization_range = values[4]; @@ -5771,64 +6126,121 @@ static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, } 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, 162, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode_point_cloud_to_buffer", 0, 1, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 202, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("DracoPy.encode_mesh_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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_2encode_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_6encode_point_cloud_to_buffer(__pyx_self, __pyx_v_points, __pyx_v_metadata, __pyx_v_quantization_bits, __pyx_v_compression_level, __pyx_v_quantization_range, __pyx_v_quantization_origin, __pyx_v_create_metadata); + + /* "DracoPy.pyx":202 + * raise ValueError("Input invalid") + * + * def encode_point_cloud_to_buffer(points, metadata: GeometryMetadataObject = None, # <<<<<<<<<<<<<< + * quantization_bits=14, compression_level=1, + * quantization_range=-1, quantization_origin=None, + */ /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_2encode_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) { +static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_points, PyObject *__pyx_v_metadata, 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; + PyObject *__pyx_v_binary_metadata = NULL; + struct DracoFunctions::EncodedObject __pyx_v_encoded_point_cloud; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + int __pyx_t_1; + int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; + PyObject *__pyx_t_4 = NULL; + 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; - std::vector __pyx_t_14; - int __pyx_t_15; + PyObject *__pyx_t_8 = NULL; + size_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + PyObject *(*__pyx_t_11)(PyObject *); + float __pyx_t_12; + Py_ssize_t __pyx_t_13; + std::vector __pyx_t_14; + std::string __pyx_t_15; int __pyx_t_16; - bool __pyx_t_17; - struct DracoFunctions::EncodedObject __pyx_t_18; - PyObject *__pyx_t_19 = NULL; + int __pyx_t_17; + bool __pyx_t_18; + struct DracoFunctions::EncodedObject __pyx_t_19; 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); + __Pyx_RefNannySetupContext("encode_point_cloud_to_buffer", 0); + __Pyx_INCREF(__pyx_v_metadata); + + /* "DracoPy.pyx":215 + * a point where each coordinate is the minimum of that coordinate among the input vertices. + * """ + * if metadata is None: # <<<<<<<<<<<<<< + * metadata = GeometryMetadataObject() + * cdef float* quant_origin = NULL + */ + __pyx_t_1 = (__pyx_v_metadata == Py_None); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { + + /* "DracoPy.pyx":216 + * """ + * if metadata is None: + * metadata = GeometryMetadataObject() # <<<<<<<<<<<<<< + * cdef float* quant_origin = NULL + * try: + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_GeometryMetadataObject); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 216, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 216, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF_SET(__pyx_v_metadata, __pyx_t_3); + __pyx_t_3 = 0; - /* "DracoPy.pyx":172 + /* "DracoPy.pyx":215 * a point where each coordinate is the minimum of that coordinate among the input vertices. * """ + * if metadata is None: # <<<<<<<<<<<<<< + * metadata = GeometryMetadataObject() + * cdef float* quant_origin = NULL + */ + } + + /* "DracoPy.pyx":217 + * if metadata is None: + * metadata = GeometryMetadataObject() * cdef float* quant_origin = NULL # <<<<<<<<<<<<<< * try: * num_dims = 3 */ __pyx_v_quant_origin = NULL; - /* "DracoPy.pyx":173 - * """ + /* "DracoPy.pyx":218 + * metadata = GeometryMetadataObject() * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< * num_dims = 3 @@ -5837,13 +6249,13 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject { __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); + __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); /*try:*/ { - /* "DracoPy.pyx":174 + /* "DracoPy.pyx":219 * cdef float* quant_origin = NULL * try: * num_dims = 3 # <<<<<<<<<<<<<< @@ -5853,110 +6265,110 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_INCREF(__pyx_int_3); __pyx_v_num_dims = __pyx_int_3; - /* "DracoPy.pyx":175 + /* "DracoPy.pyx":220 * 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) { + __pyx_t_2 = (__pyx_v_quantization_origin != Py_None); + __pyx_t_1 = (__pyx_t_2 != 0); + if (__pyx_t_1) { - /* "DracoPy.pyx":176 + /* "DracoPy.pyx":221 * 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, 176, __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, 176, __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, 176, __pyx_L3_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_v_quant_origin = ((float *)PyMem_Malloc(__pyx_t_8)); + __pyx_t_3 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 221, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 221, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_PyInt_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 221, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_quant_origin = ((float *)PyMem_Malloc(__pyx_t_9)); - /* "DracoPy.pyx":177 + /* "DracoPy.pyx":222 * 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) + * binary_metadata = encode_metadata(metadata) */ - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 177, __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; + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 222, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_4); + if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { + __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_10 = 0; + __pyx_t_11 = NULL; } else { - __pyx_t_9 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 177, __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, 177, __pyx_L3_error) + __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 222, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 222, __pyx_L4_error) } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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 (likely(!__pyx_t_11)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_3)) 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, 177, __pyx_L3_error) + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 222, __pyx_L4_error) #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 177, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 222, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_4); #endif } else { - if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_6)) break; + if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_3)) 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, 177, __pyx_L3_error) + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 222, __pyx_L4_error) #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 177, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 222, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_4); #endif } } else { - __pyx_t_7 = __pyx_t_10(__pyx_t_6); - if (unlikely(!__pyx_t_7)) { + __pyx_t_4 = __pyx_t_11(__pyx_t_3); + 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(0, 177, __pyx_L3_error) + else __PYX_ERR(0, 222, __pyx_L4_error) } break; } - __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_4); } - __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_7); - __pyx_t_7 = 0; + __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_4); + __pyx_t_4 = 0; - /* "DracoPy.pyx":178 + /* "DracoPy.pyx":223 * 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: + * binary_metadata = encode_metadata(metadata) + * encoded_point_cloud = DracoPy.encode_point_cloud( */ - __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 178, __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, 178, __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, 178, __pyx_L3_error) - (__pyx_v_quant_origin[__pyx_t_12]) = __pyx_t_11; + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 223, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 223, __pyx_L4_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 223, __pyx_L4_error) + (__pyx_v_quant_origin[__pyx_t_13]) = __pyx_t_12; - /* "DracoPy.pyx":177 + /* "DracoPy.pyx":222 * 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) + * binary_metadata = encode_metadata(metadata) */ } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":175 + /* "DracoPy.pyx":220 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -5965,177 +6377,220 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":179 + /* "DracoPy.pyx":224 * 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) # <<<<<<<<<<<<<< + * binary_metadata = encode_metadata(metadata) # <<<<<<<<<<<<<< + * encoded_point_cloud = DracoPy.encode_point_cloud( + * points, binary_metadata, quantization_bits, compression_level, + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_encode_metadata); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 224, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_metadata) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_metadata); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 224, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_binary_metadata = __pyx_t_3; + __pyx_t_3 = 0; + + /* "DracoPy.pyx":226 + * binary_metadata = encode_metadata(metadata) + * encoded_point_cloud = DracoPy.encode_point_cloud( + * points, binary_metadata, quantization_bits, compression_level, # <<<<<<<<<<<<<< + * quantization_range, quant_origin, create_metadata) + * if quant_origin != NULL: + */ + __pyx_t_14 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 226, __pyx_L4_error) + __pyx_t_15 = __pyx_convert_string_from_py_std__in_string(__pyx_v_binary_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 226, __pyx_L4_error) + __pyx_t_16 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 226, __pyx_L4_error) + __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 226, __pyx_L4_error) + + /* "DracoPy.pyx":227 + * encoded_point_cloud = DracoPy.encode_point_cloud( + * points, binary_metadata, 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, 179, __pyx_L3_error) - __pyx_t_14 = __pyx_convert_vector_from_py_uint32_t(__pyx_v_faces); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 179, __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, 179, __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, 179, __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, 179, __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, 179, __pyx_L3_error) + __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 227, __pyx_L4_error) + __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_18 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 227, __pyx_L4_error) + + /* "DracoPy.pyx":225 + * quant_origin[dim] = quantization_origin[dim] + * binary_metadata = encode_metadata(metadata) + * encoded_point_cloud = DracoPy.encode_point_cloud( # <<<<<<<<<<<<<< + * points, binary_metadata, quantization_bits, compression_level, + * quantization_range, quant_origin, create_metadata) + */ 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); + __pyx_t_19 = DracoFunctions::encode_point_cloud(__pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_12, __pyx_v_quant_origin, __pyx_t_18); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 179, __pyx_L3_error) + __PYX_ERR(0, 225, __pyx_L4_error) } - __pyx_v_encoded_mesh = __pyx_t_18; + __pyx_v_encoded_point_cloud = __pyx_t_19; - /* "DracoPy.pyx":180 - * quant_origin[dim] = quantization_origin[dim] - * encoded_mesh = DracoPy.encode_mesh(points, faces, quantization_bits, compression_level, quantization_range, quant_origin, create_metadata) + /* "DracoPy.pyx":228 + * points, binary_metadata, 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: + * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: */ - __pyx_t_5 = ((__pyx_v_quant_origin != NULL) != 0); - if (__pyx_t_5) { + __pyx_t_1 = ((__pyx_v_quant_origin != NULL) != 0); + if (__pyx_t_1) { - /* "DracoPy.pyx":181 - * encoded_mesh = DracoPy.encode_mesh(points, faces, quantization_bits, compression_level, quantization_range, quant_origin, create_metadata) + /* "DracoPy.pyx":229 + * 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) + * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: + * return bytes(encoded_point_cloud.buffer) */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":180 - * quant_origin[dim] = quantization_origin[dim] - * encoded_mesh = DracoPy.encode_mesh(points, faces, quantization_bits, compression_level, quantization_range, quant_origin, create_metadata) + /* "DracoPy.pyx":228 + * points, binary_metadata, 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: + * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: */ } - /* "DracoPy.pyx":182 + /* "DracoPy.pyx":230 * 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: + * 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_mesh.encode_status) { + switch (__pyx_v_encoded_point_cloud.encode_status) { case DracoFunctions::successful_encoding: - /* "DracoPy.pyx":183 + /* "DracoPy.pyx":231 * 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') + * 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') */ __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, 183, __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, 183, __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; + __pyx_t_3 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_encoded_point_cloud.buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 231, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 231, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L8_try_return; - /* "DracoPy.pyx":182 + /* "DracoPy.pyx":230 * 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: + * 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":185 - * return bytes(encoded_mesh.buffer) - * elif encoded_mesh.encode_status == DracoPy.encoding_status.failed_during_encoding: - * raise EncodingFailedException('Invalid mesh') # <<<<<<<<<<<<<< + /* "DracoPy.pyx":233 + * 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 mesh') + * raise EncodingFailedException('Invalid point cloud') */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 185, __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_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 233, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __Pyx_DECREF_SET(__pyx_t_3, 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, 185, __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, 185, __pyx_L3_error) + __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_u_Invalid_point_cloud) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u_Invalid_point_cloud); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 233, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 233, __pyx_L4_error) - /* "DracoPy.pyx":184 - * 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') + /* "DracoPy.pyx":232 + * 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; } - /* "DracoPy.pyx":173 - * """ + /* "DracoPy.pyx":218 + * metadata = GeometryMetadataObject() * 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; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L9_try_end; + __pyx_L4_error:; + __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; - /* "DracoPy.pyx":186 - * elif encoded_mesh.encode_status == DracoPy.encoding_status.failed_during_encoding: - * raise EncodingFailedException('Invalid mesh') + /* "DracoPy.pyx":234 + * elif encoded_point_cloud.encode_status == DracoPy.encoding_status.failed_during_encoding: + * raise EncodingFailedException('Invalid point cloud') * except EncodingFailedException: # <<<<<<<<<<<<<< - * raise EncodingFailedException('Invalid mesh') + * raise EncodingFailedException('Invalid point cloud') * 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, 186, __pyx_L5_except_error) + __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_20, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 234, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_20); - __pyx_t_16 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_7, __pyx_t_20); + __pyx_t_17 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_4, __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, 186, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_19); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); + __Pyx_ErrRestore(__pyx_t_4, __pyx_t_3, __pyx_t_5); + __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_5 = 0; + if (__pyx_t_17) { + __Pyx_AddTraceback("DracoPy.encode_point_cloud_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 234, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_4); - /* "DracoPy.pyx":187 - * raise EncodingFailedException('Invalid mesh') + /* "DracoPy.pyx":235 + * raise EncodingFailedException('Invalid point cloud') * except EncodingFailedException: - * raise EncodingFailedException('Invalid mesh') # <<<<<<<<<<<<<< + * raise EncodingFailedException('Invalid point cloud') # <<<<<<<<<<<<<< * except: * if quant_origin != NULL: */ - __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 187, __pyx_L5_except_error) + __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 235, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_21); __pyx_t_22 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_21))) { @@ -6147,41 +6602,41 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject __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_t_20 = (__pyx_t_22) ? __Pyx_PyObject_Call2Args(__pyx_t_21, __pyx_t_22, __pyx_kp_u_Invalid_point_cloud) : __Pyx_PyObject_CallOneArg(__pyx_t_21, __pyx_kp_u_Invalid_point_cloud); __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0; - if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 187, __pyx_L5_except_error) + if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 235, __pyx_L6_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, 187, __pyx_L5_except_error) + __PYX_ERR(0, 235, __pyx_L6_except_error) } - /* "DracoPy.pyx":188 + /* "DracoPy.pyx":236 * except EncodingFailedException: - * raise EncodingFailedException('Invalid mesh') + * raise EncodingFailedException('Invalid point cloud') * except: # <<<<<<<<<<<<<< * if quant_origin != NULL: * PyMem_Free(quant_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, 188, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_19); + __Pyx_AddTraceback("DracoPy.encode_point_cloud_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5) < 0) __PYX_ERR(0, 236, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_5); - /* "DracoPy.pyx":189 - * raise EncodingFailedException('Invalid mesh') + /* "DracoPy.pyx":237 + * 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) { + __pyx_t_1 = ((__pyx_v_quant_origin != NULL) != 0); + if (__pyx_t_1) { - /* "DracoPy.pyx":190 + /* "DracoPy.pyx":238 * except: * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -6190,8 +6645,8 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":189 - * raise EncodingFailedException('Invalid mesh') + /* "DracoPy.pyx":237 + * raise EncodingFailedException('Invalid point cloud') * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< * PyMem_Free(quant_origin) @@ -6199,917 +6654,312 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":191 + /* "DracoPy.pyx":239 * 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): + * def raise_decoding_error(decoding_status): */ - __pyx_t_20 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 191, __pyx_L5_except_error) + __pyx_t_20 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 239, __pyx_L6_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, 191, __pyx_L5_except_error) + __PYX_ERR(0, 239, __pyx_L6_except_error) } - __pyx_L5_except_error:; + __pyx_L6_except_error:; - /* "DracoPy.pyx":173 - * """ + /* "DracoPy.pyx":218 + * metadata = GeometryMetadataObject() * 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); + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); 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); + __pyx_L8_try_return:; + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); goto __pyx_L0; - __pyx_L8_try_end:; + __pyx_L9_try_end:; } - /* "DracoPy.pyx":162 - * pass + /* "DracoPy.pyx":202 + * raise ValueError("Input invalid") * - * 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. + * def encode_point_cloud_to_buffer(points, metadata: GeometryMetadataObject = None, # <<<<<<<<<<<<<< + * quantization_bits=14, compression_level=1, + * quantization_range=-1, quantization_origin=None, */ /* 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_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __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_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_XDECREF(__pyx_v_binary_metadata); + __Pyx_XDECREF(__pyx_v_metadata); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "DracoPy.pyx":193 +/* "DracoPy.pyx":241 * 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. + * 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_5encode_point_cloud_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7DracoPy_4encode_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_5encode_point_cloud_to_buffer = {"encode_point_cloud_to_buffer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7DracoPy_4encode_point_cloud_to_buffer}; -static PyObject *__pyx_pw_7DracoPy_5encode_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; +static PyObject *__pyx_pw_7DracoPy_9raise_decoding_error(PyObject *__pyx_self, PyObject *__pyx_v_decoding_status); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_9raise_decoding_error = {"raise_decoding_error", (PyCFunction)__pyx_pw_7DracoPy_9raise_decoding_error, METH_O, 0}; +static PyObject *__pyx_pw_7DracoPy_9raise_decoding_error(PyObject *__pyx_self, PyObject *__pyx_v_decoding_status) { 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); - values[4] = ((PyObject *)Py_None); - 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, 193, __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, 193, __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_4encode_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_RefNannySetupContext("raise_decoding_error (wrapper)", 0); + __pyx_r = __pyx_pf_7DracoPy_8raise_decoding_error(__pyx_self, ((PyObject *)__pyx_v_decoding_status)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_4encode_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_8raise_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_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; - 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_t_3; + PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("encode_point_cloud_to_buffer", 0); + __Pyx_RefNannySetupContext("raise_decoding_error", 0); - /* "DracoPy.pyx":203 - * a point where each coordinate is the minimum of that coordinate among the input vertices. - * """ - * cdef float* quant_origin = NULL # <<<<<<<<<<<<<< - * try: - * num_dims = 3 + /* "DracoPy.pyx":242 + * + * 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_v_quant_origin = NULL; + __pyx_t_1 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::not_draco_encoded); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __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, 242, __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, 242, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":204 - * """ - * cdef float* quant_origin = NULL - * try: # <<<<<<<<<<<<<< - * num_dims = 3 - * if quantization_origin is not None: + /* "DracoPy.pyx":243 + * 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_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:*/ { + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FileTypeException); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __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, 243, __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, 243, __pyx_L1_error) - /* "DracoPy.pyx":205 - * cdef float* quant_origin = NULL - * try: - * num_dims = 3 # <<<<<<<<<<<<<< - * if quantization_origin is not None: - * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) + /* "DracoPy.pyx":242 + * + * 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_INCREF(__pyx_int_3); - __pyx_v_num_dims = __pyx_int_3; + } - /* "DracoPy.pyx":206 - * 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":244 + * 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_4 = (__pyx_v_quantization_origin != Py_None); - __pyx_t_5 = (__pyx_t_4 != 0); - if (__pyx_t_5) { + __pyx_t_2 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::failed_during_decoding); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 244, __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, 244, __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, 244, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":207 - * 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] + /* "DracoPy.pyx":245 + * 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_6 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 207, __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, 207, __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, 207, __pyx_L3_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_v_quant_origin = ((float *)PyMem_Malloc(__pyx_t_8)); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __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, 245, __pyx_L1_error) - /* "DracoPy.pyx":208 - * 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":244 + * 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_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 208, __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, 208, __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, 208, __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, 208, __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, 208, __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, 208, __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, 208, __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, 208, __pyx_L3_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_7); - } - __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_7); - __pyx_t_7 = 0; - - /* "DracoPy.pyx":209 - * 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: - */ - __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 209, __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, 209, __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, 209, __pyx_L3_error) - (__pyx_v_quant_origin[__pyx_t_12]) = __pyx_t_11; - - /* "DracoPy.pyx":208 - * 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_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "DracoPy.pyx":206 - * 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":210 - * 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) - */ - __pyx_t_13 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 210, __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, 210, __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, 210, __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, 210, __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, 210, __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, 210, __pyx_L3_error) - } - __pyx_v_encoded_point_cloud = __pyx_t_17; - - /* "DracoPy.pyx":211 - * 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: - */ - __pyx_t_5 = ((__pyx_v_quant_origin != NULL) != 0); - if (__pyx_t_5) { - - /* "DracoPy.pyx":212 - * 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) - */ - PyMem_Free(__pyx_v_quant_origin); - - /* "DracoPy.pyx":211 - * 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":213 - * 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: - - /* "DracoPy.pyx":214 - * 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') - */ - __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, 214, __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, 214, __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":213 - * 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":216 - * 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, 216, __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, 216, __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, 216, __pyx_L3_error) - - /* "DracoPy.pyx":215 - * 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; - } - - /* "DracoPy.pyx":204 - * """ - * 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":217 - * 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, 217, __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, 217, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_18); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); - - /* "DracoPy.pyx":218 - * 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, 218, __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); - } - } - __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, 218, __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, 218, __pyx_L5_except_error) - } - - /* "DracoPy.pyx":219 - * 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, 219, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_18); - - /* "DracoPy.pyx":220 - * 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":221 - * except: - * if quant_origin != NULL: - * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< - * raise ValueError("Input invalid") + /* "DracoPy.pyx":246 + * 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') * */ - PyMem_Free(__pyx_v_quant_origin); - - /* "DracoPy.pyx":220 - * raise EncodingFailedException('Invalid point cloud') - * except: - * if quant_origin != NULL: # <<<<<<<<<<<<<< - * PyMem_Free(quant_origin) - * raise ValueError("Input invalid") - */ - } + __pyx_t_1 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::no_position_attribute); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 246, __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, 246, __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, 246, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":222 - * if quant_origin != NULL: - * PyMem_Free(quant_origin) - * raise ValueError("Input invalid") # <<<<<<<<<<<<<< + /* "DracoPy.pyx":247 + * 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 raise_decoding_error(decoding_status): + * def decode_buffer_to_mesh(buffer): */ - __pyx_t_19 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 222, __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, 222, __pyx_L5_except_error) - } - __pyx_L5_except_error:; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 247, __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, 247, __pyx_L1_error) - /* "DracoPy.pyx":204 - * """ - * cdef float* quant_origin = NULL - * try: # <<<<<<<<<<<<<< - * num_dims = 3 - * if quantization_origin is not None: + /* "DracoPy.pyx":246 + * 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_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:; } - /* "DracoPy.pyx":193 + /* "DracoPy.pyx":241 * 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. + * 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_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_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_XDECREF(__pyx_v_num_dims); - __Pyx_XDECREF(__pyx_v_dim); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "DracoPy.pyx":224 - * raise ValueError("Input invalid") +/* "DracoPy.pyx":249 + * raise ValueError('DracoPy only supports meshes with position attributes') * - * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< - * if decoding_status == DracoPy.decoding_status.not_draco_encoded: - * raise FileTypeException('Input mesh is not draco encoded') + * def decode_buffer_to_mesh(buffer): # <<<<<<<<<<<<<< + * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) + * if mesh_struct.decode_status == DracoPy.decoding_status.successful: */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_7raise_decoding_error(PyObject *__pyx_self, PyObject *__pyx_v_decoding_status); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_7raise_decoding_error = {"raise_decoding_error", (PyCFunction)__pyx_pw_7DracoPy_7raise_decoding_error, METH_O, 0}; -static PyObject *__pyx_pw_7DracoPy_7raise_decoding_error(PyObject *__pyx_self, PyObject *__pyx_v_decoding_status) { +static PyObject *__pyx_pw_7DracoPy_11decode_buffer_to_mesh(PyObject *__pyx_self, PyObject *__pyx_v_buffer); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_11decode_buffer_to_mesh = {"decode_buffer_to_mesh", (PyCFunction)__pyx_pw_7DracoPy_11decode_buffer_to_mesh, METH_O, 0}; +static PyObject *__pyx_pw_7DracoPy_11decode_buffer_to_mesh(PyObject *__pyx_self, PyObject *__pyx_v_buffer) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("raise_decoding_error (wrapper)", 0); - __pyx_r = __pyx_pf_7DracoPy_6raise_decoding_error(__pyx_self, ((PyObject *)__pyx_v_decoding_status)); + __Pyx_RefNannySetupContext("decode_buffer_to_mesh (wrapper)", 0); + __pyx_r = __pyx_pf_7DracoPy_10decode_buffer_to_mesh(__pyx_self, ((PyObject *)__pyx_v_buffer)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_6raise_decoding_error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_decoding_status) { +static PyObject *__pyx_pf_7DracoPy_10decode_buffer_to_mesh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer) { + struct DracoFunctions::MeshObject __pyx_v_mesh_struct; 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; + 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; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("raise_decoding_error", 0); + __Pyx_RefNannySetupContext("decode_buffer_to_mesh", 0); - /* "DracoPy.pyx":225 - * - * 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, 225, __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, 225, __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, 225, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(__pyx_t_3)) { - - /* "DracoPy.pyx":226 - * 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, 226, __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, 226, __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, 226, __pyx_L1_error) - - /* "DracoPy.pyx":225 - * - * 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":227 - * 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, 227, __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, 227, __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, 227, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(__pyx_t_3)) { - - /* "DracoPy.pyx":228 - * 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__5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 228, __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, 228, __pyx_L1_error) - - /* "DracoPy.pyx":227 - * 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":229 - * 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, 229, __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, 229, __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, 229, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(__pyx_t_3)) { - - /* "DracoPy.pyx":230 - * 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): - */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 230, __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, 230, __pyx_L1_error) - - /* "DracoPy.pyx":229 - * 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":224 - * 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":232 - * 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: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_9decode_buffer_to_mesh(PyObject *__pyx_self, PyObject *__pyx_v_buffer); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_9decode_buffer_to_mesh = {"decode_buffer_to_mesh", (PyCFunction)__pyx_pw_7DracoPy_9decode_buffer_to_mesh, METH_O, 0}; -static PyObject *__pyx_pw_7DracoPy_9decode_buffer_to_mesh(PyObject *__pyx_self, PyObject *__pyx_v_buffer) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("decode_buffer_to_mesh (wrapper)", 0); - __pyx_r = __pyx_pf_7DracoPy_8decode_buffer_to_mesh(__pyx_self, ((PyObject *)__pyx_v_buffer)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer) { - struct DracoFunctions::MeshObject __pyx_v_mesh_struct; - 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; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("decode_buffer_to_mesh", 0); - - /* "DracoPy.pyx":233 + /* "DracoPy.pyx":250 * * 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) */ - __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 233, __pyx_L1_error) - __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 233, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 250, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 250, __pyx_L1_error) try { __pyx_t_3 = DracoFunctions::decode_buffer(__pyx_t_1, __pyx_t_2); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 233, __pyx_L1_error) + __PYX_ERR(0, 250, __pyx_L1_error) } __pyx_v_mesh_struct = __pyx_t_3; - /* "DracoPy.pyx":234 + /* "DracoPy.pyx":251 * def decode_buffer_to_mesh(buffer): * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< @@ -7119,7 +6969,7 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject __pyx_t_4 = ((__pyx_v_mesh_struct.decode_status == DracoFunctions::successful) != 0); if (__pyx_t_4) { - /* "DracoPy.pyx":235 + /* "DracoPy.pyx":252 * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: * return DracoMesh(mesh_struct) # <<<<<<<<<<<<<< @@ -7127,9 +6977,9 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject * 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, 235, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_DracoMesh); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 252, __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, 235, __pyx_L1_error) + __pyx_t_7 = __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(__pyx_v_mesh_struct); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 252, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -7144,14 +6994,14 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject __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, 235, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 252, __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":234 + /* "DracoPy.pyx":251 * def decode_buffer_to_mesh(buffer): * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< @@ -7160,7 +7010,7 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":237 + /* "DracoPy.pyx":254 * return DracoMesh(mesh_struct) * else: * raise_decoding_error(mesh_struct.decode_status) # <<<<<<<<<<<<<< @@ -7168,9 +7018,9 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject * 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, 237, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_raise_decoding_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 254, __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, 237, __pyx_L1_error) + __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, 254, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -7185,13 +7035,13 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject __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, 237, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 254, __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; } - /* "DracoPy.pyx":232 + /* "DracoPy.pyx":249 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer): # <<<<<<<<<<<<<< @@ -7215,7 +7065,7 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject return __pyx_r; } -/* "DracoPy.pyx":239 +/* "DracoPy.pyx":256 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer): # <<<<<<<<<<<<<< @@ -7224,20 +7074,20 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_11decode_point_cloud_buffer(PyObject *__pyx_self, PyObject *__pyx_v_buffer); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_11decode_point_cloud_buffer = {"decode_point_cloud_buffer", (PyCFunction)__pyx_pw_7DracoPy_11decode_point_cloud_buffer, METH_O, 0}; -static PyObject *__pyx_pw_7DracoPy_11decode_point_cloud_buffer(PyObject *__pyx_self, PyObject *__pyx_v_buffer) { +static PyObject *__pyx_pw_7DracoPy_13decode_point_cloud_buffer(PyObject *__pyx_self, PyObject *__pyx_v_buffer); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_13decode_point_cloud_buffer = {"decode_point_cloud_buffer", (PyCFunction)__pyx_pw_7DracoPy_13decode_point_cloud_buffer, METH_O, 0}; +static PyObject *__pyx_pw_7DracoPy_13decode_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_10decode_point_cloud_buffer(__pyx_self, ((PyObject *)__pyx_v_buffer)); + __pyx_r = __pyx_pf_7DracoPy_12decode_point_cloud_buffer(__pyx_self, ((PyObject *)__pyx_v_buffer)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer) { +static PyObject *__pyx_pf_7DracoPy_12decode_point_cloud_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer) { struct DracoFunctions::PointCloudObject __pyx_v_point_cloud_struct; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -7254,24 +7104,24 @@ static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyO int __pyx_clineno = 0; __Pyx_RefNannySetupContext("decode_point_cloud_buffer", 0); - /* "DracoPy.pyx":240 + /* "DracoPy.pyx":257 * * 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) */ - __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 240, __pyx_L1_error) - __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 240, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 257, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 257, __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, 240, __pyx_L1_error) + __PYX_ERR(0, 257, __pyx_L1_error) } __pyx_v_point_cloud_struct = __pyx_t_3; - /* "DracoPy.pyx":241 + /* "DracoPy.pyx":258 * 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: # <<<<<<<<<<<<<< @@ -7281,7 +7131,7 @@ static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyO __pyx_t_4 = ((__pyx_v_point_cloud_struct.decode_status == DracoFunctions::successful) != 0); if (__pyx_t_4) { - /* "DracoPy.pyx":242 + /* "DracoPy.pyx":259 * 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) # <<<<<<<<<<<<<< @@ -7289,9 +7139,9 @@ static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyO * raise_decoding_error(point_cloud_struct.decode_status) */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 242, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 259, __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, 242, __pyx_L1_error) + __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, 259, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -7306,14 +7156,14 @@ static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyO __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, 242, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 259, __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":241 + /* "DracoPy.pyx":258 * 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: # <<<<<<<<<<<<<< @@ -7322,15 +7172,15 @@ static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyO */ } - /* "DracoPy.pyx":244 + /* "DracoPy.pyx":261 * return DracoPointCloud(point_cloud_struct) * 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, 244, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_raise_decoding_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 261, __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, 244, __pyx_L1_error) + __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, 261, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -7345,13 +7195,13 @@ static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyO __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, 244, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 261, __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; } - /* "DracoPy.pyx":239 + /* "DracoPy.pyx":256 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer): # <<<<<<<<<<<<<< @@ -7375,300 +7225,164 @@ static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyO return __pyx_r; } -/* "vector.from_py":45 +/* "string.from_py":13 * - * @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: + * @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::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; +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 - 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; + char const *__pyx_t_1; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_float", 0); + __Pyx_RefNannySetupContext("__pyx_convert_string_from_py_std__in_string", 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 + /* "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) */ - 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; + __pyx_v_length = 0; - /* "vector.from_py":48 - * cdef vector[X] v - * for item in o: - * v.push_back(item) # <<<<<<<<<<<<<< - * return v + /* "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_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; + __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; - /* "vector.from_py":49 - * for item in o: - * v.push_back(item) - * return v # <<<<<<<<<<<<<< + /* "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 = __pyx_v_v; + __pyx_r = std::string(__pyx_v_data, __pyx_v_length); goto __pyx_L0; - /* "vector.from_py":45 + /* "string.from_py":13 * - * @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: + * @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_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_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_XDECREF(__pyx_v_item); __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; - 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 +/* "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 *: */ - __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; +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); - /* "vector.from_py":49 - * for item in o: - * v.push_back(item) - * return v # <<<<<<<<<<<<<< - * - * + /* "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_r = __pyx_v_v; + __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; - /* "vector.from_py":45 + /* "string.to_py":31 * - * @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: + * @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_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_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_XDECREF(__pyx_v_item); + __Pyx_XGIVEREF(__pyx_r); __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())] +/* "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 PyObject *__pyx_convert_vector_to_py_unsigned_char(const std::vector &__pyx_v_v) { - size_t __pyx_v_i; +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; - 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); + __Pyx_RefNannySetupContext("__pyx_convert_PyUnicode_string_to_py_std__in_string", 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())] # <<<<<<<<<<<<<< - * - * + /* "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 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L1_error) + __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_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())] + /* "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_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_unsigned_char", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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); @@ -7676,56 +7390,49 @@ static PyObject *__pyx_convert_vector_to_py_unsigned_char(const std::vector &__pyx_v_v) { - size_t __pyx_v_i; +/* "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; - 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); + __Pyx_RefNannySetupContext("__pyx_convert_PyStr_string_to_py_std__in_string", 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())] # <<<<<<<<<<<<<< - * - * + /* "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 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L1_error) + __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_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())] + /* "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_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_float", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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); @@ -7733,56 +7440,49 @@ static PyObject *__pyx_convert_vector_to_py_float(const std::vector &__p return __pyx_r; } -static PyObject *__pyx_convert_vector_to_py_unsigned_int(const std::vector &__pyx_v_v) { - size_t __pyx_v_i; +/* "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; - 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); + __Pyx_RefNannySetupContext("__pyx_convert_PyBytes_string_to_py_std__in_string", 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; - } + /* "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; - /* "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())] + /* "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_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_unsigned_int", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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); @@ -7790,56 +7490,48 @@ static PyObject *__pyx_convert_vector_to_py_unsigned_int(const std::vector &__pyx_v_v) { - size_t __pyx_v_i; +/* "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; - 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); + __Pyx_RefNannySetupContext("__pyx_convert_PyByteArray_string_to_py_std__in_string", 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())] # <<<<<<<<<<<<<< - * + /* "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 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L1_error) + __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_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 + /* "string.to_py":55 * - * @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())] + * @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_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_double", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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); @@ -7847,248 +7539,585 @@ static PyObject *__pyx_convert_vector_to_py_double(const std::vector &_ return __pyx_r; } -/* "string.to_py":31 +/* "vector.from_py":45 * - * @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 *: + * @cname("__pyx_convert_vector_from_py_uint8_t") + * cdef vector[X] __pyx_convert_vector_from_py_uint8_t(object o) except *: # <<<<<<<<<<<<<< + * cdef vector[X] v + * for item in o: */ -static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &__pyx_v_s) { - PyObject *__pyx_r = NULL; +static std::vector __pyx_convert_vector_from_py_uint8_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; + uint8_t __pyx_t_5; 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); + __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_uint8_t", 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) + /* "vector.from_py":47 + * cdef vector[X] __pyx_convert_vector_from_py_uint8_t(object o) except *: + * cdef vector[X] v + * for item in o: # <<<<<<<<<<<<<< + * v.push_back(item) + * return v */ - __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; + 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; - /* "string.to_py":31 + /* "vector.from_py":48 + * cdef vector[X] v + * for item in o: + * v.push_back(item) # <<<<<<<<<<<<<< + * return v * - * @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 *: */ + __pyx_t_5 = __Pyx_PyInt_As_uint8_t(__pyx_v_item); if (unlikely((__pyx_t_5 == ((uint8_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 48, __pyx_L1_error) + __pyx_v_v.push_back(((uint8_t)__pyx_t_5)); - /* 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 *: + /* "vector.from_py":47 + * cdef vector[X] __pyx_convert_vector_from_py_uint8_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; -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) + /* "vector.from_py":49 + * for item in o: + * v.push_back(item) + * return v # <<<<<<<<<<<<<< + * + * */ - __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; + __pyx_r = __pyx_v_v; goto __pyx_L0; - /* "string.to_py":37 + /* "vector.from_py":45 * - * @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 *: + * @cname("__pyx_convert_vector_from_py_uint8_t") + * cdef vector[X] __pyx_convert_vector_from_py_uint8_t(object o) except *: # <<<<<<<<<<<<<< + * cdef vector[X] v + * for item in o: */ /* 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_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_uint8_t", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_item); __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; +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_PyStr_string_to_py_std__in_string", 0); + __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_float", 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; + /* "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; - /* "string.to_py":43 + /* "vector.from_py":45 * - * @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 *: + * @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_AddTraceback("string.to_py.__pyx_convert_PyStr_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __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_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_item); __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; +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_PyBytes_string_to_py_std__in_string", 0); + __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_uint32_t", 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) + /* "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_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; + 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; - /* "string.to_py":49 + /* "vector.from_py":45 * - * @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 *: + * @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_AddTraceback("string.to_py.__pyx_convert_PyBytes_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __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_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_item); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "string.to_py":55 +/* "vector.to_py":60 * - * @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()) + * @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 CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &__pyx_v_s) { +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_PyByteArray_string_to_py_std__in_string", 0); + __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_unsigned_char", 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()) # <<<<<<<<<<<<<< + /* "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 = __Pyx_PyByteArray_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 56, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __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()) + __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_AddTraceback("string.to_py.__pyx_convert_PyByteArray_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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; +} + +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); @@ -8142,6 +8171,9 @@ static struct PyModuleDef __pyx_moduledef = { #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_n_s_AttributeMetadataObject, __pyx_k_AttributeMetadataObject, sizeof(__pyx_k_AttributeMetadataObject), 0, 0, 1, 1}, + {&__pyx_n_u_AttributeMetadataObject, __pyx_k_AttributeMetadataObject, sizeof(__pyx_k_AttributeMetadataObject), 0, 1, 0, 1}, + {&__pyx_n_s_AttributeMetadataObject___init, __pyx_k_AttributeMetadataObject___init, sizeof(__pyx_k_AttributeMetadataObject___init), 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}, @@ -8172,47 +8204,34 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_MetadataObject, __pyx_k_MetadataObject, sizeof(__pyx_k_MetadataObject), 0, 0, 1, 1}, {&__pyx_n_u_MetadataObject, __pyx_k_MetadataObject, sizeof(__pyx_k_MetadataObject), 0, 1, 0, 1}, {&__pyx_n_s_MetadataObject___init, __pyx_k_MetadataObject___init, sizeof(__pyx_k_MetadataObject___init), 0, 0, 1, 1}, - {&__pyx_n_s_Reader, __pyx_k_Reader, sizeof(__pyx_k_Reader), 0, 0, 1, 1}, - {&__pyx_n_s_Reader___get_endian, __pyx_k_Reader___get_endian, sizeof(__pyx_k_Reader___get_endian), 0, 0, 1, 1}, - {&__pyx_n_s_Reader___init, __pyx_k_Reader___init, sizeof(__pyx_k_Reader___init), 0, 0, 1, 1}, - {&__pyx_n_s_Reader___read_bytes, __pyx_k_Reader___read_bytes, sizeof(__pyx_k_Reader___read_bytes), 0, 0, 1, 1}, - {&__pyx_n_s_Reader__get_endian, __pyx_k_Reader__get_endian, sizeof(__pyx_k_Reader__get_endian), 0, 0, 1, 1}, - {&__pyx_n_s_Reader__read_bytes, __pyx_k_Reader__read_bytes, sizeof(__pyx_k_Reader__read_bytes), 0, 0, 1, 1}, - {&__pyx_n_s_Reader_is_end, __pyx_k_Reader_is_end, sizeof(__pyx_k_Reader_is_end), 0, 0, 1, 1}, - {&__pyx_n_s_Reader_read_bytes, __pyx_k_Reader_read_bytes, sizeof(__pyx_k_Reader_read_bytes), 0, 0, 1, 1}, - {&__pyx_n_s_Reader_read_str, __pyx_k_Reader_read_str, sizeof(__pyx_k_Reader_read_str), 0, 0, 1, 1}, - {&__pyx_n_s_Reader_read_uint, __pyx_k_Reader_read_uint, sizeof(__pyx_k_Reader_read_uint), 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_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__27, __pyx_k__27, sizeof(__pyx_k__27), 0, 0, 1, 1}, + {&__pyx_n_s__15, __pyx_k__15, sizeof(__pyx_k__15), 0, 0, 1, 1}, {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1}, - {&__pyx_n_s_attr_len, __pyx_k_attr_len, sizeof(__pyx_k_attr_len), 0, 0, 1, 1}, {&__pyx_n_s_attribute_metadata, __pyx_k_attribute_metadata, sizeof(__pyx_k_attribute_metadata), 0, 0, 1, 1}, {&__pyx_n_s_attribute_metadatas, __pyx_k_attribute_metadatas, sizeof(__pyx_k_attribute_metadatas), 0, 0, 1, 1}, {&__pyx_n_s_attribute_metadatas_len, __pyx_k_attribute_metadatas_len, sizeof(__pyx_k_attribute_metadatas_len), 0, 0, 1, 1}, {&__pyx_n_s_axis, __pyx_k_axis, sizeof(__pyx_k_axis), 0, 0, 1, 1}, - {&__pyx_n_u_big, __pyx_k_big, sizeof(__pyx_k_big), 0, 1, 0, 1}, {&__pyx_n_s_binary_metadata, __pyx_k_binary_metadata, sizeof(__pyx_k_binary_metadata), 0, 0, 1, 1}, {&__pyx_n_u_binary_metadata, __pyx_k_binary_metadata, sizeof(__pyx_k_binary_metadata), 0, 1, 0, 1}, - {&__pyx_n_u_bool, __pyx_k_bool, sizeof(__pyx_k_bool), 0, 1, 0, 1}, {&__pyx_n_s_buffer, __pyx_k_buffer, sizeof(__pyx_k_buffer), 0, 0, 1, 1}, - {&__pyx_n_s_byteorder, __pyx_k_byteorder, sizeof(__pyx_k_byteorder), 0, 0, 1, 1}, - {&__pyx_n_u_bytes, __pyx_k_bytes, sizeof(__pyx_k_bytes), 0, 1, 0, 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_count, __pyx_k_count, sizeof(__pyx_k_count), 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, __pyx_k_decode, sizeof(__pyx_k_decode), 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_metadata, __pyx_k_decode_metadata, sizeof(__pyx_k_decode_metadata), 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_draco_metadata, __pyx_k_draco_metadata, sizeof(__pyx_k_draco_metadata), 0, 0, 1, 1}, + {&__pyx_n_s_draco_sub_metadata, __pyx_k_draco_sub_metadata, sizeof(__pyx_k_draco_sub_metadata), 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_metadata, __pyx_k_encode_metadata, sizeof(__pyx_k_encode_metadata), 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}, @@ -8220,25 +8239,19 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1}, - {&__pyx_n_s_endian_order, __pyx_k_endian_order, sizeof(__pyx_k_endian_order), 0, 0, 1, 1}, {&__pyx_n_s_entries, __pyx_k_entries, sizeof(__pyx_k_entries), 0, 0, 1, 1}, + {&__pyx_n_s_entries_len, __pyx_k_entries_len, sizeof(__pyx_k_entries_len), 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_from_bytes, __pyx_k_from_bytes, sizeof(__pyx_k_from_bytes), 0, 0, 1, 1}, {&__pyx_n_s_geometry_metadata, __pyx_k_geometry_metadata, sizeof(__pyx_k_geometry_metadata), 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_get_endian, __pyx_k_get_endian, sizeof(__pyx_k_get_endian), 0, 0, 1, 1}, {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_n_s_in_bytes, __pyx_k_in_bytes, sizeof(__pyx_k_in_bytes), 0, 0, 1, 1}, - {&__pyx_n_s_in_bytes_2, __pyx_k_in_bytes_2, sizeof(__pyx_k_in_bytes_2), 0, 0, 1, 1}, {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, {&__pyx_n_u_int, __pyx_k_int, sizeof(__pyx_k_int), 0, 1, 0, 1}, {&__pyx_n_s_inverse_alpha, __pyx_k_inverse_alpha, sizeof(__pyx_k_inverse_alpha), 0, 0, 1, 1}, - {&__pyx_n_s_is_end, __pyx_k_is_end, sizeof(__pyx_k_is_end), 0, 0, 1, 1}, - {&__pyx_n_u_little, __pyx_k_little, sizeof(__pyx_k_little), 0, 1, 0, 1}, + {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 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}, @@ -8249,16 +8262,13 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 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_kp_u_not_read_bytes_detected, __pyx_k_not_read_bytes_detected, sizeof(__pyx_k_not_read_bytes_detected), 0, 1, 0, 0}, {&__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_parse_binary_metadata, __pyx_k_parse_binary_metadata, sizeof(__pyx_k_parse_binary_metadata), 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_pos, __pyx_k_pos, sizeof(__pyx_k_pos), 0, 0, 1, 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}, @@ -8272,38 +8282,32 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_read_bytes, __pyx_k_read_bytes, sizeof(__pyx_k_read_bytes), 0, 0, 1, 1}, - {&__pyx_n_s_read_bytes_2, __pyx_k_read_bytes_2, sizeof(__pyx_k_read_bytes_2), 0, 0, 1, 1}, - {&__pyx_n_s_read_str, __pyx_k_read_str, sizeof(__pyx_k_read_str), 0, 0, 1, 1}, - {&__pyx_n_s_read_uint, __pyx_k_read_uint, sizeof(__pyx_k_read_uint), 0, 0, 1, 1}, {&__pyx_n_s_reader, __pyx_k_reader, sizeof(__pyx_k_reader), 0, 0, 1, 1}, - {&__pyx_n_s_result_bytes, __pyx_k_result_bytes, sizeof(__pyx_k_result_bytes), 0, 0, 1, 1}, - {&__pyx_n_s_return, __pyx_k_return, sizeof(__pyx_k_return), 0, 0, 1, 1}, + {&__pyx_n_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 1}, {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, - {&__pyx_n_s_signed, __pyx_k_signed, sizeof(__pyx_k_signed), 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_staticmethod, __pyx_k_staticmethod, sizeof(__pyx_k_staticmethod), 0, 0, 1, 1}, + {&__pyx_n_s_ss, __pyx_k_ss, sizeof(__pyx_k_ss), 0, 0, 1, 1}, {&__pyx_n_s_sub_metadata, __pyx_k_sub_metadata, sizeof(__pyx_k_sub_metadata), 0, 0, 1, 1}, {&__pyx_n_s_sub_metadatas, __pyx_k_sub_metadatas, sizeof(__pyx_k_sub_metadatas), 0, 0, 1, 1}, {&__pyx_n_s_sub_metadatas_len, __pyx_k_sub_metadatas_len, sizeof(__pyx_k_sub_metadatas_len), 0, 0, 1, 1}, {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 0, 0, 1, 1}, {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_to_parse_metadata, __pyx_k_to_parse_metadata, sizeof(__pyx_k_to_parse_metadata), 0, 0, 1, 1}, {&__pyx_n_s_to_parse_metadata_next, __pyx_k_to_parse_metadata_next, sizeof(__pyx_k_to_parse_metadata_next), 0, 0, 1, 1}, {&__pyx_n_s_to_parse_metadatas, __pyx_k_to_parse_metadatas, sizeof(__pyx_k_to_parse_metadatas), 0, 0, 1, 1}, {&__pyx_n_s_typing, __pyx_k_typing, sizeof(__pyx_k_typing), 0, 0, 1, 1}, - {&__pyx_n_u_unicode, __pyx_k_unicode, sizeof(__pyx_k_unicode), 0, 1, 0, 1}, - {&__pyx_kp_u_unknown_endian_order, __pyx_k_unknown_endian_order, sizeof(__pyx_k_unknown_endian_order), 0, 1, 0, 0}, + {&__pyx_n_s_unique_id, __pyx_k_unique_id, sizeof(__pyx_k_unique_id), 0, 0, 1, 1}, {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1}, + {&__pyx_n_s_writer, __pyx_k_writer, sizeof(__pyx_k_writer), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_staticmethod = __Pyx_GetBuiltinName(__pyx_n_s_staticmethod); if (!__pyx_builtin_staticmethod) __PYX_ERR(0, 15, __pyx_L1_error) __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 96, __pyx_L1_error) __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) __PYX_ERR(0, 114, __pyx_L1_error) - __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 59, __pyx_L1_error) - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 70, __pyx_L1_error) + __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 20, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 40, __pyx_L1_error) __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 141, __pyx_L1_error) - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 228, __pyx_L1_error) + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 245, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -8313,28 +8317,6 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "DracoPy.pyx":23 - * return "big" - * else: - * raise Exception("unknown endian order") # <<<<<<<<<<<<<< - * - * def __read_bytes(self, count: int) -> bytes: - */ - __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_unknown_endian_order); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 23, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple_); - __Pyx_GIVEREF(__pyx_tuple_); - - /* "DracoPy.pyx":92 - * to_parse_metadatas = to_parse_metadata_next - * if not reader.is_end(): - * raise Exception("not read bytes detected") # <<<<<<<<<<<<<< - * return geometry_metadata - * - */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_not_read_bytes_detected); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 92, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__2); - __Pyx_GIVEREF(__pyx_tuple__2); - /* "DracoPy.pyx":141 * def get_encoded_coordinate(self, value, axis): * if value < self.quantization_origin[axis] or value > (self.quantization_origin[axis] + self.quantization_range): @@ -8342,203 +8324,146 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * 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, 141, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__3); - __Pyx_GIVEREF(__pyx_tuple__3); + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_Specified_value_out_of_encoded_r); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__2); + __Pyx_GIVEREF(__pyx_tuple__2); - /* "DracoPy.pyx":191 + /* "DracoPy.pyx":200 * 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): + * def encode_point_cloud_to_buffer(points, metadata: GeometryMetadataObject = None, */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_Input_invalid); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 191, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__4); - __Pyx_GIVEREF(__pyx_tuple__4); + __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_Input_invalid); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__3); + __Pyx_GIVEREF(__pyx_tuple__3); - /* "DracoPy.pyx":228 + /* "DracoPy.pyx":245 * 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__5 = PyTuple_Pack(1, __pyx_kp_u_Failed_to_decode_input_mesh_Data); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 228, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); + __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_Failed_to_decode_input_mesh_Data); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 245, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__4); + __Pyx_GIVEREF(__pyx_tuple__4); - /* "DracoPy.pyx":230 + /* "DracoPy.pyx":247 * 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): */ - __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_DracoPy_only_supports_meshes_wit); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 230, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__6); - __Pyx_GIVEREF(__pyx_tuple__6); + __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_DracoPy_only_supports_meshes_wit); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 247, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__5); + __Pyx_GIVEREF(__pyx_tuple__5); - /* "DracoPy.pyx":11 + /* "DracoPy.pyx":10 * - * class _Reader: - * def __init__(self, in_bytes: bytes): # <<<<<<<<<<<<<< - * self._in_bytes = in_bytes - * self._pos = 0 + * class MetadataObject: + * def __init__(self, entries: Dict[str, bytes] = None, # <<<<<<<<<<<<<< + * sub_metadatas: Dict[str, 'MetadataObject'] = None): + * self.entries = entries if entries else {} */ - __pyx_tuple__7 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_in_bytes); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 11, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); - __pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__7, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_init, 11, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__8)) __PYX_ERR(0, 11, __pyx_L1_error) + __pyx_tuple__6 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_entries, __pyx_n_s_sub_metadatas); 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(3, 0, 3, 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_tuple__8 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__8); - /* "DracoPy.pyx":16 + /* "DracoPy.pyx":17 * - * @staticmethod - * def __get_endian() -> str: # <<<<<<<<<<<<<< - * endian_order = get_endian_order() - * if endian_order == DracoPy.endian_order.little_endian: + * class AttributeMetadataObject(MetadataObject): + * def __init__(self, unique_id: int, # <<<<<<<<<<<<<< + * entries: Dict[str, bytes] = None, + * sub_metadatas: Dict[str, 'MetadataObject'] = None): */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_n_s_endian_order); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 16, __pyx_L1_error) + __pyx_tuple__9 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_unique_id, __pyx_n_s_entries, __pyx_n_s_sub_metadatas); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9); - __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_get_endian, 16, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 16, __pyx_L1_error) - - /* "DracoPy.pyx":25 - * raise Exception("unknown endian order") - * - * def __read_bytes(self, count: int) -> bytes: # <<<<<<<<<<<<<< - * end = self._pos + count - * result_bytes = self._in_bytes[self._pos:end] - */ - __pyx_tuple__11 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_count, __pyx_n_s_end, __pyx_n_s_result_bytes); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 25, __pyx_L1_error) + __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_init, 17, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 17, __pyx_L1_error) + __pyx_tuple__11 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__11); __Pyx_GIVEREF(__pyx_tuple__11); - __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_read_bytes_2, 25, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 25, __pyx_L1_error) - /* "DracoPy.pyx":31 - * return result_bytes + /* "DracoPy.pyx":25 * - * def read_uint(self) -> int: # <<<<<<<<<<<<<< - * value = int.from_bytes(self.__read_bytes(4), - * byteorder=self.__get_endian(), signed=False) - */ - __pyx_tuple__13 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_value); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 31, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__13); - __Pyx_GIVEREF(__pyx_tuple__13); - __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_read_uint, 31, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 31, __pyx_L1_error) + * class GeometryMetadataObject(MetadataObject): + * def __init__(self, entries: Dict[str, bytes] = None, # <<<<<<<<<<<<<< + * sub_metadatas: Dict[str, 'MetadataObject'] = None, + * attribute_metadatas: List['AttributeMetadataObject'] = None): + */ + __pyx_tuple__12 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_entries, __pyx_n_s_sub_metadatas, __pyx_n_s_attribute_metadatas); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__12); + __Pyx_GIVEREF(__pyx_tuple__12); + __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 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_init, 25, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 25, __pyx_L1_error) + __pyx_tuple__14 = PyTuple_Pack(3, ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__14); + __Pyx_GIVEREF(__pyx_tuple__14); - /* "DracoPy.pyx":36 - * return value + /* "DracoPy.pyx":33 * - * def read_str(self) -> str: # <<<<<<<<<<<<<< - * count = self.read_uint() - * return self.__read_bytes(count).decode() + * + * def decode_metadata(binary_metadata: bytes) -> MetadataObject: # <<<<<<<<<<<<<< + * ss = new stringstream(binary_metadata) + * reader = new DracoPy.MetadataReader(ss) */ - __pyx_tuple__15 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_count); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__15); - __Pyx_GIVEREF(__pyx_tuple__15); - __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_read_str, 36, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 36, __pyx_L1_error) + __pyx_tuple__16 = PyTuple_Pack(16, __pyx_n_s_binary_metadata, __pyx_n_s_ss, __pyx_n_s_reader, __pyx_n_s_geometry_metadata, __pyx_n_s_to_parse_metadatas, __pyx_n_s_attribute_metadatas_len, __pyx_n_s__15, __pyx_n_s_unique_id, __pyx_n_s_attribute_metadata, __pyx_n_s_to_parse_metadata_next, __pyx_n_s_metadata, __pyx_n_s_entries_len, __pyx_n_s_name_2, __pyx_n_s_value, __pyx_n_s_sub_metadatas_len, __pyx_n_s_sub_metadata); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__16); + __Pyx_GIVEREF(__pyx_tuple__16); + __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(1, 0, 16, 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_decode_metadata, 33, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 33, __pyx_L1_error) - /* "DracoPy.pyx":40 - * return self.__read_bytes(count).decode() + /* "DracoPy.pyx":67 + * return geometry_metadata * - * def read_bytes(self) -> bytes: # <<<<<<<<<<<<<< - * count = self.read_uint() - * return self.__read_bytes(count) + * def encode_metadata(geometry_metadata: GeometryMetadataObject) -> bytes: # <<<<<<<<<<<<<< + * ss = new stringstream(b"") + * writer = new DracoPy.MetadataWriter(ss) */ - __pyx_tuple__17 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_count); 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(1, 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_read_bytes, 40, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 40, __pyx_L1_error) + __pyx_tuple__18 = PyTuple_Pack(11, __pyx_n_s_geometry_metadata, __pyx_n_s_ss, __pyx_n_s_writer, __pyx_n_s_to_parse_metadata, __pyx_n_s_attribute_metadata, __pyx_n_s_to_parse_metadata_next, __pyx_n_s_draco_metadata, __pyx_n_s_name_2, __pyx_n_s_value, __pyx_n_s_draco_sub_metadata, __pyx_n_s_s); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 67, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__18); + __Pyx_GIVEREF(__pyx_tuple__18); + __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(1, 0, 11, 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_encode_metadata, 67, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 67, __pyx_L1_error) - /* "DracoPy.pyx":44 - * return self.__read_bytes(count) + /* "DracoPy.pyx":96 * - * def is_end(self) -> bool: # <<<<<<<<<<<<<< - * return len(self._in_bytes) == self._pos * + * class DracoPointCloud(object): # <<<<<<<<<<<<<< + * def __init__(self, data_struct): + * self.data_struct = data_struct */ - __pyx_tuple__19 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__19); - __Pyx_GIVEREF(__pyx_tuple__19); - __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_is_end, 44, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_tuple__20 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 96, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__20); + __Pyx_GIVEREF(__pyx_tuple__20); - /* "DracoPy.pyx":49 + /* "DracoPy.pyx":97 * - * class MetadataObject: - * def __init__(self, entries: typing.Dict[str, bytes] = None, # <<<<<<<<<<<<<< - * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None): - * self.entries = entries if entries else {} + * class DracoPointCloud(object): + * def __init__(self, data_struct): # <<<<<<<<<<<<<< + * self.data_struct = data_struct + * if data_struct['encoding_options_set']: */ - __pyx_tuple__21 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_entries, __pyx_n_s_sub_metadatas); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 49, __pyx_L1_error) + __pyx_tuple__21 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_data_struct); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 97, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__21); __Pyx_GIVEREF(__pyx_tuple__21); - __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 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, 49, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 49, __pyx_L1_error) - __pyx_tuple__23 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__23); - __Pyx_GIVEREF(__pyx_tuple__23); - - /* "DracoPy.pyx":56 - * - * class GeometryMetadataObject(MetadataObject): - * def __init__(self, entries: typing.Dict[str, bytes] = None, # <<<<<<<<<<<<<< - * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None, - * attribute_metadatas: typing.List['MetadataObject'] = None): - */ - __pyx_tuple__24 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_entries, __pyx_n_s_sub_metadatas, __pyx_n_s_attribute_metadatas); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__24); - __Pyx_GIVEREF(__pyx_tuple__24); - __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_init, 56, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 56, __pyx_L1_error) - __pyx_tuple__26 = PyTuple_Pack(3, ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__26); - __Pyx_GIVEREF(__pyx_tuple__26); - - /* "DracoPy.pyx":64 - * - * - * def _parse_binary_metadata(binary_metadata: bytes) -> MetadataObject: # <<<<<<<<<<<<<< - * reader = _Reader(binary_metadata) - * geometry_metadata = GeometryMetadataObject() - */ - __pyx_tuple__28 = PyTuple_Pack(14, __pyx_n_s_binary_metadata, __pyx_n_s_reader, __pyx_n_s_geometry_metadata, __pyx_n_s_to_parse_metadatas, __pyx_n_s_attribute_metadatas_len, __pyx_n_s__27, __pyx_n_s_attribute_metadata, __pyx_n_s_to_parse_metadata_next, __pyx_n_s_metadata, __pyx_n_s_attr_len, __pyx_n_s_name_2, __pyx_n_s_value, __pyx_n_s_sub_metadatas_len, __pyx_n_s_sub_metadata); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__28); - __Pyx_GIVEREF(__pyx_tuple__28); - __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(1, 0, 14, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_parse_binary_metadata, 64, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 64, __pyx_L1_error) - - /* "DracoPy.pyx":96 - * - * - * class DracoPointCloud(object): # <<<<<<<<<<<<<< - * def __init__(self, data_struct): - * self.data_struct = data_struct - */ - __pyx_tuple__30 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 96, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__30); - __Pyx_GIVEREF(__pyx_tuple__30); - - /* "DracoPy.pyx":97 - * - * class DracoPointCloud(object): - * def __init__(self, data_struct): # <<<<<<<<<<<<<< - * self.data_struct = data_struct - * if data_struct['encoding_options_set']: - */ - __pyx_tuple__31 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_data_struct); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 97, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__31); - __Pyx_GIVEREF(__pyx_tuple__31); - __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 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_init, 97, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 97, __pyx_L1_error) + __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_init, 97, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 97, __pyx_L1_error) /* "DracoPy.pyx":106 - * self.metadata = _parse_binary_metadata(data_struct["binary_metadata"]) + * self.metadata = decode_metadata(data_struct["binary_metadata"]) * * 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__33 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_value, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__33); - __Pyx_GIVEREF(__pyx_tuple__33); - __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 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_get_encoded_coordinate, 106, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 106, __pyx_L1_error) + __pyx_tuple__23 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_value, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 106, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__23); + __Pyx_GIVEREF(__pyx_tuple__23); + __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 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, 106, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 106, __pyx_L1_error) /* "DracoPy.pyx":110 * return self.encoding_options.get_encoded_coordinate(value, axis) @@ -8547,10 +8472,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * if self.encoding_options is not None: * return self.encoding_options.get_encoded_point(point) */ - __pyx_tuple__35 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_point); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 110, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__35); - __Pyx_GIVEREF(__pyx_tuple__35); - __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(2, 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_get_encoded_point, 110, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_tuple__25 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_point); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__25); + __Pyx_GIVEREF(__pyx_tuple__25); + __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 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, 110, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 110, __pyx_L1_error) /* "DracoPy.pyx":115 * @@ -8559,10 +8484,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return 3 * */ - __pyx_tuple__37 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 115, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__37); - __Pyx_GIVEREF(__pyx_tuple__37); - __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_num_axes, 115, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 115, __pyx_L1_error) + __pyx_tuple__27 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 115, __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, 115, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 115, __pyx_L1_error) /* "DracoPy.pyx":119 * @@ -8571,10 +8496,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return self.data_struct['points'] * */ - __pyx_tuple__39 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__39); - __Pyx_GIVEREF(__pyx_tuple__39); - __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_points, 119, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 119, __pyx_L1_error) + __pyx_tuple__29 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 119, __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_points, 119, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 119, __pyx_L1_error) /* "DracoPy.pyx":125 * class DracoMesh(DracoPointCloud): @@ -8583,10 +8508,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return self.data_struct['faces'] * */ - __pyx_tuple__41 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 125, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__41); - __Pyx_GIVEREF(__pyx_tuple__41); - __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_faces, 125, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 125, __pyx_L1_error) + __pyx_tuple__31 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 125, __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, 125, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 125, __pyx_L1_error) /* "DracoPy.pyx":129 * @@ -8595,10 +8520,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return self.data_struct['normals'] * */ - __pyx_tuple__43 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__43); - __Pyx_GIVEREF(__pyx_tuple__43); - __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_normals, 129, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 129, __pyx_L1_error) + __pyx_tuple__33 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 129, __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, 129, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 129, __pyx_L1_error) /* "DracoPy.pyx":132 * return self.data_struct['normals'] @@ -8607,9 +8532,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * def __init__(self, quantization_bits, quantization_range, quantization_origin): * self.quantization_bits = quantization_bits */ - __pyx_tuple__45 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__45); - __Pyx_GIVEREF(__pyx_tuple__45); + __pyx_tuple__35 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__35); + __Pyx_GIVEREF(__pyx_tuple__35); /* "DracoPy.pyx":133 * @@ -8618,10 +8543,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * self.quantization_bits = quantization_bits * self.quantization_range = quantization_range */ - __pyx_tuple__46 = 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__46)) __PYX_ERR(0, 133, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__46); - __Pyx_GIVEREF(__pyx_tuple__46); - __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 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_init, 133, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 133, __pyx_L1_error) + __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, 133, __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, 133, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 133, __pyx_L1_error) /* "DracoPy.pyx":139 * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) @@ -8630,10 +8555,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * 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__48 = 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__48)) __PYX_ERR(0, 139, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__48); - __Pyx_GIVEREF(__pyx_tuple__48); - __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_get_encoded_coordinate, 139, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 139, __pyx_L1_error) + __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, 139, __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, 139, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 139, __pyx_L1_error) /* "DracoPy.pyx":146 * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) @@ -8642,10 +8567,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * encoded_point = [] * for axis in range(self.num_axes): */ - __pyx_tuple__50 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_point, __pyx_n_s_encoded_point, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 146, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__50); - __Pyx_GIVEREF(__pyx_tuple__50); - __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 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_get_encoded_point, 146, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 146, __pyx_L1_error) + __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, 146, __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, 146, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 146, __pyx_L1_error) /* "DracoPy.pyx":153 * @@ -8654,70 +8579,70 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return 3 * */ - __pyx_tuple__52 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 153, __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_num_axes, 153, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 153, __pyx_L1_error) + __pyx_tuple__42 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 153, __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, 153, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 153, __pyx_L1_error) /* "DracoPy.pyx":162 * 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. + * def encode_mesh_to_buffer(points, faces, metadata: GeometryMetadataObject = None, # <<<<<<<<<<<<<< + * quantization_bits=14, compression_level=1, + * quantization_range=-1, quantization_origin=None, */ - __pyx_tuple__54 = 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__54)) __PYX_ERR(0, 162, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__54); - __Pyx_GIVEREF(__pyx_tuple__54); - __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(7, 0, 11, 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_encode_mesh_to_buffer, 162, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 162, __pyx_L1_error) + __pyx_tuple__44 = PyTuple_Pack(13, __pyx_n_s_points, __pyx_n_s_faces, __pyx_n_s_metadata, __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_binary_metadata, __pyx_n_s_encoded_mesh); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__44); + __Pyx_GIVEREF(__pyx_tuple__44); + __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(8, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_encode_mesh_to_buffer, 162, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 162, __pyx_L1_error) - /* "DracoPy.pyx":193 + /* "DracoPy.pyx":202 * 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. + * def encode_point_cloud_to_buffer(points, metadata: GeometryMetadataObject = None, # <<<<<<<<<<<<<< + * quantization_bits=14, compression_level=1, + * quantization_range=-1, quantization_origin=None, */ - __pyx_tuple__56 = 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__56)) __PYX_ERR(0, 193, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__56); - __Pyx_GIVEREF(__pyx_tuple__56); - __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(6, 0, 10, 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_encode_point_cloud_to_buffer, 193, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 193, __pyx_L1_error) + __pyx_tuple__46 = PyTuple_Pack(12, __pyx_n_s_points, __pyx_n_s_metadata, __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_binary_metadata, __pyx_n_s_encoded_point_cloud); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 202, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__46); + __Pyx_GIVEREF(__pyx_tuple__46); + __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(7, 0, 12, 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_point_cloud_to_buffer, 202, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 202, __pyx_L1_error) - /* "DracoPy.pyx":224 + /* "DracoPy.pyx":241 * 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__58 = PyTuple_Pack(1, __pyx_n_s_decoding_status); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 224, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__58); - __Pyx_GIVEREF(__pyx_tuple__58); - __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_src_DracoPy_pyx, __pyx_n_s_raise_decoding_error, 224, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(0, 224, __pyx_L1_error) + __pyx_tuple__48 = PyTuple_Pack(1, __pyx_n_s_decoding_status); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 241, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__48); + __Pyx_GIVEREF(__pyx_tuple__48); + __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_raise_decoding_error, 241, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 241, __pyx_L1_error) - /* "DracoPy.pyx":232 + /* "DracoPy.pyx":249 * 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: */ - __pyx_tuple__60 = PyTuple_Pack(2, __pyx_n_s_buffer, __pyx_n_s_mesh_struct); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 232, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__60); - __Pyx_GIVEREF(__pyx_tuple__60); - __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_buffer_to_mesh, 232, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 232, __pyx_L1_error) + __pyx_tuple__50 = PyTuple_Pack(2, __pyx_n_s_buffer, __pyx_n_s_mesh_struct); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__50); + __Pyx_GIVEREF(__pyx_tuple__50); + __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 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_decode_buffer_to_mesh, 249, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 249, __pyx_L1_error) - /* "DracoPy.pyx":239 + /* "DracoPy.pyx":256 * 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_tuple__62 = PyTuple_Pack(2, __pyx_n_s_buffer, __pyx_n_s_point_cloud_struct); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(0, 239, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__62); - __Pyx_GIVEREF(__pyx_tuple__62); - __pyx_codeobj__63 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__62, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_point_cloud_buffer, 239, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__63)) __PYX_ERR(0, 239, __pyx_L1_error) + __pyx_tuple__52 = PyTuple_Pack(2, __pyx_n_s_buffer, __pyx_n_s_point_cloud_struct); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 256, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__52); + __Pyx_GIVEREF(__pyx_tuple__52); + __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 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_decode_point_cloud_buffer, 256, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 256, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -8728,11 +8653,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { 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_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __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; @@ -9013,425 +8936,399 @@ if (!__Pyx_RefNanny) { /* "DracoPy.pyx":2 * # distutils: language = c++ - * import typing # <<<<<<<<<<<<<< + * from typing import Dict, List # <<<<<<<<<<<<<< * * from cpython.mem cimport PyMem_Malloc, PyMem_Free */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_typing, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error) + __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __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_t_2 = __Pyx_Import(__pyx_n_s_typing, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __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, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_typing, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Dict, __pyx_t_1) < 0) __PYX_ERR(0, 2, __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, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_List, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "DracoPy.pyx":6 * from cpython.mem cimport PyMem_Malloc, PyMem_Free * cimport DracoPy * from math import floor # <<<<<<<<<<<<<< - * from libc.string cimport memcmp + * * */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_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_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) + 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, 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; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "DracoPy.pyx":10 - * - * - * class _Reader: # <<<<<<<<<<<<<< - * def __init__(self, in_bytes: bytes): - * self._in_bytes = in_bytes - */ - __pyx_t_2 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_Reader, __pyx_n_s_Reader, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error) + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_floor); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - - /* "DracoPy.pyx":11 - * - * class _Reader: - * def __init__(self, in_bytes: bytes): # <<<<<<<<<<<<<< - * self._in_bytes = in_bytes - * self._pos = 0 - */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_in_bytes, __pyx_n_u_bytes) < 0) __PYX_ERR(0, 11, __pyx_L1_error) - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_7_Reader_1__init__, 0, __pyx_n_s_Reader___init, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__8)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 11, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_floor, __pyx_t_2) < 0) __PYX_ERR(0, 6, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 11, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "DracoPy.pyx":16 - * - * @staticmethod - * def __get_endian() -> str: # <<<<<<<<<<<<<< - * endian_order = get_endian_order() - * if endian_order == DracoPy.endian_order.little_endian: - */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 16, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 16, __pyx_L1_error) - __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_7_Reader_3__get_endian, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_Reader___get_endian, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__10)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":15 - * self._pos = 0 + /* "DracoPy.pyx":9 * - * @staticmethod # <<<<<<<<<<<<<< - * def __get_endian() -> str: - * endian_order = get_endian_order() - */ - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_staticmethod, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_Reader__get_endian, __pyx_t_3) < 0) __PYX_ERR(0, 16, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "DracoPy.pyx":25 - * raise Exception("unknown endian order") * - * def __read_bytes(self, count: int) -> bytes: # <<<<<<<<<<<<<< - * end = self._pos + count - * result_bytes = self._in_bytes[self._pos:end] + * class MetadataObject: # <<<<<<<<<<<<<< + * def __init__(self, entries: Dict[str, bytes] = None, + * sub_metadatas: Dict[str, 'MetadataObject'] = None): */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_count, __pyx_n_u_int) < 0) __PYX_ERR(0, 25, __pyx_L1_error) - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_u_bytes) < 0) __PYX_ERR(0, 25, __pyx_L1_error) - __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_7_Reader_5__read_bytes, 0, __pyx_n_s_Reader___read_bytes, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__12)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __pyx_L1_error) + __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_MetadataObject, __pyx_n_s_MetadataObject, (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); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_Reader__read_bytes, __pyx_t_1) < 0) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":31 - * return result_bytes + /* "DracoPy.pyx":10 * - * def read_uint(self) -> int: # <<<<<<<<<<<<<< - * value = int.from_bytes(self.__read_bytes(4), - * byteorder=self.__get_endian(), signed=False) + * class MetadataObject: + * def __init__(self, entries: Dict[str, bytes] = None, # <<<<<<<<<<<<<< + * sub_metadatas: Dict[str, 'MetadataObject'] = None): + * self.entries = entries if entries else {} */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_int) < 0) __PYX_ERR(0, 31, __pyx_L1_error) - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_7_Reader_7read_uint, 0, __pyx_n_s_Reader_read_uint, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__14)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 31, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Dict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 10, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_read_uint, __pyx_t_3) < 0) __PYX_ERR(0, 31, __pyx_L1_error) + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)(&PyUnicode_Type))); + __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)(&PyUnicode_Type))); + __Pyx_INCREF(((PyObject *)(&PyBytes_Type))); + __Pyx_GIVEREF(((PyObject *)(&PyBytes_Type))); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)(&PyBytes_Type))); + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_entries, __pyx_t_5) < 0) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "DracoPy.pyx":36 - * return value - * - * def read_str(self) -> str: # <<<<<<<<<<<<<< - * count = self.read_uint() - * return self.__read_bytes(count).decode() + /* "DracoPy.pyx":11 + * class MetadataObject: + * def __init__(self, entries: Dict[str, bytes] = None, + * sub_metadatas: Dict[str, 'MetadataObject'] = None): # <<<<<<<<<<<<<< + * self.entries = entries if entries else {} + * self.sub_metadatas = sub_metadatas if sub_metadatas else {} */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 11, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)(&PyUnicode_Type))); + __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)(&PyUnicode_Type))); + __Pyx_INCREF(__pyx_n_u_MetadataObject); + __Pyx_GIVEREF(__pyx_n_u_MetadataObject); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_n_u_MetadataObject); + __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 11, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_u_unicode) < 0) __PYX_ERR(0, 36, __pyx_L1_error) - __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_7_Reader_9read_str, 0, __pyx_n_s_Reader_read_str, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__16)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_sub_metadatas, __pyx_t_3) < 0) __PYX_ERR(0, 10, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_read_str, __pyx_t_1) < 0) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":40 - * return self.__read_bytes(count).decode() + /* "DracoPy.pyx":10 * - * def read_bytes(self) -> bytes: # <<<<<<<<<<<<<< - * count = self.read_uint() - * return self.__read_bytes(count) + * class MetadataObject: + * def __init__(self, entries: Dict[str, bytes] = None, # <<<<<<<<<<<<<< + * sub_metadatas: Dict[str, 'MetadataObject'] = None): + * self.entries = entries if entries else {} */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_return, __pyx_n_u_bytes) < 0) __PYX_ERR(0, 40, __pyx_L1_error) - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_7_Reader_11read_bytes, 0, __pyx_n_s_Reader_read_bytes, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__18)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 40, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_14MetadataObject_1__init__, 0, __pyx_n_s_MetadataObject___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); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_read_bytes, __pyx_t_3) < 0) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__8); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + 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; - /* "DracoPy.pyx":44 - * return self.__read_bytes(count) + /* "DracoPy.pyx":9 * - * def is_end(self) -> bool: # <<<<<<<<<<<<<< - * return len(self._in_bytes) == self._pos * + * class MetadataObject: # <<<<<<<<<<<<<< + * def __init__(self, entries: Dict[str, bytes] = None, + * sub_metadatas: Dict[str, 'MetadataObject'] = None): */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_3 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_MetadataObject, __pyx_empty_tuple, __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_t_3, __pyx_n_s_return, __pyx_n_u_bool) < 0) __PYX_ERR(0, 44, __pyx_L1_error) - __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_7_Reader_13is_end, 0, __pyx_n_s_Reader_is_end, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__20)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_1, __pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_MetadataObject, __pyx_t_3) < 0) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_is_end, __pyx_t_1) < 0) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":10 + /* "DracoPy.pyx":16 * * - * class _Reader: # <<<<<<<<<<<<<< - * def __init__(self, in_bytes: bytes): - * self._in_bytes = in_bytes + * class AttributeMetadataObject(MetadataObject): # <<<<<<<<<<<<<< + * def __init__(self, unique_id: int, + * entries: Dict[str, bytes] = None, */ - __pyx_t_1 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_Reader, __pyx_empty_tuple, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_MetadataObject); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_Reader, __pyx_t_1) < 0) __PYX_ERR(0, 10, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_AttributeMetadataObject, __pyx_n_s_AttributeMetadataObject, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); - /* "DracoPy.pyx":48 - * + /* "DracoPy.pyx":17 * - * class MetadataObject: # <<<<<<<<<<<<<< - * def __init__(self, entries: typing.Dict[str, bytes] = None, - * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None): + * class AttributeMetadataObject(MetadataObject): + * def __init__(self, unique_id: int, # <<<<<<<<<<<<<< + * entries: Dict[str, bytes] = None, + * sub_metadatas: Dict[str, 'MetadataObject'] = None): */ - __pyx_t_2 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_MetadataObject, __pyx_n_s_MetadataObject, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_unique_id, __pyx_n_u_int) < 0) __PYX_ERR(0, 17, __pyx_L1_error) - /* "DracoPy.pyx":49 - * - * class MetadataObject: - * def __init__(self, entries: typing.Dict[str, bytes] = None, # <<<<<<<<<<<<<< - * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None): - * self.entries = entries if entries else {} + /* "DracoPy.pyx":18 + * class AttributeMetadataObject(MetadataObject): + * def __init__(self, unique_id: int, + * entries: Dict[str, bytes] = None, # <<<<<<<<<<<<<< + * sub_metadatas: Dict[str, 'MetadataObject'] = None): + * super().__init__(entries, sub_metadatas) */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_typing); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_Dict); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(((PyObject *)(&PyUnicode_Type))); __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)(&PyUnicode_Type))); + PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)(&PyUnicode_Type))); __Pyx_INCREF(((PyObject *)(&PyBytes_Type))); __Pyx_GIVEREF(((PyObject *)(&PyBytes_Type))); - PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)(&PyBytes_Type))); - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_entries, __pyx_t_5) < 0) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)(&PyBytes_Type))); + __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_entries, __pyx_t_8) < 0) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "DracoPy.pyx":50 - * class MetadataObject: - * def __init__(self, entries: typing.Dict[str, bytes] = None, - * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None): # <<<<<<<<<<<<<< - * self.entries = entries if entries else {} - * self.sub_metadatas = sub_metadatas if sub_metadatas else {} + /* "DracoPy.pyx":19 + * def __init__(self, unique_id: int, + * entries: Dict[str, bytes] = None, + * sub_metadatas: Dict[str, 'MetadataObject'] = None): # <<<<<<<<<<<<<< + * super().__init__(entries, sub_metadatas) + * self.unique_id = unique_id */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_typing); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_Dict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_Dict); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(((PyObject *)(&PyUnicode_Type))); __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)(&PyUnicode_Type))); + PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)(&PyUnicode_Type))); __Pyx_INCREF(__pyx_n_u_MetadataObject); __Pyx_GIVEREF(__pyx_n_u_MetadataObject); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_n_u_MetadataObject); - __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_sub_metadatas, __pyx_t_4) < 0) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_n_u_MetadataObject); + __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_sub_metadatas, __pyx_t_6) < 0) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "DracoPy.pyx":49 + /* "DracoPy.pyx":17 * - * class MetadataObject: - * def __init__(self, entries: typing.Dict[str, bytes] = None, # <<<<<<<<<<<<<< - * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None): - * self.entries = entries if entries else {} + * class AttributeMetadataObject(MetadataObject): + * def __init__(self, unique_id: int, # <<<<<<<<<<<<<< + * entries: Dict[str, bytes] = None, + * sub_metadatas: Dict[str, 'MetadataObject'] = None): */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_14MetadataObject_1__init__, 0, __pyx_n_s_MetadataObject___init, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__22)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__23); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_1); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_4) < 0) __PYX_ERR(0, 49, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_23AttributeMetadataObject_1__init__, 0, __pyx_n_s_AttributeMetadataObject___init, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__10)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_t_6); + PyList_Append(__pyx_t_4, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_6, __pyx_tuple__11); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_6) < 0) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "DracoPy.pyx":48 + /* "DracoPy.pyx":16 * * - * class MetadataObject: # <<<<<<<<<<<<<< - * def __init__(self, entries: typing.Dict[str, bytes] = None, - * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None): + * class AttributeMetadataObject(MetadataObject): # <<<<<<<<<<<<<< + * def __init__(self, unique_id: int, + * entries: Dict[str, bytes] = None, */ - __pyx_t_4 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_MetadataObject, __pyx_empty_tuple, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_MetadataObject, __pyx_t_4) < 0) __PYX_ERR(0, 48, __pyx_L1_error) + __pyx_t_6 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_AttributeMetadataObject, __pyx_t_3, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 16, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_CyFunction_InitClassCell(__pyx_t_4, __pyx_t_6) < 0) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_AttributeMetadataObject, __pyx_t_6) < 0) __PYX_ERR(0, 16, __pyx_L1_error) + __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; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":55 + /* "DracoPy.pyx":24 * * * class GeometryMetadataObject(MetadataObject): # <<<<<<<<<<<<<< - * def __init__(self, entries: typing.Dict[str, bytes] = None, - * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None, + * def __init__(self, entries: Dict[str, bytes] = None, + * sub_metadatas: Dict[str, 'MetadataObject'] = None, */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_MetadataObject); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 55, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_4); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_4, __pyx_n_s_GeometryMetadataObject, __pyx_n_s_GeometryMetadataObject, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_MetadataObject); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 55, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_3, __pyx_t_1, __pyx_n_s_GeometryMetadataObject, __pyx_n_s_GeometryMetadataObject, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); - /* "DracoPy.pyx":56 + /* "DracoPy.pyx":25 * * class GeometryMetadataObject(MetadataObject): - * def __init__(self, entries: typing.Dict[str, bytes] = None, # <<<<<<<<<<<<<< - * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None, - * attribute_metadatas: typing.List['MetadataObject'] = None): + * def __init__(self, entries: Dict[str, bytes] = None, # <<<<<<<<<<<<<< + * sub_metadatas: Dict[str, 'MetadataObject'] = None, + * attribute_metadatas: List['AttributeMetadataObject'] = None): */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_typing); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_Dict); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 56, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 56, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(((PyObject *)(&PyUnicode_Type))); __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); - PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)(&PyUnicode_Type))); + PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)(&PyUnicode_Type))); __Pyx_INCREF(((PyObject *)(&PyBytes_Type))); __Pyx_GIVEREF(((PyObject *)(&PyBytes_Type))); - PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)(&PyBytes_Type))); - __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 56, __pyx_L1_error) + PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)(&PyBytes_Type))); + __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_entries, __pyx_t_8) < 0) __PYX_ERR(0, 56, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_entries, __pyx_t_8) < 0) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "DracoPy.pyx":57 + /* "DracoPy.pyx":26 * class GeometryMetadataObject(MetadataObject): - * def __init__(self, entries: typing.Dict[str, bytes] = None, - * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None, # <<<<<<<<<<<<<< - * attribute_metadatas: typing.List['MetadataObject'] = None): + * def __init__(self, entries: Dict[str, bytes] = None, + * sub_metadatas: Dict[str, 'MetadataObject'] = None, # <<<<<<<<<<<<<< + * attribute_metadatas: List['AttributeMetadataObject'] = None): * super().__init__(entries, sub_metadatas) */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_typing); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_Dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_Dict); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 26, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(((PyObject *)(&PyUnicode_Type))); __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); - PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)(&PyUnicode_Type))); + PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)(&PyUnicode_Type))); __Pyx_INCREF(__pyx_n_u_MetadataObject); __Pyx_GIVEREF(__pyx_n_u_MetadataObject); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_n_u_MetadataObject); - __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_n_u_MetadataObject); + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_sub_metadatas, __pyx_t_7) < 0) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_sub_metadatas, __pyx_t_5) < 0) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "DracoPy.pyx":58 - * def __init__(self, entries: typing.Dict[str, bytes] = None, - * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None, - * attribute_metadatas: typing.List['MetadataObject'] = None): # <<<<<<<<<<<<<< + /* "DracoPy.pyx":27 + * def __init__(self, entries: Dict[str, bytes] = None, + * sub_metadatas: Dict[str, 'MetadataObject'] = None, + * attribute_metadatas: List['AttributeMetadataObject'] = None): # <<<<<<<<<<<<<< * super().__init__(entries, sub_metadatas) * self.attribute_metadatas = attribute_metadatas if attribute_metadatas \ */ - __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_typing); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 58, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_List); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 58, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_t_8, __pyx_n_u_MetadataObject); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_List); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 27, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_t_5, __pyx_n_u_AttributeMetadataObject); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 27, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_attribute_metadatas, __pyx_t_7) < 0) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_attribute_metadatas, __pyx_t_7) < 0) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "DracoPy.pyx":56 + /* "DracoPy.pyx":25 * * class GeometryMetadataObject(MetadataObject): - * def __init__(self, entries: typing.Dict[str, bytes] = None, # <<<<<<<<<<<<<< - * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None, - * attribute_metadatas: typing.List['MetadataObject'] = None): + * def __init__(self, entries: Dict[str, bytes] = None, # <<<<<<<<<<<<<< + * sub_metadatas: Dict[str, 'MetadataObject'] = None, + * attribute_metadatas: List['AttributeMetadataObject'] = None): */ - __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_22GeometryMetadataObject_1__init__, 0, __pyx_n_s_GeometryMetadataObject___init, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__25)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 56, __pyx_L1_error) + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_22GeometryMetadataObject_1__init__, 0, __pyx_n_s_GeometryMetadataObject___init, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(__pyx_t_7); - PyList_Append(__pyx_t_5, __pyx_t_7); + PyList_Append(__pyx_t_6, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__26); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_7) < 0) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__14); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_7) < 0) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "DracoPy.pyx":55 + /* "DracoPy.pyx":24 * * * class GeometryMetadataObject(MetadataObject): # <<<<<<<<<<<<<< - * def __init__(self, entries: typing.Dict[str, bytes] = None, - * sub_metadatas: typing.Dict[str, 'MetadataObject'] = None, + * def __init__(self, entries: Dict[str, bytes] = None, + * sub_metadatas: Dict[str, 'MetadataObject'] = None, */ - __pyx_t_7 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_GeometryMetadataObject, __pyx_t_4, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 55, __pyx_L1_error) + __pyx_t_7 = __Pyx_Py3ClassCreate(__pyx_t_3, __pyx_n_s_GeometryMetadataObject, __pyx_t_1, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - if (__Pyx_CyFunction_InitClassCell(__pyx_t_5, __pyx_t_7) < 0) __PYX_ERR(0, 55, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_GeometryMetadataObject, __pyx_t_7) < 0) __PYX_ERR(0, 55, __pyx_L1_error) + if (__Pyx_CyFunction_InitClassCell(__pyx_t_6, __pyx_t_7) < 0) __PYX_ERR(0, 24, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_GeometryMetadataObject, __pyx_t_7) < 0) __PYX_ERR(0, 24, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":64 + /* "DracoPy.pyx":33 * * - * def _parse_binary_metadata(binary_metadata: bytes) -> MetadataObject: # <<<<<<<<<<<<<< - * reader = _Reader(binary_metadata) - * geometry_metadata = GeometryMetadataObject() + * def decode_metadata(binary_metadata: bytes) -> MetadataObject: # <<<<<<<<<<<<<< + * ss = new stringstream(binary_metadata) + * reader = new DracoPy.MetadataReader(ss) */ - __pyx_t_4 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_1_parse_binary_metadata, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_parse_binary_metadata, __pyx_t_4) < 0) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_1decode_metadata, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode_metadata, __pyx_t_1) < 0) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "DracoPy.pyx":67 + * return geometry_metadata + * + * def encode_metadata(geometry_metadata: GeometryMetadataObject) -> bytes: # <<<<<<<<<<<<<< + * ss = new stringstream(b"") + * writer = new DracoPy.MetadataWriter(ss) + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_3encode_metadata, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_metadata, __pyx_t_1) < 0) __PYX_ERR(0, 67, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "DracoPy.pyx":96 * @@ -9440,10 +9337,10 @@ if (!__Pyx_RefNanny) { * def __init__(self, data_struct): * self.data_struct = data_struct */ - __pyx_t_4 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__30); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 96, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_4, __pyx_tuple__30, __pyx_n_s_DracoPointCloud, __pyx_n_s_DracoPointCloud, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__20); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__20, __pyx_n_s_DracoPointCloud, __pyx_n_s_DracoPointCloud, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 96, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); /* "DracoPy.pyx":97 * @@ -9452,22 +9349,22 @@ if (!__Pyx_RefNanny) { * self.data_struct = data_struct * if data_struct['encoding_options_set']: */ - __pyx_t_1 = __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__32)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_1) < 0) __PYX_ERR(0, 97, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __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__22)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "DracoPy.pyx":106 - * self.metadata = _parse_binary_metadata(data_struct["binary_metadata"]) + * self.metadata = decode_metadata(data_struct["binary_metadata"]) * * 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_1 = __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__34)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_get_encoded_coordinate, __pyx_t_1) < 0) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __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__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 106, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_get_encoded_coordinate, __pyx_t_2) < 0) __PYX_ERR(0, 106, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "DracoPy.pyx":110 * return self.encoding_options.get_encoded_coordinate(value, axis) @@ -9476,10 +9373,10 @@ if (!__Pyx_RefNanny) { * if self.encoding_options is not None: * return self.encoding_options.get_encoded_point(point) */ - __pyx_t_1 = __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__36)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_get_encoded_point, __pyx_t_1) < 0) __PYX_ERR(0, 110, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __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__26)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_get_encoded_point, __pyx_t_2) < 0) __PYX_ERR(0, 110, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "DracoPy.pyx":115 * @@ -9488,8 +9385,8 @@ if (!__Pyx_RefNanny) { * return 3 * */ - __pyx_t_1 = __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__38)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 115, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __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__28)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 115, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); /* "DracoPy.pyx":114 * return self.encoding_options.get_encoded_point(point) @@ -9498,10 +9395,10 @@ if (!__Pyx_RefNanny) { * def num_axes(self): * return 3 */ - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 114, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_num_axes, __pyx_t_7) < 0) __PYX_ERR(0, 115, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_num_axes, __pyx_t_7) < 0) __PYX_ERR(0, 115, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; /* "DracoPy.pyx":119 @@ -9511,7 +9408,7 @@ if (!__Pyx_RefNanny) { * return self.data_struct['points'] * */ - __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_9points, 0, __pyx_n_s_DracoPointCloud_points, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__40)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 119, __pyx_L1_error) + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_9points, 0, __pyx_n_s_DracoPointCloud_points, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 119, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); /* "DracoPy.pyx":118 @@ -9521,11 +9418,11 @@ if (!__Pyx_RefNanny) { * def points(self): * return self.data_struct['points'] */ - __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_7); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_points, __pyx_t_1) < 0) __PYX_ERR(0, 119, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_points, __pyx_t_2) < 0) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "DracoPy.pyx":96 * @@ -9534,12 +9431,12 @@ if (!__Pyx_RefNanny) { * def __init__(self, data_struct): * self.data_struct = data_struct */ - __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_4, __pyx_n_s_DracoPointCloud, __pyx_tuple__30, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoPointCloud, __pyx_t_1) < 0) __PYX_ERR(0, 96, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoPointCloud, __pyx_tuple__20, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoPointCloud, __pyx_t_2) < 0) __PYX_ERR(0, 96, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "DracoPy.pyx":123 * @@ -9548,17 +9445,17 @@ if (!__Pyx_RefNanny) { * @property * def faces(self): */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_4, __pyx_t_2, __pyx_n_s_DracoMesh, __pyx_n_s_DracoMesh, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_DracoMesh, __pyx_n_s_DracoMesh, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); /* "DracoPy.pyx":125 * class DracoMesh(DracoPointCloud): @@ -9567,7 +9464,7 @@ if (!__Pyx_RefNanny) { * return self.data_struct['faces'] * */ - __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_9DracoMesh_1faces, 0, __pyx_n_s_DracoMesh_faces, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__42)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 125, __pyx_L1_error) + __pyx_t_7 = __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_7)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); /* "DracoPy.pyx":124 @@ -9577,11 +9474,11 @@ if (!__Pyx_RefNanny) { * def faces(self): * return self.data_struct['faces'] */ - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 124, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 124, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_faces, __pyx_t_5) < 0) __PYX_ERR(0, 125, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_faces, __pyx_t_6) < 0) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; /* "DracoPy.pyx":129 * @@ -9590,8 +9487,8 @@ if (!__Pyx_RefNanny) { * 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__44)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __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_6)) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); /* "DracoPy.pyx":128 * return self.data_struct['faces'] @@ -9600,10 +9497,10 @@ if (!__Pyx_RefNanny) { * def normals(self): * return self.data_struct['normals'] */ - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 128, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 128, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_normals, __pyx_t_7) < 0) __PYX_ERR(0, 129, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_normals, __pyx_t_7) < 0) __PYX_ERR(0, 129, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; /* "DracoPy.pyx":123 @@ -9613,13 +9510,13 @@ if (!__Pyx_RefNanny) { * @property * def faces(self): */ - __pyx_t_7 = __Pyx_Py3ClassCreate(__pyx_t_4, __pyx_n_s_DracoMesh, __pyx_t_2, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 123, __pyx_L1_error) + __pyx_t_7 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoMesh, __pyx_t_3, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoMesh, __pyx_t_7) < 0) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 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_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "DracoPy.pyx":132 * return self.data_struct['normals'] @@ -9628,10 +9525,10 @@ if (!__Pyx_RefNanny) { * def __init__(self, quantization_bits, quantization_range, quantization_origin): * self.quantization_bits = quantization_bits */ - __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__45); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_tuple__45, __pyx_n_s_EncodingOptions, __pyx_n_s_EncodingOptions, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__35); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_3, __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, 132, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); /* "DracoPy.pyx":133 * @@ -9640,10 +9537,10 @@ if (!__Pyx_RefNanny) { * self.quantization_bits = quantization_bits * self.quantization_range = quantization_range */ - __pyx_t_1 = __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__47)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_SetNameInClass(__pyx_t_4, __pyx_n_s_init, __pyx_t_1) < 0) __PYX_ERR(0, 133, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __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_2)) __PYX_ERR(0, 133, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 133, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "DracoPy.pyx":139 * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) @@ -9652,10 +9549,10 @@ if (!__Pyx_RefNanny) { * 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_1 = __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__49)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_SetNameInClass(__pyx_t_4, __pyx_n_s_get_encoded_coordinate, __pyx_t_1) < 0) __PYX_ERR(0, 139, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __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_2)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_encoded_coordinate, __pyx_t_2) < 0) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "DracoPy.pyx":146 * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) @@ -9664,10 +9561,10 @@ if (!__Pyx_RefNanny) { * encoded_point = [] * for axis in range(self.num_axes): */ - __pyx_t_1 = __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__51)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_SetNameInClass(__pyx_t_4, __pyx_n_s_get_encoded_point, __pyx_t_1) < 0) __PYX_ERR(0, 146, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __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_2)) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_encoded_point, __pyx_t_2) < 0) __PYX_ERR(0, 146, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "DracoPy.pyx":153 * @@ -9676,8 +9573,8 @@ if (!__Pyx_RefNanny) { * return 3 * */ - __pyx_t_1 = __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__53)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __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_2)) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); /* "DracoPy.pyx":152 * return encoded_point @@ -9686,10 +9583,10 @@ if (!__Pyx_RefNanny) { * def num_axes(self): * return 3 */ - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 152, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 152, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_SetNameInClass(__pyx_t_4, __pyx_n_s_num_axes, __pyx_t_7) < 0) __PYX_ERR(0, 153, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_num_axes, __pyx_t_7) < 0) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; /* "DracoPy.pyx":132 @@ -9699,12 +9596,12 @@ if (!__Pyx_RefNanny) { * def __init__(self, quantization_bits, quantization_range, quantization_origin): * self.quantization_bits = quantization_bits */ - __pyx_t_7 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_EncodingOptions, __pyx_tuple__45, __pyx_t_4, NULL, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 132, __pyx_L1_error) + __pyx_t_7 = __Pyx_Py3ClassCreate(__pyx_t_3, __pyx_n_s_EncodingOptions, __pyx_tuple__35, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingOptions, __pyx_t_7) < 0) __PYX_ERR(0, 132, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 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_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "DracoPy.pyx":156 * return 3 @@ -9713,22 +9610,22 @@ if (!__Pyx_RefNanny) { * pass * */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __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_4 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_4, __pyx_t_2, __pyx_n_s_FileTypeException, __pyx_n_s_FileTypeException, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_4, __pyx_n_s_FileTypeException, __pyx_t_2, __pyx_t_7, NULL, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error) + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_FileTypeException, __pyx_t_1) < 0) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_FileTypeException, __pyx_n_s_FileTypeException, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_FileTypeException, __pyx_t_3, __pyx_t_7, NULL, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_FileTypeException, __pyx_t_2) < 0) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "DracoPy.pyx":159 * pass @@ -9737,98 +9634,98 @@ if (!__Pyx_RefNanny) { * pass * */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __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_4 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 159, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_4, __pyx_t_2, __pyx_n_s_EncodingFailedException, __pyx_n_s_EncodingFailedException, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 159, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_1 = __Pyx_Py3ClassCreate(__pyx_t_4, __pyx_n_s_EncodingFailedException, __pyx_t_2, __pyx_t_7, NULL, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error) + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingFailedException, __pyx_t_1) < 0) __PYX_ERR(0, 159, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_EncodingFailedException, __pyx_n_s_EncodingFailedException, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_2 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_EncodingFailedException, __pyx_t_3, __pyx_t_7, NULL, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingFailedException, __pyx_t_2) < 0) __PYX_ERR(0, 159, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "DracoPy.pyx":162 * 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. + * def encode_mesh_to_buffer(points, faces, metadata: GeometryMetadataObject = None, # <<<<<<<<<<<<<< + * quantization_bits=14, compression_level=1, + * quantization_range=-1, quantization_origin=None, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_3encode_mesh_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __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, 162, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_5encode_mesh_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_mesh_to_buffer, __pyx_t_3) < 0) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":193 + /* "DracoPy.pyx":202 * 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. + * def encode_point_cloud_to_buffer(points, metadata: GeometryMetadataObject = None, # <<<<<<<<<<<<<< + * quantization_bits=14, compression_level=1, + * quantization_range=-1, quantization_origin=None, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_5encode_point_cloud_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 193, __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, 193, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_7encode_point_cloud_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_point_cloud_to_buffer, __pyx_t_3) < 0) __PYX_ERR(0, 202, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":224 + /* "DracoPy.pyx":241 * 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_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_7raise_decoding_error, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 224, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_raise_decoding_error, __pyx_t_2) < 0) __PYX_ERR(0, 224, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_9raise_decoding_error, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 241, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_raise_decoding_error, __pyx_t_3) < 0) __PYX_ERR(0, 241, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":232 + /* "DracoPy.pyx":249 * 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: */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_9decode_buffer_to_mesh, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 232, __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, 232, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_11decode_buffer_to_mesh, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode_buffer_to_mesh, __pyx_t_3) < 0) __PYX_ERR(0, 249, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":239 + /* "DracoPy.pyx":256 * 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_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_11decode_point_cloud_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 239, __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, 239, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_13decode_point_cloud_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 256, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode_point_cloud_buffer, __pyx_t_3) < 0) __PYX_ERR(0, 256, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "DracoPy.pyx":1 * # distutils: language = c++ # <<<<<<<<<<<<<< - * import typing + * from typing import Dict, List * */ - __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; + __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "string.to_py":55 + /* "vector.to_py":60 * - * @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()) + * @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())] * */ @@ -9909,32 +9806,6 @@ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { return result; } -/* RaiseArgTupleInvalid */ -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) -{ - Py_ssize_t num_expected; - const char *more_or_less; - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; - } else { - num_expected = num_max; - more_or_less = "at most"; - } - if (exact) { - more_or_less = "exactly"; - } - PyErr_Format(PyExc_TypeError, - "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); -} - /* RaiseDoubleKeywords */ static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, @@ -9942,470 +9813,172 @@ static void __Pyx_RaiseDoubleKeywordsError( { PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AsString(kw_name)); - #endif -} - -/* ParseKeywords */ -static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; - continue; - } - name = first_kw_arg; - #if PY_MAJOR_VERSION < 3 - if (likely(PyString_Check(key))) { - while (*name) { - if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) - && _PyString_Eq(**name, key)) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - if ((**argname == key) || ( - (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) - && _PyString_Eq(**argname, key))) { - goto arg_passed_twice; - } - argname++; - } - } - } else - #endif - if (likely(PyUnicode_Check(key))) { - while (*name) { - int cmp = (**name == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; - } - } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - 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 -bad: - return -1; -} - -/* 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; -} - -/* PyObjectSetAttrStr */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_setattro)) - return tp->tp_setattro(obj, attr_name, value); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_setattr)) - return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value); -#endif - return PyObject_SetAttr(obj, attr_name, value); -} -#endif - -/* 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: - Py_XDECREF(owned_instance); - return; + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); + #endif } -#endif -/* SliceObject */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(PyObject* obj, - Py_ssize_t cstart, Py_ssize_t cstop, - PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, - int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { -#if CYTHON_USE_TYPE_SLOTS - PyMappingMethods* mp; -#if PY_MAJOR_VERSION < 3 - PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence; - if (likely(ms && ms->sq_slice)) { - if (!has_cstart) { - if (_py_start && (*_py_start != Py_None)) { - cstart = __Pyx_PyIndex_AsSsize_t(*_py_start); - if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; - } else - cstart = 0; +/* ParseKeywords */ +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + continue; } - if (!has_cstop) { - if (_py_stop && (*_py_stop != Py_None)) { - cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop); - if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; - } else - cstop = PY_SSIZE_T_MAX; - } - if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) { - Py_ssize_t l = ms->sq_length(obj); - if (likely(l >= 0)) { - if (cstop < 0) { - cstop += l; - if (cstop < 0) cstop = 0; + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; + break; } - if (cstart < 0) { - cstart += l; - if (cstart < 0) cstart = 0; + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; } - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - goto bad; - PyErr_Clear(); } - } - return ms->sq_slice(obj, cstart, cstop); - } -#endif - mp = Py_TYPE(obj)->tp_as_mapping; - if (likely(mp && mp->mp_subscript)) -#endif - { - PyObject* result; - PyObject *py_slice, *py_start, *py_stop; - if (_py_slice) { - py_slice = *_py_slice; - } else { - PyObject* owned_start = NULL; - PyObject* owned_stop = NULL; - if (_py_start) { - py_start = *_py_start; - } else { - if (has_cstart) { - owned_start = py_start = PyInt_FromSsize_t(cstart); - if (unlikely(!py_start)) goto bad; - } else - py_start = Py_None; + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; } - if (_py_stop) { - py_stop = *_py_stop; - } else { - if (has_cstop) { - owned_stop = py_stop = PyInt_FromSsize_t(cstop); - if (unlikely(!py_stop)) { - Py_XDECREF(owned_start); - goto bad; - } - } else - py_stop = Py_None; + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } } - py_slice = PySlice_New(py_start, py_stop, Py_None); - Py_XDECREF(owned_start); - Py_XDECREF(owned_stop); - if (unlikely(!py_slice)) goto bad; - } -#if CYTHON_USE_TYPE_SLOTS - result = mp->mp_subscript(obj, py_slice); -#else - result = PyObject_GetItem(obj, py_slice); -#endif - if (!_py_slice) { - Py_DECREF(py_slice); + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; } - return result; } + 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, - "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name); + #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 NULL; + return -1; } -/* PyCFunctionFastCall */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - int flags = PyCFunction_GET_FLAGS(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { - return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); +/* RaiseArgTupleInvalid */ +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) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; } else { - return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +/* PyObjectSetAttrStr */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_setattro)) + return tp->tp_setattro(obj, attr_name, value); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_setattr)) + return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value); +#endif + return PyObject_SetAttr(obj, attr_name, value); +} +#endif + +/* 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 @@ -10507,137 +10080,70 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, } else { d = NULL; - nd = 0; - } -#if PY_MAJOR_VERSION >= 3 - result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, - args, (int)nargs, - k, (int)nk, - d, (int)nd, kwdefs, closure); -#else - result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, - args, (int)nargs, - k, (int)nk, - d, (int)nd, closure); -#endif - Py_XDECREF(kwtuple); -done: - Py_LeaveRecursiveCall(); - return result; -} -#endif -#endif - -/* PyObjectCall2Args */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { - PyObject *args, *result = NULL; - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyFunction_FastCall(function, args, 2); - } - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyCFunction_FastCall(function, args, 2); - } - #endif - args = PyTuple_New(2); - if (unlikely(!args)) goto done; - Py_INCREF(arg1); - PyTuple_SET_ITEM(args, 0, arg1); - Py_INCREF(arg2); - PyTuple_SET_ITEM(args, 1, arg2); - Py_INCREF(function); - result = __Pyx_PyObject_Call(function, args, NULL); - Py_DECREF(args); - Py_DECREF(function); -done: - return result; -} - -/* PyObjectCallMethO */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); + nd = 0; } - return result; -} +#if PY_MAJOR_VERSION >= 3 + result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, + args, (int)nargs, + k, (int)nk, + d, (int)nd, kwdefs, closure); +#else + result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, + args, (int)nargs, + k, (int)nk, + d, (int)nd, closure); #endif - -/* PyObjectCallOneArg */ -#if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); + Py_XDECREF(kwtuple); +done: + Py_LeaveRecursiveCall(); return result; } -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); - } #endif - if (likely(PyCFunction_Check(func))) { - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (__Pyx_PyFastCFunction_Check(func)) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); #endif - } + +/* PyCFunctionFastCall */ +#if CYTHON_FAST_PYCCALL +static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { + PyCFunctionObject *func = (PyCFunctionObject*)func_obj; + PyCFunction meth = PyCFunction_GET_FUNCTION(func); + PyObject *self = PyCFunction_GET_SELF(func); + int flags = PyCFunction_GET_FLAGS(func); + assert(PyCFunction_Check(func)); + assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); + assert(nargs >= 0); + assert(nargs == 0 || args != NULL); + /* _PyCFunction_FastCallDict() must not be called with an exception set, + because it may clear it (directly or indirectly) and so the + caller loses its exception */ + assert(!PyErr_Occurred()); + if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { + return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); + } else { + return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; } #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); +/* 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; } -#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); - } + else if (exact) { + #if PY_MAJOR_VERSION == 2 + if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; + #endif } - return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); + 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; } -#endif /* PyDictVersioning */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS @@ -10700,6 +10206,117 @@ static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) return __Pyx_GetBuiltinName(name); } +/* PyObjectCallMethO */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = PyCFunction_GET_FUNCTION(func); + self = PyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#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 + +/* PyObjectCallOneArg */ +#if CYTHON_COMPILING_IN_CPYTHON +static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_New(1); + if (unlikely(!args)) return NULL; + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 0, arg); + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { +#if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCall(func, &arg, 1); + } +#endif + if (likely(PyCFunction_Check(func))) { + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, arg); +#if CYTHON_FAST_PYCCALL + } else if (__Pyx_PyFastCFunction_Check(func)) { + return __Pyx_PyCFunction_FastCall(func, &arg, 1); +#endif + } + } + return __Pyx__PyObject_CallOneArg(func, arg); +} +#else +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_Pack(1, arg); + if (unlikely(!args)) return NULL; + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; +} +#endif + +/* PyObjectCall2Args */ +static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { + PyObject *args, *result = NULL; + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(function)) { + PyObject *args[2] = {arg1, arg2}; + return __Pyx_PyFunction_FastCall(function, args, 2); + } + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(function)) { + PyObject *args[2] = {arg1, arg2}; + return __Pyx_PyCFunction_FastCall(function, args, 2); + } + #endif + args = PyTuple_New(2); + if (unlikely(!args)) goto done; + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 0, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 1, arg2); + Py_INCREF(function); + result = __Pyx_PyObject_Call(function, args, NULL); + Py_DECREF(args); + Py_DECREF(function); +done: + return result; +} + /* PyObjectGetMethod */ static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { PyObject *attr; @@ -10802,29 +10419,286 @@ static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) { Py_DECREF(method); return result; } -static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { - PyObject *method = NULL, *result; +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { + PyObject *method = NULL, *result; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_Call2Args(method, obj, arg); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) return NULL; + return __Pyx__PyObject_CallMethod1(method, arg); +} + +/* append */ +static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) { + if (likely(PyList_CheckExact(L))) { + if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1; + } else { + PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x); + if (unlikely(!retval)) + return -1; + Py_DECREF(retval); + } + return 0; +} + +/* 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 +} + +/* 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_Call2Args(method, obj, arg); + result = __Pyx_PyObject_CallOneArg(method, obj); Py_DECREF(method); return result; } - if (unlikely(!method)) return NULL; - return __Pyx__PyObject_CallMethod1(method, arg); + if (unlikely(!method)) goto bad; + result = __Pyx_PyObject_CallNoArg(method); + Py_DECREF(method); +bad: + return result; } -/* append */ -static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) { - if (likely(PyList_CheckExact(L))) { - if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1; - } else { - PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x); - if (unlikely(!retval)) - return -1; +/* 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; } /* DictGetItem */ @@ -11090,55 +10964,238 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, return r; } } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); - if (likely(l >= 0)) { - i += l; - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return NULL; - PyErr_Clear(); - } - } - return m->sq_item(o, i); + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); + } + } + return m->sq_item(o, i); + } + } +#else + if (is_list || PySequence_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +/* ObjectGetItem */ +#if CYTHON_USE_TYPE_SLOTS +static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { + PyObject *runerr; + Py_ssize_t key_value; + PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence; + if (unlikely(!(m && m->sq_item))) { + PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name); + return NULL; + } + key_value = __Pyx_PyIndex_AsSsize_t(index); + if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { + return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); + } + if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { + PyErr_Clear(); + PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name); + } + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { + PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping; + if (likely(m && m->mp_subscript)) { + return m->mp_subscript(obj, key); + } + return __Pyx_PyObject_GetIndex(obj, 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 - if (is_list || PySequence_Check(o)) { - return PySequence_GetItem(o, i); - } + 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 - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -} - -/* ObjectGetItem */ -#if CYTHON_USE_TYPE_SLOTS -static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { - PyObject *runerr; - Py_ssize_t key_value; - PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence; - if (unlikely(!(m && m->sq_item))) { - PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name); - return NULL; - } - key_value = __Pyx_PyIndex_AsSsize_t(index); - if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { - return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); - } - if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { - PyErr_Clear(); - PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name); - } - return NULL; -} -static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { - PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping; - if (likely(m && m->mp_subscript)) { - return m->mp_subscript(obj, key); } - return __Pyx_PyObject_GetIndex(obj, key); +bad: + Py_XDECREF(owned_instance); + return; } #endif @@ -12609,27 +12666,261 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(s Py_DECREF(res); return NULL; } - /* CIntFromPy */ - static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { + /* 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); + } +} + +/* CIntFromPy */ + static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) { +#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 PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(uint32_t) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(uint32_t, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (uint32_t) 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 (uint32_t) 0; + case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, digits[0]) + case 2: + if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) >= 2 * PyLong_SHIFT) { + return (uint32_t) (((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); + } + } + break; + case 3: + if (8 * sizeof(uint32_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) >= 3 * PyLong_SHIFT) { + return (uint32_t) (((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); + } + } + break; + case 4: + if (8 * sizeof(uint32_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_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(uint32_t) >= 4 * PyLong_SHIFT) { + return (uint32_t) (((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)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 (uint32_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if (sizeof(uint32_t) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, 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 (uint32_t) 0; + case -1: __PYX_VERIFY_RETURN_INT(uint32_t, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, +digits[0]) + case -2: + if (8 * sizeof(uint32_t) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { + return (uint32_t) (((uint32_t)-1)*(((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + case 2: + if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { + return (uint32_t) ((((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + case -3: + if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { + return (uint32_t) (((uint32_t)-1)*(((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + case 3: + if (8 * sizeof(uint32_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { + return (uint32_t) ((((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + case -4: + if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_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(uint32_t) - 1 > 4 * PyLong_SHIFT) { + return (uint32_t) (((uint32_t)-1)*(((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + case 4: + if (8 * sizeof(uint32_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_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(uint32_t) - 1 > 4 * PyLong_SHIFT) { + return (uint32_t) ((((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + } +#endif + if (sizeof(uint32_t) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_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 + uint32_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 (uint32_t) -1; + } + } else { + uint32_t val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (uint32_t) -1; + val = __Pyx_PyInt_As_uint32_t(tmp); + Py_DECREF(tmp); + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to uint32_t"); + return (uint32_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to uint32_t"); + return (uint32_t) -1; +} + +/* CIntFromPy */ + static CYTHON_INLINE uint8_t __Pyx_PyInt_As_uint8_t(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 uint8_t neg_one = (uint8_t) -1, const_zero = (uint8_t) 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(uint8_t) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(uint8_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; + return (uint8_t) val; } } else #endif @@ -12638,32 +12929,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 (uint8_t) 0; + case 1: __PYX_VERIFY_RETURN_INT(uint8_t, digit, digits[0]) case 2: - if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(uint8_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])); + __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint8_t) >= 2 * PyLong_SHIFT) { + return (uint8_t) (((((uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])); } } break; case 3: - if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(uint8_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])); + __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint8_t) >= 3 * PyLong_SHIFT) { + return (uint8_t) (((((((uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])); } } break; case 4: - if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(uint8_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])); + __PYX_VERIFY_RETURN_INT(uint8_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(uint8_t) >= 4 * PyLong_SHIFT) { + return (uint8_t) (((((((((uint8_t)digits[3]) << PyLong_SHIFT) | (uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])); } } break; @@ -12677,86 +12968,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 (size_t) -1; + return (uint8_t) -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(uint8_t) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(uint8_t, 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(uint8_t) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(uint8_t, 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 (uint8_t) 0; + case -1: __PYX_VERIFY_RETURN_INT(uint8_t, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(uint8_t, digit, +digits[0]) case -2: - if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(uint8_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]))); + __PYX_VERIFY_RETURN_INT(uint8_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint8_t) - 1 > 2 * PyLong_SHIFT) { + return (uint8_t) (((uint8_t)-1)*(((((uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); } } break; case 2: - if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(uint8_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]))); + __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint8_t) - 1 > 2 * PyLong_SHIFT) { + return (uint8_t) ((((((uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); } } break; case -3: - if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(uint8_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]))); + __PYX_VERIFY_RETURN_INT(uint8_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint8_t) - 1 > 3 * PyLong_SHIFT) { + return (uint8_t) (((uint8_t)-1)*(((((((uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); } } break; case 3: - if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(uint8_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]))); + __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint8_t) - 1 > 3 * PyLong_SHIFT) { + return (uint8_t) ((((((((uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); } } break; case -4: - if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(uint8_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]))); + __PYX_VERIFY_RETURN_INT(uint8_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(uint8_t) - 1 > 4 * PyLong_SHIFT) { + return (uint8_t) (((uint8_t)-1)*(((((((((uint8_t)digits[3]) << PyLong_SHIFT) | (uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); } } break; case 4: - if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(uint8_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]))); + __PYX_VERIFY_RETURN_INT(uint8_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(uint8_t) - 1 > 4 * PyLong_SHIFT) { + return (uint8_t) ((((((((((uint8_t)digits[3]) << PyLong_SHIFT) | (uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); } } break; } #endif - if (sizeof(size_t) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x)) + if (sizeof(uint8_t) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(uint8_t, 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(uint8_t) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(uint8_t, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } @@ -12765,7 +13056,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; + uint8_t val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { @@ -12785,47 +13076,47 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(s return val; } #endif - return (size_t) -1; + return (uint8_t) -1; } } else { - size_t val; + uint8_t val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (size_t) -1; - val = __Pyx_PyInt_As_size_t(tmp); + if (!tmp) return (uint8_t) -1; + val = __Pyx_PyInt_As_uint8_t(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 uint8_t"); + return (uint8_t) -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 uint8_t"); + return (uint8_t) -1; } /* CIntFromPy */ - static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) { + 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 uint32_t neg_one = (uint32_t) -1, const_zero = (uint32_t) 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 PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(uint32_t) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(uint32_t, long, PyInt_AS_LONG(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 (uint32_t) val; + return (size_t) val; } } else #endif @@ -12834,32 +13125,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 (uint32_t) 0; - case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, digits[0]) + case 0: return (size_t) 0; + case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0]) case 2: - if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) >= 2 * PyLong_SHIFT) { - return (uint32_t) (((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); + __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(uint32_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) >= 3 * PyLong_SHIFT) { - return (uint32_t) (((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); + __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(uint32_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_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(uint32_t) >= 4 * PyLong_SHIFT) { - return (uint32_t) (((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); + __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; @@ -12873,86 +13164,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 (uint32_t) -1; + return (size_t) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif - if (sizeof(uint32_t) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned long, PyLong_AsUnsignedLong(x)) + 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(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } 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 CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return (uint32_t) 0; - case -1: __PYX_VERIFY_RETURN_INT(uint32_t, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, +digits[0]) + 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(uint32_t) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { - return (uint32_t) (((uint32_t)-1)*(((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + __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(uint32_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { - return (uint32_t) ((((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + __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(uint32_t) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { - return (uint32_t) (((uint32_t)-1)*(((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + __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(uint32_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { - return (uint32_t) ((((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + __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(uint32_t) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_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(uint32_t) - 1 > 4 * PyLong_SHIFT) { - return (uint32_t) (((uint32_t)-1)*(((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + __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(uint32_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_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(uint32_t) - 1 > 4 * PyLong_SHIFT) { - return (uint32_t) ((((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + __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(uint32_t) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(uint32_t, long, PyLong_AsLong(x)) + if (sizeof(size_t) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(uint32_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } @@ -12961,7 +13252,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 - uint32_t val; + size_t val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { @@ -12981,24 +13272,24 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(s return val; } #endif - return (uint32_t) -1; + return (size_t) -1; } } else { - uint32_t val; + size_t val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (uint32_t) -1; - val = __Pyx_PyInt_As_uint32_t(tmp); + if (!tmp) return (size_t) -1; + val = __Pyx_PyInt_As_size_t(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, - "value too large to convert to uint32_t"); - return (uint32_t) -1; + "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 uint32_t"); - return (uint32_t) -1; + "can't convert negative value to size_t"); + return (size_t) -1; } /* CIntFromPy */ diff --git a/src/DracoPy.h b/src/DracoPy.h index f67a928..4c6d7b0 100644 --- a/src/DracoPy.h +++ b/src/DracoPy.h @@ -10,45 +10,12 @@ #include "draco/mesh/triangle_soup_mesh_builder.h" #include "draco/point_cloud/point_cloud_builder.h" -namespace { - void encode(std::ostream& o_stream, const uint32_t& value) - { - o_stream.write(reinterpret_cast(&value), 4); - } - - void encode(std::ostream& o_stream, const uint8_t* data, uint32_t data_len) - { - encode(o_stream, data_len); - if (data_len > 0) - o_stream.write(reinterpret_cast(data), data_len); - } - - template - void encode(std::ostream& o_stream, const std::vector& v) - { - encode(o_stream, reinterpret_cast(v.data()), - static_cast(v.size() * sizeof(Item))); - } - - void encode(std::ostream& o_stream, const std::string& s) - { - encode(o_stream, reinterpret_cast(s.data()), - static_cast(s.size())); - } -} - namespace DracoFunctions { using namespace draco; enum decoding_status { successful, not_draco_encoded, no_position_attribute, failed_during_decoding }; enum encoding_status { successful_encoding, failed_during_encoding }; - enum endian_order : uint32_t { - little_endian = 0x00000001, - big_endian = 0x01000000, - unknown_endian = 0xFFFFFFFF - }; - struct PointCloudObject { std::vector points; @@ -74,29 +41,75 @@ namespace DracoFunctions { encoding_status encode_status; }; - /** - * A simple function that can be used to help determine a program's endianness - * at compile-time. - */ - constexpr endian_order get_endian_order() { - return - ((0xFFFFFFFF & 1) == little_endian) - ? little_endian - : ((0xFFFFFFFF & 1) == big_endian) - ? big_endian - : unknown_endian; + class MetadataReader { + public: + MetadataReader(std::stringstream* s): stream(*s) {} + + uint32_t read_uint() { + uint32_t value; + stream.read(reinterpret_cast(&value), sizeof(uint32_t)); + return value; + } + + std::string read_bytes() { + const auto str_len = read_uint(); + std::string value; + value.resize(str_len); + stream.read(reinterpret_cast(value.data()), str_len); + return value; + } + + std::vector read_bytes_to_vec() { + const auto vec_len = read_uint(); + std::vector value; + value.resize(vec_len); + stream.read(reinterpret_cast(value.data()), vec_len); + return value; } - std::string encodeDracoMetadata(const GeometryMetadata& geometry_metadata) { + private: + std::stringstream& stream; + }; + + class MetadataWriter { + public: + MetadataWriter(std::stringstream* s): stream(*s) {} + + void write_uint(const uint32_t& value) { + stream.write(reinterpret_cast(&value), sizeof(uint32_t)); + } + + template + void write_bytes(const StdContainer& value) { + write_uint(static_cast(value.size())); + stream.write(reinterpret_cast(value.data()), value.size()); + } + + void write_bytes_from_str(const std::string& value) { + write_bytes(value); + } + + void write_bytes_from_vec(const std::vector& value) { + write_bytes(value); + } + + private: + std::stringstream& stream; + }; + + std::string encode_metadata(const GeometryMetadata& geometry_metadata) { std::stringstream ss; + MetadataWriter writer(&ss); std::vector to_parse_metadata = { {static_cast(&geometry_metadata)} }; // consider attribute metadatas const auto& attribute_metadatas = geometry_metadata.attribute_metadatas(); - encode(ss, static_cast(attribute_metadatas.size())); - for (const auto& attribute_metadata: attribute_metadatas) + writer.write_uint(static_cast(attribute_metadatas.size())); + for (const auto& attribute_metadata: attribute_metadatas) { + writer.write_uint(attribute_metadata->att_unique_id()); to_parse_metadata.push_back( static_cast(attribute_metadata.get())); + } // encode metadatas level by level for (std::vector to_parse_metadatas_next; !to_parse_metadata.empty(); @@ -104,16 +117,16 @@ namespace DracoFunctions { for (const auto* draco_metadata: to_parse_metadata) { // encode entries const auto& entries = draco_metadata->entries(); - encode(ss, static_cast(entries.size())); + writer.write_uint(static_cast(entries.size())); for (const auto& [name, value]: draco_metadata->entries()) { - encode(ss, name); - encode(ss, value.data()); + writer.write_bytes(name); + writer.write_bytes(value.data()); } // consider sub metadatas const auto& sub_metadatas = draco_metadata->sub_metadatas(); - encode(ss, static_cast(sub_metadatas.size())); + writer.write_uint(static_cast(sub_metadatas.size())); for (const auto& [name, draco_sub_metadata]: sub_metadatas) { - encode(ss, name); + writer.write_bytes(name); to_parse_metadatas_next.push_back(draco_sub_metadata.get()); } } @@ -121,6 +134,47 @@ namespace DracoFunctions { return ss.str(); } + GeometryMetadata decode_metadata(const std::string& s) { + + std::stringstream ss(s); + MetadataReader reader(&ss); + GeometryMetadata geometry_metadata; + std::vector to_parse_metadata = { + {static_cast(&geometry_metadata)} }; + // consider attribute metadatas + const auto attrbite_metadatas_len = reader.read_uint(); + for (uint32_t i = 0; i < attrbite_metadatas_len; ++i) { + auto attribute_metadata = std::make_unique(); + const auto unique_id = reader.read_uint(); + attribute_metadata->set_att_unique_id(unique_id); + to_parse_metadata.push_back(attribute_metadata.get()); + geometry_metadata.AddAttributeMetadata(std::move(attribute_metadata)); + } + // parse metadatas level by level + for (std::vector to_parse_metadatas_next; + !to_parse_metadata.empty(); + to_parse_metadata = std::move(to_parse_metadatas_next)) { + for (auto* metadata: to_parse_metadata) { + // parse entries + const auto entries_len = reader.read_uint(); + for (uint32_t i = 0; i < entries_len; ++i) { + std::string name = reader.read_bytes(); + std::vector value = reader.read_bytes_to_vec(); + metadata->AddEntryBinary(name, value); + } + // consider sub metadatas + const auto sub_metadatas_len = reader.read_uint(); + for (uint32_t i = 0; i < sub_metadatas_len; ++i) { + auto sub_metadata = std::make_unique(); + to_parse_metadatas_next.push_back(sub_metadata.get()); + std::string name = reader.read_bytes(); + metadata->AddSubMetadata(name, std::move(sub_metadata)); + } + } + } + return geometry_metadata; + + } MeshObject decode_buffer(const char *buffer, std::size_t buffer_len) { MeshObject meshObject; @@ -172,7 +226,7 @@ namespace DracoFunctions { metadata->GetEntryDoubleArray("quantization_origin", &(meshObject.quantization_origin))) { meshObject.encoding_options_set = true; } - meshObject.binary_metadata = encodeDracoMetadata(*metadata); + meshObject.binary_metadata = encode_metadata(*metadata); } meshObject.decode_status = successful; return meshObject; @@ -221,7 +275,7 @@ namespace DracoFunctions { metadata->GetEntryDoubleArray("quantization_origin", &(pointCloudObject.quantization_origin))) { pointCloudObject.encoding_options_set = true; } - pointCloudObject.binary_metadata = encodeDracoMetadata(*metadata); + pointCloudObject.binary_metadata = encode_metadata(*metadata); } pointCloudObject.decode_status = successful; return pointCloudObject; @@ -251,7 +305,8 @@ namespace DracoFunctions { } } - EncodedObject encode_mesh(const std::vector &points, const std::vector &faces, + EncodedObject encode_mesh(const std::vector &points, const + std::vector &faces, const std::string& binary_metadata, int quantization_bits, int compression_level, float quantization_range, const float *quantization_origin, bool create_metadata) { TriangleSoupMeshBuilder mb; mb.Start(faces.size()); @@ -282,7 +337,8 @@ namespace DracoFunctions { return encodedMeshObject; } - EncodedObject encode_point_cloud(const std::vector &points, int quantization_bits, + EncodedObject encode_point_cloud(const std::vector &points, + const std::string& binary_metadata, int quantization_bits, int compression_level, float quantization_range, const float *quantization_origin, bool create_metadata) { int num_points = points.size() / 3; PointCloudBuilder pcb; @@ -310,5 +366,4 @@ namespace DracoFunctions { } return encodedPointCloudObject; } - } diff --git a/src/DracoPy.pxd b/src/DracoPy.pxd index 48b471a..2f4a3d0 100644 --- a/src/DracoPy.pxd +++ b/src/DracoPy.pxd @@ -1,6 +1,6 @@ from libcpp.vector cimport vector from libcpp.string cimport string -from libc.stdint cimport uint32_t +from libc.stdint cimport uint32_t, uint8_t from libcpp cimport bool @@ -13,11 +13,6 @@ cdef extern from "DracoPy.h" namespace "DracoFunctions": cdef enum encoding_status: successful_encoding, failed_during_encoding - cdef enum endian_order: - little_endian - big_endian - unknown_endian - cdef struct PointCloudObject: vector[float] points @@ -54,14 +49,34 @@ cdef extern from "DracoPy.h" namespace "DracoFunctions": vector[unsigned char] buffer encoding_status encode_status - endian_order get_endian_order() except + + cdef extern from "" namespace "std" nogil: + cdef cppclass stringstream: + stringstream(const string&) + string to_string "str"() const + + cdef cppclass MetadataReader: + MetadataReader(stringstream* s) except + + uint32_t read_uint() except + + string read_bytes() except + + + cdef cppclass MetadataWriter: + MetadataWriter(stringstream* s) except + + void write_uint(const uint32_t& value) except + + void write_bytes_from_str(const string& value) except + + void write_bytes_from_vec(const vector[uint8_t]& value) except + MeshObject decode_buffer(const char *buffer, size_t buffer_len) except + PointCloudObject decode_buffer_to_point_cloud(const char *buffer, size_t buffer_len) 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, string binary_metadata, + int quantization_bits, int compression_level, + float quantization_range, const float *quantization_origin, + bool create_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, string binary_metadata, + int quantization_bits, int compression_level, + float quantization_range, const float *quantization_origin, + bool create_metadata) except + diff --git a/src/DracoPy.pyx b/src/DracoPy.pyx index 9b0aeda..7e934d5 100644 --- a/src/DracoPy.pyx +++ b/src/DracoPy.pyx @@ -1,74 +1,45 @@ # distutils: language = c++ -import typing +from typing import Dict, List from cpython.mem cimport PyMem_Malloc, PyMem_Free cimport DracoPy from math import floor -from libc.string cimport memcmp - - -class _Reader: - def __init__(self, in_bytes: bytes): - self._in_bytes = in_bytes - self._pos = 0 - - @staticmethod - def __get_endian() -> str: - endian_order = get_endian_order() - if endian_order == DracoPy.endian_order.little_endian: - return "little" - elif endian_order == DracoPy.endian_order.big_endian: - return "big" - else: - raise Exception("unknown endian order") - - def __read_bytes(self, count: int) -> bytes: - end = self._pos + count - result_bytes = self._in_bytes[self._pos:end] - self._pos = end - return result_bytes - - def read_uint(self) -> int: - value = int.from_bytes(self.__read_bytes(4), - byteorder=self.__get_endian(), signed=False) - return value - - def read_str(self) -> str: - count = self.read_uint() - return self.__read_bytes(count).decode() - - def read_bytes(self) -> bytes: - count = self.read_uint() - return self.__read_bytes(count) - - def is_end(self) -> bool: - return len(self._in_bytes) == self._pos class MetadataObject: - def __init__(self, entries: typing.Dict[str, bytes] = None, - sub_metadatas: typing.Dict[str, 'MetadataObject'] = None): + def __init__(self, entries: Dict[str, bytes] = None, + sub_metadatas: Dict[str, 'MetadataObject'] = None): self.entries = entries if entries else {} self.sub_metadatas = sub_metadatas if sub_metadatas else {} +class AttributeMetadataObject(MetadataObject): + def __init__(self, unique_id: int, + entries: Dict[str, bytes] = None, + sub_metadatas: Dict[str, 'MetadataObject'] = None): + super().__init__(entries, sub_metadatas) + self.unique_id = unique_id + + class GeometryMetadataObject(MetadataObject): - def __init__(self, entries: typing.Dict[str, bytes] = None, - sub_metadatas: typing.Dict[str, 'MetadataObject'] = None, - attribute_metadatas: typing.List['MetadataObject'] = None): + def __init__(self, entries: Dict[str, bytes] = None, + sub_metadatas: Dict[str, 'MetadataObject'] = None, + attribute_metadatas: List['AttributeMetadataObject'] = None): super().__init__(entries, sub_metadatas) self.attribute_metadatas = attribute_metadatas if attribute_metadatas \ else [] -def _parse_binary_metadata(binary_metadata: bytes) -> MetadataObject: - reader = _Reader(binary_metadata) +def decode_metadata(binary_metadata: bytes) -> MetadataObject: + ss = new stringstream(binary_metadata) + reader = new DracoPy.MetadataReader(ss) geometry_metadata = GeometryMetadataObject() to_parse_metadatas = [geometry_metadata] - # parse attribute metadatas + # consider attribute metadatas attribute_metadatas_len = reader.read_uint() for _ in range(attribute_metadatas_len): - attribute_metadata = MetadataObject() + unique_id = reader.read_uint() + attribute_metadata = AttributeMetadataObject(unique_id) geometry_metadata.attribute_metadatas.append(attribute_metadata) to_parse_metadatas.append(attribute_metadata) # parse metadatas level by level @@ -76,22 +47,51 @@ def _parse_binary_metadata(binary_metadata: bytes) -> MetadataObject: to_parse_metadata_next = [] for metadata in to_parse_metadatas: # parse entries - attr_len = reader.read_uint() - for _ in range(attr_len): - name = reader.read_str() + entries_len = reader.read_uint() + for _ in range(entries_len): + name = reader.read_bytes() value = reader.read_bytes() metadata.entries[name] = value sub_metadatas_len = reader.read_uint() + # consider sub metadatas for _ in range(sub_metadatas_len): - name = reader.read_str() + name = reader.read_bytes() sub_metadata = MetadataObject() metadata.sub_metadatas[name] = sub_metadata to_parse_metadata_next.append(sub_metadata) to_parse_metadatas = to_parse_metadata_next - if not reader.is_end(): - raise Exception("not read bytes detected") + del reader + del ss return geometry_metadata +def encode_metadata(geometry_metadata: GeometryMetadataObject) -> bytes: + ss = new stringstream(b"") + writer = new DracoPy.MetadataWriter(ss) + to_parse_metadata = [geometry_metadata] + # consider attribute metadatas + writer.write_uint(len(geometry_metadata.attribute_metadatas)) + for attribute_metadata in geometry_metadata.attribute_metadatas: + writer.write_uint(attribute_metadata.unique_id) + to_parse_metadata.append(attribute_metadata) + # encode metadatas level by level + while to_parse_metadata: + to_parse_metadata_next = [] + for draco_metadata in to_parse_metadata: + # encode entries + writer.write_uint(len(draco_metadata.entries)) + for name, value in draco_metadata.entries.items(): + writer.write_bytes_from_str(name) + writer.write_bytes_from_vec(value) + # consider sub metadatas + writer.write_uint(len(draco_metadata.sub_metadatas)) + for name, draco_sub_metadata in draco_metadata.sub_metadatas.items(): + writer.write_bytes_from_str(name) + to_parse_metadata_next.append(draco_sub_metadata) + del writer + s = ss.to_string() + del ss + return s + class DracoPointCloud(object): def __init__(self, data_struct): @@ -101,7 +101,7 @@ class DracoPointCloud(object): data_struct['quantization_range'], data_struct['quantization_origin']) else: self.encoding_options = None - self.metadata = _parse_binary_metadata(data_struct["binary_metadata"]) + self.metadata = decode_metadata(data_struct["binary_metadata"]) def get_encoded_coordinate(self, value, axis): if self.encoding_options is not None: @@ -159,7 +159,10 @@ class FileTypeException(Exception): 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 encode_mesh_to_buffer(points, faces, metadata: GeometryMetadataObject = None, + 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 @@ -169,6 +172,8 @@ def encode_mesh_to_buffer(points, faces, quantization_bits=14, compression_level 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. """ + if metadata is None: + metadata = GeometryMetadataObject() cdef float* quant_origin = NULL try: num_dims = 3 @@ -176,7 +181,11 @@ def encode_mesh_to_buffer(points, faces, quantization_bits=14, compression_level 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) + binary_metadata = encode_metadata(metadata) + encoded_mesh = DracoPy.encode_mesh(points, faces, binary_metadata, + 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: @@ -190,7 +199,10 @@ def encode_mesh_to_buffer(points, faces, quantization_bits=14, compression_level 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): +def encode_point_cloud_to_buffer(points, metadata: GeometryMetadataObject = None, + 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. Quantization bits should be an integer between 0 and 31 @@ -200,6 +212,8 @@ def encode_point_cloud_to_buffer(points, quantization_bits=14, compression_level 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. """ + if metadata is None: + metadata = GeometryMetadataObject() cdef float* quant_origin = NULL try: num_dims = 3 @@ -207,7 +221,10 @@ def encode_point_cloud_to_buffer(points, quantization_bits=14, compression_level 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) + binary_metadata = encode_metadata(metadata) + encoded_point_cloud = DracoPy.encode_point_cloud( + points, binary_metadata, 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: From 13c6387e9250a17203456379770868d49101e62d Mon Sep 17 00:00:00 2001 From: Andrey Romanov Date: Wed, 20 Oct 2021 19:43:59 +0300 Subject: [PATCH 03/21] get rid of c++ stream in interfaces --- src/DracoPy.cpp | 1903 +++++++++++++++++++++++------------------------ src/DracoPy.h | 19 +- src/DracoPy.pxd | 10 +- src/DracoPy.pyx | 12 +- 4 files changed, 928 insertions(+), 1016 deletions(-) diff --git a/src/DracoPy.cpp b/src/DracoPy.cpp index b71c882..c7f0737 100644 --- a/src/DracoPy.cpp +++ b/src/DracoPy.cpp @@ -637,7 +637,6 @@ static CYTHON_INLINE float __PYX_NAN() { #include #include #include -#include #include "DracoPy.h" #ifdef _OPENMP #include @@ -1519,10 +1518,7 @@ static PyObject *__pyx_builtin_super; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_TypeError; -static const char __pyx_k_[] = ""; -static const char __pyx_k_s[] = "s"; -static const char __pyx_k_ss[] = "ss"; -static const char __pyx_k__15[] = "_"; +static const char __pyx_k__14[] = "_"; static const char __pyx_k_dim[] = "dim"; static const char __pyx_k_doc[] = "__doc__"; static const char __pyx_k_int[] = "int"; @@ -1674,7 +1670,7 @@ static PyObject *__pyx_n_s_MetadataObject___init; static PyObject *__pyx_kp_u_Specified_value_out_of_encoded_r; static PyObject *__pyx_n_s_TypeError; static PyObject *__pyx_n_s_ValueError; -static PyObject *__pyx_n_s__15; +static PyObject *__pyx_n_s__14; static PyObject *__pyx_n_s_append; static PyObject *__pyx_n_s_attribute_metadata; static PyObject *__pyx_n_s_attribute_metadatas; @@ -1750,10 +1746,8 @@ 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_reader; -static PyObject *__pyx_n_s_s; static PyObject *__pyx_n_s_self; static PyObject *__pyx_kp_s_src_DracoPy_pyx; -static PyObject *__pyx_n_s_ss; static PyObject *__pyx_n_s_sub_metadata; static PyObject *__pyx_n_s_sub_metadatas; static PyObject *__pyx_n_s_sub_metadatas_len; @@ -1793,57 +1787,57 @@ static PyObject *__pyx_int_2; static PyObject *__pyx_int_3; static PyObject *__pyx_int_14; static PyObject *__pyx_int_neg_1; +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__14; -static PyObject *__pyx_tuple__16; -static PyObject *__pyx_tuple__18; +static PyObject *__pyx_tuple__13; +static PyObject *__pyx_tuple__15; +static PyObject *__pyx_tuple__17; +static PyObject *__pyx_tuple__19; static PyObject *__pyx_tuple__20; -static PyObject *__pyx_tuple__21; -static PyObject *__pyx_tuple__23; -static PyObject *__pyx_tuple__25; -static PyObject *__pyx_tuple__27; -static PyObject *__pyx_tuple__29; -static PyObject *__pyx_tuple__31; -static PyObject *__pyx_tuple__33; +static PyObject *__pyx_tuple__22; +static PyObject *__pyx_tuple__24; +static PyObject *__pyx_tuple__26; +static PyObject *__pyx_tuple__28; +static PyObject *__pyx_tuple__30; +static PyObject *__pyx_tuple__32; +static PyObject *__pyx_tuple__34; static PyObject *__pyx_tuple__35; -static PyObject *__pyx_tuple__36; -static PyObject *__pyx_tuple__38; -static PyObject *__pyx_tuple__40; -static PyObject *__pyx_tuple__42; -static PyObject *__pyx_tuple__44; -static PyObject *__pyx_tuple__46; -static PyObject *__pyx_tuple__48; -static PyObject *__pyx_tuple__50; -static PyObject *__pyx_tuple__52; -static PyObject *__pyx_codeobj__7; -static PyObject *__pyx_codeobj__10; -static PyObject *__pyx_codeobj__13; -static PyObject *__pyx_codeobj__17; -static PyObject *__pyx_codeobj__19; -static PyObject *__pyx_codeobj__22; -static PyObject *__pyx_codeobj__24; -static PyObject *__pyx_codeobj__26; -static PyObject *__pyx_codeobj__28; -static PyObject *__pyx_codeobj__30; -static PyObject *__pyx_codeobj__32; -static PyObject *__pyx_codeobj__34; -static PyObject *__pyx_codeobj__37; -static PyObject *__pyx_codeobj__39; -static PyObject *__pyx_codeobj__41; -static PyObject *__pyx_codeobj__43; -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_tuple__37; +static PyObject *__pyx_tuple__39; +static PyObject *__pyx_tuple__41; +static PyObject *__pyx_tuple__43; +static PyObject *__pyx_tuple__45; +static PyObject *__pyx_tuple__47; +static PyObject *__pyx_tuple__49; +static PyObject *__pyx_tuple__51; +static PyObject *__pyx_codeobj__6; +static PyObject *__pyx_codeobj__9; +static PyObject *__pyx_codeobj__12; +static PyObject *__pyx_codeobj__16; +static PyObject *__pyx_codeobj__18; +static PyObject *__pyx_codeobj__21; +static PyObject *__pyx_codeobj__23; +static PyObject *__pyx_codeobj__25; +static PyObject *__pyx_codeobj__27; +static PyObject *__pyx_codeobj__29; +static PyObject *__pyx_codeobj__31; +static PyObject *__pyx_codeobj__33; +static PyObject *__pyx_codeobj__36; +static PyObject *__pyx_codeobj__38; +static PyObject *__pyx_codeobj__40; +static PyObject *__pyx_codeobj__42; +static PyObject *__pyx_codeobj__44; +static PyObject *__pyx_codeobj__46; +static PyObject *__pyx_codeobj__48; +static PyObject *__pyx_codeobj__50; +static PyObject *__pyx_codeobj__52; /* Late includes */ /* "DracoPy.pyx":10 @@ -2543,8 +2537,8 @@ static PyObject *__pyx_pf_7DracoPy_22GeometryMetadataObject___init__(CYTHON_UNUS * * * def decode_metadata(binary_metadata: bytes) -> MetadataObject: # <<<<<<<<<<<<<< - * ss = new stringstream(binary_metadata) - * reader = new DracoPy.MetadataReader(ss) + * reader = new DracoPy.MetadataReader(binary_metadata) + * geometry_metadata = GeometryMetadataObject() */ /* Python wrapper */ @@ -2570,7 +2564,6 @@ static PyObject *__pyx_pw_7DracoPy_1decode_metadata(PyObject *__pyx_self, PyObje } static PyObject *__pyx_pf_7DracoPy_decode_metadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_binary_metadata) { - std::stringstream *__pyx_v_ss; DracoFunctions::MetadataReader *__pyx_v_reader; PyObject *__pyx_v_geometry_metadata = NULL; PyObject *__pyx_v_to_parse_metadatas = NULL; @@ -2608,36 +2601,27 @@ static PyObject *__pyx_pf_7DracoPy_decode_metadata(CYTHON_UNUSED PyObject *__pyx /* "DracoPy.pyx":34 * * def decode_metadata(binary_metadata: bytes) -> MetadataObject: - * ss = new stringstream(binary_metadata) # <<<<<<<<<<<<<< - * reader = new DracoPy.MetadataReader(ss) - * geometry_metadata = GeometryMetadataObject() - */ - __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_v_binary_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 34, __pyx_L1_error) - __pyx_v_ss = new std::stringstream(__pyx_t_1); - - /* "DracoPy.pyx":35 - * def decode_metadata(binary_metadata: bytes) -> MetadataObject: - * ss = new stringstream(binary_metadata) - * reader = new DracoPy.MetadataReader(ss) # <<<<<<<<<<<<<< + * reader = new DracoPy.MetadataReader(binary_metadata) # <<<<<<<<<<<<<< * geometry_metadata = GeometryMetadataObject() * to_parse_metadatas = [geometry_metadata] */ + __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_v_binary_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 34, __pyx_L1_error) try { - __pyx_t_2 = new DracoFunctions::MetadataReader(__pyx_v_ss); + __pyx_t_2 = new DracoFunctions::MetadataReader(__pyx_t_1); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 35, __pyx_L1_error) + __PYX_ERR(0, 34, __pyx_L1_error) } __pyx_v_reader = __pyx_t_2; - /* "DracoPy.pyx":36 - * ss = new stringstream(binary_metadata) - * reader = new DracoPy.MetadataReader(ss) + /* "DracoPy.pyx":35 + * def decode_metadata(binary_metadata: bytes) -> MetadataObject: + * reader = new DracoPy.MetadataReader(binary_metadata) * geometry_metadata = GeometryMetadataObject() # <<<<<<<<<<<<<< * to_parse_metadatas = [geometry_metadata] * # consider attribute metadatas */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_GeometryMetadataObject); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_GeometryMetadataObject); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { @@ -2651,20 +2635,20 @@ static PyObject *__pyx_pf_7DracoPy_decode_metadata(CYTHON_UNUSED PyObject *__pyx } __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_geometry_metadata = __pyx_t_3; __pyx_t_3 = 0; - /* "DracoPy.pyx":37 - * reader = new DracoPy.MetadataReader(ss) + /* "DracoPy.pyx":36 + * reader = new DracoPy.MetadataReader(binary_metadata) * geometry_metadata = GeometryMetadataObject() * to_parse_metadatas = [geometry_metadata] # <<<<<<<<<<<<<< * # consider attribute metadatas * attribute_metadatas_len = reader.read_uint() */ - __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 37, __pyx_L1_error) + __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_geometry_metadata); __Pyx_GIVEREF(__pyx_v_geometry_metadata); @@ -2672,7 +2656,7 @@ static PyObject *__pyx_pf_7DracoPy_decode_metadata(CYTHON_UNUSED PyObject *__pyx __pyx_v_to_parse_metadatas = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":39 + /* "DracoPy.pyx":38 * to_parse_metadatas = [geometry_metadata] * # consider attribute metadatas * attribute_metadatas_len = reader.read_uint() # <<<<<<<<<<<<<< @@ -2683,11 +2667,11 @@ static PyObject *__pyx_pf_7DracoPy_decode_metadata(CYTHON_UNUSED PyObject *__pyx __pyx_t_6 = __pyx_v_reader->read_uint(); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 39, __pyx_L1_error) + __PYX_ERR(0, 38, __pyx_L1_error) } __pyx_v_attribute_metadatas_len = __pyx_t_6; - /* "DracoPy.pyx":40 + /* "DracoPy.pyx":39 * # consider attribute metadatas * attribute_metadatas_len = reader.read_uint() * for _ in range(attribute_metadatas_len): # <<<<<<<<<<<<<< @@ -2699,7 +2683,7 @@ static PyObject *__pyx_pf_7DracoPy_decode_metadata(CYTHON_UNUSED PyObject *__pyx for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { __pyx_v__ = __pyx_t_8; - /* "DracoPy.pyx":41 + /* "DracoPy.pyx":40 * attribute_metadatas_len = reader.read_uint() * for _ in range(attribute_metadatas_len): * unique_id = reader.read_uint() # <<<<<<<<<<<<<< @@ -2710,20 +2694,20 @@ static PyObject *__pyx_pf_7DracoPy_decode_metadata(CYTHON_UNUSED PyObject *__pyx __pyx_t_9 = __pyx_v_reader->read_uint(); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 41, __pyx_L1_error) + __PYX_ERR(0, 40, __pyx_L1_error) } __pyx_v_unique_id = __pyx_t_9; - /* "DracoPy.pyx":42 + /* "DracoPy.pyx":41 * for _ in range(attribute_metadatas_len): * unique_id = reader.read_uint() * attribute_metadata = AttributeMetadataObject(unique_id) # <<<<<<<<<<<<<< * geometry_metadata.attribute_metadatas.append(attribute_metadata) * to_parse_metadatas.append(attribute_metadata) */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_AttributeMetadataObject); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 42, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_AttributeMetadataObject); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_From_uint32_t(__pyx_v_unique_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 42, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyInt_From_uint32_t(__pyx_v_unique_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __pyx_t_10 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { @@ -2738,35 +2722,35 @@ static PyObject *__pyx_pf_7DracoPy_decode_metadata(CYTHON_UNUSED PyObject *__pyx __pyx_t_3 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_10, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF_SET(__pyx_v_attribute_metadata, __pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":43 + /* "DracoPy.pyx":42 * unique_id = reader.read_uint() * attribute_metadata = AttributeMetadataObject(unique_id) * geometry_metadata.attribute_metadatas.append(attribute_metadata) # <<<<<<<<<<<<<< * to_parse_metadatas.append(attribute_metadata) * # parse metadatas level by level */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_geometry_metadata, __pyx_n_s_attribute_metadatas); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 43, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_geometry_metadata, __pyx_n_s_attribute_metadatas); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = __Pyx_PyObject_Append(__pyx_t_3, __pyx_v_attribute_metadata); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 43, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyObject_Append(__pyx_t_3, __pyx_v_attribute_metadata); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":44 + /* "DracoPy.pyx":43 * attribute_metadata = AttributeMetadataObject(unique_id) * geometry_metadata.attribute_metadatas.append(attribute_metadata) * to_parse_metadatas.append(attribute_metadata) # <<<<<<<<<<<<<< * # parse metadatas level by level * while to_parse_metadatas: */ - __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_to_parse_metadatas, __pyx_v_attribute_metadata); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_to_parse_metadatas, __pyx_v_attribute_metadata); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 43, __pyx_L1_error) } - /* "DracoPy.pyx":46 + /* "DracoPy.pyx":45 * to_parse_metadatas.append(attribute_metadata) * # parse metadatas level by level * while to_parse_metadatas: # <<<<<<<<<<<<<< @@ -2777,19 +2761,19 @@ static PyObject *__pyx_pf_7DracoPy_decode_metadata(CYTHON_UNUSED PyObject *__pyx __pyx_t_12 = (PyList_GET_SIZE(__pyx_v_to_parse_metadatas) != 0); if (!__pyx_t_12) break; - /* "DracoPy.pyx":47 + /* "DracoPy.pyx":46 * # parse metadatas level by level * while to_parse_metadatas: * to_parse_metadata_next = [] # <<<<<<<<<<<<<< * for metadata in to_parse_metadatas: * # parse entries */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 47, __pyx_L1_error) + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF_SET(__pyx_v_to_parse_metadata_next, ((PyObject*)__pyx_t_3)); __pyx_t_3 = 0; - /* "DracoPy.pyx":48 + /* "DracoPy.pyx":47 * while to_parse_metadatas: * to_parse_metadata_next = [] * for metadata in to_parse_metadatas: # <<<<<<<<<<<<<< @@ -2800,15 +2784,15 @@ static PyObject *__pyx_pf_7DracoPy_decode_metadata(CYTHON_UNUSED PyObject *__pyx for (;;) { if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_13); __Pyx_INCREF(__pyx_t_4); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 48, __pyx_L1_error) + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_13); __Pyx_INCREF(__pyx_t_4); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 47, __pyx_L1_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 48, __pyx_L1_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); #endif __Pyx_XDECREF_SET(__pyx_v_metadata, __pyx_t_4); __pyx_t_4 = 0; - /* "DracoPy.pyx":50 + /* "DracoPy.pyx":49 * for metadata in to_parse_metadatas: * # parse entries * entries_len = reader.read_uint() # <<<<<<<<<<<<<< @@ -2819,11 +2803,11 @@ static PyObject *__pyx_pf_7DracoPy_decode_metadata(CYTHON_UNUSED PyObject *__pyx __pyx_t_6 = __pyx_v_reader->read_uint(); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 50, __pyx_L1_error) + __PYX_ERR(0, 49, __pyx_L1_error) } __pyx_v_entries_len = __pyx_t_6; - /* "DracoPy.pyx":51 + /* "DracoPy.pyx":50 * # parse entries * entries_len = reader.read_uint() * for _ in range(entries_len): # <<<<<<<<<<<<<< @@ -2835,7 +2819,7 @@ static PyObject *__pyx_pf_7DracoPy_decode_metadata(CYTHON_UNUSED PyObject *__pyx for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { __pyx_v__ = __pyx_t_8; - /* "DracoPy.pyx":52 + /* "DracoPy.pyx":51 * entries_len = reader.read_uint() * for _ in range(entries_len): * name = reader.read_bytes() # <<<<<<<<<<<<<< @@ -2846,11 +2830,11 @@ static PyObject *__pyx_pf_7DracoPy_decode_metadata(CYTHON_UNUSED PyObject *__pyx __pyx_t_1 = __pyx_v_reader->read_bytes(); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 52, __pyx_L1_error) + __PYX_ERR(0, 51, __pyx_L1_error) } __pyx_v_name = __pyx_t_1; - /* "DracoPy.pyx":53 + /* "DracoPy.pyx":52 * for _ in range(entries_len): * name = reader.read_bytes() * value = reader.read_bytes() # <<<<<<<<<<<<<< @@ -2861,30 +2845,30 @@ static PyObject *__pyx_pf_7DracoPy_decode_metadata(CYTHON_UNUSED PyObject *__pyx __pyx_t_1 = __pyx_v_reader->read_bytes(); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 53, __pyx_L1_error) + __PYX_ERR(0, 52, __pyx_L1_error) } __pyx_v_value = __pyx_t_1; - /* "DracoPy.pyx":54 + /* "DracoPy.pyx":53 * name = reader.read_bytes() * value = reader.read_bytes() * metadata.entries[name] = value # <<<<<<<<<<<<<< * sub_metadatas_len = reader.read_uint() * # consider sub metadatas */ - __pyx_t_4 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error) + __pyx_t_4 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_entries); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 54, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_entries); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_10 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_name); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 54, __pyx_L1_error) + __pyx_t_10 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_name); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - if (unlikely(PyObject_SetItem(__pyx_t_5, __pyx_t_10, __pyx_t_4) < 0)) __PYX_ERR(0, 54, __pyx_L1_error) + if (unlikely(PyObject_SetItem(__pyx_t_5, __pyx_t_10, __pyx_t_4) < 0)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - /* "DracoPy.pyx":55 + /* "DracoPy.pyx":54 * value = reader.read_bytes() * metadata.entries[name] = value * sub_metadatas_len = reader.read_uint() # <<<<<<<<<<<<<< @@ -2895,11 +2879,11 @@ static PyObject *__pyx_pf_7DracoPy_decode_metadata(CYTHON_UNUSED PyObject *__pyx __pyx_t_6 = __pyx_v_reader->read_uint(); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 55, __pyx_L1_error) + __PYX_ERR(0, 54, __pyx_L1_error) } __pyx_v_sub_metadatas_len = __pyx_t_6; - /* "DracoPy.pyx":57 + /* "DracoPy.pyx":56 * sub_metadatas_len = reader.read_uint() * # consider sub metadatas * for _ in range(sub_metadatas_len): # <<<<<<<<<<<<<< @@ -2911,7 +2895,7 @@ static PyObject *__pyx_pf_7DracoPy_decode_metadata(CYTHON_UNUSED PyObject *__pyx for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { __pyx_v__ = __pyx_t_8; - /* "DracoPy.pyx":58 + /* "DracoPy.pyx":57 * # consider sub metadatas * for _ in range(sub_metadatas_len): * name = reader.read_bytes() # <<<<<<<<<<<<<< @@ -2922,18 +2906,18 @@ static PyObject *__pyx_pf_7DracoPy_decode_metadata(CYTHON_UNUSED PyObject *__pyx __pyx_t_1 = __pyx_v_reader->read_bytes(); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 58, __pyx_L1_error) + __PYX_ERR(0, 57, __pyx_L1_error) } __pyx_v_name = __pyx_t_1; - /* "DracoPy.pyx":59 + /* "DracoPy.pyx":58 * for _ in range(sub_metadatas_len): * name = reader.read_bytes() * sub_metadata = MetadataObject() # <<<<<<<<<<<<<< * metadata.sub_metadatas[name] = sub_metadata * to_parse_metadata_next.append(sub_metadata) */ - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_MetadataObject); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_MetadataObject); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) { @@ -2947,38 +2931,38 @@ static PyObject *__pyx_pf_7DracoPy_decode_metadata(CYTHON_UNUSED PyObject *__pyx } __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_10); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 59, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_XDECREF_SET(__pyx_v_sub_metadata, __pyx_t_4); __pyx_t_4 = 0; - /* "DracoPy.pyx":60 + /* "DracoPy.pyx":59 * name = reader.read_bytes() * sub_metadata = MetadataObject() * metadata.sub_metadatas[name] = sub_metadata # <<<<<<<<<<<<<< * to_parse_metadata_next.append(sub_metadata) * to_parse_metadatas = to_parse_metadata_next */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_sub_metadatas); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 60, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_sub_metadatas); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_name); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 60, __pyx_L1_error) + __pyx_t_10 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_name); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - if (unlikely(PyObject_SetItem(__pyx_t_4, __pyx_t_10, __pyx_v_sub_metadata) < 0)) __PYX_ERR(0, 60, __pyx_L1_error) + if (unlikely(PyObject_SetItem(__pyx_t_4, __pyx_t_10, __pyx_v_sub_metadata) < 0)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "DracoPy.pyx":61 + /* "DracoPy.pyx":60 * sub_metadata = MetadataObject() * metadata.sub_metadatas[name] = sub_metadata * to_parse_metadata_next.append(sub_metadata) # <<<<<<<<<<<<<< * to_parse_metadatas = to_parse_metadata_next * del reader */ - __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_to_parse_metadata_next, __pyx_v_sub_metadata); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 61, __pyx_L1_error) + __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_to_parse_metadata_next, __pyx_v_sub_metadata); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 60, __pyx_L1_error) } - /* "DracoPy.pyx":48 + /* "DracoPy.pyx":47 * while to_parse_metadatas: * to_parse_metadata_next = [] * for metadata in to_parse_metadatas: # <<<<<<<<<<<<<< @@ -2988,38 +2972,29 @@ static PyObject *__pyx_pf_7DracoPy_decode_metadata(CYTHON_UNUSED PyObject *__pyx } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":62 + /* "DracoPy.pyx":61 * metadata.sub_metadatas[name] = sub_metadata * to_parse_metadata_next.append(sub_metadata) * to_parse_metadatas = to_parse_metadata_next # <<<<<<<<<<<<<< * del reader - * del ss + * return geometry_metadata */ __Pyx_INCREF(__pyx_v_to_parse_metadata_next); __Pyx_DECREF_SET(__pyx_v_to_parse_metadatas, __pyx_v_to_parse_metadata_next); } - /* "DracoPy.pyx":63 + /* "DracoPy.pyx":62 * to_parse_metadata_next.append(sub_metadata) * to_parse_metadatas = to_parse_metadata_next * del reader # <<<<<<<<<<<<<< - * del ss * return geometry_metadata + * */ delete __pyx_v_reader; - /* "DracoPy.pyx":64 + /* "DracoPy.pyx":63 * to_parse_metadatas = to_parse_metadata_next * del reader - * del ss # <<<<<<<<<<<<<< - * return geometry_metadata - * - */ - delete __pyx_v_ss; - - /* "DracoPy.pyx":65 - * del reader - * del ss * return geometry_metadata # <<<<<<<<<<<<<< * * def encode_metadata(geometry_metadata: GeometryMetadataObject) -> bytes: @@ -3033,8 +3008,8 @@ static PyObject *__pyx_pf_7DracoPy_decode_metadata(CYTHON_UNUSED PyObject *__pyx * * * def decode_metadata(binary_metadata: bytes) -> MetadataObject: # <<<<<<<<<<<<<< - * ss = new stringstream(binary_metadata) - * reader = new DracoPy.MetadataReader(ss) + * reader = new DracoPy.MetadataReader(binary_metadata) + * geometry_metadata = GeometryMetadataObject() */ /* function exit code */ @@ -3057,12 +3032,12 @@ static PyObject *__pyx_pf_7DracoPy_decode_metadata(CYTHON_UNUSED PyObject *__pyx return __pyx_r; } -/* "DracoPy.pyx":67 +/* "DracoPy.pyx":65 * return geometry_metadata * * def encode_metadata(geometry_metadata: GeometryMetadataObject) -> bytes: # <<<<<<<<<<<<<< - * ss = new stringstream(b"") - * writer = new DracoPy.MetadataWriter(ss) + * cdef DracoPy.MetadataWriter writer + * to_parse_metadata = [geometry_metadata] */ /* Python wrapper */ @@ -3080,8 +3055,7 @@ static PyObject *__pyx_pw_7DracoPy_3encode_metadata(PyObject *__pyx_self, PyObje } static PyObject *__pyx_pf_7DracoPy_2encode_metadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_geometry_metadata) { - std::stringstream *__pyx_v_ss; - DracoFunctions::MetadataWriter *__pyx_v_writer; + DracoFunctions::MetadataWriter __pyx_v_writer; PyObject *__pyx_v_to_parse_metadata = NULL; PyObject *__pyx_v_attribute_metadata = NULL; PyObject *__pyx_v_to_parse_metadata_next = NULL; @@ -3089,167 +3063,141 @@ static PyObject *__pyx_pf_7DracoPy_2encode_metadata(CYTHON_UNUSED PyObject *__py PyObject *__pyx_v_name = NULL; PyObject *__pyx_v_value = NULL; PyObject *__pyx_v_draco_sub_metadata = NULL; - std::string __pyx_v_s; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - DracoFunctions::MetadataWriter *__pyx_t_1; - PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *(*__pyx_t_5)(PyObject *); - uint32_t __pyx_t_6; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *(*__pyx_t_4)(PyObject *); + uint32_t __pyx_t_5; + int __pyx_t_6; int __pyx_t_7; - int __pyx_t_8; + Py_ssize_t __pyx_t_8; Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - int __pyx_t_11; + int __pyx_t_10; + PyObject *__pyx_t_11 = NULL; PyObject *__pyx_t_12 = NULL; - PyObject *__pyx_t_13 = NULL; - int __pyx_t_14; - std::string __pyx_t_15; - std::vector __pyx_t_16; + int __pyx_t_13; + std::string __pyx_t_14; + std::vector __pyx_t_15; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("encode_metadata", 0); - /* "DracoPy.pyx":68 - * - * def encode_metadata(geometry_metadata: GeometryMetadataObject) -> bytes: - * ss = new stringstream(b"") # <<<<<<<<<<<<<< - * writer = new DracoPy.MetadataWriter(ss) - * to_parse_metadata = [geometry_metadata] - */ - __pyx_v_ss = new std::stringstream(__pyx_k_); - - /* "DracoPy.pyx":69 + /* "DracoPy.pyx":67 * def encode_metadata(geometry_metadata: GeometryMetadataObject) -> bytes: - * ss = new stringstream(b"") - * writer = new DracoPy.MetadataWriter(ss) # <<<<<<<<<<<<<< - * to_parse_metadata = [geometry_metadata] - * # consider attribute metadatas - */ - try { - __pyx_t_1 = new DracoFunctions::MetadataWriter(__pyx_v_ss); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 69, __pyx_L1_error) - } - __pyx_v_writer = __pyx_t_1; - - /* "DracoPy.pyx":70 - * ss = new stringstream(b"") - * writer = new DracoPy.MetadataWriter(ss) + * cdef DracoPy.MetadataWriter writer * to_parse_metadata = [geometry_metadata] # <<<<<<<<<<<<<< * # consider attribute metadatas * writer.write_uint(len(geometry_metadata.attribute_metadatas)) */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_geometry_metadata); __Pyx_GIVEREF(__pyx_v_geometry_metadata); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_geometry_metadata); - __pyx_v_to_parse_metadata = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_geometry_metadata); + __pyx_v_to_parse_metadata = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "DracoPy.pyx":72 + /* "DracoPy.pyx":69 * to_parse_metadata = [geometry_metadata] * # consider attribute metadatas * writer.write_uint(len(geometry_metadata.attribute_metadatas)) # <<<<<<<<<<<<<< * for attribute_metadata in geometry_metadata.attribute_metadatas: * writer.write_uint(attribute_metadata.unique_id) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_geometry_metadata, __pyx_n_s_attribute_metadatas); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_3 == ((Py_ssize_t)-1))) __PYX_ERR(0, 72, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geometry_metadata, __pyx_n_s_attribute_metadatas); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; try { - __pyx_v_writer->write_uint(__pyx_t_3); + __pyx_v_writer.write_uint(__pyx_t_2); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 72, __pyx_L1_error) + __PYX_ERR(0, 69, __pyx_L1_error) } - /* "DracoPy.pyx":73 + /* "DracoPy.pyx":70 * # consider attribute metadatas * writer.write_uint(len(geometry_metadata.attribute_metadatas)) * for attribute_metadata in geometry_metadata.attribute_metadatas: # <<<<<<<<<<<<<< * writer.write_uint(attribute_metadata.unique_id) * to_parse_metadata.append(attribute_metadata) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_geometry_metadata, __pyx_n_s_attribute_metadatas); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_4 = __pyx_t_2; __Pyx_INCREF(__pyx_t_4); __pyx_t_3 = 0; - __pyx_t_5 = NULL; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geometry_metadata, __pyx_n_s_attribute_metadatas); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_2 = 0; + __pyx_t_4 = NULL; } else { - __pyx_t_3 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 73, __pyx_L1_error) + __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error) } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { - if (likely(!__pyx_t_5)) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_4)) break; + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 73, __pyx_L1_error) + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 70, __pyx_L1_error) #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); #endif } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_4)) break; + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 73, __pyx_L1_error) + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 70, __pyx_L1_error) #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); #endif } } else { - __pyx_t_2 = __pyx_t_5(__pyx_t_4); - if (unlikely(!__pyx_t_2)) { + __pyx_t_1 = __pyx_t_4(__pyx_t_3); + if (unlikely(!__pyx_t_1)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 73, __pyx_L1_error) + else __PYX_ERR(0, 70, __pyx_L1_error) } break; } - __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_1); } - __Pyx_XDECREF_SET(__pyx_v_attribute_metadata, __pyx_t_2); - __pyx_t_2 = 0; + __Pyx_XDECREF_SET(__pyx_v_attribute_metadata, __pyx_t_1); + __pyx_t_1 = 0; - /* "DracoPy.pyx":74 + /* "DracoPy.pyx":71 * writer.write_uint(len(geometry_metadata.attribute_metadatas)) * for attribute_metadata in geometry_metadata.attribute_metadatas: * writer.write_uint(attribute_metadata.unique_id) # <<<<<<<<<<<<<< * to_parse_metadata.append(attribute_metadata) * # encode metadatas level by level */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_attribute_metadata, __pyx_n_s_unique_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 74, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyInt_As_uint32_t(__pyx_t_2); if (unlikely((__pyx_t_6 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 74, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_attribute_metadata, __pyx_n_s_unique_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyInt_As_uint32_t(__pyx_t_1); if (unlikely((__pyx_t_5 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 71, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; try { - __pyx_v_writer->write_uint(__pyx_t_6); + __pyx_v_writer.write_uint(__pyx_t_5); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 74, __pyx_L1_error) + __PYX_ERR(0, 71, __pyx_L1_error) } - /* "DracoPy.pyx":75 + /* "DracoPy.pyx":72 * for attribute_metadata in geometry_metadata.attribute_metadatas: * writer.write_uint(attribute_metadata.unique_id) * to_parse_metadata.append(attribute_metadata) # <<<<<<<<<<<<<< * # encode metadatas level by level * while to_parse_metadata: */ - __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_to_parse_metadata, __pyx_v_attribute_metadata); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 75, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_to_parse_metadata, __pyx_v_attribute_metadata); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 72, __pyx_L1_error) - /* "DracoPy.pyx":73 + /* "DracoPy.pyx":70 * # consider attribute metadatas * writer.write_uint(len(geometry_metadata.attribute_metadatas)) * for attribute_metadata in geometry_metadata.attribute_metadatas: # <<<<<<<<<<<<<< @@ -3257,9 +3205,9 @@ static PyObject *__pyx_pf_7DracoPy_2encode_metadata(CYTHON_UNUSED PyObject *__py * to_parse_metadata.append(attribute_metadata) */ } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":77 + /* "DracoPy.pyx":74 * to_parse_metadata.append(attribute_metadata) * # encode metadatas level by level * while to_parse_metadata: # <<<<<<<<<<<<<< @@ -3267,197 +3215,197 @@ static PyObject *__pyx_pf_7DracoPy_2encode_metadata(CYTHON_UNUSED PyObject *__py * for draco_metadata in to_parse_metadata: */ while (1) { - __pyx_t_8 = (PyList_GET_SIZE(__pyx_v_to_parse_metadata) != 0); - if (!__pyx_t_8) break; + __pyx_t_7 = (PyList_GET_SIZE(__pyx_v_to_parse_metadata) != 0); + if (!__pyx_t_7) break; - /* "DracoPy.pyx":78 + /* "DracoPy.pyx":75 * # encode metadatas level by level * while to_parse_metadata: * to_parse_metadata_next = [] # <<<<<<<<<<<<<< * for draco_metadata in to_parse_metadata: * # encode entries */ - __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_XDECREF_SET(__pyx_v_to_parse_metadata_next, ((PyObject*)__pyx_t_4)); - __pyx_t_4 = 0; + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 75, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_to_parse_metadata_next, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; - /* "DracoPy.pyx":79 + /* "DracoPy.pyx":76 * while to_parse_metadata: * to_parse_metadata_next = [] * for draco_metadata in to_parse_metadata: # <<<<<<<<<<<<<< * # encode entries * writer.write_uint(len(draco_metadata.entries)) */ - __pyx_t_4 = __pyx_v_to_parse_metadata; __Pyx_INCREF(__pyx_t_4); __pyx_t_3 = 0; + __pyx_t_3 = __pyx_v_to_parse_metadata; __Pyx_INCREF(__pyx_t_3); __pyx_t_2 = 0; for (;;) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_4)) break; + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 79, __pyx_L1_error) + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 76, __pyx_L1_error) #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); #endif - __Pyx_XDECREF_SET(__pyx_v_draco_metadata, __pyx_t_2); - __pyx_t_2 = 0; + __Pyx_XDECREF_SET(__pyx_v_draco_metadata, __pyx_t_1); + __pyx_t_1 = 0; - /* "DracoPy.pyx":81 + /* "DracoPy.pyx":78 * for draco_metadata in to_parse_metadata: * # encode entries * writer.write_uint(len(draco_metadata.entries)) # <<<<<<<<<<<<<< * for name, value in draco_metadata.entries.items(): * writer.write_bytes_from_str(name) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_draco_metadata, __pyx_n_s_entries); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_draco_metadata, __pyx_n_s_entries); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; try { - __pyx_v_writer->write_uint(__pyx_t_9); + __pyx_v_writer.write_uint(__pyx_t_8); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 81, __pyx_L1_error) + __PYX_ERR(0, 78, __pyx_L1_error) } - /* "DracoPy.pyx":82 + /* "DracoPy.pyx":79 * # encode entries * writer.write_uint(len(draco_metadata.entries)) * for name, value in draco_metadata.entries.items(): # <<<<<<<<<<<<<< * writer.write_bytes_from_str(name) * writer.write_bytes_from_vec(value) */ - __pyx_t_9 = 0; - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_draco_metadata, __pyx_n_s_entries); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - if (unlikely(__pyx_t_12 == Py_None)) { + __pyx_t_8 = 0; + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_draco_metadata, __pyx_n_s_entries); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + if (unlikely(__pyx_t_11 == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); - __PYX_ERR(0, 82, __pyx_L1_error) + __PYX_ERR(0, 79, __pyx_L1_error) } - __pyx_t_13 = __Pyx_dict_iterator(__pyx_t_12, 0, __pyx_n_s_items, (&__pyx_t_10), (&__pyx_t_11)); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_2); - __pyx_t_2 = __pyx_t_13; - __pyx_t_13 = 0; + __pyx_t_12 = __Pyx_dict_iterator(__pyx_t_11, 0, __pyx_n_s_items, (&__pyx_t_9), (&__pyx_t_10)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_t_1); + __pyx_t_1 = __pyx_t_12; + __pyx_t_12 = 0; while (1) { - __pyx_t_14 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_10, &__pyx_t_9, &__pyx_t_13, &__pyx_t_12, NULL, __pyx_t_11); - if (unlikely(__pyx_t_14 == 0)) break; - if (unlikely(__pyx_t_14 == -1)) __PYX_ERR(0, 82, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); + __pyx_t_13 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_9, &__pyx_t_8, &__pyx_t_12, &__pyx_t_11, NULL, __pyx_t_10); + if (unlikely(__pyx_t_13 == 0)) break; + if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 79, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); - __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_13); - __pyx_t_13 = 0; - __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_12); + __Pyx_GOTREF(__pyx_t_11); + __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_11); + __pyx_t_11 = 0; - /* "DracoPy.pyx":83 + /* "DracoPy.pyx":80 * writer.write_uint(len(draco_metadata.entries)) * for name, value in draco_metadata.entries.items(): * writer.write_bytes_from_str(name) # <<<<<<<<<<<<<< * writer.write_bytes_from_vec(value) * # consider sub metadatas */ - __pyx_t_15 = __pyx_convert_string_from_py_std__in_string(__pyx_v_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 83, __pyx_L1_error) + __pyx_t_14 = __pyx_convert_string_from_py_std__in_string(__pyx_v_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 80, __pyx_L1_error) try { - __pyx_v_writer->write_bytes_from_str(__pyx_t_15); + __pyx_v_writer.write_bytes_from_str(__pyx_t_14); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 83, __pyx_L1_error) + __PYX_ERR(0, 80, __pyx_L1_error) } - /* "DracoPy.pyx":84 + /* "DracoPy.pyx":81 * for name, value in draco_metadata.entries.items(): * writer.write_bytes_from_str(name) * writer.write_bytes_from_vec(value) # <<<<<<<<<<<<<< * # consider sub metadatas * writer.write_uint(len(draco_metadata.sub_metadatas)) */ - __pyx_t_16 = __pyx_convert_vector_from_py_uint8_t(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_t_15 = __pyx_convert_vector_from_py_uint8_t(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 81, __pyx_L1_error) try { - __pyx_v_writer->write_bytes_from_vec(__pyx_t_16); + __pyx_v_writer.write_bytes_from_vec(__pyx_t_15); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 84, __pyx_L1_error) + __PYX_ERR(0, 81, __pyx_L1_error) } } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":86 + /* "DracoPy.pyx":83 * writer.write_bytes_from_vec(value) * # consider sub metadatas * writer.write_uint(len(draco_metadata.sub_metadatas)) # <<<<<<<<<<<<<< * for name, draco_sub_metadata in draco_metadata.sub_metadatas.items(): * writer.write_bytes_from_str(name) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_draco_metadata, __pyx_n_s_sub_metadatas); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_10 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_10 == ((Py_ssize_t)-1))) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_draco_metadata, __pyx_n_s_sub_metadatas); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; try { - __pyx_v_writer->write_uint(__pyx_t_10); + __pyx_v_writer.write_uint(__pyx_t_9); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 86, __pyx_L1_error) + __PYX_ERR(0, 83, __pyx_L1_error) } - /* "DracoPy.pyx":87 + /* "DracoPy.pyx":84 * # consider sub metadatas * writer.write_uint(len(draco_metadata.sub_metadatas)) * for name, draco_sub_metadata in draco_metadata.sub_metadatas.items(): # <<<<<<<<<<<<<< * writer.write_bytes_from_str(name) * to_parse_metadata_next.append(draco_sub_metadata) */ - __pyx_t_10 = 0; - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_v_draco_metadata, __pyx_n_s_sub_metadatas); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 87, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - if (unlikely(__pyx_t_12 == Py_None)) { + __pyx_t_9 = 0; + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_draco_metadata, __pyx_n_s_sub_metadatas); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + if (unlikely(__pyx_t_11 == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); - __PYX_ERR(0, 87, __pyx_L1_error) + __PYX_ERR(0, 84, __pyx_L1_error) } - __pyx_t_13 = __Pyx_dict_iterator(__pyx_t_12, 0, __pyx_n_s_items, (&__pyx_t_9), (&__pyx_t_11)); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 87, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_XDECREF(__pyx_t_2); - __pyx_t_2 = __pyx_t_13; - __pyx_t_13 = 0; + __pyx_t_12 = __Pyx_dict_iterator(__pyx_t_11, 0, __pyx_n_s_items, (&__pyx_t_8), (&__pyx_t_10)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_XDECREF(__pyx_t_1); + __pyx_t_1 = __pyx_t_12; + __pyx_t_12 = 0; while (1) { - __pyx_t_14 = __Pyx_dict_iter_next(__pyx_t_2, __pyx_t_9, &__pyx_t_10, &__pyx_t_13, &__pyx_t_12, NULL, __pyx_t_11); - if (unlikely(__pyx_t_14 == 0)) break; - if (unlikely(__pyx_t_14 == -1)) __PYX_ERR(0, 87, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); + __pyx_t_13 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_8, &__pyx_t_9, &__pyx_t_12, &__pyx_t_11, NULL, __pyx_t_10); + if (unlikely(__pyx_t_13 == 0)) break; + if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); - __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_13); - __pyx_t_13 = 0; - __Pyx_XDECREF_SET(__pyx_v_draco_sub_metadata, __pyx_t_12); + __Pyx_GOTREF(__pyx_t_11); + __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_12); __pyx_t_12 = 0; + __Pyx_XDECREF_SET(__pyx_v_draco_sub_metadata, __pyx_t_11); + __pyx_t_11 = 0; - /* "DracoPy.pyx":88 + /* "DracoPy.pyx":85 * writer.write_uint(len(draco_metadata.sub_metadatas)) * for name, draco_sub_metadata in draco_metadata.sub_metadatas.items(): * writer.write_bytes_from_str(name) # <<<<<<<<<<<<<< * to_parse_metadata_next.append(draco_sub_metadata) - * del writer + * return writer.get() */ - __pyx_t_15 = __pyx_convert_string_from_py_std__in_string(__pyx_v_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 88, __pyx_L1_error) + __pyx_t_14 = __pyx_convert_string_from_py_std__in_string(__pyx_v_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 85, __pyx_L1_error) try { - __pyx_v_writer->write_bytes_from_str(__pyx_t_15); + __pyx_v_writer.write_bytes_from_str(__pyx_t_14); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 88, __pyx_L1_error) + __PYX_ERR(0, 85, __pyx_L1_error) } - /* "DracoPy.pyx":89 + /* "DracoPy.pyx":86 * for name, draco_sub_metadata in draco_metadata.sub_metadatas.items(): * writer.write_bytes_from_str(name) * to_parse_metadata_next.append(draco_sub_metadata) # <<<<<<<<<<<<<< - * del writer - * s = ss.to_string() + * return writer.get() + * */ - __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_to_parse_metadata_next, __pyx_v_draco_sub_metadata); if (unlikely(__pyx_t_7 == ((int)-1))) __PYX_ERR(0, 89, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_to_parse_metadata_next, __pyx_v_draco_sub_metadata); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 86, __pyx_L1_error) } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":79 + /* "DracoPy.pyx":76 * while to_parse_metadata: * to_parse_metadata_next = [] * for draco_metadata in to_parse_metadata: # <<<<<<<<<<<<<< @@ -3465,64 +3413,43 @@ static PyObject *__pyx_pf_7DracoPy_2encode_metadata(CYTHON_UNUSED PyObject *__py * writer.write_uint(len(draco_metadata.entries)) */ } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - /* "DracoPy.pyx":90 + /* "DracoPy.pyx":87 * writer.write_bytes_from_str(name) * to_parse_metadata_next.append(draco_sub_metadata) - * del writer # <<<<<<<<<<<<<< - * s = ss.to_string() - * del ss - */ - delete __pyx_v_writer; - - /* "DracoPy.pyx":91 - * to_parse_metadata_next.append(draco_sub_metadata) - * del writer - * s = ss.to_string() # <<<<<<<<<<<<<< - * del ss - * return s - */ - __pyx_v_s = __pyx_v_ss->str(); - - /* "DracoPy.pyx":92 - * del writer - * s = ss.to_string() - * del ss # <<<<<<<<<<<<<< - * return s - * - */ - delete __pyx_v_ss; - - /* "DracoPy.pyx":93 - * s = ss.to_string() - * del ss - * return s # <<<<<<<<<<<<<< + * return writer.get() # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_s); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 93, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_r = ((PyObject*)__pyx_t_4); - __pyx_t_4 = 0; + try { + __pyx_t_14 = __pyx_v_writer.get(); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 87, __pyx_L1_error) + } + __pyx_t_3 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; goto __pyx_L0; - /* "DracoPy.pyx":67 + /* "DracoPy.pyx":65 * return geometry_metadata * * def encode_metadata(geometry_metadata: GeometryMetadataObject) -> bytes: # <<<<<<<<<<<<<< - * ss = new stringstream(b"") - * writer = new DracoPy.MetadataWriter(ss) + * cdef DracoPy.MetadataWriter writer + * to_parse_metadata = [geometry_metadata] */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); - __Pyx_XDECREF(__pyx_t_13); __Pyx_AddTraceback("DracoPy.encode_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -3538,7 +3465,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_metadata(CYTHON_UNUSED PyObject *__py return __pyx_r; } -/* "DracoPy.pyx":97 +/* "DracoPy.pyx":91 * * class DracoPointCloud(object): * def __init__(self, data_struct): # <<<<<<<<<<<<<< @@ -3581,11 +3508,11 @@ static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_1__init__(PyObject *__pyx_s case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data_struct)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 97, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 91, __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, 97, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 91, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -3598,7 +3525,7 @@ static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_1__init__(PyObject *__pyx_s } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 97, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 91, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("DracoPy.DracoPointCloud.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3628,50 +3555,50 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyOb int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "DracoPy.pyx":98 + /* "DracoPy.pyx":92 * 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, 98, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_data_struct, __pyx_v_data_struct) < 0) __PYX_ERR(0, 92, __pyx_L1_error) - /* "DracoPy.pyx":99 + /* "DracoPy.pyx":93 * 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_Dict_GetItem(__pyx_v_data_struct, __pyx_n_u_encoding_options_set); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __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, 93, __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, 99, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 93, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "DracoPy.pyx":100 + /* "DracoPy.pyx":94 * 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, 100, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_EncodingOptions); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 94, __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, 100, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data_struct, __pyx_n_u_quantization_bits); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - /* "DracoPy.pyx":101 + /* "DracoPy.pyx":95 * 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, 101, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data_struct, __pyx_n_u_quantization_range); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 95, __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, 101, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data_struct, __pyx_n_u_quantization_origin); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 95, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; __pyx_t_8 = 0; @@ -3688,7 +3615,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyOb #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, 100, __pyx_L1_error) + __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, 94, __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; @@ -3699,7 +3626,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyOb #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, 100, __pyx_L1_error) + __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, 94, __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; @@ -3708,7 +3635,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyOb } else #endif { - __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 100, __pyx_L1_error) + __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 94, __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; @@ -3722,23 +3649,23 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyOb __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, 100, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 94, __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":100 + /* "DracoPy.pyx":94 * 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, 100, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options, __pyx_t_1) < 0) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":99 + /* "DracoPy.pyx":93 * def __init__(self, data_struct): * self.data_struct = data_struct * if data_struct['encoding_options_set']: # <<<<<<<<<<<<<< @@ -3748,7 +3675,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyOb goto __pyx_L3; } - /* "DracoPy.pyx":103 + /* "DracoPy.pyx":97 * data_struct['quantization_range'], data_struct['quantization_origin']) * else: * self.encoding_options = None # <<<<<<<<<<<<<< @@ -3756,20 +3683,20 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyOb * */ /*else*/ { - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options, Py_None) < 0) __PYX_ERR(0, 103, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options, Py_None) < 0) __PYX_ERR(0, 97, __pyx_L1_error) } __pyx_L3:; - /* "DracoPy.pyx":104 + /* "DracoPy.pyx":98 * else: * self.encoding_options = None * self.metadata = decode_metadata(data_struct["binary_metadata"]) # <<<<<<<<<<<<<< * * def get_encoded_coordinate(self, value, axis): */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_decode_metadata); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_decode_metadata); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data_struct, __pyx_n_u_binary_metadata); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 104, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data_struct, __pyx_n_u_binary_metadata); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_6 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { @@ -3784,13 +3711,13 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyOb __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_9); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_metadata, __pyx_t_1) < 0) __PYX_ERR(0, 104, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_metadata, __pyx_t_1) < 0) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":97 + /* "DracoPy.pyx":91 * * class DracoPointCloud(object): * def __init__(self, data_struct): # <<<<<<<<<<<<<< @@ -3817,7 +3744,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyOb return __pyx_r; } -/* "DracoPy.pyx":106 +/* "DracoPy.pyx":100 * self.metadata = decode_metadata(data_struct["binary_metadata"]) * * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< @@ -3863,17 +3790,17 @@ static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_3get_encoded_coordinate(PyO 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, 106, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, 1); __PYX_ERR(0, 100, __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, 106, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, 2); __PYX_ERR(0, 100, __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, 106, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_encoded_coordinate") < 0)) __PYX_ERR(0, 100, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -3888,7 +3815,7 @@ static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_3get_encoded_coordinate(PyO } 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, 106, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 100, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("DracoPy.DracoPointCloud.get_encoded_coordinate", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3916,21 +3843,21 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_2get_encoded_coordinate(CYT int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_encoded_coordinate", 0); - /* "DracoPy.pyx":107 + /* "DracoPy.pyx":101 * * 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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __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, 101, __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":108 + /* "DracoPy.pyx":102 * def get_encoded_coordinate(self, value, axis): * if self.encoding_options is not None: * return self.encoding_options.get_encoded_coordinate(value, axis) # <<<<<<<<<<<<<< @@ -3938,9 +3865,9 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_2get_encoded_coordinate(CYT * 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, 108, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 102, __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, 108, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get_encoded_coordinate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; @@ -3958,7 +3885,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_2get_encoded_coordinate(CYT #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, 108, __pyx_L1_error) + __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, 102, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); } else @@ -3966,13 +3893,13 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_2get_encoded_coordinate(CYT #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, 108, __pyx_L1_error) + __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, 102, __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, 108, __pyx_L1_error) + __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 102, __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; @@ -3983,7 +3910,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_2get_encoded_coordinate(CYT __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, 108, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 102, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } @@ -3992,7 +3919,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_2get_encoded_coordinate(CYT __pyx_t_1 = 0; goto __pyx_L0; - /* "DracoPy.pyx":107 + /* "DracoPy.pyx":101 * * def get_encoded_coordinate(self, value, axis): * if self.encoding_options is not None: # <<<<<<<<<<<<<< @@ -4001,7 +3928,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_2get_encoded_coordinate(CYT */ } - /* "DracoPy.pyx":106 + /* "DracoPy.pyx":100 * self.metadata = decode_metadata(data_struct["binary_metadata"]) * * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< @@ -4025,7 +3952,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_2get_encoded_coordinate(CYT return __pyx_r; } -/* "DracoPy.pyx":110 +/* "DracoPy.pyx":104 * return self.encoding_options.get_encoded_coordinate(value, axis) * * def get_encoded_point(self, point): # <<<<<<<<<<<<<< @@ -4068,11 +3995,11 @@ static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_5get_encoded_point(PyObject 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, 110, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_point", 1, 2, 2, 1); __PYX_ERR(0, 104, __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, 110, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_encoded_point") < 0)) __PYX_ERR(0, 104, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -4085,7 +4012,7 @@ static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_5get_encoded_point(PyObject } 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, 110, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_point", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 104, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("DracoPy.DracoPointCloud.get_encoded_point", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -4111,21 +4038,21 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_4get_encoded_point(CYTHON_U int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_encoded_point", 0); - /* "DracoPy.pyx":111 + /* "DracoPy.pyx":105 * * def get_encoded_point(self, point): * if self.encoding_options is not None: # <<<<<<<<<<<<<< * return self.encoding_options.get_encoded_point(point) * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 111, __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, 105, __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":112 + /* "DracoPy.pyx":106 * def get_encoded_point(self, point): * if self.encoding_options is not None: * return self.encoding_options.get_encoded_point(point) # <<<<<<<<<<<<<< @@ -4133,9 +4060,9 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_4get_encoded_point(CYTHON_U * @property */ __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, 112, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __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, 112, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get_encoded_point); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 106, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; @@ -4150,14 +4077,14 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_4get_encoded_point(CYTHON_U } __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, 112, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 106, __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":111 + /* "DracoPy.pyx":105 * * def get_encoded_point(self, point): * if self.encoding_options is not None: # <<<<<<<<<<<<<< @@ -4166,7 +4093,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_4get_encoded_point(CYTHON_U */ } - /* "DracoPy.pyx":110 + /* "DracoPy.pyx":104 * return self.encoding_options.get_encoded_coordinate(value, axis) * * def get_encoded_point(self, point): # <<<<<<<<<<<<<< @@ -4189,7 +4116,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_4get_encoded_point(CYTHON_U return __pyx_r; } -/* "DracoPy.pyx":115 +/* "DracoPy.pyx":109 * * @property * def num_axes(self): # <<<<<<<<<<<<<< @@ -4216,7 +4143,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_6num_axes(CYTHON_UNUSED PyO __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("num_axes", 0); - /* "DracoPy.pyx":116 + /* "DracoPy.pyx":110 * @property * def num_axes(self): * return 3 # <<<<<<<<<<<<<< @@ -4228,7 +4155,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_6num_axes(CYTHON_UNUSED PyO __pyx_r = __pyx_int_3; goto __pyx_L0; - /* "DracoPy.pyx":115 + /* "DracoPy.pyx":109 * * @property * def num_axes(self): # <<<<<<<<<<<<<< @@ -4243,7 +4170,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_6num_axes(CYTHON_UNUSED PyO return __pyx_r; } -/* "DracoPy.pyx":119 +/* "DracoPy.pyx":113 * * @property * def points(self): # <<<<<<<<<<<<<< @@ -4275,7 +4202,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_8points(CYTHON_UNUSED PyObj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("points", 0); - /* "DracoPy.pyx":120 + /* "DracoPy.pyx":114 * @property * def points(self): * return self.data_struct['points'] # <<<<<<<<<<<<<< @@ -4283,16 +4210,16 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_8points(CYTHON_UNUSED PyObj * */ __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, 120, __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, 114, __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, 120, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_points); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 114, __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":119 + /* "DracoPy.pyx":113 * * @property * def points(self): # <<<<<<<<<<<<<< @@ -4312,7 +4239,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_8points(CYTHON_UNUSED PyObj return __pyx_r; } -/* "DracoPy.pyx":125 +/* "DracoPy.pyx":119 * class DracoMesh(DracoPointCloud): * @property * def faces(self): # <<<<<<<<<<<<<< @@ -4344,7 +4271,7 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_faces(CYTHON_UNUSED PyObject *__py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("faces", 0); - /* "DracoPy.pyx":126 + /* "DracoPy.pyx":120 * @property * def faces(self): * return self.data_struct['faces'] # <<<<<<<<<<<<<< @@ -4352,16 +4279,16 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_faces(CYTHON_UNUSED PyObject *__py * @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, 126, __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, 120, __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, 126, __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, 120, __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":125 + /* "DracoPy.pyx":119 * class DracoMesh(DracoPointCloud): * @property * def faces(self): # <<<<<<<<<<<<<< @@ -4381,7 +4308,7 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_faces(CYTHON_UNUSED PyObject *__py return __pyx_r; } -/* "DracoPy.pyx":129 +/* "DracoPy.pyx":123 * * @property * def normals(self): # <<<<<<<<<<<<<< @@ -4413,7 +4340,7 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_2normals(CYTHON_UNUSED PyObject *_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("normals", 0); - /* "DracoPy.pyx":130 + /* "DracoPy.pyx":124 * @property * def normals(self): * return self.data_struct['normals'] # <<<<<<<<<<<<<< @@ -4421,16 +4348,16 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_2normals(CYTHON_UNUSED PyObject *_ * 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, 130, __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, 124, __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, 130, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_normals); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 124, __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":129 + /* "DracoPy.pyx":123 * * @property * def normals(self): # <<<<<<<<<<<<<< @@ -4450,7 +4377,7 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_2normals(CYTHON_UNUSED PyObject *_ return __pyx_r; } -/* "DracoPy.pyx":133 +/* "DracoPy.pyx":127 * * class EncodingOptions(object): * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< @@ -4499,23 +4426,23 @@ static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_1__init__(PyObject *__pyx_s 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, 133, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); __PYX_ERR(0, 127, __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, 133, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 2); __PYX_ERR(0, 127, __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("__init__", 1, 4, 4, 3); __PYX_ERR(0, 133, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 3); __PYX_ERR(0, 127, __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, 133, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 127, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; @@ -4532,7 +4459,7 @@ static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_1__init__(PyObject *__pyx_s } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 133, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 127, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("DracoPy.EncodingOptions.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -4555,52 +4482,52 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions___init__(CYTHON_UNUSED PyOb int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "DracoPy.pyx":134 + /* "DracoPy.pyx":128 * 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, 134, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_quantization_bits, __pyx_v_quantization_bits) < 0) __PYX_ERR(0, 128, __pyx_L1_error) - /* "DracoPy.pyx":135 + /* "DracoPy.pyx":129 * 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, 135, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_quantization_range, __pyx_v_quantization_range) < 0) __PYX_ERR(0, 129, __pyx_L1_error) - /* "DracoPy.pyx":136 + /* "DracoPy.pyx":130 * 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_origin, __pyx_v_quantization_origin) < 0) __PYX_ERR(0, 136, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin, __pyx_v_quantization_origin) < 0) __PYX_ERR(0, 130, __pyx_L1_error) - /* "DracoPy.pyx":137 + /* "DracoPy.pyx":131 * 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): */ - __pyx_t_1 = __Pyx_PyNumber_PowerOf2(__pyx_int_2, __pyx_v_quantization_bits, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 137, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyNumber_PowerOf2(__pyx_int_2, __pyx_v_quantization_bits, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 131, __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, 137, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_SubtractObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 131, __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, 137, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_quantization_range, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 131, __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, 137, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_inverse_alpha, __pyx_t_1) < 0) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":133 + /* "DracoPy.pyx":127 * * class EncodingOptions(object): * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< @@ -4622,7 +4549,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions___init__(CYTHON_UNUSED PyOb return __pyx_r; } -/* "DracoPy.pyx":139 +/* "DracoPy.pyx":133 * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) * * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< @@ -4668,17 +4595,17 @@ static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_3get_encoded_coordinate(PyO 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, 139, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, 1); __PYX_ERR(0, 133, __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, 139, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, 2); __PYX_ERR(0, 133, __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, 139, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_encoded_coordinate") < 0)) __PYX_ERR(0, 133, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -4693,7 +4620,7 @@ static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_3get_encoded_coordinate(PyO } 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, 139, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 133, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("DracoPy.EncodingOptions.get_encoded_coordinate", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -4722,60 +4649,60 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_2get_encoded_coordinate(CYT int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_encoded_coordinate", 0); - /* "DracoPy.pyx":140 + /* "DracoPy.pyx":134 * * 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_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 140, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __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, 140, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_axis); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 134, __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, 140, __pyx_L1_error) + __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, 134, __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, 140, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 134, __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, 140, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __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, 140, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_axis); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 134, __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, 140, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_range); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __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, 140, __pyx_L1_error) + __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 134, __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, 140, __pyx_L1_error) + __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, 134, __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, 140, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 134, __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":141 + /* "DracoPy.pyx":135 * 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__2, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 141, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 135, __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_ERR(0, 135, __pyx_L1_error) - /* "DracoPy.pyx":140 + /* "DracoPy.pyx":134 * * def get_encoded_coordinate(self, value, axis): * if value < self.quantization_origin[axis] or value > (self.quantization_origin[axis] + self.quantization_range): # <<<<<<<<<<<<<< @@ -4784,39 +4711,39 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_2get_encoded_coordinate(CYT */ } - /* "DracoPy.pyx":142 + /* "DracoPy.pyx":136 * 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_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 136, __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, 142, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_axis); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 136, __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, 142, __pyx_L1_error) + __pyx_t_2 = PyNumber_Subtract(__pyx_v_value, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 136, __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":143 + /* "DracoPy.pyx":137 * 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_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_floor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 143, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_floor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 137, __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, 143, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_inverse_alpha); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 137, __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, 143, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_v_difference, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 137, __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, 143, __pyx_L1_error) + __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, 137, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; @@ -4832,13 +4759,13 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_2get_encoded_coordinate(CYT __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, 143, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 137, __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":144 + /* "DracoPy.pyx":138 * 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) # <<<<<<<<<<<<<< @@ -4846,17 +4773,17 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_2get_encoded_coordinate(CYT * 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, 144, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 138, __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, 144, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_axis); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 138, __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, 144, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_inverse_alpha); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 138, __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, 144, __pyx_L1_error) + __pyx_t_3 = PyNumber_Multiply(__pyx_v_quantized_index, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 138, __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, 144, __pyx_L1_error) + __pyx_t_2 = PyNumber_Add(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 138, __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; @@ -4864,7 +4791,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_2get_encoded_coordinate(CYT __pyx_t_2 = 0; goto __pyx_L0; - /* "DracoPy.pyx":139 + /* "DracoPy.pyx":133 * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) * * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< @@ -4888,7 +4815,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_2get_encoded_coordinate(CYT return __pyx_r; } -/* "DracoPy.pyx":146 +/* "DracoPy.pyx":140 * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) * * def get_encoded_point(self, point): # <<<<<<<<<<<<<< @@ -4931,11 +4858,11 @@ static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_5get_encoded_point(PyObject 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, 146, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_point", 1, 2, 2, 1); __PYX_ERR(0, 140, __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, 146, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_encoded_point") < 0)) __PYX_ERR(0, 140, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -4948,7 +4875,7 @@ static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_5get_encoded_point(PyObject } 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, 146, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_point", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 140, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("DracoPy.EncodingOptions.get_encoded_point", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -4981,37 +4908,37 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_encoded_point", 0); - /* "DracoPy.pyx":147 + /* "DracoPy.pyx":141 * * 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, 147, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_encoded_point = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":148 + /* "DracoPy.pyx":142 * 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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_num_axes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_num_axes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __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, 148, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __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, 148, __pyx_L1_error) + __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __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, 148, __pyx_L1_error) + __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 142, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; for (;;) { @@ -5019,17 +4946,17 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U 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, 148, __pyx_L1_error) + __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, 142, __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, 148, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __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, 148, __pyx_L1_error) + __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, 142, __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, 148, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif } @@ -5039,7 +4966,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 148, __pyx_L1_error) + else __PYX_ERR(0, 142, __pyx_L1_error) } break; } @@ -5048,16 +4975,16 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U __Pyx_XDECREF_SET(__pyx_v_axis, __pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":149 + /* "DracoPy.pyx":143 * 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, 149, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_encoded_coordinate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 143, __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, 149, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_point, __pyx_v_axis); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 143, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; __pyx_t_8 = 0; @@ -5074,7 +5001,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U #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, 149, __pyx_L1_error) + __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, 143, __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; @@ -5083,14 +5010,14 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U #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, 149, __pyx_L1_error) + __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, 143, __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, 149, __pyx_L1_error) + __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 143, __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; @@ -5101,15 +5028,15 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U __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, 149, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 143, __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, 149, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_encoded_point, __pyx_t_2); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 143, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":148 + /* "DracoPy.pyx":142 * def get_encoded_point(self, point): * encoded_point = [] * for axis in range(self.num_axes): # <<<<<<<<<<<<<< @@ -5119,7 +5046,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":150 + /* "DracoPy.pyx":144 * for axis in range(self.num_axes): * encoded_point.append(self.get_encoded_coordinate(point[axis], axis)) * return encoded_point # <<<<<<<<<<<<<< @@ -5131,7 +5058,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U __pyx_r = __pyx_v_encoded_point; goto __pyx_L0; - /* "DracoPy.pyx":146 + /* "DracoPy.pyx":140 * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) * * def get_encoded_point(self, point): # <<<<<<<<<<<<<< @@ -5157,7 +5084,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U return __pyx_r; } -/* "DracoPy.pyx":153 +/* "DracoPy.pyx":147 * * @property * def num_axes(self): # <<<<<<<<<<<<<< @@ -5184,7 +5111,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_6num_axes(CYTHON_UNUSED PyO __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("num_axes", 0); - /* "DracoPy.pyx":154 + /* "DracoPy.pyx":148 * @property * def num_axes(self): * return 3 # <<<<<<<<<<<<<< @@ -5196,7 +5123,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_6num_axes(CYTHON_UNUSED PyO __pyx_r = __pyx_int_3; goto __pyx_L0; - /* "DracoPy.pyx":153 + /* "DracoPy.pyx":147 * * @property * def num_axes(self): # <<<<<<<<<<<<<< @@ -5211,7 +5138,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_6num_axes(CYTHON_UNUSED PyO return __pyx_r; } -/* "DracoPy.pyx":162 +/* "DracoPy.pyx":156 * pass * * def encode_mesh_to_buffer(points, faces, metadata: GeometryMetadataObject = None, # <<<<<<<<<<<<<< @@ -5246,7 +5173,7 @@ static PyObject *__pyx_pw_7DracoPy_5encode_mesh_to_buffer(PyObject *__pyx_self, values[4] = ((PyObject *)__pyx_int_1); values[5] = ((PyObject *)__pyx_int_neg_1); - /* "DracoPy.pyx":164 + /* "DracoPy.pyx":158 * def encode_mesh_to_buffer(points, faces, metadata: GeometryMetadataObject = None, * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, # <<<<<<<<<<<<<< @@ -5255,7 +5182,7 @@ static PyObject *__pyx_pw_7DracoPy_5encode_mesh_to_buffer(PyObject *__pyx_self, */ values[6] = ((PyObject *)Py_None); - /* "DracoPy.pyx":165 + /* "DracoPy.pyx":159 * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, * create_metadata=False): # <<<<<<<<<<<<<< @@ -5295,7 +5222,7 @@ static PyObject *__pyx_pw_7DracoPy_5encode_mesh_to_buffer(PyObject *__pyx_self, 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, 8, 1); __PYX_ERR(0, 162, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 2, 8, 1); __PYX_ERR(0, 156, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -5335,7 +5262,7 @@ static PyObject *__pyx_pw_7DracoPy_5encode_mesh_to_buffer(PyObject *__pyx_self, } } 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, 162, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode_mesh_to_buffer") < 0)) __PYX_ERR(0, 156, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -5368,7 +5295,7 @@ static PyObject *__pyx_pw_7DracoPy_5encode_mesh_to_buffer(PyObject *__pyx_self, } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 2, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 162, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 2, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 156, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("DracoPy.encode_mesh_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -5376,7 +5303,7 @@ static PyObject *__pyx_pw_7DracoPy_5encode_mesh_to_buffer(PyObject *__pyx_self, __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7DracoPy_4encode_mesh_to_buffer(__pyx_self, __pyx_v_points, __pyx_v_faces, __pyx_v_metadata, __pyx_v_quantization_bits, __pyx_v_compression_level, __pyx_v_quantization_range, __pyx_v_quantization_origin, __pyx_v_create_metadata); - /* "DracoPy.pyx":162 + /* "DracoPy.pyx":156 * pass * * def encode_mesh_to_buffer(points, faces, metadata: GeometryMetadataObject = None, # <<<<<<<<<<<<<< @@ -5426,7 +5353,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_RefNannySetupContext("encode_mesh_to_buffer", 0); __Pyx_INCREF(__pyx_v_metadata); - /* "DracoPy.pyx":175 + /* "DracoPy.pyx":169 * a point where each coordinate is the minimum of that coordinate among the input vertices. * """ * if metadata is None: # <<<<<<<<<<<<<< @@ -5437,14 +5364,14 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "DracoPy.pyx":176 + /* "DracoPy.pyx":170 * """ * if metadata is None: * metadata = GeometryMetadataObject() # <<<<<<<<<<<<<< * cdef float* quant_origin = NULL * try: */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_GeometryMetadataObject); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 176, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_GeometryMetadataObject); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { @@ -5458,13 +5385,13 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject } __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 176, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF_SET(__pyx_v_metadata, __pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":175 + /* "DracoPy.pyx":169 * a point where each coordinate is the minimum of that coordinate among the input vertices. * """ * if metadata is None: # <<<<<<<<<<<<<< @@ -5473,7 +5400,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":177 + /* "DracoPy.pyx":171 * if metadata is None: * metadata = GeometryMetadataObject() * cdef float* quant_origin = NULL # <<<<<<<<<<<<<< @@ -5482,7 +5409,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ __pyx_v_quant_origin = NULL; - /* "DracoPy.pyx":178 + /* "DracoPy.pyx":172 * metadata = GeometryMetadataObject() * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -5498,7 +5425,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_XGOTREF(__pyx_t_8); /*try:*/ { - /* "DracoPy.pyx":179 + /* "DracoPy.pyx":173 * cdef float* quant_origin = NULL * try: * num_dims = 3 # <<<<<<<<<<<<<< @@ -5508,7 +5435,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_INCREF(__pyx_int_3); __pyx_v_num_dims = __pyx_int_3; - /* "DracoPy.pyx":180 + /* "DracoPy.pyx":174 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -5519,38 +5446,38 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "DracoPy.pyx":181 + /* "DracoPy.pyx":175 * 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_3 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 181, __pyx_L4_error) + __pyx_t_3 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 175, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 181, __pyx_L4_error) + __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 175, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_9 = __Pyx_PyInt_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 181, __pyx_L4_error) + __pyx_t_9 = __Pyx_PyInt_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 175, __pyx_L4_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_quant_origin = ((float *)PyMem_Malloc(__pyx_t_9)); - /* "DracoPy.pyx":182 + /* "DracoPy.pyx":176 * 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] * binary_metadata = encode_metadata(metadata) */ - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 182, __pyx_L4_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 176, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_4); if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_10 = 0; __pyx_t_11 = NULL; } else { - __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 182, __pyx_L4_error) + __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 176, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 182, __pyx_L4_error) + __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 176, __pyx_L4_error) } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; for (;;) { @@ -5558,17 +5485,17 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject if (likely(PyList_CheckExact(__pyx_t_3))) { if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 182, __pyx_L4_error) + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 176, __pyx_L4_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 182, __pyx_L4_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 176, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_4); #endif } else { if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 182, __pyx_L4_error) + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 176, __pyx_L4_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 182, __pyx_L4_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 176, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_4); #endif } @@ -5578,7 +5505,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 182, __pyx_L4_error) + else __PYX_ERR(0, 176, __pyx_L4_error) } break; } @@ -5587,21 +5514,21 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_4); __pyx_t_4 = 0; - /* "DracoPy.pyx":183 + /* "DracoPy.pyx":177 * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) * for dim in range(num_dims): * quant_origin[dim] = quantization_origin[dim] # <<<<<<<<<<<<<< * binary_metadata = encode_metadata(metadata) * encoded_mesh = DracoPy.encode_mesh(points, faces, binary_metadata, */ - __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 183, __pyx_L4_error) + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 177, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L4_error) + __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 177, __pyx_L4_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L4_error) + __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 177, __pyx_L4_error) (__pyx_v_quant_origin[__pyx_t_13]) = __pyx_t_12; - /* "DracoPy.pyx":182 + /* "DracoPy.pyx":176 * if quantization_origin is not None: * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) * for dim in range(num_dims): # <<<<<<<<<<<<<< @@ -5611,7 +5538,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":180 + /* "DracoPy.pyx":174 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -5620,14 +5547,14 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":184 + /* "DracoPy.pyx":178 * for dim in range(num_dims): * quant_origin[dim] = quantization_origin[dim] * binary_metadata = encode_metadata(metadata) # <<<<<<<<<<<<<< * encoded_mesh = DracoPy.encode_mesh(points, faces, binary_metadata, * quantization_bits, compression_level, */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_encode_metadata); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 184, __pyx_L4_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_encode_metadata); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 178, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { @@ -5641,52 +5568,52 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject } __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_metadata) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_metadata); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L4_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 178, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_binary_metadata = __pyx_t_3; __pyx_t_3 = 0; - /* "DracoPy.pyx":185 + /* "DracoPy.pyx":179 * quant_origin[dim] = quantization_origin[dim] * binary_metadata = encode_metadata(metadata) * encoded_mesh = DracoPy.encode_mesh(points, faces, binary_metadata, # <<<<<<<<<<<<<< * quantization_bits, compression_level, * quantization_range, quant_origin, */ - __pyx_t_14 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L4_error) - __pyx_t_15 = __pyx_convert_vector_from_py_uint32_t(__pyx_v_faces); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L4_error) - __pyx_t_16 = __pyx_convert_string_from_py_std__in_string(__pyx_v_binary_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L4_error) + __pyx_t_14 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 179, __pyx_L4_error) + __pyx_t_15 = __pyx_convert_vector_from_py_uint32_t(__pyx_v_faces); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 179, __pyx_L4_error) + __pyx_t_16 = __pyx_convert_string_from_py_std__in_string(__pyx_v_binary_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 179, __pyx_L4_error) - /* "DracoPy.pyx":186 + /* "DracoPy.pyx":180 * binary_metadata = encode_metadata(metadata) * encoded_mesh = DracoPy.encode_mesh(points, faces, binary_metadata, * quantization_bits, compression_level, # <<<<<<<<<<<<<< * quantization_range, quant_origin, * create_metadata) */ - __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 186, __pyx_L4_error) - __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 186, __pyx_L4_error) + __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L4_error) + __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L4_error) - /* "DracoPy.pyx":187 + /* "DracoPy.pyx":181 * encoded_mesh = DracoPy.encode_mesh(points, faces, binary_metadata, * quantization_bits, compression_level, * quantization_range, quant_origin, # <<<<<<<<<<<<<< * create_metadata) * if quant_origin != NULL: */ - __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 187, __pyx_L4_error) + __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 181, __pyx_L4_error) - /* "DracoPy.pyx":188 + /* "DracoPy.pyx":182 * quantization_bits, compression_level, * quantization_range, quant_origin, * create_metadata) # <<<<<<<<<<<<<< * if quant_origin != NULL: * PyMem_Free(quant_origin) */ - __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_19 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 188, __pyx_L4_error) + __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_19 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 182, __pyx_L4_error) - /* "DracoPy.pyx":185 + /* "DracoPy.pyx":179 * quant_origin[dim] = quantization_origin[dim] * binary_metadata = encode_metadata(metadata) * encoded_mesh = DracoPy.encode_mesh(points, faces, binary_metadata, # <<<<<<<<<<<<<< @@ -5697,11 +5624,11 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_20 = DracoFunctions::encode_mesh(__pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_12, __pyx_v_quant_origin, __pyx_t_19); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 185, __pyx_L4_error) + __PYX_ERR(0, 179, __pyx_L4_error) } __pyx_v_encoded_mesh = __pyx_t_20; - /* "DracoPy.pyx":189 + /* "DracoPy.pyx":183 * quantization_range, quant_origin, * create_metadata) * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -5711,7 +5638,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_1 = ((__pyx_v_quant_origin != NULL) != 0); if (__pyx_t_1) { - /* "DracoPy.pyx":190 + /* "DracoPy.pyx":184 * create_metadata) * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -5720,7 +5647,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":189 + /* "DracoPy.pyx":183 * quantization_range, quant_origin, * create_metadata) * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -5729,7 +5656,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":191 + /* "DracoPy.pyx":185 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -5739,7 +5666,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject switch (__pyx_v_encoded_mesh.encode_status) { case DracoFunctions::successful_encoding: - /* "DracoPy.pyx":192 + /* "DracoPy.pyx":186 * PyMem_Free(quant_origin) * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: * return bytes(encoded_mesh.buffer) # <<<<<<<<<<<<<< @@ -5747,16 +5674,16 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject * raise EncodingFailedException('Invalid mesh') */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_encoded_mesh.buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 192, __pyx_L4_error) + __pyx_t_3 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_encoded_mesh.buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 186, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 192, __pyx_L4_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 186, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L8_try_return; - /* "DracoPy.pyx":191 + /* "DracoPy.pyx":185 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -5766,14 +5693,14 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject break; case DracoFunctions::failed_during_encoding: - /* "DracoPy.pyx":194 + /* "DracoPy.pyx":188 * 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_3, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 194, __pyx_L4_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 188, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { @@ -5787,14 +5714,14 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject } __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_u_Invalid_mesh) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u_Invalid_mesh); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 194, __pyx_L4_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 188, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 194, __pyx_L4_error) + __PYX_ERR(0, 188, __pyx_L4_error) - /* "DracoPy.pyx":193 + /* "DracoPy.pyx":187 * 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: # <<<<<<<<<<<<<< @@ -5805,7 +5732,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject default: break; } - /* "DracoPy.pyx":178 + /* "DracoPy.pyx":172 * metadata = GeometryMetadataObject() * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -5822,7 +5749,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "DracoPy.pyx":195 + /* "DracoPy.pyx":189 * elif encoded_mesh.encode_status == DracoPy.encoding_status.failed_during_encoding: * raise EncodingFailedException('Invalid mesh') * except EncodingFailedException: # <<<<<<<<<<<<<< @@ -5830,7 +5757,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject * except: */ __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 195, __pyx_L6_except_error) + __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 189, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_21); __pyx_t_18 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_4, __pyx_t_21); __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; @@ -5838,19 +5765,19 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_5 = 0; if (__pyx_t_18) { __Pyx_AddTraceback("DracoPy.encode_mesh_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 195, __pyx_L6_except_error) + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 189, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_4); - /* "DracoPy.pyx":196 + /* "DracoPy.pyx":190 * raise EncodingFailedException('Invalid mesh') * except EncodingFailedException: * raise EncodingFailedException('Invalid mesh') # <<<<<<<<<<<<<< * except: * if quant_origin != NULL: */ - __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 196, __pyx_L6_except_error) + __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 190, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_22); __pyx_t_23 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_22))) { @@ -5864,15 +5791,15 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject } __pyx_t_21 = (__pyx_t_23) ? __Pyx_PyObject_Call2Args(__pyx_t_22, __pyx_t_23, __pyx_kp_u_Invalid_mesh) : __Pyx_PyObject_CallOneArg(__pyx_t_22, __pyx_kp_u_Invalid_mesh); __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0; - if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 196, __pyx_L6_except_error) + if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 190, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_21); __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; __Pyx_Raise(__pyx_t_21, 0, 0, 0); __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - __PYX_ERR(0, 196, __pyx_L6_except_error) + __PYX_ERR(0, 190, __pyx_L6_except_error) } - /* "DracoPy.pyx":197 + /* "DracoPy.pyx":191 * except EncodingFailedException: * raise EncodingFailedException('Invalid mesh') * except: # <<<<<<<<<<<<<< @@ -5881,12 +5808,12 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ /*except:*/ { __Pyx_AddTraceback("DracoPy.encode_mesh_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5) < 0) __PYX_ERR(0, 197, __pyx_L6_except_error) + if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5) < 0) __PYX_ERR(0, 191, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_5); - /* "DracoPy.pyx":198 + /* "DracoPy.pyx":192 * raise EncodingFailedException('Invalid mesh') * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -5896,7 +5823,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_1 = ((__pyx_v_quant_origin != NULL) != 0); if (__pyx_t_1) { - /* "DracoPy.pyx":199 + /* "DracoPy.pyx":193 * except: * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -5905,7 +5832,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":198 + /* "DracoPy.pyx":192 * raise EncodingFailedException('Invalid mesh') * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -5914,22 +5841,22 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":200 + /* "DracoPy.pyx":194 * if quant_origin != NULL: * PyMem_Free(quant_origin) * raise ValueError("Input invalid") # <<<<<<<<<<<<<< * * def encode_point_cloud_to_buffer(points, metadata: GeometryMetadataObject = None, */ - __pyx_t_21 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 200, __pyx_L6_except_error) + __pyx_t_21 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 194, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_21); __Pyx_Raise(__pyx_t_21, 0, 0, 0); __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - __PYX_ERR(0, 200, __pyx_L6_except_error) + __PYX_ERR(0, 194, __pyx_L6_except_error) } __pyx_L6_except_error:; - /* "DracoPy.pyx":178 + /* "DracoPy.pyx":172 * metadata = GeometryMetadataObject() * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -5950,7 +5877,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_L9_try_end:; } - /* "DracoPy.pyx":162 + /* "DracoPy.pyx":156 * pass * * def encode_mesh_to_buffer(points, faces, metadata: GeometryMetadataObject = None, # <<<<<<<<<<<<<< @@ -5980,7 +5907,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject return __pyx_r; } -/* "DracoPy.pyx":202 +/* "DracoPy.pyx":196 * raise ValueError("Input invalid") * * def encode_point_cloud_to_buffer(points, metadata: GeometryMetadataObject = None, # <<<<<<<<<<<<<< @@ -6014,7 +5941,7 @@ static PyObject *__pyx_pw_7DracoPy_7encode_point_cloud_to_buffer(PyObject *__pyx values[3] = ((PyObject *)__pyx_int_1); values[4] = ((PyObject *)__pyx_int_neg_1); - /* "DracoPy.pyx":204 + /* "DracoPy.pyx":198 * def encode_point_cloud_to_buffer(points, metadata: GeometryMetadataObject = None, * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, # <<<<<<<<<<<<<< @@ -6023,7 +5950,7 @@ static PyObject *__pyx_pw_7DracoPy_7encode_point_cloud_to_buffer(PyObject *__pyx */ values[5] = ((PyObject *)Py_None); - /* "DracoPy.pyx":205 + /* "DracoPy.pyx":199 * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, * create_metadata=False): # <<<<<<<<<<<<<< @@ -6095,7 +6022,7 @@ static PyObject *__pyx_pw_7DracoPy_7encode_point_cloud_to_buffer(PyObject *__pyx } } 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, 202, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode_point_cloud_to_buffer") < 0)) __PYX_ERR(0, 196, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -6126,7 +6053,7 @@ static PyObject *__pyx_pw_7DracoPy_7encode_point_cloud_to_buffer(PyObject *__pyx } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("encode_point_cloud_to_buffer", 0, 1, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 202, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode_point_cloud_to_buffer", 0, 1, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 196, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("DracoPy.encode_point_cloud_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -6134,7 +6061,7 @@ static PyObject *__pyx_pw_7DracoPy_7encode_point_cloud_to_buffer(PyObject *__pyx __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(__pyx_self, __pyx_v_points, __pyx_v_metadata, __pyx_v_quantization_bits, __pyx_v_compression_level, __pyx_v_quantization_range, __pyx_v_quantization_origin, __pyx_v_create_metadata); - /* "DracoPy.pyx":202 + /* "DracoPy.pyx":196 * raise ValueError("Input invalid") * * def encode_point_cloud_to_buffer(points, metadata: GeometryMetadataObject = None, # <<<<<<<<<<<<<< @@ -6183,7 +6110,7 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_RefNannySetupContext("encode_point_cloud_to_buffer", 0); __Pyx_INCREF(__pyx_v_metadata); - /* "DracoPy.pyx":215 + /* "DracoPy.pyx":209 * a point where each coordinate is the minimum of that coordinate among the input vertices. * """ * if metadata is None: # <<<<<<<<<<<<<< @@ -6194,14 +6121,14 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "DracoPy.pyx":216 + /* "DracoPy.pyx":210 * """ * if metadata is None: * metadata = GeometryMetadataObject() # <<<<<<<<<<<<<< * cdef float* quant_origin = NULL * try: */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_GeometryMetadataObject); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 216, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_GeometryMetadataObject); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { @@ -6215,13 +6142,13 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P } __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 216, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF_SET(__pyx_v_metadata, __pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":215 + /* "DracoPy.pyx":209 * a point where each coordinate is the minimum of that coordinate among the input vertices. * """ * if metadata is None: # <<<<<<<<<<<<<< @@ -6230,7 +6157,7 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P */ } - /* "DracoPy.pyx":217 + /* "DracoPy.pyx":211 * if metadata is None: * metadata = GeometryMetadataObject() * cdef float* quant_origin = NULL # <<<<<<<<<<<<<< @@ -6239,7 +6166,7 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P */ __pyx_v_quant_origin = NULL; - /* "DracoPy.pyx":218 + /* "DracoPy.pyx":212 * metadata = GeometryMetadataObject() * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -6255,7 +6182,7 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_XGOTREF(__pyx_t_8); /*try:*/ { - /* "DracoPy.pyx":219 + /* "DracoPy.pyx":213 * cdef float* quant_origin = NULL * try: * num_dims = 3 # <<<<<<<<<<<<<< @@ -6265,7 +6192,7 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_INCREF(__pyx_int_3); __pyx_v_num_dims = __pyx_int_3; - /* "DracoPy.pyx":220 + /* "DracoPy.pyx":214 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -6276,38 +6203,38 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "DracoPy.pyx":221 + /* "DracoPy.pyx":215 * 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_3 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 221, __pyx_L4_error) + __pyx_t_3 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 215, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 221, __pyx_L4_error) + __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 215, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_9 = __Pyx_PyInt_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 221, __pyx_L4_error) + __pyx_t_9 = __Pyx_PyInt_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L4_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_quant_origin = ((float *)PyMem_Malloc(__pyx_t_9)); - /* "DracoPy.pyx":222 + /* "DracoPy.pyx":216 * 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] * binary_metadata = encode_metadata(metadata) */ - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 222, __pyx_L4_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 216, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_4); if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_10 = 0; __pyx_t_11 = NULL; } else { - __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 222, __pyx_L4_error) + __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 216, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 222, __pyx_L4_error) + __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 216, __pyx_L4_error) } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; for (;;) { @@ -6315,17 +6242,17 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P if (likely(PyList_CheckExact(__pyx_t_3))) { if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 222, __pyx_L4_error) + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 216, __pyx_L4_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 222, __pyx_L4_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 216, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_4); #endif } else { if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 222, __pyx_L4_error) + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 216, __pyx_L4_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 222, __pyx_L4_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 216, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_4); #endif } @@ -6335,7 +6262,7 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 222, __pyx_L4_error) + else __PYX_ERR(0, 216, __pyx_L4_error) } break; } @@ -6344,21 +6271,21 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_4); __pyx_t_4 = 0; - /* "DracoPy.pyx":223 + /* "DracoPy.pyx":217 * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) * for dim in range(num_dims): * quant_origin[dim] = quantization_origin[dim] # <<<<<<<<<<<<<< * binary_metadata = encode_metadata(metadata) * encoded_point_cloud = DracoPy.encode_point_cloud( */ - __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 223, __pyx_L4_error) + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 217, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 223, __pyx_L4_error) + __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 217, __pyx_L4_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 223, __pyx_L4_error) + __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 217, __pyx_L4_error) (__pyx_v_quant_origin[__pyx_t_13]) = __pyx_t_12; - /* "DracoPy.pyx":222 + /* "DracoPy.pyx":216 * if quantization_origin is not None: * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) * for dim in range(num_dims): # <<<<<<<<<<<<<< @@ -6368,7 +6295,7 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":220 + /* "DracoPy.pyx":214 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -6377,14 +6304,14 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P */ } - /* "DracoPy.pyx":224 + /* "DracoPy.pyx":218 * for dim in range(num_dims): * quant_origin[dim] = quantization_origin[dim] * binary_metadata = encode_metadata(metadata) # <<<<<<<<<<<<<< * encoded_point_cloud = DracoPy.encode_point_cloud( * points, binary_metadata, quantization_bits, compression_level, */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_encode_metadata); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 224, __pyx_L4_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_encode_metadata); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 218, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { @@ -6398,35 +6325,35 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P } __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_metadata) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_metadata); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 224, __pyx_L4_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 218, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_binary_metadata = __pyx_t_3; __pyx_t_3 = 0; - /* "DracoPy.pyx":226 + /* "DracoPy.pyx":220 * binary_metadata = encode_metadata(metadata) * encoded_point_cloud = DracoPy.encode_point_cloud( * points, binary_metadata, quantization_bits, compression_level, # <<<<<<<<<<<<<< * quantization_range, quant_origin, create_metadata) * if quant_origin != NULL: */ - __pyx_t_14 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 226, __pyx_L4_error) - __pyx_t_15 = __pyx_convert_string_from_py_std__in_string(__pyx_v_binary_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 226, __pyx_L4_error) - __pyx_t_16 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 226, __pyx_L4_error) - __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 226, __pyx_L4_error) + __pyx_t_14 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L4_error) + __pyx_t_15 = __pyx_convert_string_from_py_std__in_string(__pyx_v_binary_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L4_error) + __pyx_t_16 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L4_error) + __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L4_error) - /* "DracoPy.pyx":227 + /* "DracoPy.pyx":221 * encoded_point_cloud = DracoPy.encode_point_cloud( * points, binary_metadata, quantization_bits, compression_level, * quantization_range, quant_origin, create_metadata) # <<<<<<<<<<<<<< * if quant_origin != NULL: * PyMem_Free(quant_origin) */ - __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 227, __pyx_L4_error) - __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_18 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 227, __pyx_L4_error) + __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 221, __pyx_L4_error) + __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_18 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 221, __pyx_L4_error) - /* "DracoPy.pyx":225 + /* "DracoPy.pyx":219 * quant_origin[dim] = quantization_origin[dim] * binary_metadata = encode_metadata(metadata) * encoded_point_cloud = DracoPy.encode_point_cloud( # <<<<<<<<<<<<<< @@ -6437,11 +6364,11 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_19 = DracoFunctions::encode_point_cloud(__pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_12, __pyx_v_quant_origin, __pyx_t_18); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 225, __pyx_L4_error) + __PYX_ERR(0, 219, __pyx_L4_error) } __pyx_v_encoded_point_cloud = __pyx_t_19; - /* "DracoPy.pyx":228 + /* "DracoPy.pyx":222 * points, binary_metadata, quantization_bits, compression_level, * quantization_range, quant_origin, create_metadata) * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -6451,7 +6378,7 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_1 = ((__pyx_v_quant_origin != NULL) != 0); if (__pyx_t_1) { - /* "DracoPy.pyx":229 + /* "DracoPy.pyx":223 * quantization_range, quant_origin, create_metadata) * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -6460,7 +6387,7 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":228 + /* "DracoPy.pyx":222 * points, binary_metadata, quantization_bits, compression_level, * quantization_range, quant_origin, create_metadata) * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -6469,7 +6396,7 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P */ } - /* "DracoPy.pyx":230 + /* "DracoPy.pyx":224 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -6479,7 +6406,7 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P switch (__pyx_v_encoded_point_cloud.encode_status) { case DracoFunctions::successful_encoding: - /* "DracoPy.pyx":231 + /* "DracoPy.pyx":225 * PyMem_Free(quant_origin) * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: * return bytes(encoded_point_cloud.buffer) # <<<<<<<<<<<<<< @@ -6487,16 +6414,16 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P * raise EncodingFailedException('Invalid point cloud') */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_encoded_point_cloud.buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 231, __pyx_L4_error) + __pyx_t_3 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_encoded_point_cloud.buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 231, __pyx_L4_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 225, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L8_try_return; - /* "DracoPy.pyx":230 + /* "DracoPy.pyx":224 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -6506,14 +6433,14 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P break; case DracoFunctions::failed_during_encoding: - /* "DracoPy.pyx":233 + /* "DracoPy.pyx":227 * 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_3, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 233, __pyx_L4_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 227, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { @@ -6527,14 +6454,14 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P } __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_u_Invalid_point_cloud) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u_Invalid_point_cloud); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 233, __pyx_L4_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 227, __pyx_L4_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 233, __pyx_L4_error) + __PYX_ERR(0, 227, __pyx_L4_error) - /* "DracoPy.pyx":232 + /* "DracoPy.pyx":226 * 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: # <<<<<<<<<<<<<< @@ -6545,7 +6472,7 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P default: break; } - /* "DracoPy.pyx":218 + /* "DracoPy.pyx":212 * metadata = GeometryMetadataObject() * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -6562,7 +6489,7 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "DracoPy.pyx":234 + /* "DracoPy.pyx":228 * elif encoded_point_cloud.encode_status == DracoPy.encoding_status.failed_during_encoding: * raise EncodingFailedException('Invalid point cloud') * except EncodingFailedException: # <<<<<<<<<<<<<< @@ -6570,7 +6497,7 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P * except: */ __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_20, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 234, __pyx_L6_except_error) + __Pyx_GetModuleGlobalName(__pyx_t_20, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 228, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_20); __pyx_t_17 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_4, __pyx_t_20); __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; @@ -6578,19 +6505,19 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_5 = 0; if (__pyx_t_17) { __Pyx_AddTraceback("DracoPy.encode_point_cloud_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 234, __pyx_L6_except_error) + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 228, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_4); - /* "DracoPy.pyx":235 + /* "DracoPy.pyx":229 * raise EncodingFailedException('Invalid point cloud') * except EncodingFailedException: * raise EncodingFailedException('Invalid point cloud') # <<<<<<<<<<<<<< * except: * if quant_origin != NULL: */ - __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 235, __pyx_L6_except_error) + __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 229, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_21); __pyx_t_22 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_21))) { @@ -6604,15 +6531,15 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P } __pyx_t_20 = (__pyx_t_22) ? __Pyx_PyObject_Call2Args(__pyx_t_21, __pyx_t_22, __pyx_kp_u_Invalid_point_cloud) : __Pyx_PyObject_CallOneArg(__pyx_t_21, __pyx_kp_u_Invalid_point_cloud); __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0; - if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 235, __pyx_L6_except_error) + if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 229, __pyx_L6_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, 235, __pyx_L6_except_error) + __PYX_ERR(0, 229, __pyx_L6_except_error) } - /* "DracoPy.pyx":236 + /* "DracoPy.pyx":230 * except EncodingFailedException: * raise EncodingFailedException('Invalid point cloud') * except: # <<<<<<<<<<<<<< @@ -6621,12 +6548,12 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P */ /*except:*/ { __Pyx_AddTraceback("DracoPy.encode_point_cloud_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5) < 0) __PYX_ERR(0, 236, __pyx_L6_except_error) + if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5) < 0) __PYX_ERR(0, 230, __pyx_L6_except_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_5); - /* "DracoPy.pyx":237 + /* "DracoPy.pyx":231 * raise EncodingFailedException('Invalid point cloud') * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -6636,7 +6563,7 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_1 = ((__pyx_v_quant_origin != NULL) != 0); if (__pyx_t_1) { - /* "DracoPy.pyx":238 + /* "DracoPy.pyx":232 * except: * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -6645,7 +6572,7 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":237 + /* "DracoPy.pyx":231 * raise EncodingFailedException('Invalid point cloud') * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -6654,22 +6581,22 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P */ } - /* "DracoPy.pyx":239 + /* "DracoPy.pyx":233 * if quant_origin != NULL: * PyMem_Free(quant_origin) * raise ValueError("Input invalid") # <<<<<<<<<<<<<< * * def raise_decoding_error(decoding_status): */ - __pyx_t_20 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 239, __pyx_L6_except_error) + __pyx_t_20 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 233, __pyx_L6_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, 239, __pyx_L6_except_error) + __PYX_ERR(0, 233, __pyx_L6_except_error) } __pyx_L6_except_error:; - /* "DracoPy.pyx":218 + /* "DracoPy.pyx":212 * metadata = GeometryMetadataObject() * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -6690,7 +6617,7 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_L9_try_end:; } - /* "DracoPy.pyx":202 + /* "DracoPy.pyx":196 * raise ValueError("Input invalid") * * def encode_point_cloud_to_buffer(points, metadata: GeometryMetadataObject = None, # <<<<<<<<<<<<<< @@ -6720,7 +6647,7 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P return __pyx_r; } -/* "DracoPy.pyx":241 +/* "DracoPy.pyx":235 * raise ValueError("Input invalid") * * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< @@ -6754,29 +6681,29 @@ static PyObject *__pyx_pf_7DracoPy_8raise_decoding_error(CYTHON_UNUSED PyObject int __pyx_clineno = 0; __Pyx_RefNannySetupContext("raise_decoding_error", 0); - /* "DracoPy.pyx":242 + /* "DracoPy.pyx":236 * * 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, 242, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::not_draco_encoded); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 236, __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, 242, __pyx_L1_error) + __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, 236, __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, 242, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 236, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":243 + /* "DracoPy.pyx":237 * 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, 243, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FileTypeException); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { @@ -6790,14 +6717,14 @@ static PyObject *__pyx_pf_7DracoPy_8raise_decoding_error(CYTHON_UNUSED PyObject } __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, 243, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 237, __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, 243, __pyx_L1_error) + __PYX_ERR(0, 237, __pyx_L1_error) - /* "DracoPy.pyx":242 + /* "DracoPy.pyx":236 * * def raise_decoding_error(decoding_status): * if decoding_status == DracoPy.decoding_status.not_draco_encoded: # <<<<<<<<<<<<<< @@ -6806,35 +6733,35 @@ static PyObject *__pyx_pf_7DracoPy_8raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":244 + /* "DracoPy.pyx":238 * 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, 244, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::failed_during_decoding); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 238, __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, 244, __pyx_L1_error) + __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, 238, __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, 244, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 238, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":245 + /* "DracoPy.pyx":239 * 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__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 245, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __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, 245, __pyx_L1_error) + __PYX_ERR(0, 239, __pyx_L1_error) - /* "DracoPy.pyx":244 + /* "DracoPy.pyx":238 * 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: # <<<<<<<<<<<<<< @@ -6843,35 +6770,35 @@ static PyObject *__pyx_pf_7DracoPy_8raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":246 + /* "DracoPy.pyx":240 * 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, 246, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::no_position_attribute); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __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, 246, __pyx_L1_error) + __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, 240, __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, 246, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 240, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":247 + /* "DracoPy.pyx":241 * 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): */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 247, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 241, __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, 247, __pyx_L1_error) + __PYX_ERR(0, 241, __pyx_L1_error) - /* "DracoPy.pyx":246 + /* "DracoPy.pyx":240 * 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: # <<<<<<<<<<<<<< @@ -6880,7 +6807,7 @@ static PyObject *__pyx_pf_7DracoPy_8raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":241 + /* "DracoPy.pyx":235 * raise ValueError("Input invalid") * * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< @@ -6903,7 +6830,7 @@ static PyObject *__pyx_pf_7DracoPy_8raise_decoding_error(CYTHON_UNUSED PyObject return __pyx_r; } -/* "DracoPy.pyx":249 +/* "DracoPy.pyx":243 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer): # <<<<<<<<<<<<<< @@ -6942,24 +6869,24 @@ static PyObject *__pyx_pf_7DracoPy_10decode_buffer_to_mesh(CYTHON_UNUSED PyObjec int __pyx_clineno = 0; __Pyx_RefNannySetupContext("decode_buffer_to_mesh", 0); - /* "DracoPy.pyx":250 + /* "DracoPy.pyx":244 * * 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) */ - __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 250, __pyx_L1_error) - __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 250, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 244, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 244, __pyx_L1_error) try { __pyx_t_3 = DracoFunctions::decode_buffer(__pyx_t_1, __pyx_t_2); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 250, __pyx_L1_error) + __PYX_ERR(0, 244, __pyx_L1_error) } __pyx_v_mesh_struct = __pyx_t_3; - /* "DracoPy.pyx":251 + /* "DracoPy.pyx":245 * def decode_buffer_to_mesh(buffer): * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< @@ -6969,7 +6896,7 @@ static PyObject *__pyx_pf_7DracoPy_10decode_buffer_to_mesh(CYTHON_UNUSED PyObjec __pyx_t_4 = ((__pyx_v_mesh_struct.decode_status == DracoFunctions::successful) != 0); if (__pyx_t_4) { - /* "DracoPy.pyx":252 + /* "DracoPy.pyx":246 * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: * return DracoMesh(mesh_struct) # <<<<<<<<<<<<<< @@ -6977,9 +6904,9 @@ static PyObject *__pyx_pf_7DracoPy_10decode_buffer_to_mesh(CYTHON_UNUSED PyObjec * 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, 252, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_DracoMesh); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 246, __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, 252, __pyx_L1_error) + __pyx_t_7 = __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(__pyx_v_mesh_struct); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 246, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -6994,14 +6921,14 @@ static PyObject *__pyx_pf_7DracoPy_10decode_buffer_to_mesh(CYTHON_UNUSED PyObjec __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, 252, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 246, __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":251 + /* "DracoPy.pyx":245 * def decode_buffer_to_mesh(buffer): * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< @@ -7010,7 +6937,7 @@ static PyObject *__pyx_pf_7DracoPy_10decode_buffer_to_mesh(CYTHON_UNUSED PyObjec */ } - /* "DracoPy.pyx":254 + /* "DracoPy.pyx":248 * return DracoMesh(mesh_struct) * else: * raise_decoding_error(mesh_struct.decode_status) # <<<<<<<<<<<<<< @@ -7018,9 +6945,9 @@ static PyObject *__pyx_pf_7DracoPy_10decode_buffer_to_mesh(CYTHON_UNUSED PyObjec * 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, 254, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_raise_decoding_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 248, __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, 254, __pyx_L1_error) + __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, 248, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -7035,13 +6962,13 @@ static PyObject *__pyx_pf_7DracoPy_10decode_buffer_to_mesh(CYTHON_UNUSED PyObjec __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, 254, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 248, __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; } - /* "DracoPy.pyx":249 + /* "DracoPy.pyx":243 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer): # <<<<<<<<<<<<<< @@ -7065,7 +6992,7 @@ static PyObject *__pyx_pf_7DracoPy_10decode_buffer_to_mesh(CYTHON_UNUSED PyObjec return __pyx_r; } -/* "DracoPy.pyx":256 +/* "DracoPy.pyx":250 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer): # <<<<<<<<<<<<<< @@ -7104,24 +7031,24 @@ static PyObject *__pyx_pf_7DracoPy_12decode_point_cloud_buffer(CYTHON_UNUSED PyO int __pyx_clineno = 0; __Pyx_RefNannySetupContext("decode_point_cloud_buffer", 0); - /* "DracoPy.pyx":257 + /* "DracoPy.pyx":251 * * 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) */ - __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 257, __pyx_L1_error) - __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 257, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 251, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 251, __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, 257, __pyx_L1_error) + __PYX_ERR(0, 251, __pyx_L1_error) } __pyx_v_point_cloud_struct = __pyx_t_3; - /* "DracoPy.pyx":258 + /* "DracoPy.pyx":252 * 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: # <<<<<<<<<<<<<< @@ -7131,7 +7058,7 @@ static PyObject *__pyx_pf_7DracoPy_12decode_point_cloud_buffer(CYTHON_UNUSED PyO __pyx_t_4 = ((__pyx_v_point_cloud_struct.decode_status == DracoFunctions::successful) != 0); if (__pyx_t_4) { - /* "DracoPy.pyx":259 + /* "DracoPy.pyx":253 * 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) # <<<<<<<<<<<<<< @@ -7139,9 +7066,9 @@ static PyObject *__pyx_pf_7DracoPy_12decode_point_cloud_buffer(CYTHON_UNUSED PyO * raise_decoding_error(point_cloud_struct.decode_status) */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 259, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 253, __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, 259, __pyx_L1_error) + __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, 253, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -7156,14 +7083,14 @@ static PyObject *__pyx_pf_7DracoPy_12decode_point_cloud_buffer(CYTHON_UNUSED PyO __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, 259, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 253, __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":258 + /* "DracoPy.pyx":252 * 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: # <<<<<<<<<<<<<< @@ -7172,15 +7099,15 @@ static PyObject *__pyx_pf_7DracoPy_12decode_point_cloud_buffer(CYTHON_UNUSED PyO */ } - /* "DracoPy.pyx":261 + /* "DracoPy.pyx":255 * return DracoPointCloud(point_cloud_struct) * 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, 261, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_raise_decoding_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 255, __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, 261, __pyx_L1_error) + __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, 255, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -7195,13 +7122,13 @@ static PyObject *__pyx_pf_7DracoPy_12decode_point_cloud_buffer(CYTHON_UNUSED PyO __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, 261, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 255, __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; } - /* "DracoPy.pyx":256 + /* "DracoPy.pyx":250 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer): # <<<<<<<<<<<<<< @@ -8207,7 +8134,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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__15, __pyx_k__15, sizeof(__pyx_k__15), 0, 0, 1, 1}, + {&__pyx_n_s__14, __pyx_k__14, sizeof(__pyx_k__14), 0, 0, 1, 1}, {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1}, {&__pyx_n_s_attribute_metadata, __pyx_k_attribute_metadata, sizeof(__pyx_k_attribute_metadata), 0, 0, 1, 1}, {&__pyx_n_s_attribute_metadatas, __pyx_k_attribute_metadatas, sizeof(__pyx_k_attribute_metadatas), 0, 0, 1, 1}, @@ -8283,10 +8210,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_reader, __pyx_k_reader, sizeof(__pyx_k_reader), 0, 0, 1, 1}, - {&__pyx_n_s_s, __pyx_k_s, sizeof(__pyx_k_s), 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_ss, __pyx_k_ss, sizeof(__pyx_k_ss), 0, 0, 1, 1}, {&__pyx_n_s_sub_metadata, __pyx_k_sub_metadata, sizeof(__pyx_k_sub_metadata), 0, 0, 1, 1}, {&__pyx_n_s_sub_metadatas, __pyx_k_sub_metadatas, sizeof(__pyx_k_sub_metadatas), 0, 0, 1, 1}, {&__pyx_n_s_sub_metadatas_len, __pyx_k_sub_metadatas_len, sizeof(__pyx_k_sub_metadatas_len), 0, 0, 1, 1}, @@ -8302,12 +8227,12 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {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, 96, __pyx_L1_error) - __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) __PYX_ERR(0, 114, __pyx_L1_error) + __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 90, __pyx_L1_error) + __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) __PYX_ERR(0, 108, __pyx_L1_error) __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 20, __pyx_L1_error) - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 40, __pyx_L1_error) - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 141, __pyx_L1_error) - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 245, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 39, __pyx_L1_error) + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 135, __pyx_L1_error) + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 239, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -8317,49 +8242,49 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "DracoPy.pyx":141 + /* "DracoPy.pyx":135 * 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__2 = PyTuple_Pack(1, __pyx_kp_u_Specified_value_out_of_encoded_r); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 141, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__2); - __Pyx_GIVEREF(__pyx_tuple__2); + __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_Specified_value_out_of_encoded_r); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 135, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple_); + __Pyx_GIVEREF(__pyx_tuple_); - /* "DracoPy.pyx":200 + /* "DracoPy.pyx":194 * if quant_origin != NULL: * PyMem_Free(quant_origin) * raise ValueError("Input invalid") # <<<<<<<<<<<<<< * * def encode_point_cloud_to_buffer(points, metadata: GeometryMetadataObject = None, */ - __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_Input_invalid); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 200, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__3); - __Pyx_GIVEREF(__pyx_tuple__3); + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_Input_invalid); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__2); + __Pyx_GIVEREF(__pyx_tuple__2); - /* "DracoPy.pyx":245 + /* "DracoPy.pyx":239 * 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__4 = PyTuple_Pack(1, __pyx_kp_u_Failed_to_decode_input_mesh_Data); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 245, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__4); - __Pyx_GIVEREF(__pyx_tuple__4); + __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_Failed_to_decode_input_mesh_Data); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 239, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__3); + __Pyx_GIVEREF(__pyx_tuple__3); - /* "DracoPy.pyx":247 + /* "DracoPy.pyx":241 * 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): */ - __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_DracoPy_only_supports_meshes_wit); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 247, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); + __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_DracoPy_only_supports_meshes_wit); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 241, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__4); + __Pyx_GIVEREF(__pyx_tuple__4); /* "DracoPy.pyx":10 * @@ -8368,13 +8293,13 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * sub_metadatas: Dict[str, 'MetadataObject'] = None): * self.entries = entries if entries else {} */ - __pyx_tuple__6 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_entries, __pyx_n_s_sub_metadatas); 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(3, 0, 3, 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_tuple__8 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 10, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); + __pyx_tuple__5 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_entries, __pyx_n_s_sub_metadatas); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__5); + __Pyx_GIVEREF(__pyx_tuple__5); + __pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_init, 10, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 10, __pyx_L1_error) + __pyx_tuple__7 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__7); + __Pyx_GIVEREF(__pyx_tuple__7); /* "DracoPy.pyx":17 * @@ -8383,13 +8308,13 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * entries: Dict[str, bytes] = None, * sub_metadatas: Dict[str, 'MetadataObject'] = None): */ - __pyx_tuple__9 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_unique_id, __pyx_n_s_entries, __pyx_n_s_sub_metadatas); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); - __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_init, 17, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 17, __pyx_L1_error) - __pyx_tuple__11 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__11); - __Pyx_GIVEREF(__pyx_tuple__11); + __pyx_tuple__8 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_unique_id, __pyx_n_s_entries, __pyx_n_s_sub_metadatas); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__8); + __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 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_init, 17, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 17, __pyx_L1_error) + __pyx_tuple__10 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__10); + __Pyx_GIVEREF(__pyx_tuple__10); /* "DracoPy.pyx":25 * @@ -8398,251 +8323,251 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * sub_metadatas: Dict[str, 'MetadataObject'] = None, * attribute_metadatas: List['AttributeMetadataObject'] = None): */ - __pyx_tuple__12 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_entries, __pyx_n_s_sub_metadatas, __pyx_n_s_attribute_metadatas); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__12); - __Pyx_GIVEREF(__pyx_tuple__12); - __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 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_init, 25, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 25, __pyx_L1_error) - __pyx_tuple__14 = PyTuple_Pack(3, ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__14); - __Pyx_GIVEREF(__pyx_tuple__14); + __pyx_tuple__11 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_entries, __pyx_n_s_sub_metadatas, __pyx_n_s_attribute_metadatas); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__11); + __Pyx_GIVEREF(__pyx_tuple__11); + __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_init, 25, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 25, __pyx_L1_error) + __pyx_tuple__13 = PyTuple_Pack(3, ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 25, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__13); + __Pyx_GIVEREF(__pyx_tuple__13); /* "DracoPy.pyx":33 * * * def decode_metadata(binary_metadata: bytes) -> MetadataObject: # <<<<<<<<<<<<<< - * ss = new stringstream(binary_metadata) - * reader = new DracoPy.MetadataReader(ss) + * reader = new DracoPy.MetadataReader(binary_metadata) + * geometry_metadata = GeometryMetadataObject() */ - __pyx_tuple__16 = PyTuple_Pack(16, __pyx_n_s_binary_metadata, __pyx_n_s_ss, __pyx_n_s_reader, __pyx_n_s_geometry_metadata, __pyx_n_s_to_parse_metadatas, __pyx_n_s_attribute_metadatas_len, __pyx_n_s__15, __pyx_n_s_unique_id, __pyx_n_s_attribute_metadata, __pyx_n_s_to_parse_metadata_next, __pyx_n_s_metadata, __pyx_n_s_entries_len, __pyx_n_s_name_2, __pyx_n_s_value, __pyx_n_s_sub_metadatas_len, __pyx_n_s_sub_metadata); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 33, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__16); - __Pyx_GIVEREF(__pyx_tuple__16); - __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(1, 0, 16, 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_decode_metadata, 33, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 33, __pyx_L1_error) + __pyx_tuple__15 = PyTuple_Pack(15, __pyx_n_s_binary_metadata, __pyx_n_s_reader, __pyx_n_s_geometry_metadata, __pyx_n_s_to_parse_metadatas, __pyx_n_s_attribute_metadatas_len, __pyx_n_s__14, __pyx_n_s_unique_id, __pyx_n_s_attribute_metadata, __pyx_n_s_to_parse_metadata_next, __pyx_n_s_metadata, __pyx_n_s_entries_len, __pyx_n_s_name_2, __pyx_n_s_value, __pyx_n_s_sub_metadatas_len, __pyx_n_s_sub_metadata); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__15); + __Pyx_GIVEREF(__pyx_tuple__15); + __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(1, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_metadata, 33, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 33, __pyx_L1_error) - /* "DracoPy.pyx":67 + /* "DracoPy.pyx":65 * return geometry_metadata * * def encode_metadata(geometry_metadata: GeometryMetadataObject) -> bytes: # <<<<<<<<<<<<<< - * ss = new stringstream(b"") - * writer = new DracoPy.MetadataWriter(ss) + * cdef DracoPy.MetadataWriter writer + * to_parse_metadata = [geometry_metadata] */ - __pyx_tuple__18 = PyTuple_Pack(11, __pyx_n_s_geometry_metadata, __pyx_n_s_ss, __pyx_n_s_writer, __pyx_n_s_to_parse_metadata, __pyx_n_s_attribute_metadata, __pyx_n_s_to_parse_metadata_next, __pyx_n_s_draco_metadata, __pyx_n_s_name_2, __pyx_n_s_value, __pyx_n_s_draco_sub_metadata, __pyx_n_s_s); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 67, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__18); - __Pyx_GIVEREF(__pyx_tuple__18); - __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(1, 0, 11, 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_encode_metadata, 67, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 67, __pyx_L1_error) + __pyx_tuple__17 = PyTuple_Pack(9, __pyx_n_s_geometry_metadata, __pyx_n_s_writer, __pyx_n_s_to_parse_metadata, __pyx_n_s_attribute_metadata, __pyx_n_s_to_parse_metadata_next, __pyx_n_s_draco_metadata, __pyx_n_s_name_2, __pyx_n_s_value, __pyx_n_s_draco_sub_metadata); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__17); + __Pyx_GIVEREF(__pyx_tuple__17); + __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(1, 0, 9, 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_encode_metadata, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 65, __pyx_L1_error) - /* "DracoPy.pyx":96 + /* "DracoPy.pyx":90 * * * class DracoPointCloud(object): # <<<<<<<<<<<<<< * def __init__(self, data_struct): * self.data_struct = data_struct */ - __pyx_tuple__20 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 96, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__20); - __Pyx_GIVEREF(__pyx_tuple__20); + __pyx_tuple__19 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__19); + __Pyx_GIVEREF(__pyx_tuple__19); - /* "DracoPy.pyx":97 + /* "DracoPy.pyx":91 * * class DracoPointCloud(object): * def __init__(self, data_struct): # <<<<<<<<<<<<<< * self.data_struct = data_struct * if data_struct['encoding_options_set']: */ - __pyx_tuple__21 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_data_struct); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 97, __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_init, 97, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_tuple__20 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_data_struct); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__20); + __Pyx_GIVEREF(__pyx_tuple__20); + __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_init, 91, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 91, __pyx_L1_error) - /* "DracoPy.pyx":106 + /* "DracoPy.pyx":100 * self.metadata = decode_metadata(data_struct["binary_metadata"]) * * 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__23 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_value, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__23); - __Pyx_GIVEREF(__pyx_tuple__23); - __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 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, 106, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 106, __pyx_L1_error) + __pyx_tuple__22 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_value, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 100, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__22); + __Pyx_GIVEREF(__pyx_tuple__22); + __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_get_encoded_coordinate, 100, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 100, __pyx_L1_error) - /* "DracoPy.pyx":110 + /* "DracoPy.pyx":104 * 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__25 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_point); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 110, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__25); - __Pyx_GIVEREF(__pyx_tuple__25); - __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 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, 110, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_tuple__24 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_point); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__24); + __Pyx_GIVEREF(__pyx_tuple__24); + __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_get_encoded_point, 104, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 104, __pyx_L1_error) - /* "DracoPy.pyx":115 + /* "DracoPy.pyx":109 * * @property * def num_axes(self): # <<<<<<<<<<<<<< * return 3 * */ - __pyx_tuple__27 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 115, __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, 115, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 115, __pyx_L1_error) + __pyx_tuple__26 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 109, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__26); + __Pyx_GIVEREF(__pyx_tuple__26); + __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_num_axes, 109, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 109, __pyx_L1_error) - /* "DracoPy.pyx":119 + /* "DracoPy.pyx":113 * * @property * def points(self): # <<<<<<<<<<<<<< * return self.data_struct['points'] * */ - __pyx_tuple__29 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 119, __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_points, 119, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 119, __pyx_L1_error) + __pyx_tuple__28 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 113, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__28); + __Pyx_GIVEREF(__pyx_tuple__28); + __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_points, 113, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 113, __pyx_L1_error) - /* "DracoPy.pyx":125 + /* "DracoPy.pyx":119 * class DracoMesh(DracoPointCloud): * @property * def faces(self): # <<<<<<<<<<<<<< * return self.data_struct['faces'] * */ - __pyx_tuple__31 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 125, __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, 125, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 125, __pyx_L1_error) + __pyx_tuple__30 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__30); + __Pyx_GIVEREF(__pyx_tuple__30); + __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_faces, 119, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 119, __pyx_L1_error) - /* "DracoPy.pyx":129 + /* "DracoPy.pyx":123 * * @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, 129, __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, 129, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 129, __pyx_L1_error) + __pyx_tuple__32 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__32); + __Pyx_GIVEREF(__pyx_tuple__32); + __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_normals, 123, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 123, __pyx_L1_error) - /* "DracoPy.pyx":132 + /* "DracoPy.pyx":126 * return self.data_struct['normals'] * * 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, 132, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__35); - __Pyx_GIVEREF(__pyx_tuple__35); + __pyx_tuple__34 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__34); + __Pyx_GIVEREF(__pyx_tuple__34); - /* "DracoPy.pyx":133 + /* "DracoPy.pyx":127 * * 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, 133, __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, 133, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 133, __pyx_L1_error) + __pyx_tuple__35 = 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__35)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__35); + __Pyx_GIVEREF(__pyx_tuple__35); + __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 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_init, 127, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 127, __pyx_L1_error) - /* "DracoPy.pyx":139 + /* "DracoPy.pyx":133 * 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, 139, __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, 139, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 139, __pyx_L1_error) + __pyx_tuple__37 = 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__37)) __PYX_ERR(0, 133, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__37); + __Pyx_GIVEREF(__pyx_tuple__37); + __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_get_encoded_coordinate, 133, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 133, __pyx_L1_error) - /* "DracoPy.pyx":146 + /* "DracoPy.pyx":140 * 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, 146, __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, 146, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 146, __pyx_L1_error) + __pyx_tuple__39 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_point, __pyx_n_s_encoded_point, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 140, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__39); + __Pyx_GIVEREF(__pyx_tuple__39); + __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_get_encoded_point, 140, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 140, __pyx_L1_error) - /* "DracoPy.pyx":153 + /* "DracoPy.pyx":147 * * @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, 153, __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, 153, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 153, __pyx_L1_error) + __pyx_tuple__41 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__41); + __Pyx_GIVEREF(__pyx_tuple__41); + __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_num_axes, 147, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 147, __pyx_L1_error) - /* "DracoPy.pyx":162 + /* "DracoPy.pyx":156 * pass * * def encode_mesh_to_buffer(points, faces, metadata: GeometryMetadataObject = None, # <<<<<<<<<<<<<< * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, */ - __pyx_tuple__44 = PyTuple_Pack(13, __pyx_n_s_points, __pyx_n_s_faces, __pyx_n_s_metadata, __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_binary_metadata, __pyx_n_s_encoded_mesh); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 162, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__44); - __Pyx_GIVEREF(__pyx_tuple__44); - __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(8, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_encode_mesh_to_buffer, 162, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 162, __pyx_L1_error) + __pyx_tuple__43 = PyTuple_Pack(13, __pyx_n_s_points, __pyx_n_s_faces, __pyx_n_s_metadata, __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_binary_metadata, __pyx_n_s_encoded_mesh); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__43); + __Pyx_GIVEREF(__pyx_tuple__43); + __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(8, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_encode_mesh_to_buffer, 156, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 156, __pyx_L1_error) - /* "DracoPy.pyx":202 + /* "DracoPy.pyx":196 * raise ValueError("Input invalid") * * def encode_point_cloud_to_buffer(points, metadata: GeometryMetadataObject = None, # <<<<<<<<<<<<<< * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, */ - __pyx_tuple__46 = PyTuple_Pack(12, __pyx_n_s_points, __pyx_n_s_metadata, __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_binary_metadata, __pyx_n_s_encoded_point_cloud); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 202, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__46); - __Pyx_GIVEREF(__pyx_tuple__46); - __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(7, 0, 12, 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_point_cloud_to_buffer, 202, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 202, __pyx_L1_error) + __pyx_tuple__45 = PyTuple_Pack(12, __pyx_n_s_points, __pyx_n_s_metadata, __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_binary_metadata, __pyx_n_s_encoded_point_cloud); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 196, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__45); + __Pyx_GIVEREF(__pyx_tuple__45); + __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(7, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_encode_point_cloud_to_buffer, 196, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 196, __pyx_L1_error) - /* "DracoPy.pyx":241 + /* "DracoPy.pyx":235 * 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__48 = PyTuple_Pack(1, __pyx_n_s_decoding_status); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 241, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__48); - __Pyx_GIVEREF(__pyx_tuple__48); - __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_raise_decoding_error, 241, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_tuple__47 = PyTuple_Pack(1, __pyx_n_s_decoding_status); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 235, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__47); + __Pyx_GIVEREF(__pyx_tuple__47); + __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_raise_decoding_error, 235, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) __PYX_ERR(0, 235, __pyx_L1_error) - /* "DracoPy.pyx":249 + /* "DracoPy.pyx":243 * 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: */ - __pyx_tuple__50 = PyTuple_Pack(2, __pyx_n_s_buffer, __pyx_n_s_mesh_struct); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 249, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__50); - __Pyx_GIVEREF(__pyx_tuple__50); - __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 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_decode_buffer_to_mesh, 249, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 249, __pyx_L1_error) + __pyx_tuple__49 = PyTuple_Pack(2, __pyx_n_s_buffer, __pyx_n_s_mesh_struct); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 243, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__49); + __Pyx_GIVEREF(__pyx_tuple__49); + __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_buffer_to_mesh, 243, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(0, 243, __pyx_L1_error) - /* "DracoPy.pyx":256 + /* "DracoPy.pyx":250 * 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_tuple__52 = PyTuple_Pack(2, __pyx_n_s_buffer, __pyx_n_s_point_cloud_struct); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 256, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__52); - __Pyx_GIVEREF(__pyx_tuple__52); - __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 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_decode_point_cloud_buffer, 256, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 256, __pyx_L1_error) + __pyx_tuple__51 = PyTuple_Pack(2, __pyx_n_s_buffer, __pyx_n_s_point_cloud_struct); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 250, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__51); + __Pyx_GIVEREF(__pyx_tuple__51); + __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_point_cloud_buffer, 250, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) __PYX_ERR(0, 250, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -9049,9 +8974,9 @@ if (!__Pyx_RefNanny) { * sub_metadatas: Dict[str, 'MetadataObject'] = None): * self.entries = entries if entries else {} */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_14MetadataObject_1__init__, 0, __pyx_n_s_MetadataObject___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_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_14MetadataObject_1__init__, 0, __pyx_n_s_MetadataObject___init, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__6)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 10, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__8); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__7); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 10, __pyx_L1_error) @@ -9157,12 +9082,12 @@ if (!__Pyx_RefNanny) { * entries: Dict[str, bytes] = None, * sub_metadatas: Dict[str, 'MetadataObject'] = None): */ - __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_23AttributeMetadataObject_1__init__, 0, __pyx_n_s_AttributeMetadataObject___init, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__10)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 17, __pyx_L1_error) + __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_23AttributeMetadataObject_1__init__, 0, __pyx_n_s_AttributeMetadataObject___init, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_t_6); PyList_Append(__pyx_t_4, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_6, __pyx_tuple__11); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_6, __pyx_tuple__10); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_5); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_6) < 0) __PYX_ERR(0, 17, __pyx_L1_error) @@ -9278,12 +9203,12 @@ if (!__Pyx_RefNanny) { * sub_metadatas: Dict[str, 'MetadataObject'] = None, * attribute_metadatas: List['AttributeMetadataObject'] = None): */ - __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_22GeometryMetadataObject_1__init__, 0, __pyx_n_s_GeometryMetadataObject___init, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 25, __pyx_L1_error) + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_22GeometryMetadataObject_1__init__, 0, __pyx_n_s_GeometryMetadataObject___init, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__12)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(__pyx_t_7); PyList_Append(__pyx_t_6, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__14); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__13); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_4); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_7) < 0) __PYX_ERR(0, 25, __pyx_L1_error) @@ -9310,405 +9235,405 @@ if (!__Pyx_RefNanny) { * * * def decode_metadata(binary_metadata: bytes) -> MetadataObject: # <<<<<<<<<<<<<< - * ss = new stringstream(binary_metadata) - * reader = new DracoPy.MetadataReader(ss) + * reader = new DracoPy.MetadataReader(binary_metadata) + * geometry_metadata = GeometryMetadataObject() */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_1decode_metadata, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 33, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode_metadata, __pyx_t_1) < 0) __PYX_ERR(0, 33, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":67 + /* "DracoPy.pyx":65 * return geometry_metadata * * def encode_metadata(geometry_metadata: GeometryMetadataObject) -> bytes: # <<<<<<<<<<<<<< - * ss = new stringstream(b"") - * writer = new DracoPy.MetadataWriter(ss) + * cdef DracoPy.MetadataWriter writer + * to_parse_metadata = [geometry_metadata] */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_3encode_metadata, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_3encode_metadata, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_metadata, __pyx_t_1) < 0) __PYX_ERR(0, 67, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_metadata, __pyx_t_1) < 0) __PYX_ERR(0, 65, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":96 + /* "DracoPy.pyx":90 * * * class DracoPointCloud(object): # <<<<<<<<<<<<<< * def __init__(self, data_struct): * self.data_struct = data_struct */ - __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__20); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 96, __pyx_L1_error) + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__19); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__20, __pyx_n_s_DracoPointCloud, __pyx_n_s_DracoPointCloud, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 96, __pyx_L1_error) + __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__19, __pyx_n_s_DracoPointCloud, __pyx_n_s_DracoPointCloud, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - /* "DracoPy.pyx":97 + /* "DracoPy.pyx":91 * * class DracoPointCloud(object): * def __init__(self, data_struct): # <<<<<<<<<<<<<< * self.data_struct = data_struct * if data_struct['encoding_options_set']: */ - __pyx_t_2 = __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__22)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error) + __pyx_t_2 = __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__21)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 97, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 91, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":106 + /* "DracoPy.pyx":100 * self.metadata = decode_metadata(data_struct["binary_metadata"]) * * 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_2 = __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__24)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 106, __pyx_L1_error) + __pyx_t_2 = __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__23)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_get_encoded_coordinate, __pyx_t_2) < 0) __PYX_ERR(0, 106, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_get_encoded_coordinate, __pyx_t_2) < 0) __PYX_ERR(0, 100, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":110 + /* "DracoPy.pyx":104 * 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_2 = __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__26)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 110, __pyx_L1_error) + __pyx_t_2 = __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__25)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_get_encoded_point, __pyx_t_2) < 0) __PYX_ERR(0, 110, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_get_encoded_point, __pyx_t_2) < 0) __PYX_ERR(0, 104, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":115 + /* "DracoPy.pyx":109 * * @property * def num_axes(self): # <<<<<<<<<<<<<< * return 3 * */ - __pyx_t_2 = __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__28)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 115, __pyx_L1_error) + __pyx_t_2 = __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__27)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - /* "DracoPy.pyx":114 + /* "DracoPy.pyx":108 * return self.encoding_options.get_encoded_point(point) * * @property # <<<<<<<<<<<<<< * def num_axes(self): * return 3 */ - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 114, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 108, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_num_axes, __pyx_t_7) < 0) __PYX_ERR(0, 115, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_num_axes, __pyx_t_7) < 0) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "DracoPy.pyx":119 + /* "DracoPy.pyx":113 * * @property * def points(self): # <<<<<<<<<<<<<< * return self.data_struct['points'] * */ - __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_9points, 0, __pyx_n_s_DracoPointCloud_points, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 119, __pyx_L1_error) + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_9points, 0, __pyx_n_s_DracoPointCloud_points, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - /* "DracoPy.pyx":118 + /* "DracoPy.pyx":112 * return 3 * * @property # <<<<<<<<<<<<<< * def points(self): * return self.data_struct['points'] */ - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_points, __pyx_t_2) < 0) __PYX_ERR(0, 119, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_points, __pyx_t_2) < 0) __PYX_ERR(0, 113, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":96 + /* "DracoPy.pyx":90 * * * class DracoPointCloud(object): # <<<<<<<<<<<<<< * def __init__(self, data_struct): * self.data_struct = data_struct */ - __pyx_t_2 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoPointCloud, __pyx_tuple__20, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 96, __pyx_L1_error) + __pyx_t_2 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoPointCloud, __pyx_tuple__19, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoPointCloud, __pyx_t_2) < 0) __PYX_ERR(0, 96, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoPointCloud, __pyx_t_2) < 0) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":123 + /* "DracoPy.pyx":117 * * * class DracoMesh(DracoPointCloud): # <<<<<<<<<<<<<< * @property * def faces(self): */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 123, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 123, __pyx_L1_error) + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_DracoMesh, __pyx_n_s_DracoMesh, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 123, __pyx_L1_error) + __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_DracoMesh, __pyx_n_s_DracoMesh, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - /* "DracoPy.pyx":125 + /* "DracoPy.pyx":119 * class DracoMesh(DracoPointCloud): * @property * def faces(self): # <<<<<<<<<<<<<< * return self.data_struct['faces'] * */ - __pyx_t_7 = __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_7)) __PYX_ERR(0, 125, __pyx_L1_error) + __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_9DracoMesh_1faces, 0, __pyx_n_s_DracoMesh_faces, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__31)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 119, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - /* "DracoPy.pyx":124 + /* "DracoPy.pyx":118 * * class DracoMesh(DracoPointCloud): * @property # <<<<<<<<<<<<<< * def faces(self): * return self.data_struct['faces'] */ - __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 124, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_faces, __pyx_t_6) < 0) __PYX_ERR(0, 125, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_faces, __pyx_t_6) < 0) __PYX_ERR(0, 119, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "DracoPy.pyx":129 + /* "DracoPy.pyx":123 * * @property * def normals(self): # <<<<<<<<<<<<<< * return self.data_struct['normals'] * */ - __pyx_t_6 = __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_6)) __PYX_ERR(0, 129, __pyx_L1_error) + __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_9DracoMesh_3normals, 0, __pyx_n_s_DracoMesh_normals, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - /* "DracoPy.pyx":128 + /* "DracoPy.pyx":122 * return self.data_struct['faces'] * * @property # <<<<<<<<<<<<<< * def normals(self): * return self.data_struct['normals'] */ - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 128, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_normals, __pyx_t_7) < 0) __PYX_ERR(0, 129, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_normals, __pyx_t_7) < 0) __PYX_ERR(0, 123, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "DracoPy.pyx":123 + /* "DracoPy.pyx":117 * * * class DracoMesh(DracoPointCloud): # <<<<<<<<<<<<<< * @property * def faces(self): */ - __pyx_t_7 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoMesh, __pyx_t_3, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 123, __pyx_L1_error) + __pyx_t_7 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoMesh, __pyx_t_3, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoMesh, __pyx_t_7) < 0) __PYX_ERR(0, 123, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoMesh, __pyx_t_7) < 0) __PYX_ERR(0, 117, __pyx_L1_error) __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; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":132 + /* "DracoPy.pyx":126 * return self.data_struct['normals'] * * class EncodingOptions(object): # <<<<<<<<<<<<<< * def __init__(self, quantization_bits, quantization_range, quantization_origin): * self.quantization_bits = quantization_bits */ - __pyx_t_3 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__35); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 132, __pyx_L1_error) + __pyx_t_3 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__34); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_3, __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, 132, __pyx_L1_error) + __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_3, __pyx_tuple__34, __pyx_n_s_EncodingOptions, __pyx_n_s_EncodingOptions, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - /* "DracoPy.pyx":133 + /* "DracoPy.pyx":127 * * class EncodingOptions(object): * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< * self.quantization_bits = quantization_bits * self.quantization_range = quantization_range */ - __pyx_t_2 = __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_2)) __PYX_ERR(0, 133, __pyx_L1_error) + __pyx_t_2 = __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__36)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 127, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 133, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 127, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":139 + /* "DracoPy.pyx":133 * 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_2 = __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_2)) __PYX_ERR(0, 139, __pyx_L1_error) + __pyx_t_2 = __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__38)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 133, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_encoded_coordinate, __pyx_t_2) < 0) __PYX_ERR(0, 139, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_encoded_coordinate, __pyx_t_2) < 0) __PYX_ERR(0, 133, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":146 + /* "DracoPy.pyx":140 * 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_2 = __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_2)) __PYX_ERR(0, 146, __pyx_L1_error) + __pyx_t_2 = __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__40)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 140, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_encoded_point, __pyx_t_2) < 0) __PYX_ERR(0, 146, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_encoded_point, __pyx_t_2) < 0) __PYX_ERR(0, 140, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":153 + /* "DracoPy.pyx":147 * * @property * def num_axes(self): # <<<<<<<<<<<<<< * return 3 * */ - __pyx_t_2 = __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_2)) __PYX_ERR(0, 153, __pyx_L1_error) + __pyx_t_2 = __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__42)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 147, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - /* "DracoPy.pyx":152 + /* "DracoPy.pyx":146 * return encoded_point * * @property # <<<<<<<<<<<<<< * def num_axes(self): * return 3 */ - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 152, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 146, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_num_axes, __pyx_t_7) < 0) __PYX_ERR(0, 153, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_num_axes, __pyx_t_7) < 0) __PYX_ERR(0, 147, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "DracoPy.pyx":132 + /* "DracoPy.pyx":126 * return self.data_struct['normals'] * * class EncodingOptions(object): # <<<<<<<<<<<<<< * def __init__(self, quantization_bits, quantization_range, quantization_origin): * self.quantization_bits = quantization_bits */ - __pyx_t_7 = __Pyx_Py3ClassCreate(__pyx_t_3, __pyx_n_s_EncodingOptions, __pyx_tuple__35, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 132, __pyx_L1_error) + __pyx_t_7 = __Pyx_Py3ClassCreate(__pyx_t_3, __pyx_n_s_EncodingOptions, __pyx_tuple__34, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingOptions, __pyx_t_7) < 0) __PYX_ERR(0, 132, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingOptions, __pyx_t_7) < 0) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":156 + /* "DracoPy.pyx":150 * return 3 * * class FileTypeException(Exception): # <<<<<<<<<<<<<< * pass * */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 156, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); __Pyx_GIVEREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error) + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_FileTypeException, __pyx_n_s_FileTypeException, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 156, __pyx_L1_error) + __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_FileTypeException, __pyx_n_s_FileTypeException, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_FileTypeException, __pyx_t_3, __pyx_t_7, NULL, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 156, __pyx_L1_error) + __pyx_t_2 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_FileTypeException, __pyx_t_3, __pyx_t_7, NULL, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_FileTypeException, __pyx_t_2) < 0) __PYX_ERR(0, 156, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_FileTypeException, __pyx_t_2) < 0) __PYX_ERR(0, 150, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":159 + /* "DracoPy.pyx":153 * pass * * class EncodingFailedException(Exception): # <<<<<<<<<<<<<< * pass * */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 159, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); __Pyx_GIVEREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error) + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_EncodingFailedException, __pyx_n_s_EncodingFailedException, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 159, __pyx_L1_error) + __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_EncodingFailedException, __pyx_n_s_EncodingFailedException, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_EncodingFailedException, __pyx_t_3, __pyx_t_7, NULL, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 159, __pyx_L1_error) + __pyx_t_2 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_EncodingFailedException, __pyx_t_3, __pyx_t_7, NULL, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingFailedException, __pyx_t_2) < 0) __PYX_ERR(0, 159, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingFailedException, __pyx_t_2) < 0) __PYX_ERR(0, 153, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":162 + /* "DracoPy.pyx":156 * pass * * def encode_mesh_to_buffer(points, faces, metadata: GeometryMetadataObject = None, # <<<<<<<<<<<<<< * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, */ - __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_5encode_mesh_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 162, __pyx_L1_error) + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_5encode_mesh_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_mesh_to_buffer, __pyx_t_3) < 0) __PYX_ERR(0, 162, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_mesh_to_buffer, __pyx_t_3) < 0) __PYX_ERR(0, 156, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":202 + /* "DracoPy.pyx":196 * raise ValueError("Input invalid") * * def encode_point_cloud_to_buffer(points, metadata: GeometryMetadataObject = None, # <<<<<<<<<<<<<< * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, */ - __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_7encode_point_cloud_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error) + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_7encode_point_cloud_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_point_cloud_to_buffer, __pyx_t_3) < 0) __PYX_ERR(0, 202, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_point_cloud_to_buffer, __pyx_t_3) < 0) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":241 + /* "DracoPy.pyx":235 * 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_t_3 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_9raise_decoding_error, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_9raise_decoding_error, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_raise_decoding_error, __pyx_t_3) < 0) __PYX_ERR(0, 241, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_raise_decoding_error, __pyx_t_3) < 0) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":249 + /* "DracoPy.pyx":243 * 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: */ - __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_11decode_buffer_to_mesh, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 249, __pyx_L1_error) + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_11decode_buffer_to_mesh, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 243, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode_buffer_to_mesh, __pyx_t_3) < 0) __PYX_ERR(0, 249, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode_buffer_to_mesh, __pyx_t_3) < 0) __PYX_ERR(0, 243, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":256 + /* "DracoPy.pyx":250 * 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_t_3 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_13decode_point_cloud_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 256, __pyx_L1_error) + __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_13decode_point_cloud_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 250, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode_point_cloud_buffer, __pyx_t_3) < 0) __PYX_ERR(0, 256, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode_point_cloud_buffer, __pyx_t_3) < 0) __PYX_ERR(0, 250, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "DracoPy.pyx":1 diff --git a/src/DracoPy.h b/src/DracoPy.h index 4c6d7b0..4b67da5 100644 --- a/src/DracoPy.h +++ b/src/DracoPy.h @@ -43,7 +43,7 @@ namespace DracoFunctions { class MetadataReader { public: - MetadataReader(std::stringstream* s): stream(*s) {} + MetadataReader(const std::string& s): stream(s) {} uint32_t read_uint() { uint32_t value; @@ -68,13 +68,11 @@ namespace DracoFunctions { } private: - std::stringstream& stream; + std::stringstream stream; }; class MetadataWriter { public: - MetadataWriter(std::stringstream* s): stream(*s) {} - void write_uint(const uint32_t& value) { stream.write(reinterpret_cast(&value), sizeof(uint32_t)); } @@ -93,13 +91,14 @@ namespace DracoFunctions { write_bytes(value); } + std::string get() { return stream.str(); } + private: - std::stringstream& stream; + std::stringstream stream; }; std::string encode_metadata(const GeometryMetadata& geometry_metadata) { - std::stringstream ss; - MetadataWriter writer(&ss); + MetadataWriter writer; std::vector to_parse_metadata = { {static_cast(&geometry_metadata)} }; // consider attribute metadatas @@ -131,13 +130,11 @@ namespace DracoFunctions { } } } - return ss.str(); + return writer.get(); } GeometryMetadata decode_metadata(const std::string& s) { - - std::stringstream ss(s); - MetadataReader reader(&ss); + MetadataReader reader(s); GeometryMetadata geometry_metadata; std::vector to_parse_metadata = { {static_cast(&geometry_metadata)} }; diff --git a/src/DracoPy.pxd b/src/DracoPy.pxd index 2f4a3d0..a3c8978 100644 --- a/src/DracoPy.pxd +++ b/src/DracoPy.pxd @@ -49,21 +49,17 @@ cdef extern from "DracoPy.h" namespace "DracoFunctions": vector[unsigned char] buffer encoding_status encode_status - cdef extern from "" namespace "std" nogil: - cdef cppclass stringstream: - stringstream(const string&) - string to_string "str"() const - cdef cppclass MetadataReader: - MetadataReader(stringstream* s) except + + MetadataReader(const string& s) except + uint32_t read_uint() except + string read_bytes() except + cdef cppclass MetadataWriter: - MetadataWriter(stringstream* s) except + + MetadataWriter() except + void write_uint(const uint32_t& value) except + void write_bytes_from_str(const string& value) except + void write_bytes_from_vec(const vector[uint8_t]& value) except + + string get() except + MeshObject decode_buffer(const char *buffer, size_t buffer_len) except + diff --git a/src/DracoPy.pyx b/src/DracoPy.pyx index 7e934d5..39557a1 100644 --- a/src/DracoPy.pyx +++ b/src/DracoPy.pyx @@ -31,8 +31,7 @@ class GeometryMetadataObject(MetadataObject): def decode_metadata(binary_metadata: bytes) -> MetadataObject: - ss = new stringstream(binary_metadata) - reader = new DracoPy.MetadataReader(ss) + reader = new DracoPy.MetadataReader(binary_metadata) geometry_metadata = GeometryMetadataObject() to_parse_metadatas = [geometry_metadata] # consider attribute metadatas @@ -61,12 +60,10 @@ def decode_metadata(binary_metadata: bytes) -> MetadataObject: to_parse_metadata_next.append(sub_metadata) to_parse_metadatas = to_parse_metadata_next del reader - del ss return geometry_metadata def encode_metadata(geometry_metadata: GeometryMetadataObject) -> bytes: - ss = new stringstream(b"") - writer = new DracoPy.MetadataWriter(ss) + cdef DracoPy.MetadataWriter writer to_parse_metadata = [geometry_metadata] # consider attribute metadatas writer.write_uint(len(geometry_metadata.attribute_metadatas)) @@ -87,10 +84,7 @@ def encode_metadata(geometry_metadata: GeometryMetadataObject) -> bytes: for name, draco_sub_metadata in draco_metadata.sub_metadatas.items(): writer.write_bytes_from_str(name) to_parse_metadata_next.append(draco_sub_metadata) - del writer - s = ss.to_string() - del ss - return s + return writer.get() class DracoPointCloud(object): From 6fa686d306fcbcd4c53a6854b006e622300d1c39 Mon Sep 17 00:00:00 2001 From: Andrey Romanov Date: Fri, 22 Oct 2021 18:41:30 +0300 Subject: [PATCH 04/21] attributes parsing works --- src/DracoPy.cpp | 11001 ++++++++++++++++++---------------------------- src/DracoPy.h | 300 +- src/DracoPy.pxd | 22 +- src/DracoPy.pyx | 184 +- 4 files changed, 4511 insertions(+), 6996 deletions(-) diff --git a/src/DracoPy.cpp b/src/DracoPy.cpp index c7f0737..d4cd74a 100644 --- a/src/DracoPy.cpp +++ b/src/DracoPy.cpp @@ -636,6 +636,19 @@ static CYTHON_INLINE float __PYX_NAN() { #include #include #include +#include + + #if __cplusplus > 199711L + #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" #ifdef _OPENMP @@ -926,6 +939,10 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject /* GetBuiltinName.proto */ static PyObject *__Pyx_GetBuiltinName(PyObject *name); +/* RaiseArgTupleInvalid.proto */ +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); + /* RaiseDoubleKeywords.proto */ static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); @@ -934,10 +951,6 @@ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ const char* function_name); -/* RaiseArgTupleInvalid.proto */ -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); - /* PyObjectSetAttrStr.proto */ #if CYTHON_USE_TYPE_SLOTS #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL) @@ -947,49 +960,17 @@ static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr #define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) #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 - -/* PyFunctionFastCall.proto */ -#if CYTHON_FAST_PYCALL -#define __Pyx_PyFunction_FastCall(func, args, nargs)\ - __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); -#else -#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) -#endif -#define __Pyx_BUILD_ASSERT_EXPR(cond)\ - (sizeof(char [1 - 2*!(cond)]) - 1) -#ifndef Py_MEMBER_SIZE -#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) -#endif - static size_t __pyx_pyframe_localsplus_offset = 0; - #include "frameobject.h" - #define __Pxy_PyFrame_Initialize_Offsets()\ - ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ - (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 - -/* PyCFunctionFastCall.proto */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); +/* DictGetItem.proto */ +#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); +#define __Pyx_PyObject_Dict_GetItem(obj, name)\ + (likely(PyDict_CheckExact(obj)) ?\ + __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name)) #else -#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) +#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) +#define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name) #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); - /* PyDictVersioning.proto */ #if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS #define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) @@ -1037,99 +1018,53 @@ static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_ve static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); #endif -/* PyObjectCallMethO.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +/* PyFunctionFastCall.proto */ +#if CYTHON_FAST_PYCALL +#define __Pyx_PyFunction_FastCall(func, args, nargs)\ + __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL) +#if 1 || PY_VERSION_HEX < 0x030600B1 +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); +#else +#define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs) +#endif +#define __Pyx_BUILD_ASSERT_EXPR(cond)\ + (sizeof(char [1 - 2*!(cond)]) - 1) +#ifndef Py_MEMBER_SIZE +#define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) +#endif + static size_t __pyx_pyframe_localsplus_offset = 0; + #include "frameobject.h" + #define __Pxy_PyFrame_Initialize_Offsets()\ + ((void)__Pyx_BUILD_ASSERT_EXPR(sizeof(PyFrameObject) == offsetof(PyFrameObject, f_localsplus) + Py_MEMBER_SIZE(PyFrameObject, f_localsplus)),\ + (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 -/* PyObjectCallNoArg.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); +/* PyCFunctionFastCall.proto */ +#if CYTHON_FAST_PYCCALL +static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs); #else -#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) +#define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) #endif -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); +/* 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); -/* ListAppend.proto */ -#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS -static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { - PyListObject* L = (PyListObject*) list; - Py_ssize_t len = Py_SIZE(list); - if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { - Py_INCREF(x); - PyList_SET_ITEM(list, len, x); - __Pyx_SET_SIZE(list, len + 1); - return 0; - } - return PyList_Append(list, x); -} -#else -#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) +/* PyObjectCallMethO.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); #endif -/* PyObjectGetMethod.proto */ -static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); - -/* PyObjectCallMethod1.proto */ -static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); - -/* append.proto */ -static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x); - -/* IterFinish.proto */ -static CYTHON_INLINE int __Pyx_IterFinish(void); - -/* 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); - -/* DictGetItem.proto */ -#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY -static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key); -#define __Pyx_PyObject_Dict_GetItem(obj, name)\ - (likely(PyDict_CheckExact(obj)) ?\ - __Pyx_PyDict_GetItem(obj, name) : PyObject_GetItem(obj, name)) -#else -#define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) -#define __Pyx_PyObject_Dict_GetItem(obj, name) PyObject_GetItem(obj, name) -#endif +/* PyObjectCallOneArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); /* PyIntBinop.proto */ #if !CYTHON_COMPILING_IN_PYPY @@ -1220,6 +1155,23 @@ static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floa (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2)) #endif +/* ListAppend.proto */ +#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS +static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + __Pyx_SET_SIZE(list, len + 1); + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) +#endif + /* GetTopmostException.proto */ #if CYTHON_USE_EXC_INFO_STACK static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); @@ -1280,6 +1232,9 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /* ImportFrom.proto */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); +/* CalculateMetaclass.proto */ +static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases); + /* FetchCommonType.proto */ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); @@ -1354,18 +1309,12 @@ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, #define __Pyx_SetNameInClass(ns, name, value) PyObject_SetItem(ns, name, value) #endif -/* CalculateMetaclass.proto */ -static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases); - /* Py3ClassCreate.proto */ static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc); static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict, PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass); -/* CyFunctionClassCell.proto */ -static int __Pyx_CyFunction_InitClassCell(PyObject *cyfunctions, PyObject *classobj); - /* CLineInTraceback.proto */ #ifdef CYTHON_CLINE_IN_TRACEBACK #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) @@ -1392,6 +1341,11 @@ 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); +/* GCCDiagnostics.proto */ +#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#define __Pyx_HAS_GCC_DIAGNOSTIC +#endif + /* CppExceptionConversion.proto */ #ifndef __Pyx_CppExn2PyErr #include @@ -1434,24 +1388,15 @@ static void __Pyx_CppExn2PyErr() { } #endif -/* GCCDiagnostics.proto */ -#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) -#define __Pyx_HAS_GCC_DIAGNOSTIC -#endif - +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_MetadataObject(struct DracoFunctions::MetadataObject 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); -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value); - /* CIntFromPy.proto */ -static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *); - -/* CIntFromPy.proto */ -static CYTHON_INLINE uint8_t __Pyx_PyInt_As_uint8_t(PyObject *); +static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *); /* CIntFromPy.proto */ -static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *); +static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *); /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); @@ -1468,6 +1413,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value) /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value); + /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); @@ -1487,6 +1435,10 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* 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' */ @@ -1494,19 +1446,22 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'cpython.mem' */ /* Module declarations from 'DracoPy' */ -static std::string __pyx_convert_string_from_py_std__in_string(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 std::vector __pyx_convert_vector_from_py_uint8_t(PyObject *); /*proto*/ static std::vector __pyx_convert_vector_from_py_float(PyObject *); /*proto*/ static std::vector __pyx_convert_vector_from_py_uint32_t(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 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_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 PyObject *__pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_string(std::unordered_map const &); /*proto*/ +static PyObject *__pyx_convert_vector_to_py_uint32_t(const std::vector &); /*proto*/ +static PyObject *__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_MetadataObject(const std::vector &); /*proto*/ #define __Pyx_MODULE_NAME "DracoPy" extern int __pyx_module_is_main_DracoPy; int __pyx_module_is_main_DracoPy = 0; @@ -1514,17 +1469,15 @@ int __pyx_module_is_main_DracoPy = 0; /* Implementation of 'DracoPy' */ static PyObject *__pyx_builtin_object; static PyObject *__pyx_builtin_property; -static PyObject *__pyx_builtin_super; -static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_TypeError; -static const char __pyx_k__14[] = "_"; static const char __pyx_k_dim[] = "dim"; static const char __pyx_k_doc[] = "__doc__"; -static const char __pyx_k_int[] = "int"; 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_init[] = "__init__"; static const char __pyx_k_main[] = "__main__"; static const char __pyx_k_math[] = "math"; @@ -1533,99 +1486,77 @@ static const char __pyx_k_self[] = "self"; static const char __pyx_k_test[] = "__test__"; static const char __pyx_k_faces[] = "faces"; static const char __pyx_k_floor[] = "floor"; -static const char __pyx_k_items[] = "items"; static const char __pyx_k_point[] = "point"; static const char __pyx_k_range[] = "range"; -static const char __pyx_k_super[] = "super"; static const char __pyx_k_value[] = "value"; -static const char __pyx_k_append[] = "append"; 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_points[] = "points"; -static const char __pyx_k_reader[] = "reader"; static const char __pyx_k_typing[] = "typing"; -static const char __pyx_k_writer[] = "writer"; static const char __pyx_k_DracoPy[] = "DracoPy"; static const char __pyx_k_entries[] = "entries"; static const char __pyx_k_normals[] = "normals"; static const char __pyx_k_prepare[] = "__prepare__"; -static const char __pyx_k_metadata[] = "metadata"; 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_qualname[] = "__qualname__"; static const char __pyx_k_DracoMesh[] = "DracoMesh"; static const char __pyx_k_TypeError[] = "TypeError"; +static const char __pyx_k_dimension[] = "dimension"; static const char __pyx_k_metaclass[] = "__metaclass__"; +static const char __pyx_k_metadatas[] = "metadatas"; static const char __pyx_k_unique_id[] = "unique_id"; static const char __pyx_k_ValueError[] = "ValueError"; +static const char __pyx_k_attributes[] = "attributes"; static const char __pyx_k_difference[] = "difference"; static const char __pyx_k_data_struct[] = "data_struct"; -static const char __pyx_k_entries_len[] = "entries_len"; static const char __pyx_k_mesh_struct[] = "mesh_struct"; static const char __pyx_k_Invalid_mesh[] = "Invalid mesh"; +static const char __pyx_k_element_size[] = "element_size"; static const char __pyx_k_encoded_mesh[] = "encoded_mesh"; static const char __pyx_k_quant_origin[] = "quant_origin"; -static const char __pyx_k_sub_metadata[] = "sub_metadata"; static const char __pyx_k_Input_invalid[] = "Input invalid"; static const char __pyx_k_decode_status[] = "decode_status"; static const char __pyx_k_encoded_point[] = "encoded_point"; static const char __pyx_k_inverse_alpha[] = "inverse_alpha"; -static const char __pyx_k_sub_metadatas[] = "sub_metadatas"; -static const char __pyx_k_MetadataObject[] = "MetadataObject"; -static const char __pyx_k_draco_metadata[] = "draco_metadata"; 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_binary_metadata[] = "binary_metadata"; static const char __pyx_k_create_metadata[] = "create_metadata"; -static const char __pyx_k_decode_metadata[] = "decode_metadata"; static const char __pyx_k_decoding_status[] = "decoding_status"; -static const char __pyx_k_encode_metadata[] = "encode_metadata"; 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_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_sub_metadatas_len[] = "sub_metadatas_len"; -static const char __pyx_k_to_parse_metadata[] = "to_parse_metadata"; -static const char __pyx_k_attribute_metadata[] = "attribute_metadata"; static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; -static const char __pyx_k_draco_sub_metadata[] = "draco_sub_metadata"; 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_to_parse_metadatas[] = "to_parse_metadatas"; static const char __pyx_k_Invalid_point_cloud[] = "Invalid point cloud"; -static const char __pyx_k_attribute_metadatas[] = "attribute_metadatas"; static const char __pyx_k_encoded_point_cloud[] = "encoded_point_cloud"; static const char __pyx_k_quantization_origin[] = "quantization_origin"; 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_MetadataObject___init[] = "MetadataObject.__init__"; 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_GeometryMetadataObject[] = "GeometryMetadataObject"; static const char __pyx_k_get_encoded_coordinate[] = "get_encoded_coordinate"; -static const char __pyx_k_to_parse_metadata_next[] = "to_parse_metadata_next"; -static const char __pyx_k_AttributeMetadataObject[] = "AttributeMetadataObject"; static const char __pyx_k_EncodingFailedException[] = "EncodingFailedException"; -static const char __pyx_k_attribute_metadatas_len[] = "attribute_metadatas_len"; 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_DracoPointCloud_metadatas[] = "DracoPointCloud.metadatas"; static const char __pyx_k_decode_point_cloud_buffer[] = "decode_point_cloud_buffer"; +static const char __pyx_k_DracoPointCloud_attributes[] = "DracoPointCloud.attributes"; static const char __pyx_k_encode_point_cloud_to_buffer[] = "encode_point_cloud_to_buffer"; -static const char __pyx_k_GeometryMetadataObject___init[] = "GeometryMetadataObject.__init__"; -static const char __pyx_k_AttributeMetadataObject___init[] = "AttributeMetadataObject.__init__"; static const char __pyx_k_Input_mesh_is_not_draco_encoded[] = "Input mesh is not draco encoded"; 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"; @@ -1634,17 +1565,16 @@ static const char __pyx_k_EncodingOptions_get_encoded_coor[] = "EncodingOptions. 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_Specified_value_out_of_encoded_r[] = "Specified value out of encoded range"; -static PyObject *__pyx_n_s_AttributeMetadataObject; -static PyObject *__pyx_n_u_AttributeMetadataObject; -static PyObject *__pyx_n_s_AttributeMetadataObject___init; 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_attributes; 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; @@ -1657,44 +1587,33 @@ static PyObject *__pyx_n_s_EncodingOptions_get_encoded_poin; static PyObject *__pyx_n_s_EncodingOptions_num_axes; static PyObject *__pyx_kp_u_Failed_to_decode_input_mesh_Data; static PyObject *__pyx_n_s_FileTypeException; -static PyObject *__pyx_n_s_GeometryMetadataObject; -static PyObject *__pyx_n_s_GeometryMetadataObject___init; 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_List; -static PyObject *__pyx_n_s_MetadataObject; -static PyObject *__pyx_n_u_MetadataObject; -static PyObject *__pyx_n_s_MetadataObject___init; static PyObject *__pyx_kp_u_Specified_value_out_of_encoded_r; static PyObject *__pyx_n_s_TypeError; static PyObject *__pyx_n_s_ValueError; -static PyObject *__pyx_n_s__14; -static PyObject *__pyx_n_s_append; -static PyObject *__pyx_n_s_attribute_metadata; -static PyObject *__pyx_n_s_attribute_metadatas; -static PyObject *__pyx_n_s_attribute_metadatas_len; +static PyObject *__pyx_n_s_attributes; +static PyObject *__pyx_n_u_attributes; static PyObject *__pyx_n_s_axis; -static PyObject *__pyx_n_s_binary_metadata; -static PyObject *__pyx_n_u_binary_metadata; static PyObject *__pyx_n_s_buffer; static PyObject *__pyx_n_s_cline_in_traceback; static PyObject *__pyx_n_s_compression_level; static PyObject *__pyx_n_s_create_metadata; +static PyObject *__pyx_n_s_data; static PyObject *__pyx_n_s_data_struct; static PyObject *__pyx_n_s_decode_buffer_to_mesh; -static PyObject *__pyx_n_s_decode_metadata; static PyObject *__pyx_n_s_decode_point_cloud_buffer; static PyObject *__pyx_n_s_decode_status; static PyObject *__pyx_n_s_decoding_status; 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_metadata; -static PyObject *__pyx_n_s_draco_sub_metadata; +static PyObject *__pyx_n_s_element_size; static PyObject *__pyx_n_s_encode_mesh_to_buffer; -static PyObject *__pyx_n_s_encode_metadata; static PyObject *__pyx_n_s_encode_point_cloud_to_buffer; static PyObject *__pyx_n_s_encoded_mesh; static PyObject *__pyx_n_s_encoded_point; @@ -1703,26 +1622,22 @@ 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_entries; -static PyObject *__pyx_n_s_entries_len; static PyObject *__pyx_n_s_faces; static PyObject *__pyx_n_u_faces; static PyObject *__pyx_n_s_floor; -static PyObject *__pyx_n_s_geometry_metadata; static PyObject *__pyx_n_s_get_encoded_coordinate; static PyObject *__pyx_n_s_get_encoded_point; static PyObject *__pyx_n_s_import; static PyObject *__pyx_n_s_init; -static PyObject *__pyx_n_u_int; static PyObject *__pyx_n_s_inverse_alpha; -static PyObject *__pyx_n_s_items; static PyObject *__pyx_n_s_main; static PyObject *__pyx_n_s_math; static PyObject *__pyx_n_s_mesh_struct; static PyObject *__pyx_n_s_metaclass; -static PyObject *__pyx_n_s_metadata; +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_normals; static PyObject *__pyx_n_u_normals; static PyObject *__pyx_n_s_num_axes; @@ -1745,42 +1660,31 @@ 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_reader; static PyObject *__pyx_n_s_self; static PyObject *__pyx_kp_s_src_DracoPy_pyx; -static PyObject *__pyx_n_s_sub_metadata; -static PyObject *__pyx_n_s_sub_metadatas; -static PyObject *__pyx_n_s_sub_metadatas_len; -static PyObject *__pyx_n_s_super; +static PyObject *__pyx_n_s_sub_metadata_ids; static PyObject *__pyx_n_s_test; -static PyObject *__pyx_n_s_to_parse_metadata; -static PyObject *__pyx_n_s_to_parse_metadata_next; -static PyObject *__pyx_n_s_to_parse_metadatas; static PyObject *__pyx_n_s_typing; static PyObject *__pyx_n_s_unique_id; static PyObject *__pyx_n_s_value; -static PyObject *__pyx_n_s_writer; -static PyObject *__pyx_pf_7DracoPy_14MetadataObject___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_entries, PyObject *__pyx_v_sub_metadatas); /* proto */ -static PyObject *__pyx_pf_7DracoPy_23AttributeMetadataObject___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_unique_id, PyObject *__pyx_v_entries, PyObject *__pyx_v_sub_metadatas); /* proto */ -static PyObject *__pyx_pf_7DracoPy_22GeometryMetadataObject___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_entries, PyObject *__pyx_v_sub_metadatas, PyObject *__pyx_v_attribute_metadatas); /* proto */ -static PyObject *__pyx_pf_7DracoPy_decode_metadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_binary_metadata); /* proto */ -static PyObject *__pyx_pf_7DracoPy_2encode_metadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_geometry_metadata); /* 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_10metadatas(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_12attributes(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_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_points, PyObject *__pyx_v_faces, PyObject *__pyx_v_metadata, 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_metadata, 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_8raise_decoding_error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_decoding_status); /* proto */ -static PyObject *__pyx_pf_7DracoPy_10decode_buffer_to_mesh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer); /* proto */ -static PyObject *__pyx_pf_7DracoPy_12decode_point_cloud_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer); /* 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_float_0_5; static PyObject *__pyx_int_1; static PyObject *__pyx_int_2; @@ -1792,69 +1696,59 @@ static PyObject *__pyx_tuple__2; static PyObject *__pyx_tuple__3; static PyObject *__pyx_tuple__4; static PyObject *__pyx_tuple__5; -static PyObject *__pyx_tuple__7; +static PyObject *__pyx_tuple__6; static PyObject *__pyx_tuple__8; static PyObject *__pyx_tuple__10; -static PyObject *__pyx_tuple__11; -static PyObject *__pyx_tuple__13; -static PyObject *__pyx_tuple__15; -static PyObject *__pyx_tuple__17; -static PyObject *__pyx_tuple__19; +static PyObject *__pyx_tuple__12; +static PyObject *__pyx_tuple__14; +static PyObject *__pyx_tuple__16; +static PyObject *__pyx_tuple__18; static PyObject *__pyx_tuple__20; static PyObject *__pyx_tuple__22; static PyObject *__pyx_tuple__24; -static PyObject *__pyx_tuple__26; -static PyObject *__pyx_tuple__28; -static PyObject *__pyx_tuple__30; -static PyObject *__pyx_tuple__32; -static PyObject *__pyx_tuple__34; +static PyObject *__pyx_tuple__25; +static PyObject *__pyx_tuple__27; +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_tuple__39; static PyObject *__pyx_tuple__41; -static PyObject *__pyx_tuple__43; -static PyObject *__pyx_tuple__45; -static PyObject *__pyx_tuple__47; -static PyObject *__pyx_tuple__49; -static PyObject *__pyx_tuple__51; -static PyObject *__pyx_codeobj__6; +static PyObject *__pyx_codeobj__7; static PyObject *__pyx_codeobj__9; -static PyObject *__pyx_codeobj__12; -static PyObject *__pyx_codeobj__16; -static PyObject *__pyx_codeobj__18; +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_codeobj__21; static PyObject *__pyx_codeobj__23; -static PyObject *__pyx_codeobj__25; -static PyObject *__pyx_codeobj__27; -static PyObject *__pyx_codeobj__29; -static PyObject *__pyx_codeobj__31; -static PyObject *__pyx_codeobj__33; +static PyObject *__pyx_codeobj__26; +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__40; static PyObject *__pyx_codeobj__42; -static PyObject *__pyx_codeobj__44; -static PyObject *__pyx_codeobj__46; -static PyObject *__pyx_codeobj__48; -static PyObject *__pyx_codeobj__50; -static PyObject *__pyx_codeobj__52; /* Late includes */ -/* "DracoPy.pyx":10 +/* "DracoPy.pyx":91 * - * class MetadataObject: - * def __init__(self, entries: Dict[str, bytes] = None, # <<<<<<<<<<<<<< - * sub_metadatas: Dict[str, 'MetadataObject'] = None): - * self.entries = entries if entries else {} + * 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_14MetadataObject_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_14MetadataObject_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_14MetadataObject_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_7DracoPy_14MetadataObject_1__init__(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_entries = 0; - PyObject *__pyx_v_sub_metadatas = 0; + PyObject *__pyx_v_data_struct = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -1862,24 +1756,12 @@ static PyObject *__pyx_pw_7DracoPy_14MetadataObject_1__init__(PyObject *__pyx_se __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_entries,&__pyx_n_s_sub_metadatas,0}; - PyObject* values[3] = {0,0,0}; - values[1] = ((PyObject *)((PyObject *)Py_None)); - - /* "DracoPy.pyx":11 - * class MetadataObject: - * def __init__(self, entries: Dict[str, bytes] = None, - * sub_metadatas: Dict[str, 'MetadataObject'] = None): # <<<<<<<<<<<<<< - * self.entries = entries if entries else {} - * self.sub_metadatas = sub_metadatas if sub_metadatas else {} - */ - values[2] = ((PyObject *)((PyObject *)Py_None)); + 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; 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); @@ -1894,115 +1776,193 @@ static PyObject *__pyx_pw_7DracoPy_14MetadataObject_1__init__(PyObject *__pyx_se else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_entries); - 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_sub_metadatas); - if (value) { values[2] = value; kw_args--; } + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data_struct)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 91, __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, "__init__") < 0)) __PYX_ERR(0, 91, __pyx_L3_error) } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_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); - 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); } __pyx_v_self = values[0]; - __pyx_v_entries = values[1]; - __pyx_v_sub_metadatas = values[2]; + __pyx_v_data_struct = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 10, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 91, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("DracoPy.MetadataObject.__init__", __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_14MetadataObject___init__(__pyx_self, __pyx_v_self, __pyx_v_entries, __pyx_v_sub_metadatas); - - /* "DracoPy.pyx":10 - * - * class MetadataObject: - * def __init__(self, entries: Dict[str, bytes] = None, # <<<<<<<<<<<<<< - * sub_metadatas: Dict[str, 'MetadataObject'] = None): - * self.entries = entries if entries else {} - */ + __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_14MetadataObject___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_entries, PyObject *__pyx_v_sub_metadatas) { +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; 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); - /* "DracoPy.pyx":12 - * def __init__(self, entries: Dict[str, bytes] = None, - * sub_metadatas: Dict[str, 'MetadataObject'] = None): - * self.entries = entries if entries else {} # <<<<<<<<<<<<<< - * self.sub_metadatas = sub_metadatas if sub_metadatas else {} - * + /* "DracoPy.pyx":92 + * 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'], */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_entries); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 12, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_data_struct, __pyx_v_data_struct) < 0) __PYX_ERR(0, 92, __pyx_L1_error) + + /* "DracoPy.pyx":93 + * 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_Dict_GetItem(__pyx_v_data_struct, __pyx_n_u_encoding_options_set); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __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, 93, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - __Pyx_INCREF(__pyx_v_entries); - __pyx_t_1 = __pyx_v_entries; - } else { - __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 12, __pyx_L1_error) + + /* "DracoPy.pyx":94 + * 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, 94, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data_struct, __pyx_n_u_quantization_bits); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 94, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + + /* "DracoPy.pyx":95 + * 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, 95, __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, 95, __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; + } + } + #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, 94, __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, 94, __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, 94, __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, 94, __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":94 + * 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, 94, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "DracoPy.pyx":93 + * 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; } - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_entries, __pyx_t_1) < 0) __PYX_ERR(0, 12, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":13 - * sub_metadatas: Dict[str, 'MetadataObject'] = None): - * self.entries = entries if entries else {} - * self.sub_metadatas = sub_metadatas if sub_metadatas else {} # <<<<<<<<<<<<<< - * + /* "DracoPy.pyx":97 + * data_struct['quantization_range'], data_struct['quantization_origin']) + * else: + * self.encoding_options = None # <<<<<<<<<<<<<< + * # self.metadata = decode_metadata(data_struct["binary_metadata"]) * */ - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_sub_metadatas); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 13, __pyx_L1_error) - if (__pyx_t_2) { - __Pyx_INCREF(__pyx_v_sub_metadatas); - __pyx_t_1 = __pyx_v_sub_metadatas; - } else { - __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __pyx_t_3; - __pyx_t_3 = 0; + /*else*/ { + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options, Py_None) < 0) __PYX_ERR(0, 97, __pyx_L1_error) } - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_sub_metadatas, __pyx_t_1) < 0) __PYX_ERR(0, 13, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_L3:; - /* "DracoPy.pyx":10 + /* "DracoPy.pyx":91 * - * class MetadataObject: - * def __init__(self, entries: Dict[str, bytes] = None, # <<<<<<<<<<<<<< - * sub_metadatas: Dict[str, 'MetadataObject'] = None): - * self.entries = entries if entries else {} + * class DracoPointCloud(object): + * def __init__(self, data_struct): # <<<<<<<<<<<<<< + * self.data_struct = data_struct + * if data_struct['encoding_options_set']: */ /* function exit code */ @@ -2011,7 +1971,12 @@ static PyObject *__pyx_pf_7DracoPy_14MetadataObject___init__(CYTHON_UNUSED PyObj __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("DracoPy.MetadataObject.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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); @@ -2019,55 +1984,34 @@ static PyObject *__pyx_pf_7DracoPy_14MetadataObject___init__(CYTHON_UNUSED PyObj return __pyx_r; } -/* "DracoPy.pyx":17 +/* "DracoPy.pyx":100 + * # self.metadata = decode_metadata(data_struct["binary_metadata"]) * - * class AttributeMetadataObject(MetadataObject): - * def __init__(self, unique_id: int, # <<<<<<<<<<<<<< - * entries: Dict[str, bytes] = None, - * sub_metadatas: Dict[str, 'MetadataObject'] = 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_23AttributeMetadataObject_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_23AttributeMetadataObject_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_23AttributeMetadataObject_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_7DracoPy_23AttributeMetadataObject_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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_unique_id = 0; - PyObject *__pyx_v_entries = 0; - PyObject *__pyx_v_sub_metadatas = 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("__init__ (wrapper)", 0); + __Pyx_RefNannySetupContext("get_encoded_coordinate (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_unique_id,&__pyx_n_s_entries,&__pyx_n_s_sub_metadatas,0}; - PyObject* values[4] = {0,0,0,0}; - - /* "DracoPy.pyx":18 - * class AttributeMetadataObject(MetadataObject): - * def __init__(self, unique_id: int, - * entries: Dict[str, bytes] = None, # <<<<<<<<<<<<<< - * sub_metadatas: Dict[str, 'MetadataObject'] = None): - * super().__init__(entries, sub_metadatas) - */ - values[2] = ((PyObject *)((PyObject *)Py_None)); - - /* "DracoPy.pyx":19 - * def __init__(self, unique_id: int, - * entries: Dict[str, bytes] = None, - * sub_metadatas: Dict[str, 'MetadataObject'] = None): # <<<<<<<<<<<<<< - * super().__init__(entries, sub_metadatas) - * self.unique_id = unique_id - */ - values[3] = ((PyObject *)((PyObject *)Py_None)); + 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 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); @@ -2084,235 +2028,197 @@ static PyObject *__pyx_pw_7DracoPy_23AttributeMetadataObject_1__init__(PyObject else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_unique_id)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, 1); __PYX_ERR(0, 17, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, 1); __PYX_ERR(0, 100, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_entries); - 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_sub_metadatas); - if (value) { values[3] = 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, 100, __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, 17, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_encoded_coordinate") < 0)) __PYX_ERR(0, 100, __pyx_L3_error) } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; } else { - switch (PyTuple_GET_SIZE(__pyx_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); - 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_self = values[0]; - __pyx_v_unique_id = values[1]; - __pyx_v_entries = values[2]; - __pyx_v_sub_metadatas = values[3]; + __pyx_v_value = values[1]; + __pyx_v_axis = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 17, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 100, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("DracoPy.AttributeMetadataObject.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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_23AttributeMetadataObject___init__(__pyx_self, __pyx_v_self, __pyx_v_unique_id, __pyx_v_entries, __pyx_v_sub_metadatas); - - /* "DracoPy.pyx":17 - * - * class AttributeMetadataObject(MetadataObject): - * def __init__(self, unique_id: int, # <<<<<<<<<<<<<< - * entries: Dict[str, bytes] = None, - * sub_metadatas: Dict[str, 'MetadataObject'] = None): - */ + __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_23AttributeMetadataObject___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_unique_id, PyObject *__pyx_v_entries, PyObject *__pyx_v_sub_metadatas) { +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; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; + 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("__init__", 0); - - /* "DracoPy.pyx":20 - * entries: Dict[str, bytes] = None, - * sub_metadatas: Dict[str, 'MetadataObject'] = None): - * super().__init__(entries, sub_metadatas) # <<<<<<<<<<<<<< - * self.unique_id = unique_id - * - */ - __pyx_t_2 = __Pyx_CyFunction_GetClassObj(__pyx_self); - if (!__pyx_t_2) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 20, __pyx_L1_error) } - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_INCREF(__pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - __pyx_t_4 = 0; - 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_4 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_entries, __pyx_v_sub_metadatas}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_entries, __pyx_v_sub_metadatas}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 20, __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_v_entries); - __Pyx_GIVEREF(__pyx_v_entries); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_entries); - __Pyx_INCREF(__pyx_v_sub_metadatas); - __Pyx_GIVEREF(__pyx_v_sub_metadatas); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_sub_metadatas); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __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; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_RefNannySetupContext("get_encoded_coordinate", 0); - /* "DracoPy.pyx":21 - * sub_metadatas: Dict[str, 'MetadataObject'] = None): - * super().__init__(entries, sub_metadatas) - * self.unique_id = unique_id # <<<<<<<<<<<<<< + /* "DracoPy.pyx":101 * + * def get_encoded_coordinate(self, value, axis): + * if self.encoding_options is not None: # <<<<<<<<<<<<<< + * return self.encoding_options.get_encoded_coordinate(value, axis) * */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_unique_id, __pyx_v_unique_id) < 0) __PYX_ERR(0, 21, __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, 101, __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":17 + /* "DracoPy.pyx":102 + * def get_encoded_coordinate(self, value, axis): + * if self.encoding_options is not None: + * return self.encoding_options.get_encoded_coordinate(value, axis) # <<<<<<<<<<<<<< * - * class AttributeMetadataObject(MetadataObject): - * def __init__(self, unique_id: int, # <<<<<<<<<<<<<< - * entries: Dict[str, bytes] = None, - * sub_metadatas: Dict[str, 'MetadataObject'] = None): + * 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, 102, __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, 102, __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, 102, __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, 102, __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, 102, __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, 102, __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":101 + * + * 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":100 + * # self.metadata = decode_metadata(data_struct["binary_metadata"]) + * + * 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_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_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* 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_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("DracoPy.AttributeMetadataObject.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "DracoPy.pyx":25 +/* "DracoPy.pyx":104 + * return self.encoding_options.get_encoded_coordinate(value, axis) * - * class GeometryMetadataObject(MetadataObject): - * def __init__(self, entries: Dict[str, bytes] = None, # <<<<<<<<<<<<<< - * sub_metadatas: Dict[str, 'MetadataObject'] = None, - * attribute_metadatas: List['AttributeMetadataObject'] = None): + * 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_22GeometryMetadataObject_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_22GeometryMetadataObject_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_22GeometryMetadataObject_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_7DracoPy_22GeometryMetadataObject_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_entries = 0; - PyObject *__pyx_v_sub_metadatas = 0; - PyObject *__pyx_v_attribute_metadatas = 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_entries,&__pyx_n_s_sub_metadatas,&__pyx_n_s_attribute_metadatas,0}; - PyObject* values[4] = {0,0,0,0}; - values[1] = ((PyObject *)((PyObject *)Py_None)); - - /* "DracoPy.pyx":26 - * class GeometryMetadataObject(MetadataObject): - * def __init__(self, entries: Dict[str, bytes] = None, - * sub_metadatas: Dict[str, 'MetadataObject'] = None, # <<<<<<<<<<<<<< - * attribute_metadatas: List['AttributeMetadataObject'] = None): - * super().__init__(entries, sub_metadatas) - */ - values[2] = ((PyObject *)((PyObject *)Py_None)); - - /* "DracoPy.pyx":27 - * def __init__(self, entries: Dict[str, bytes] = None, - * sub_metadatas: Dict[str, 'MetadataObject'] = None, - * attribute_metadatas: List['AttributeMetadataObject'] = None): # <<<<<<<<<<<<<< - * super().__init__(entries, sub_metadatas) - * self.attribute_metadatas = attribute_metadatas if attribute_metadatas \ - */ - values[3] = ((PyObject *)((PyObject *)Py_None)); + 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); @@ -2327,194 +2233,112 @@ static PyObject *__pyx_pw_7DracoPy_22GeometryMetadataObject_1__init__(PyObject * else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_entries); - 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_sub_metadatas); - 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_attribute_metadatas); - if (value) { values[3] = value; kw_args--; } + 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, 104, __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, 25, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_encoded_point") < 0)) __PYX_ERR(0, 104, __pyx_L3_error) } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; } else { - switch (PyTuple_GET_SIZE(__pyx_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); - break; - default: goto __pyx_L5_argtuple_error; - } + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_self = values[0]; - __pyx_v_entries = values[1]; - __pyx_v_sub_metadatas = values[2]; - __pyx_v_attribute_metadatas = values[3]; + __pyx_v_point = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 1, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 25, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_point", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 104, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("DracoPy.GeometryMetadataObject.__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_22GeometryMetadataObject___init__(__pyx_self, __pyx_v_self, __pyx_v_entries, __pyx_v_sub_metadatas, __pyx_v_attribute_metadatas); - - /* "DracoPy.pyx":25 - * - * class GeometryMetadataObject(MetadataObject): - * def __init__(self, entries: Dict[str, bytes] = None, # <<<<<<<<<<<<<< - * sub_metadatas: Dict[str, 'MetadataObject'] = None, - * attribute_metadatas: List['AttributeMetadataObject'] = None): - */ + __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_22GeometryMetadataObject___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_entries, PyObject *__pyx_v_sub_metadatas, PyObject *__pyx_v_attribute_metadatas) { +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; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; + int __pyx_t_2; + int __pyx_t_3; + 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("__init__", 0); + __Pyx_RefNannySetupContext("get_encoded_point", 0); - /* "DracoPy.pyx":28 - * sub_metadatas: Dict[str, 'MetadataObject'] = None, - * attribute_metadatas: List['AttributeMetadataObject'] = None): - * super().__init__(entries, sub_metadatas) # <<<<<<<<<<<<<< - * self.attribute_metadatas = attribute_metadatas if attribute_metadatas \ - * else [] - */ - __pyx_t_2 = __Pyx_CyFunction_GetClassObj(__pyx_self); - if (!__pyx_t_2) { PyErr_SetString(PyExc_SystemError, "super(): empty __class__ cell"); __PYX_ERR(0, 28, __pyx_L1_error) } - __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_INCREF(__pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_self); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_super, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_init); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = NULL; - __pyx_t_4 = 0; - 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_4 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_entries, __pyx_v_sub_metadatas}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[3] = {__pyx_t_2, __pyx_v_entries, __pyx_v_sub_metadatas}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_4, 2+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_5 = PyTuple_New(2+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 28, __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_v_entries); - __Pyx_GIVEREF(__pyx_v_entries); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_entries); - __Pyx_INCREF(__pyx_v_sub_metadatas); - __Pyx_GIVEREF(__pyx_v_sub_metadatas); - PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_sub_metadatas); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 28, __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":105 + * + * def get_encoded_point(self, point): + * if self.encoding_options is not None: # <<<<<<<<<<<<<< + * return self.encoding_options.get_encoded_point(point) + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 105, __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":29 - * attribute_metadatas: List['AttributeMetadataObject'] = None): - * super().__init__(entries, sub_metadatas) - * self.attribute_metadatas = attribute_metadatas if attribute_metadatas \ # <<<<<<<<<<<<<< - * else [] + /* "DracoPy.pyx":106 + * def get_encoded_point(self, point): + * if self.encoding_options is not None: + * return self.encoding_options.get_encoded_point(point) # <<<<<<<<<<<<<< * + * @property */ - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_attribute_metadatas); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(0, 29, __pyx_L1_error) - if (__pyx_t_6) { - __Pyx_INCREF(__pyx_v_attribute_metadatas); - __pyx_t_1 = __pyx_v_attribute_metadatas; - } 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, 106, __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, 106, __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, 106, __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":30 - * super().__init__(entries, sub_metadatas) - * self.attribute_metadatas = attribute_metadatas if attribute_metadatas \ - * else [] # <<<<<<<<<<<<<< + /* "DracoPy.pyx":105 * + * def get_encoded_point(self, point): + * if self.encoding_options is not None: # <<<<<<<<<<<<<< + * return self.encoding_options.get_encoded_point(point) * */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __pyx_t_3; - __pyx_t_3 = 0; } - /* "DracoPy.pyx":29 - * attribute_metadatas: List['AttributeMetadataObject'] = None): - * super().__init__(entries, sub_metadatas) - * self.attribute_metadatas = attribute_metadatas if attribute_metadatas \ # <<<<<<<<<<<<<< - * else [] - * - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_attribute_metadatas, __pyx_t_1) < 0) __PYX_ERR(0, 29, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "DracoPy.pyx":25 + /* "DracoPy.pyx":104 + * return self.encoding_options.get_encoded_coordinate(value, axis) * - * class GeometryMetadataObject(MetadataObject): - * def __init__(self, entries: Dict[str, bytes] = None, # <<<<<<<<<<<<<< - * sub_metadatas: Dict[str, 'MetadataObject'] = None, - * attribute_metadatas: List['AttributeMetadataObject'] = None): + * def get_encoded_point(self, point): # <<<<<<<<<<<<<< + * if self.encoding_options is not None: + * return self.encoding_options.get_encoded_point(point) */ /* function exit code */ @@ -2522,10 +2346,9 @@ static PyObject *__pyx_pf_7DracoPy_22GeometryMetadataObject___init__(CYTHON_UNUS 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_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("DracoPy.GeometryMetadataObject.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("DracoPy.DracoPointCloud.get_encoded_point", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2533,952 +2356,421 @@ static PyObject *__pyx_pf_7DracoPy_22GeometryMetadataObject___init__(CYTHON_UNUS return __pyx_r; } -/* "DracoPy.pyx":33 +/* "DracoPy.pyx":109 * + * @property + * def num_axes(self): # <<<<<<<<<<<<<< + * return 3 * - * def decode_metadata(binary_metadata: bytes) -> MetadataObject: # <<<<<<<<<<<<<< - * reader = new DracoPy.MetadataReader(binary_metadata) - * geometry_metadata = GeometryMetadataObject() */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_1decode_metadata(PyObject *__pyx_self, PyObject *__pyx_v_binary_metadata); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_1decode_metadata = {"decode_metadata", (PyCFunction)__pyx_pw_7DracoPy_1decode_metadata, METH_O, 0}; -static PyObject *__pyx_pw_7DracoPy_1decode_metadata(PyObject *__pyx_self, PyObject *__pyx_v_binary_metadata) { - 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("decode_metadata (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_binary_metadata), (&PyBytes_Type), 1, "binary_metadata", 1))) __PYX_ERR(0, 33, __pyx_L1_error) - __pyx_r = __pyx_pf_7DracoPy_decode_metadata(__pyx_self, ((PyObject*)__pyx_v_binary_metadata)); + __Pyx_RefNannySetupContext("num_axes (wrapper)", 0); + __pyx_r = __pyx_pf_7DracoPy_15DracoPointCloud_6num_axes(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ - goto __pyx_L0; - __pyx_L1_error:; - __pyx_r = NULL; - __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_decode_metadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_binary_metadata) { - DracoFunctions::MetadataReader *__pyx_v_reader; - PyObject *__pyx_v_geometry_metadata = NULL; - PyObject *__pyx_v_to_parse_metadatas = NULL; - uint32_t __pyx_v_attribute_metadatas_len; - CYTHON_UNUSED uint32_t __pyx_v__; - uint32_t __pyx_v_unique_id; - PyObject *__pyx_v_attribute_metadata = NULL; - PyObject *__pyx_v_to_parse_metadata_next = NULL; - PyObject *__pyx_v_metadata = NULL; - uint32_t __pyx_v_entries_len; - std::string __pyx_v_name; - std::string __pyx_v_value; - uint32_t __pyx_v_sub_metadatas_len; - PyObject *__pyx_v_sub_metadata = NULL; +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 - std::string __pyx_t_1; - DracoFunctions::MetadataReader *__pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - uint32_t __pyx_t_6; - uint32_t __pyx_t_7; - uint32_t __pyx_t_8; - uint32_t __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - int __pyx_t_11; - int __pyx_t_12; - Py_ssize_t __pyx_t_13; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("decode_metadata", 0); + __Pyx_RefNannySetupContext("num_axes", 0); - /* "DracoPy.pyx":34 + /* "DracoPy.pyx":110 + * @property + * def num_axes(self): + * return 3 # <<<<<<<<<<<<<< * - * def decode_metadata(binary_metadata: bytes) -> MetadataObject: - * reader = new DracoPy.MetadataReader(binary_metadata) # <<<<<<<<<<<<<< - * geometry_metadata = GeometryMetadataObject() - * to_parse_metadatas = [geometry_metadata] + * @property */ - __pyx_t_1 = __pyx_convert_string_from_py_std__in_string(__pyx_v_binary_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 34, __pyx_L1_error) - try { - __pyx_t_2 = new DracoFunctions::MetadataReader(__pyx_t_1); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 34, __pyx_L1_error) - } - __pyx_v_reader = __pyx_t_2; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_int_3); + __pyx_r = __pyx_int_3; + goto __pyx_L0; - /* "DracoPy.pyx":35 - * def decode_metadata(binary_metadata: bytes) -> MetadataObject: - * reader = new DracoPy.MetadataReader(binary_metadata) - * geometry_metadata = GeometryMetadataObject() # <<<<<<<<<<<<<< - * to_parse_metadatas = [geometry_metadata] - * # consider attribute metadatas + /* "DracoPy.pyx":109 + * + * @property + * def num_axes(self): # <<<<<<<<<<<<<< + * return 3 + * */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_GeometryMetadataObject); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 35, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_geometry_metadata = __pyx_t_3; - __pyx_t_3 = 0; - /* "DracoPy.pyx":36 - * reader = new DracoPy.MetadataReader(binary_metadata) - * geometry_metadata = GeometryMetadataObject() - * to_parse_metadatas = [geometry_metadata] # <<<<<<<<<<<<<< - * # consider attribute metadatas - * attribute_metadatas_len = reader.read_uint() - */ - __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_geometry_metadata); - __Pyx_GIVEREF(__pyx_v_geometry_metadata); - PyList_SET_ITEM(__pyx_t_3, 0, __pyx_v_geometry_metadata); - __pyx_v_to_parse_metadatas = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; - - /* "DracoPy.pyx":38 - * to_parse_metadatas = [geometry_metadata] - * # consider attribute metadatas - * attribute_metadatas_len = reader.read_uint() # <<<<<<<<<<<<<< - * for _ in range(attribute_metadatas_len): - * unique_id = reader.read_uint() - */ - try { - __pyx_t_6 = __pyx_v_reader->read_uint(); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 38, __pyx_L1_error) - } - __pyx_v_attribute_metadatas_len = __pyx_t_6; - - /* "DracoPy.pyx":39 - * # consider attribute metadatas - * attribute_metadatas_len = reader.read_uint() - * for _ in range(attribute_metadatas_len): # <<<<<<<<<<<<<< - * unique_id = reader.read_uint() - * attribute_metadata = AttributeMetadataObject(unique_id) - */ - __pyx_t_6 = __pyx_v_attribute_metadatas_len; - __pyx_t_7 = __pyx_t_6; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v__ = __pyx_t_8; - - /* "DracoPy.pyx":40 - * attribute_metadatas_len = reader.read_uint() - * for _ in range(attribute_metadatas_len): - * unique_id = reader.read_uint() # <<<<<<<<<<<<<< - * attribute_metadata = AttributeMetadataObject(unique_id) - * geometry_metadata.attribute_metadatas.append(attribute_metadata) - */ - try { - __pyx_t_9 = __pyx_v_reader->read_uint(); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 40, __pyx_L1_error) - } - __pyx_v_unique_id = __pyx_t_9; - - /* "DracoPy.pyx":41 - * for _ in range(attribute_metadatas_len): - * unique_id = reader.read_uint() - * attribute_metadata = AttributeMetadataObject(unique_id) # <<<<<<<<<<<<<< - * geometry_metadata.attribute_metadatas.append(attribute_metadata) - * to_parse_metadatas.append(attribute_metadata) - */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_AttributeMetadataObject); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_From_uint32_t(__pyx_v_unique_id); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_10 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_10)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_10); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_3 = (__pyx_t_10) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_10, __pyx_t_5) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF_SET(__pyx_v_attribute_metadata, __pyx_t_3); - __pyx_t_3 = 0; + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "DracoPy.pyx":42 - * unique_id = reader.read_uint() - * attribute_metadata = AttributeMetadataObject(unique_id) - * geometry_metadata.attribute_metadatas.append(attribute_metadata) # <<<<<<<<<<<<<< - * to_parse_metadatas.append(attribute_metadata) - * # parse metadatas level by level +/* "DracoPy.pyx":113 + * + * @property + * def points(self): # <<<<<<<<<<<<<< + * return self.data_struct['points'] + * */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_geometry_metadata, __pyx_n_s_attribute_metadatas); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = __Pyx_PyObject_Append(__pyx_t_3, __pyx_v_attribute_metadata); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":43 - * attribute_metadata = AttributeMetadataObject(unique_id) - * geometry_metadata.attribute_metadatas.append(attribute_metadata) - * to_parse_metadatas.append(attribute_metadata) # <<<<<<<<<<<<<< - * # parse metadatas level by level - * while to_parse_metadatas: - */ - __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_to_parse_metadatas, __pyx_v_attribute_metadata); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 43, __pyx_L1_error) - } +/* 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)); - /* "DracoPy.pyx":45 - * to_parse_metadatas.append(attribute_metadata) - * # parse metadatas level by level - * while to_parse_metadatas: # <<<<<<<<<<<<<< - * to_parse_metadata_next = [] - * for metadata in to_parse_metadatas: - */ - while (1) { - __pyx_t_12 = (PyList_GET_SIZE(__pyx_v_to_parse_metadatas) != 0); - if (!__pyx_t_12) break; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "DracoPy.pyx":46 - * # parse metadatas level by level - * while to_parse_metadatas: - * to_parse_metadata_next = [] # <<<<<<<<<<<<<< - * for metadata in to_parse_metadatas: - * # parse entries - */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_XDECREF_SET(__pyx_v_to_parse_metadata_next, ((PyObject*)__pyx_t_3)); - __pyx_t_3 = 0; - - /* "DracoPy.pyx":47 - * while to_parse_metadatas: - * to_parse_metadata_next = [] - * for metadata in to_parse_metadatas: # <<<<<<<<<<<<<< - * # parse entries - * entries_len = reader.read_uint() - */ - __pyx_t_3 = __pyx_v_to_parse_metadatas; __Pyx_INCREF(__pyx_t_3); __pyx_t_13 = 0; - for (;;) { - if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_13); __Pyx_INCREF(__pyx_t_4); __pyx_t_13++; if (unlikely(0 < 0)) __PYX_ERR(0, 47, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - __Pyx_XDECREF_SET(__pyx_v_metadata, __pyx_t_4); - __pyx_t_4 = 0; +static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_8points(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("points", 0); - /* "DracoPy.pyx":49 - * for metadata in to_parse_metadatas: - * # parse entries - * entries_len = reader.read_uint() # <<<<<<<<<<<<<< - * for _ in range(entries_len): - * name = reader.read_bytes() + /* "DracoPy.pyx":114 + * @property + * def points(self): + * return self.data_struct['points'] # <<<<<<<<<<<<<< + * + * @property */ - try { - __pyx_t_6 = __pyx_v_reader->read_uint(); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 49, __pyx_L1_error) - } - __pyx_v_entries_len = __pyx_t_6; - - /* "DracoPy.pyx":50 - * # parse entries - * entries_len = reader.read_uint() - * for _ in range(entries_len): # <<<<<<<<<<<<<< - * name = reader.read_bytes() - * value = reader.read_bytes() - */ - __pyx_t_6 = __pyx_v_entries_len; - __pyx_t_7 = __pyx_t_6; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v__ = __pyx_t_8; - - /* "DracoPy.pyx":51 - * entries_len = reader.read_uint() - * for _ in range(entries_len): - * name = reader.read_bytes() # <<<<<<<<<<<<<< - * value = reader.read_bytes() - * metadata.entries[name] = value - */ - try { - __pyx_t_1 = __pyx_v_reader->read_bytes(); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 51, __pyx_L1_error) - } - __pyx_v_name = __pyx_t_1; - - /* "DracoPy.pyx":52 - * for _ in range(entries_len): - * name = reader.read_bytes() - * value = reader.read_bytes() # <<<<<<<<<<<<<< - * metadata.entries[name] = value - * sub_metadatas_len = reader.read_uint() - */ - try { - __pyx_t_1 = __pyx_v_reader->read_bytes(); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 52, __pyx_L1_error) - } - __pyx_v_value = __pyx_t_1; + __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, 114, __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, 114, __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":53 - * name = reader.read_bytes() - * value = reader.read_bytes() - * metadata.entries[name] = value # <<<<<<<<<<<<<< - * sub_metadatas_len = reader.read_uint() - * # consider sub metadatas + /* "DracoPy.pyx":113 + * + * @property + * def points(self): # <<<<<<<<<<<<<< + * return self.data_struct['points'] + * */ - __pyx_t_4 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_value); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_entries); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_10 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_name); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (unlikely(PyObject_SetItem(__pyx_t_5, __pyx_t_10, __pyx_t_4) < 0)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - } - /* "DracoPy.pyx":54 - * value = reader.read_bytes() - * metadata.entries[name] = value - * sub_metadatas_len = reader.read_uint() # <<<<<<<<<<<<<< - * # consider sub metadatas - * for _ in range(sub_metadatas_len): - */ - try { - __pyx_t_6 = __pyx_v_reader->read_uint(); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 54, __pyx_L1_error) - } - __pyx_v_sub_metadatas_len = __pyx_t_6; - - /* "DracoPy.pyx":56 - * sub_metadatas_len = reader.read_uint() - * # consider sub metadatas - * for _ in range(sub_metadatas_len): # <<<<<<<<<<<<<< - * name = reader.read_bytes() - * sub_metadata = MetadataObject() - */ - __pyx_t_6 = __pyx_v_sub_metadatas_len; - __pyx_t_7 = __pyx_t_6; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v__ = __pyx_t_8; - - /* "DracoPy.pyx":57 - * # consider sub metadatas - * for _ in range(sub_metadatas_len): - * name = reader.read_bytes() # <<<<<<<<<<<<<< - * sub_metadata = MetadataObject() - * metadata.sub_metadatas[name] = sub_metadata - */ - try { - __pyx_t_1 = __pyx_v_reader->read_bytes(); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 57, __pyx_L1_error) - } - __pyx_v_name = __pyx_t_1; - - /* "DracoPy.pyx":58 - * for _ in range(sub_metadatas_len): - * name = reader.read_bytes() - * sub_metadata = MetadataObject() # <<<<<<<<<<<<<< - * metadata.sub_metadatas[name] = sub_metadata - * to_parse_metadata_next.append(sub_metadata) - */ - __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_MetadataObject); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 58, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_10); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_10, function); - } - } - __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_XDECREF_SET(__pyx_v_sub_metadata, __pyx_t_4); - __pyx_t_4 = 0; - - /* "DracoPy.pyx":59 - * name = reader.read_bytes() - * sub_metadata = MetadataObject() - * metadata.sub_metadatas[name] = sub_metadata # <<<<<<<<<<<<<< - * to_parse_metadata_next.append(sub_metadata) - * to_parse_metadatas = to_parse_metadata_next - */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_metadata, __pyx_n_s_sub_metadatas); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_name); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_10); - if (unlikely(PyObject_SetItem(__pyx_t_4, __pyx_t_10, __pyx_v_sub_metadata) < 0)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - - /* "DracoPy.pyx":60 - * sub_metadata = MetadataObject() - * metadata.sub_metadatas[name] = sub_metadata - * to_parse_metadata_next.append(sub_metadata) # <<<<<<<<<<<<<< - * to_parse_metadatas = to_parse_metadata_next - * del reader - */ - __pyx_t_11 = __Pyx_PyList_Append(__pyx_v_to_parse_metadata_next, __pyx_v_sub_metadata); if (unlikely(__pyx_t_11 == ((int)-1))) __PYX_ERR(0, 60, __pyx_L1_error) - } + /* 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":47 - * while to_parse_metadatas: - * to_parse_metadata_next = [] - * for metadata in to_parse_metadatas: # <<<<<<<<<<<<<< - * # parse entries - * entries_len = reader.read_uint() +/* "DracoPy.pyx":117 + * + * @property + * def metadatas(self): # <<<<<<<<<<<<<< + * return self.data_struct['metadatas'] + * */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":61 - * metadata.sub_metadatas[name] = sub_metadata - * to_parse_metadata_next.append(sub_metadata) - * to_parse_metadatas = to_parse_metadata_next # <<<<<<<<<<<<<< - * del reader - * return geometry_metadata - */ - __Pyx_INCREF(__pyx_v_to_parse_metadata_next); - __Pyx_DECREF_SET(__pyx_v_to_parse_metadatas, __pyx_v_to_parse_metadata_next); - } +/* Python wrapper */ +static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_11metadatas(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_15DracoPointCloud_11metadatas = {"metadatas", (PyCFunction)__pyx_pw_7DracoPy_15DracoPointCloud_11metadatas, METH_O, 0}; +static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_11metadatas(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("metadatas (wrapper)", 0); + __pyx_r = __pyx_pf_7DracoPy_15DracoPointCloud_10metadatas(__pyx_self, ((PyObject *)__pyx_v_self)); - /* "DracoPy.pyx":62 - * to_parse_metadata_next.append(sub_metadata) - * to_parse_metadatas = to_parse_metadata_next - * del reader # <<<<<<<<<<<<<< - * return geometry_metadata - * - */ - delete __pyx_v_reader; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_10metadatas(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":63 - * to_parse_metadatas = to_parse_metadata_next - * del reader - * return geometry_metadata # <<<<<<<<<<<<<< + /* "DracoPy.pyx":118 + * @property + * def metadatas(self): + * return self.data_struct['metadatas'] # <<<<<<<<<<<<<< * - * def encode_metadata(geometry_metadata: GeometryMetadataObject) -> bytes: + * @property */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_geometry_metadata); - __pyx_r = __pyx_v_geometry_metadata; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_data_struct); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __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, 118, __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":33 + /* "DracoPy.pyx":117 * + * @property + * def metadatas(self): # <<<<<<<<<<<<<< + * return self.data_struct['metadatas'] * - * def decode_metadata(binary_metadata: bytes) -> MetadataObject: # <<<<<<<<<<<<<< - * reader = new DracoPy.MetadataReader(binary_metadata) - * geometry_metadata = GeometryMetadataObject() */ /* function exit code */ __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_AddTraceback("DracoPy.decode_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("DracoPy.DracoPointCloud.metadatas", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_geometry_metadata); - __Pyx_XDECREF(__pyx_v_to_parse_metadatas); - __Pyx_XDECREF(__pyx_v_attribute_metadata); - __Pyx_XDECREF(__pyx_v_to_parse_metadata_next); - __Pyx_XDECREF(__pyx_v_metadata); - __Pyx_XDECREF(__pyx_v_sub_metadata); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "DracoPy.pyx":65 - * return geometry_metadata +/* "DracoPy.pyx":121 + * + * @property + * def attributes(self): # <<<<<<<<<<<<<< + * return self.data_struct['attributes'] * - * def encode_metadata(geometry_metadata: GeometryMetadataObject) -> bytes: # <<<<<<<<<<<<<< - * cdef DracoPy.MetadataWriter writer - * to_parse_metadata = [geometry_metadata] */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_3encode_metadata(PyObject *__pyx_self, PyObject *__pyx_v_geometry_metadata); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_3encode_metadata = {"encode_metadata", (PyCFunction)__pyx_pw_7DracoPy_3encode_metadata, METH_O, 0}; -static PyObject *__pyx_pw_7DracoPy_3encode_metadata(PyObject *__pyx_self, PyObject *__pyx_v_geometry_metadata) { +static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_13attributes(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_15DracoPointCloud_13attributes = {"attributes", (PyCFunction)__pyx_pw_7DracoPy_15DracoPointCloud_13attributes, METH_O, 0}; +static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_13attributes(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("encode_metadata (wrapper)", 0); - __pyx_r = __pyx_pf_7DracoPy_2encode_metadata(__pyx_self, ((PyObject *)__pyx_v_geometry_metadata)); + __Pyx_RefNannySetupContext("attributes (wrapper)", 0); + __pyx_r = __pyx_pf_7DracoPy_15DracoPointCloud_12attributes(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_2encode_metadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_geometry_metadata) { - DracoFunctions::MetadataWriter __pyx_v_writer; - PyObject *__pyx_v_to_parse_metadata = NULL; - PyObject *__pyx_v_attribute_metadata = NULL; - PyObject *__pyx_v_to_parse_metadata_next = NULL; - PyObject *__pyx_v_draco_metadata = NULL; - PyObject *__pyx_v_name = NULL; - PyObject *__pyx_v_value = NULL; - PyObject *__pyx_v_draco_sub_metadata = NULL; +static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_12attributes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *(*__pyx_t_4)(PyObject *); - uint32_t __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - int __pyx_t_10; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - int __pyx_t_13; - std::string __pyx_t_14; - std::vector __pyx_t_15; + PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("encode_metadata", 0); - - /* "DracoPy.pyx":67 - * def encode_metadata(geometry_metadata: GeometryMetadataObject) -> bytes: - * cdef DracoPy.MetadataWriter writer - * to_parse_metadata = [geometry_metadata] # <<<<<<<<<<<<<< - * # consider attribute metadatas - * writer.write_uint(len(geometry_metadata.attribute_metadatas)) - */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_geometry_metadata); - __Pyx_GIVEREF(__pyx_v_geometry_metadata); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_geometry_metadata); - __pyx_v_to_parse_metadata = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __Pyx_RefNannySetupContext("attributes", 0); - /* "DracoPy.pyx":69 - * to_parse_metadata = [geometry_metadata] - * # consider attribute metadatas - * writer.write_uint(len(geometry_metadata.attribute_metadatas)) # <<<<<<<<<<<<<< - * for attribute_metadata in geometry_metadata.attribute_metadatas: - * writer.write_uint(attribute_metadata.unique_id) + /* "DracoPy.pyx":122 + * @property + * def attributes(self): + * return self.data_struct['attributes'] # <<<<<<<<<<<<<< + * + * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geometry_metadata, __pyx_n_s_attribute_metadatas); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __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, 122, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 69, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_attributes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - try { - __pyx_v_writer.write_uint(__pyx_t_2); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 69, __pyx_L1_error) - } + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "DracoPy.pyx":70 - * # consider attribute metadatas - * writer.write_uint(len(geometry_metadata.attribute_metadatas)) - * for attribute_metadata in geometry_metadata.attribute_metadatas: # <<<<<<<<<<<<<< - * writer.write_uint(attribute_metadata.unique_id) - * to_parse_metadata.append(attribute_metadata) + /* "DracoPy.pyx":121 + * + * @property + * def attributes(self): # <<<<<<<<<<<<<< + * return self.data_struct['attributes'] + * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_geometry_metadata, __pyx_n_s_attribute_metadatas); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_3 = __pyx_t_1; __Pyx_INCREF(__pyx_t_3); __pyx_t_2 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_2 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 70, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } else { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 70, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - } - } else { - __pyx_t_1 = __pyx_t_4(__pyx_t_3); - if (unlikely(!__pyx_t_1)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 70, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_XDECREF_SET(__pyx_v_attribute_metadata, __pyx_t_1); - __pyx_t_1 = 0; - /* "DracoPy.pyx":71 - * writer.write_uint(len(geometry_metadata.attribute_metadatas)) - * for attribute_metadata in geometry_metadata.attribute_metadatas: - * writer.write_uint(attribute_metadata.unique_id) # <<<<<<<<<<<<<< - * to_parse_metadata.append(attribute_metadata) - * # encode metadatas level by level - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_attribute_metadata, __pyx_n_s_unique_id); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 71, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyInt_As_uint32_t(__pyx_t_1); if (unlikely((__pyx_t_5 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(0, 71, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - try { - __pyx_v_writer.write_uint(__pyx_t_5); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 71, __pyx_L1_error) - } + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("DracoPy.DracoPointCloud.attributes", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "DracoPy.pyx":72 - * for attribute_metadata in geometry_metadata.attribute_metadatas: - * writer.write_uint(attribute_metadata.unique_id) - * to_parse_metadata.append(attribute_metadata) # <<<<<<<<<<<<<< - * # encode metadatas level by level - * while to_parse_metadata: +/* "DracoPy.pyx":127 + * class DracoMesh(DracoPointCloud): + * @property + * def faces(self): # <<<<<<<<<<<<<< + * return self.data_struct['faces'] + * */ - __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_to_parse_metadata, __pyx_v_attribute_metadata); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 72, __pyx_L1_error) - /* "DracoPy.pyx":70 - * # consider attribute metadatas - * writer.write_uint(len(geometry_metadata.attribute_metadatas)) - * for attribute_metadata in geometry_metadata.attribute_metadatas: # <<<<<<<<<<<<<< - * writer.write_uint(attribute_metadata.unique_id) - * to_parse_metadata.append(attribute_metadata) - */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "DracoPy.pyx":74 - * to_parse_metadata.append(attribute_metadata) - * # encode metadatas level by level - * while to_parse_metadata: # <<<<<<<<<<<<<< - * to_parse_metadata_next = [] - * for draco_metadata in to_parse_metadata: - */ - while (1) { - __pyx_t_7 = (PyList_GET_SIZE(__pyx_v_to_parse_metadata) != 0); - if (!__pyx_t_7) break; +/* 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)); - /* "DracoPy.pyx":75 - * # encode metadatas level by level - * while to_parse_metadata: - * to_parse_metadata_next = [] # <<<<<<<<<<<<<< - * for draco_metadata in to_parse_metadata: - * # encode entries - */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 75, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_XDECREF_SET(__pyx_v_to_parse_metadata_next, ((PyObject*)__pyx_t_3)); - __pyx_t_3 = 0; - - /* "DracoPy.pyx":76 - * while to_parse_metadata: - * to_parse_metadata_next = [] - * for draco_metadata in to_parse_metadata: # <<<<<<<<<<<<<< - * # encode entries - * writer.write_uint(len(draco_metadata.entries)) - */ - __pyx_t_3 = __pyx_v_to_parse_metadata; __Pyx_INCREF(__pyx_t_3); __pyx_t_2 = 0; - for (;;) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_2); __Pyx_INCREF(__pyx_t_1); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(0, 76, __pyx_L1_error) - #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_3, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - #endif - __Pyx_XDECREF_SET(__pyx_v_draco_metadata, __pyx_t_1); - __pyx_t_1 = 0; - - /* "DracoPy.pyx":78 - * for draco_metadata in to_parse_metadata: - * # encode entries - * writer.write_uint(len(draco_metadata.entries)) # <<<<<<<<<<<<<< - * for name, value in draco_metadata.entries.items(): - * writer.write_bytes_from_str(name) - */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_draco_metadata, __pyx_n_s_entries); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_8 == ((Py_ssize_t)-1))) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - try { - __pyx_v_writer.write_uint(__pyx_t_8); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 78, __pyx_L1_error) - } + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "DracoPy.pyx":79 - * # encode entries - * writer.write_uint(len(draco_metadata.entries)) - * for name, value in draco_metadata.entries.items(): # <<<<<<<<<<<<<< - * writer.write_bytes_from_str(name) - * writer.write_bytes_from_vec(value) - */ - __pyx_t_8 = 0; - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_draco_metadata, __pyx_n_s_entries); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 79, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (unlikely(__pyx_t_11 == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); - __PYX_ERR(0, 79, __pyx_L1_error) - } - __pyx_t_12 = __Pyx_dict_iterator(__pyx_t_11, 0, __pyx_n_s_items, (&__pyx_t_9), (&__pyx_t_10)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 79, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_XDECREF(__pyx_t_1); - __pyx_t_1 = __pyx_t_12; - __pyx_t_12 = 0; - while (1) { - __pyx_t_13 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_9, &__pyx_t_8, &__pyx_t_12, &__pyx_t_11, NULL, __pyx_t_10); - if (unlikely(__pyx_t_13 == 0)) break; - if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 79, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_GOTREF(__pyx_t_11); - __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_12); - __pyx_t_12 = 0; - __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_11); - __pyx_t_11 = 0; - - /* "DracoPy.pyx":80 - * writer.write_uint(len(draco_metadata.entries)) - * for name, value in draco_metadata.entries.items(): - * writer.write_bytes_from_str(name) # <<<<<<<<<<<<<< - * writer.write_bytes_from_vec(value) - * # consider sub metadatas - */ - __pyx_t_14 = __pyx_convert_string_from_py_std__in_string(__pyx_v_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 80, __pyx_L1_error) - try { - __pyx_v_writer.write_bytes_from_str(__pyx_t_14); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 80, __pyx_L1_error) - } +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":81 - * for name, value in draco_metadata.entries.items(): - * writer.write_bytes_from_str(name) - * writer.write_bytes_from_vec(value) # <<<<<<<<<<<<<< - * # consider sub metadatas - * writer.write_uint(len(draco_metadata.sub_metadatas)) - */ - __pyx_t_15 = __pyx_convert_vector_from_py_uint8_t(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 81, __pyx_L1_error) - try { - __pyx_v_writer.write_bytes_from_vec(__pyx_t_15); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 81, __pyx_L1_error) - } - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /* "DracoPy.pyx":128 + * @property + * def faces(self): + * return self.data_struct['faces'] # <<<<<<<<<<<<<< + * + * @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, 128, __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, 128, __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":83 - * writer.write_bytes_from_vec(value) - * # consider sub metadatas - * writer.write_uint(len(draco_metadata.sub_metadatas)) # <<<<<<<<<<<<<< - * for name, draco_sub_metadata in draco_metadata.sub_metadatas.items(): - * writer.write_bytes_from_str(name) + /* "DracoPy.pyx":127 + * class DracoMesh(DracoPointCloud): + * @property + * def faces(self): # <<<<<<<<<<<<<< + * return self.data_struct['faces'] + * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_draco_metadata, __pyx_n_s_sub_metadatas); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_9 == ((Py_ssize_t)-1))) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - try { - __pyx_v_writer.write_uint(__pyx_t_9); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 83, __pyx_L1_error) - } - /* "DracoPy.pyx":84 - * # consider sub metadatas - * writer.write_uint(len(draco_metadata.sub_metadatas)) - * for name, draco_sub_metadata in draco_metadata.sub_metadatas.items(): # <<<<<<<<<<<<<< - * writer.write_bytes_from_str(name) - * to_parse_metadata_next.append(draco_sub_metadata) - */ - __pyx_t_9 = 0; - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_v_draco_metadata, __pyx_n_s_sub_metadatas); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_11); - if (unlikely(__pyx_t_11 == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "items"); - __PYX_ERR(0, 84, __pyx_L1_error) - } - __pyx_t_12 = __Pyx_dict_iterator(__pyx_t_11, 0, __pyx_n_s_items, (&__pyx_t_8), (&__pyx_t_10)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_XDECREF(__pyx_t_1); - __pyx_t_1 = __pyx_t_12; - __pyx_t_12 = 0; - while (1) { - __pyx_t_13 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_8, &__pyx_t_9, &__pyx_t_12, &__pyx_t_11, NULL, __pyx_t_10); - if (unlikely(__pyx_t_13 == 0)) break; - if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_12); - __Pyx_GOTREF(__pyx_t_11); - __Pyx_XDECREF_SET(__pyx_v_name, __pyx_t_12); - __pyx_t_12 = 0; - __Pyx_XDECREF_SET(__pyx_v_draco_sub_metadata, __pyx_t_11); - __pyx_t_11 = 0; - - /* "DracoPy.pyx":85 - * writer.write_uint(len(draco_metadata.sub_metadatas)) - * for name, draco_sub_metadata in draco_metadata.sub_metadatas.items(): - * writer.write_bytes_from_str(name) # <<<<<<<<<<<<<< - * to_parse_metadata_next.append(draco_sub_metadata) - * return writer.get() - */ - __pyx_t_14 = __pyx_convert_string_from_py_std__in_string(__pyx_v_name); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 85, __pyx_L1_error) - try { - __pyx_v_writer.write_bytes_from_str(__pyx_t_14); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 85, __pyx_L1_error) - } + /* 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":86 - * for name, draco_sub_metadata in draco_metadata.sub_metadatas.items(): - * writer.write_bytes_from_str(name) - * to_parse_metadata_next.append(draco_sub_metadata) # <<<<<<<<<<<<<< - * return writer.get() +/* "DracoPy.pyx":131 + * + * @property + * def normals(self): # <<<<<<<<<<<<<< + * return self.data_struct['normals'] * */ - __pyx_t_6 = __Pyx_PyList_Append(__pyx_v_to_parse_metadata_next, __pyx_v_draco_sub_metadata); if (unlikely(__pyx_t_6 == ((int)-1))) __PYX_ERR(0, 86, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":76 - * while to_parse_metadata: - * to_parse_metadata_next = [] - * for draco_metadata in to_parse_metadata: # <<<<<<<<<<<<<< - * # encode entries - * writer.write_uint(len(draco_metadata.entries)) - */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } +/* 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)); - /* "DracoPy.pyx":87 - * writer.write_bytes_from_str(name) - * to_parse_metadata_next.append(draco_sub_metadata) - * return writer.get() # <<<<<<<<<<<<<< - * + /* 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":132 + * @property + * def normals(self): + * return self.data_struct['normals'] # <<<<<<<<<<<<<< * + * class EncodingOptions(object): */ __Pyx_XDECREF(__pyx_r); - try { - __pyx_t_14 = __pyx_v_writer.get(); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 87, __pyx_L1_error) - } - __pyx_t_3 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_t_14); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 87, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = ((PyObject*)__pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_data_struct); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 132, __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, 132, __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":65 - * return geometry_metadata + /* "DracoPy.pyx":131 + * + * @property + * def normals(self): # <<<<<<<<<<<<<< + * return self.data_struct['normals'] * - * def encode_metadata(geometry_metadata: GeometryMetadataObject) -> bytes: # <<<<<<<<<<<<<< - * cdef DracoPy.MetadataWriter writer - * to_parse_metadata = [geometry_metadata] */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_11); - __Pyx_XDECREF(__pyx_t_12); - __Pyx_AddTraceback("DracoPy.encode_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("DracoPy.DracoMesh.normals", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_to_parse_metadata); - __Pyx_XDECREF(__pyx_v_attribute_metadata); - __Pyx_XDECREF(__pyx_v_to_parse_metadata_next); - __Pyx_XDECREF(__pyx_v_draco_metadata); - __Pyx_XDECREF(__pyx_v_name); - __Pyx_XDECREF(__pyx_v_value); - __Pyx_XDECREF(__pyx_v_draco_sub_metadata); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "DracoPy.pyx":91 +/* "DracoPy.pyx":135 * - * class DracoPointCloud(object): - * def __init__(self, data_struct): # <<<<<<<<<<<<<< - * self.data_struct = data_struct - * if data_struct['encoding_options_set']: + * 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_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) { +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_data_struct = 0; + PyObject *__pyx_v_quantization_bits = 0; + PyObject *__pyx_v_quantization_range = 0; + PyObject *__pyx_v_quantization_origin = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -3486,12 +2778,16 @@ static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_1__init__(PyObject *__pyx_s __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_data_struct,0}; - PyObject* values[2] = {0,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}; 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); @@ -3506,223 +2802,115 @@ static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_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_data_struct)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_bits)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 91, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); __PYX_ERR(0, 135, __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, 135, __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("__init__", 1, 4, 4, 3); __PYX_ERR(0, 135, __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, 91, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 135, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + } 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_data_struct = values[1]; + __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("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 91, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 135, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("DracoPy.DracoPointCloud.__init__", __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_15DracoPointCloud___init__(__pyx_self, __pyx_v_self, __pyx_v_data_struct); + __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_15DracoPointCloud___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data_struct) { +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; - 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; + PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "DracoPy.pyx":92 - * 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":136 + * 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_data_struct, __pyx_v_data_struct) < 0) __PYX_ERR(0, 92, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_quantization_bits, __pyx_v_quantization_bits) < 0) __PYX_ERR(0, 136, __pyx_L1_error) - /* "DracoPy.pyx":93 - * 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":137 + * 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_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data_struct, __pyx_n_u_encoding_options_set); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 93, __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, 93, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_quantization_range, __pyx_v_quantization_range) < 0) __PYX_ERR(0, 137, __pyx_L1_error) - /* "DracoPy.pyx":94 - * 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: + /* "DracoPy.pyx":138 + * 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_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_EncodingOptions); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 94, __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, 94, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin, __pyx_v_quantization_origin) < 0) __PYX_ERR(0, 138, __pyx_L1_error) - /* "DracoPy.pyx":95 - * 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":139 + * 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): */ - __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data_struct, __pyx_n_u_quantization_range); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 95, __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, 95, __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; - } - } - #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, 94, __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, 94, __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, 94, __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, 94, __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":94 - * 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, 94, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "DracoPy.pyx":93 - * 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":97 - * data_struct['quantization_range'], data_struct['quantization_origin']) - * else: - * self.encoding_options = None # <<<<<<<<<<<<<< - * self.metadata = decode_metadata(data_struct["binary_metadata"]) - * - */ - /*else*/ { - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options, Py_None) < 0) __PYX_ERR(0, 97, __pyx_L1_error) - } - __pyx_L3:; - - /* "DracoPy.pyx":98 - * else: - * self.encoding_options = None - * self.metadata = decode_metadata(data_struct["binary_metadata"]) # <<<<<<<<<<<<<< - * - * def get_encoded_coordinate(self, value, axis): - */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_decode_metadata); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_9 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data_struct, __pyx_n_u_binary_metadata); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_6, __pyx_t_9) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_9); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyNumber_PowerOf2(__pyx_int_2, __pyx_v_quantization_bits, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_metadata, __pyx_t_1) < 0) __PYX_ERR(0, 98, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_SubtractObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __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, 139, __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, 139, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":91 + /* "DracoPy.pyx":135 * - * class DracoPointCloud(object): - * def __init__(self, data_struct): # <<<<<<<<<<<<<< - * self.data_struct = data_struct - * if data_struct['encoding_options_set']: + * 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 */ @@ -3730,13 +2918,8 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyOb 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_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("DracoPy.EncodingOptions.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3744,18 +2927,18 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyOb return __pyx_r; } -/* "DracoPy.pyx":100 - * self.metadata = decode_metadata(data_struct["binary_metadata"]) +/* "DracoPy.pyx":141 + * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) * * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< - * if self.encoding_options is not None: - * return self.encoding_options.get_encoded_coordinate(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_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) { +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; @@ -3790,17 +2973,17 @@ static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_3get_encoded_coordinate(PyO 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, 100, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, 1); __PYX_ERR(0, 141, __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, 100, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, 2); __PYX_ERR(0, 141, __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, 100, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_encoded_coordinate") < 0)) __PYX_ERR(0, 141, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -3815,155 +2998,213 @@ static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_3get_encoded_coordinate(PyO } 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, 100, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 141, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("DracoPy.DracoPointCloud.get_encoded_coordinate", __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_15DracoPointCloud_2get_encoded_coordinate(__pyx_self, __pyx_v_self, __pyx_v_value, __pyx_v_axis); + __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_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_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_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - PyObject *__pyx_t_7 = 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); - /* "DracoPy.pyx":101 + /* "DracoPy.pyx":142 * * def get_encoded_coordinate(self, value, axis): - * if self.encoding_options is not None: # <<<<<<<<<<<<<< - * return self.encoding_options.get_encoded_coordinate(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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __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_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __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, 142, __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, 142, __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, 142, __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, 142, __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, 142, __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, 142, __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, 142, __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, 142, __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, 142, __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":102 + /* "DracoPy.pyx":143 * def get_encoded_coordinate(self, value, axis): - * if self.encoding_options is not None: - * return self.encoding_options.get_encoded_coordinate(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, 143, __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, 143, __pyx_L1_error) + + /* "DracoPy.pyx":142 * - * def get_encoded_point(self, point): + * 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_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, 102, __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, 102, __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, 102, __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, 102, __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, 102, __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, 102, __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":101 - * - * 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":144 + * 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_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 144, __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, 144, __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, 144, __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":145 + * 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_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_floor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 145, __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, 145, __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, 145, __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, 145, __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, 145, __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":100 - * self.metadata = decode_metadata(data_struct["binary_metadata"]) + /* "DracoPy.pyx":146 + * 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): + */ + __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, 146, __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, 146, __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, 146, __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, 146, __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, 146, __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":141 + * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) * * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< - * if self.encoding_options is not None: - * return self.encoding_options.get_encoded_coordinate(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_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_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("DracoPy.DracoPointCloud.get_encoded_coordinate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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":104 - * return self.encoding_options.get_encoded_coordinate(value, axis) +/* "DracoPy.pyx":148 + * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) * * def get_encoded_point(self, point): # <<<<<<<<<<<<<< - * if self.encoding_options is not None: - * return self.encoding_options.get_encoded_point(point) + * encoded_point = [] + * for axis in range(self.num_axes): */ /* 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_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; @@ -3995,11 +3236,11 @@ static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_5get_encoded_point(PyObject 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, 104, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_point", 1, 2, 2, 1); __PYX_ERR(0, 148, __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, 104, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_encoded_point") < 0)) __PYX_ERR(0, 148, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -4012,111 +3253,216 @@ static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_5get_encoded_point(PyObject } 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, 104, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_point", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 148, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("DracoPy.DracoPointCloud.get_encoded_point", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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_15DracoPointCloud_4get_encoded_point(__pyx_self, __pyx_v_self, __pyx_v_point); + __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_15DracoPointCloud_4get_encoded_point(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_point) { +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; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = 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); - /* "DracoPy.pyx":105 + /* "DracoPy.pyx":149 * * def get_encoded_point(self, point): - * if self.encoding_options is not None: # <<<<<<<<<<<<<< - * return self.encoding_options.get_encoded_point(point) - * + * encoded_point = [] # <<<<<<<<<<<<<< + * for axis in range(self.num_axes): + * encoded_point.append(self.get_encoded_coordinate(point[axis], axis)) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 105, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 149, __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_v_encoded_point = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "DracoPy.pyx":106 + /* "DracoPy.pyx":150 * def get_encoded_point(self, point): - * if self.encoding_options is not None: - * return self.encoding_options.get_encoded_point(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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_num_axes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __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, 150, __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, 150, __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, 150, __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, 150, __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, 150, __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, 150, __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, 150, __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, 150, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __Pyx_XDECREF_SET(__pyx_v_axis, __pyx_t_2); + __pyx_t_2 = 0; + + /* "DracoPy.pyx":151 + * encoded_point = [] + * 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_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 106, __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, 106, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_encoded_coordinate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 151, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; + __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_point, __pyx_v_axis); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 151, __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_4 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_4)) { + __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_4); + __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, 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, 106, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_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, 151, __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, 151, __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, 151, __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, 151, __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_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_encoded_point, __pyx_t_2); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":105 - * + /* "DracoPy.pyx":150 * def get_encoded_point(self, point): - * if self.encoding_options is not None: # <<<<<<<<<<<<<< - * return self.encoding_options.get_encoded_point(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":104 - * return self.encoding_options.get_encoded_coordinate(value, axis) + /* "DracoPy.pyx":152 + * 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; + goto __pyx_L0; + + /* "DracoPy.pyx":148 + * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) * * def get_encoded_point(self, point): # <<<<<<<<<<<<<< - * if self.encoding_options is not None: - * return self.encoding_options.get_encoded_point(point) + * encoded_point = [] + * for axis in range(self.num_axes): */ /* 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_2); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("DracoPy.DracoPointCloud.get_encoded_point", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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":109 +/* "DracoPy.pyx":155 * * @property * def num_axes(self): # <<<<<<<<<<<<<< @@ -4125,37 +3471,37 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_4get_encoded_point(CYTHON_U */ /* 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) { +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_15DracoPointCloud_6num_axes(__pyx_self, ((PyObject *)__pyx_v_self)); + __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_15DracoPointCloud_6num_axes(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) { +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":110 + /* "DracoPy.pyx":156 * @property * def num_axes(self): * return 3 # <<<<<<<<<<<<<< * - * @property + * class FileTypeException(Exception): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_int_3); __pyx_r = __pyx_int_3; goto __pyx_L0; - /* "DracoPy.pyx":109 + /* "DracoPy.pyx":155 * * @property * def num_axes(self): # <<<<<<<<<<<<<< @@ -4170,413 +3516,741 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_6num_axes(CYTHON_UNUSED PyO return __pyx_r; } -/* "DracoPy.pyx":113 - * - * @property - * def points(self): # <<<<<<<<<<<<<< - * return self.data_struct['points'] +/* "DracoPy.pyx":164 + * pass * + * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< + * quantization_bits=14, compression_level=1, + * quantization_range=-1, quantization_origin=None, */ /* 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_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; + 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("points (wrapper)", 0); - __pyx_r = __pyx_pf_7DracoPy_15DracoPointCloud_8points(__pyx_self, ((PyObject *)__pyx_v_self)); + __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); + + /* "DracoPy.pyx":166 + * def encode_mesh_to_buffer(points, faces, + * quantization_bits=14, compression_level=1, + * quantization_range=-1, quantization_origin=None, # <<<<<<<<<<<<<< + * create_metadata=False): + * """ + */ + values[5] = ((PyObject *)Py_None); + + /* "DracoPy.pyx":167 + * 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. + */ + 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, 164, __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, 164, __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]; + } + 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, 164, __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_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); + + /* "DracoPy.pyx":164 + * pass + * + * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< + * quantization_bits=14, compression_level=1, + * quantization_range=-1, quantization_origin=None, + */ /* 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_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; 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("points", 0); + __Pyx_RefNannySetupContext("encode_mesh_to_buffer", 0); - /* "DracoPy.pyx":114 - * @property - * def points(self): - * return self.data_struct['points'] # <<<<<<<<<<<<<< - * - * + /* "DracoPy.pyx":177 + * 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_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, 114, __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, 114, __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; + __pyx_v_quant_origin = NULL; - /* "DracoPy.pyx":113 - * - * @property - * def points(self): # <<<<<<<<<<<<<< - * return self.data_struct['points'] - * + /* "DracoPy.pyx":178 + * """ + * 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:*/ { - /* 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":179 + * 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":119 - * class DracoMesh(DracoPointCloud): - * @property - * def faces(self): # <<<<<<<<<<<<<< - * return self.data_struct['faces'] - * + /* "DracoPy.pyx":180 + * 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) { -/* 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)); + /* "DracoPy.pyx":181 + * 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, 181, __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, 181, __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, 181, __pyx_L3_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_quant_origin = ((float *)PyMem_Malloc(__pyx_t_8)); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "DracoPy.pyx":182 + * 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] + * # binary_metadata = encode_metadata(metadata) + */ + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 182, __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, 182, __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, 182, __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, 182, __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, 182, __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, 182, __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, 182, __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, 182, __pyx_L3_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_7); + } + __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_7); + __pyx_t_7 = 0; -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":183 + * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) + * for dim in range(num_dims): + * quant_origin[dim] = quantization_origin[dim] # <<<<<<<<<<<<<< + * # binary_metadata = encode_metadata(metadata) + * encoded_mesh = DracoPy.encode_mesh(points, faces, + */ + __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 183, __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, 183, __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, 183, __pyx_L3_error) + (__pyx_v_quant_origin[__pyx_t_12]) = __pyx_t_11; - /* "DracoPy.pyx":120 - * @property - * def faces(self): - * return self.data_struct['faces'] # <<<<<<<<<<<<<< - * - * @property + /* "DracoPy.pyx":182 + * 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] + * # binary_metadata = encode_metadata(metadata) */ - __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, 120, __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, 120, __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; + } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "DracoPy.pyx":119 - * class DracoMesh(DracoPointCloud): - * @property - * def faces(self): # <<<<<<<<<<<<<< - * return self.data_struct['faces'] - * + /* "DracoPy.pyx":180 + * try: + * num_dims = 3 + * if quantization_origin is not None: # <<<<<<<<<<<<<< + * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) + * for dim in range(num_dims): */ + } - /* 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":185 + * quant_origin[dim] = quantization_origin[dim] + * # binary_metadata = encode_metadata(metadata) + * encoded_mesh = DracoPy.encode_mesh(points, faces, # <<<<<<<<<<<<<< + * quantization_bits, compression_level, + * quantization_range, quant_origin, + */ + __pyx_t_13 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L3_error) + __pyx_t_14 = __pyx_convert_vector_from_py_uint32_t(__pyx_v_faces); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L3_error) -/* "DracoPy.pyx":123 - * - * @property - * def normals(self): # <<<<<<<<<<<<<< - * return self.data_struct['normals'] - * + /* "DracoPy.pyx":186 + * # binary_metadata = encode_metadata(metadata) + * encoded_mesh = DracoPy.encode_mesh(points, faces, + * quantization_bits, compression_level, # <<<<<<<<<<<<<< + * quantization_range, quant_origin, + * create_metadata) */ + __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 186, __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, 186, __pyx_L3_error) -/* 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)); + /* "DracoPy.pyx":187 + * encoded_mesh = DracoPy.encode_mesh(points, faces, + * quantization_bits, compression_level, + * quantization_range, quant_origin, # <<<<<<<<<<<<<< + * create_metadata) + * if quant_origin != NULL: + */ + __pyx_t_11 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_11 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 187, __pyx_L3_error) - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "DracoPy.pyx":188 + * quantization_bits, compression_level, + * quantization_range, quant_origin, + * create_metadata) # <<<<<<<<<<<<<< + * if quant_origin != NULL: + * PyMem_Free(quant_origin) + */ + __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_17 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 188, __pyx_L3_error) -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":185 + * quant_origin[dim] = quantization_origin[dim] + * # binary_metadata = encode_metadata(metadata) + * encoded_mesh = DracoPy.encode_mesh(points, faces, # <<<<<<<<<<<<<< + * quantization_bits, compression_level, + * quantization_range, quant_origin, + */ + 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, 185, __pyx_L3_error) + } + __pyx_v_encoded_mesh = __pyx_t_18; - /* "DracoPy.pyx":124 - * @property - * def normals(self): - * return self.data_struct['normals'] # <<<<<<<<<<<<<< - * - * class EncodingOptions(object): + /* "DracoPy.pyx":189 + * 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_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, 124, __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, 124, __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; + __pyx_t_5 = ((__pyx_v_quant_origin != NULL) != 0); + if (__pyx_t_5) { - /* "DracoPy.pyx":123 - * - * @property - * def normals(self): # <<<<<<<<<<<<<< - * return self.data_struct['normals'] - * + /* "DracoPy.pyx":190 + * 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); - /* 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":189 + * 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":127 - * - * class EncodingOptions(object): - * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< - * self.quantization_bits = quantization_bits - * self.quantization_range = quantization_range + /* "DracoPy.pyx":191 + * 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: -/* 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) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_quantization_bits = 0; - PyObject *__pyx_v_quantization_range = 0; - PyObject *__pyx_v_quantization_origin = 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); - { - 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 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_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_quantization_bits)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); __PYX_ERR(0, 127, __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, 127, __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("__init__", 1, 4, 4, 3); __PYX_ERR(0, 127, __pyx_L3_error) + /* "DracoPy.pyx":192 + * 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, 192, __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, 192, __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":191 + * 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":194 + * 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, 194, __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, 194, __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, 194, __pyx_L3_error) + + /* "DracoPy.pyx":193 + * 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; } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 127, __pyx_L3_error) - } - } 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); + + /* "DracoPy.pyx":178 + * """ + * cdef float* quant_origin = NULL + * try: # <<<<<<<<<<<<<< + * num_dims = 3 + * if quantization_origin is not None: + */ } - __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("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 127, __pyx_L3_error) - __pyx_L3_error:; - __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_15EncodingOptions___init__(__pyx_self, __pyx_v_self, __pyx_v_quantization_bits, __pyx_v_quantization_range, __pyx_v_quantization_origin); + __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; - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "DracoPy.pyx":195 + * 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, 195, __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, 195, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_19); + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_7); -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; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); + /* "DracoPy.pyx":196 + * 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, 196, __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, 196, __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, 196, __pyx_L5_except_error) + } - /* "DracoPy.pyx":128 - * 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 + /* "DracoPy.pyx":197 + * except EncodingFailedException: + * raise EncodingFailedException('Invalid mesh') + * except: # <<<<<<<<<<<<<< + * if quant_origin != NULL: + * PyMem_Free(quant_origin) */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_quantization_bits, __pyx_v_quantization_bits) < 0) __PYX_ERR(0, 128, __pyx_L1_error) + /*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, 197, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_19); - /* "DracoPy.pyx":129 - * 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) + /* "DracoPy.pyx":198 + * 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_range, __pyx_v_quantization_range) < 0) __PYX_ERR(0, 129, __pyx_L1_error) + __pyx_t_5 = ((__pyx_v_quant_origin != NULL) != 0); + if (__pyx_t_5) { - /* "DracoPy.pyx":130 - * 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":199 + * 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, 130, __pyx_L1_error) + PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":131 - * self.quantization_range = quantization_range - * self.quantization_origin = quantization_origin - * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) # <<<<<<<<<<<<<< + /* "DracoPy.pyx":198 + * raise EncodingFailedException('Invalid mesh') + * except: + * if quant_origin != NULL: # <<<<<<<<<<<<<< + * PyMem_Free(quant_origin) + * raise ValueError("Input invalid") + */ + } + + /* "DracoPy.pyx":200 + * if quant_origin != NULL: + * PyMem_Free(quant_origin) + * raise ValueError("Input invalid") # <<<<<<<<<<<<<< * - * def get_encoded_coordinate(self, value, axis): + * def encode_point_cloud_to_buffer(points, */ - __pyx_t_1 = __Pyx_PyNumber_PowerOf2(__pyx_int_2, __pyx_v_quantization_bits, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 131, __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, 131, __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, 131, __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, 131, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_20 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 200, __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, 200, __pyx_L5_except_error) + } + __pyx_L5_except_error:; - /* "DracoPy.pyx":127 + /* "DracoPy.pyx":178 + * """ + * 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:; + } + + /* "DracoPy.pyx":164 + * pass * - * class EncodingOptions(object): - * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< - * self.quantization_bits = quantization_bits - * self.quantization_range = quantization_range + * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< + * quantization_bits=14, compression_level=1, + * quantization_range=-1, quantization_origin=None, */ /* 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_AddTraceback("DracoPy.EncodingOptions.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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_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":133 - * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) +/* "DracoPy.pyx":202 + * raise ValueError("Input invalid") * - * 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') + * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< + * quantization_bits=14, compression_level=1, + * quantization_range=-1, quantization_origin=None, */ /* 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; +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; 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("encode_point_cloud_to_buffer (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_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":204 + * def encode_point_cloud_to_buffer(points, + * quantization_bits=14, compression_level=1, + * quantization_range=-1, quantization_origin=None, # <<<<<<<<<<<<<< + * create_metadata=False): + * """ + */ + values[4] = ((PyObject *)Py_None); + + /* "DracoPy.pyx":205 + * 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. + */ + 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); @@ -4589,2630 +4263,1555 @@ static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_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_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_value)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, 1); __PYX_ERR(0, 133, __pyx_L3_error) + 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 (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, 133, __pyx_L3_error) + 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, "get_encoded_coordinate") < 0)) __PYX_ERR(0, 133, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode_point_cloud_to_buffer") < 0)) __PYX_ERR(0, 202, __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); + 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_self = values[0]; - __pyx_v_value = values[1]; - __pyx_v_axis = values[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]; } 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, 133, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode_point_cloud_to_buffer", 0, 1, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 202, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("DracoPy.EncodingOptions.get_encoded_coordinate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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_15EncodingOptions_2get_encoded_coordinate(__pyx_self, __pyx_v_self, __pyx_v_value, __pyx_v_axis); + __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); + + /* "DracoPy.pyx":202 + * raise ValueError("Input invalid") + * + * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< + * quantization_bits=14, compression_level=1, + * quantization_range=-1, quantization_origin=None, + */ /* function exit code */ __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; +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; 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; + 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; + 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("get_encoded_coordinate", 0); - - /* "DracoPy.pyx":134 - * - * 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_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __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, 134, __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, 134, __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, 134, __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, 134, __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, 134, __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, 134, __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, 134, __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, 134, __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, 134, __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)) { + __Pyx_RefNannySetupContext("encode_point_cloud_to_buffer", 0); - /* "DracoPy.pyx":135 - * 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":215 + * 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_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 135, __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, 135, __pyx_L1_error) + __pyx_v_quant_origin = NULL; - /* "DracoPy.pyx":134 - * - * 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":216 + * """ + * 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":136 - * 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) + /* "DracoPy.pyx":217 + * cdef float* quant_origin = NULL + * try: + * num_dims = 3 # <<<<<<<<<<<<<< + * if quantization_origin is not None: + * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 136, __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, 136, __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, 136, __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; + __Pyx_INCREF(__pyx_int_3); + __pyx_v_num_dims = __pyx_int_3; - /* "DracoPy.pyx":137 - * 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":218 + * 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_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_floor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 137, __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, 137, __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, 137, __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, 137, __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, 137, __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; + __pyx_t_4 = (__pyx_v_quantization_origin != Py_None); + __pyx_t_5 = (__pyx_t_4 != 0); + if (__pyx_t_5) { - /* "DracoPy.pyx":138 - * 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): + /* "DracoPy.pyx":219 + * 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_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, 138, __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, 138, __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, 138, __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, 138, __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, 138, __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; + __pyx_t_6 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 219, __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, 219, __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, 219, __pyx_L3_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_v_quant_origin = ((float *)PyMem_Malloc(__pyx_t_8)); - /* "DracoPy.pyx":133 - * 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":220 + * 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] + * # binary_metadata = encode_metadata(metadata) */ - - /* 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":140 - * 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): - */ - -/* 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; - } - 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, 140, __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, 140, __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, 140, __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); - - /* 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; - 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); - - /* "DracoPy.pyx":141 - * - * 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, 141, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_encoded_point = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "DracoPy.pyx":142 - * 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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_num_axes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __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, 142, __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, 142, __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, 142, __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, 142, __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, 142, __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, 142, __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, 142, __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, 142, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_XDECREF_SET(__pyx_v_axis, __pyx_t_2); - __pyx_t_2 = 0; - - /* "DracoPy.pyx":143 - * 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, 143, __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, 143, __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, 143, __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, 143, __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, 143, __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, 143, __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, 143, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "DracoPy.pyx":142 - * 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":144 - * 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; - goto __pyx_L0; - - /* "DracoPy.pyx":140 - * 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): - */ - - /* 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":147 - * - * @property - * def num_axes(self): # <<<<<<<<<<<<<< - * return 3 - * - */ - -/* 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":148 - * @property - * def num_axes(self): - * return 3 # <<<<<<<<<<<<<< - * - * class FileTypeException(Exception): - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_int_3); - __pyx_r = __pyx_int_3; - goto __pyx_L0; - - /* "DracoPy.pyx":147 - * - * @property - * def num_axes(self): # <<<<<<<<<<<<<< - * return 3 - * - */ - - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "DracoPy.pyx":156 - * pass - * - * def encode_mesh_to_buffer(points, faces, metadata: GeometryMetadataObject = None, # <<<<<<<<<<<<<< - * quantization_bits=14, compression_level=1, - * quantization_range=-1, quantization_origin=None, - */ - -/* 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 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_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_metadata = 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); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_points,&__pyx_n_s_faces,&__pyx_n_s_metadata,&__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[8] = {0,0,0,0,0,0,0,0}; - values[2] = ((PyObject *)Py_None); - values[3] = ((PyObject *)__pyx_int_14); - values[4] = ((PyObject *)__pyx_int_1); - values[5] = ((PyObject *)__pyx_int_neg_1); - - /* "DracoPy.pyx":158 - * def encode_mesh_to_buffer(points, faces, metadata: GeometryMetadataObject = None, - * quantization_bits=14, compression_level=1, - * quantization_range=-1, quantization_origin=None, # <<<<<<<<<<<<<< - * create_metadata=False): - * """ - */ - values[6] = ((PyObject *)Py_None); - - /* "DracoPy.pyx":159 - * 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. - */ - values[7] = ((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 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - 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, 8, 1); __PYX_ERR(0, 156, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_metadata); - 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_bits); - 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_compression_level); - 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_range); - 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_quantization_origin); - if (value) { values[6] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 7: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_create_metadata); - if (value) { values[7] = 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, 156, __pyx_L3_error) - } - } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - 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_metadata = values[2]; - __pyx_v_quantization_bits = values[3]; - __pyx_v_compression_level = values[4]; - __pyx_v_quantization_range = values[5]; - __pyx_v_quantization_origin = values[6]; - __pyx_v_create_metadata = values[7]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 2, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 156, __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_metadata, __pyx_v_quantization_bits, __pyx_v_compression_level, __pyx_v_quantization_range, __pyx_v_quantization_origin, __pyx_v_create_metadata); - - /* "DracoPy.pyx":156 - * pass - * - * def encode_mesh_to_buffer(points, faces, metadata: GeometryMetadataObject = None, # <<<<<<<<<<<<<< - * quantization_bits=14, compression_level=1, - * quantization_range=-1, quantization_origin=None, - */ - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -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_metadata, 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; - PyObject *__pyx_v_binary_metadata = NULL; - struct DracoFunctions::EncodedObject __pyx_v_encoded_mesh; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - 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; - PyObject *__pyx_t_8 = NULL; - size_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - PyObject *(*__pyx_t_11)(PyObject *); - float __pyx_t_12; - Py_ssize_t __pyx_t_13; - std::vector __pyx_t_14; - std::vector __pyx_t_15; - std::string __pyx_t_16; - int __pyx_t_17; - int __pyx_t_18; - bool __pyx_t_19; - struct DracoFunctions::EncodedObject __pyx_t_20; - PyObject *__pyx_t_21 = NULL; - PyObject *__pyx_t_22 = NULL; - PyObject *__pyx_t_23 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("encode_mesh_to_buffer", 0); - __Pyx_INCREF(__pyx_v_metadata); - - /* "DracoPy.pyx":169 - * a point where each coordinate is the minimum of that coordinate among the input vertices. - * """ - * if metadata is None: # <<<<<<<<<<<<<< - * metadata = GeometryMetadataObject() - * cdef float* quant_origin = NULL - */ - __pyx_t_1 = (__pyx_v_metadata == Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "DracoPy.pyx":170 - * """ - * if metadata is None: - * metadata = GeometryMetadataObject() # <<<<<<<<<<<<<< - * cdef float* quant_origin = NULL - * try: - */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_GeometryMetadataObject); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 170, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 170, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF_SET(__pyx_v_metadata, __pyx_t_3); - __pyx_t_3 = 0; - - /* "DracoPy.pyx":169 - * a point where each coordinate is the minimum of that coordinate among the input vertices. - * """ - * if metadata is None: # <<<<<<<<<<<<<< - * metadata = GeometryMetadataObject() - * cdef float* quant_origin = NULL - */ - } - - /* "DracoPy.pyx":171 - * if metadata is None: - * metadata = GeometryMetadataObject() - * cdef float* quant_origin = NULL # <<<<<<<<<<<<<< - * try: - * num_dims = 3 - */ - __pyx_v_quant_origin = NULL; - - /* "DracoPy.pyx":172 - * metadata = GeometryMetadataObject() - * 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_6, &__pyx_t_7, &__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_8); - /*try:*/ { - - /* "DracoPy.pyx":173 - * 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":174 - * 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_2 = (__pyx_v_quantization_origin != Py_None); - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { - - /* "DracoPy.pyx":175 - * 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_3 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 175, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 175, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_9 = __Pyx_PyInt_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 175, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_quant_origin = ((float *)PyMem_Malloc(__pyx_t_9)); - - /* "DracoPy.pyx":176 - * 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] - * binary_metadata = encode_metadata(metadata) - */ - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 176, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_4); - if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { - __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_10 = 0; - __pyx_t_11 = NULL; - } else { - __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 176, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 176, __pyx_L4_error) - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - for (;;) { - if (likely(!__pyx_t_11)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 176, __pyx_L4_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 176, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 176, __pyx_L4_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 176, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_11(__pyx_t_3); - 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(0, 176, __pyx_L4_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_4); - __pyx_t_4 = 0; - - /* "DracoPy.pyx":177 - * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) - * for dim in range(num_dims): - * quant_origin[dim] = quantization_origin[dim] # <<<<<<<<<<<<<< - * binary_metadata = encode_metadata(metadata) - * encoded_mesh = DracoPy.encode_mesh(points, faces, binary_metadata, - */ - __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 177, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 177, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 177, __pyx_L4_error) - (__pyx_v_quant_origin[__pyx_t_13]) = __pyx_t_12; - - /* "DracoPy.pyx":176 - * 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] - * binary_metadata = encode_metadata(metadata) - */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "DracoPy.pyx":174 - * 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":178 - * for dim in range(num_dims): - * quant_origin[dim] = quantization_origin[dim] - * binary_metadata = encode_metadata(metadata) # <<<<<<<<<<<<<< - * encoded_mesh = DracoPy.encode_mesh(points, faces, binary_metadata, - * quantization_bits, compression_level, - */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_encode_metadata); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 178, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } - } - __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_metadata) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_metadata); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 178, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_binary_metadata = __pyx_t_3; - __pyx_t_3 = 0; - - /* "DracoPy.pyx":179 - * quant_origin[dim] = quantization_origin[dim] - * binary_metadata = encode_metadata(metadata) - * encoded_mesh = DracoPy.encode_mesh(points, faces, binary_metadata, # <<<<<<<<<<<<<< - * quantization_bits, compression_level, - * quantization_range, quant_origin, - */ - __pyx_t_14 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 179, __pyx_L4_error) - __pyx_t_15 = __pyx_convert_vector_from_py_uint32_t(__pyx_v_faces); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 179, __pyx_L4_error) - __pyx_t_16 = __pyx_convert_string_from_py_std__in_string(__pyx_v_binary_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 179, __pyx_L4_error) - - /* "DracoPy.pyx":180 - * binary_metadata = encode_metadata(metadata) - * encoded_mesh = DracoPy.encode_mesh(points, faces, binary_metadata, - * quantization_bits, compression_level, # <<<<<<<<<<<<<< - * quantization_range, quant_origin, - * create_metadata) - */ - __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L4_error) - __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L4_error) - - /* "DracoPy.pyx":181 - * encoded_mesh = DracoPy.encode_mesh(points, faces, binary_metadata, - * quantization_bits, compression_level, - * quantization_range, quant_origin, # <<<<<<<<<<<<<< - * create_metadata) - * if quant_origin != NULL: - */ - __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 181, __pyx_L4_error) - - /* "DracoPy.pyx":182 - * quantization_bits, compression_level, - * quantization_range, quant_origin, - * create_metadata) # <<<<<<<<<<<<<< - * if quant_origin != NULL: - * PyMem_Free(quant_origin) - */ - __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_19 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 182, __pyx_L4_error) - - /* "DracoPy.pyx":179 - * quant_origin[dim] = quantization_origin[dim] - * binary_metadata = encode_metadata(metadata) - * encoded_mesh = DracoPy.encode_mesh(points, faces, binary_metadata, # <<<<<<<<<<<<<< - * quantization_bits, compression_level, - * quantization_range, quant_origin, - */ - try { - __pyx_t_20 = DracoFunctions::encode_mesh(__pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_12, __pyx_v_quant_origin, __pyx_t_19); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 179, __pyx_L4_error) - } - __pyx_v_encoded_mesh = __pyx_t_20; - - /* "DracoPy.pyx":183 - * 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_1 = ((__pyx_v_quant_origin != NULL) != 0); - if (__pyx_t_1) { - - /* "DracoPy.pyx":184 - * 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":183 - * 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":185 - * 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":186 - * 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_3 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_encoded_mesh.buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 186, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 186, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L8_try_return; - - /* "DracoPy.pyx":185 - * 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":188 - * 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_3, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 188, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_u_Invalid_mesh) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u_Invalid_mesh); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 188, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 188, __pyx_L4_error) - - /* "DracoPy.pyx":187 - * 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":172 - * metadata = GeometryMetadataObject() - * cdef float* quant_origin = NULL - * try: # <<<<<<<<<<<<<< - * num_dims = 3 - * if quantization_origin is not None: - */ - } - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L9_try_end; - __pyx_L4_error:; - __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; - - /* "DracoPy.pyx":189 - * 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_4, &__pyx_t_3, &__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 189, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_21); - __pyx_t_18 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_4, __pyx_t_21); - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - __Pyx_ErrRestore(__pyx_t_4, __pyx_t_3, __pyx_t_5); - __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_5 = 0; - if (__pyx_t_18) { - __Pyx_AddTraceback("DracoPy.encode_mesh_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 189, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_t_4); - - /* "DracoPy.pyx":190 - * raise EncodingFailedException('Invalid mesh') - * except EncodingFailedException: - * raise EncodingFailedException('Invalid mesh') # <<<<<<<<<<<<<< - * except: - * if quant_origin != NULL: - */ - __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 190, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_22); - __pyx_t_23 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_22))) { - __pyx_t_23 = PyMethod_GET_SELF(__pyx_t_22); - if (likely(__pyx_t_23)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_22); - __Pyx_INCREF(__pyx_t_23); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_22, function); + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 220, __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, 220, __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, 220, __pyx_L3_error) } - } - __pyx_t_21 = (__pyx_t_23) ? __Pyx_PyObject_Call2Args(__pyx_t_22, __pyx_t_23, __pyx_kp_u_Invalid_mesh) : __Pyx_PyObject_CallOneArg(__pyx_t_22, __pyx_kp_u_Invalid_mesh); - __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0; - if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 190, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_21); - __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; - __Pyx_Raise(__pyx_t_21, 0, 0, 0); - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - __PYX_ERR(0, 190, __pyx_L6_except_error) - } - - /* "DracoPy.pyx":191 - * except EncodingFailedException: - * raise EncodingFailedException('Invalid mesh') - * except: # <<<<<<<<<<<<<< - * if quant_origin != NULL: - * PyMem_Free(quant_origin) - */ - /*except:*/ { - __Pyx_AddTraceback("DracoPy.encode_mesh_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5) < 0) __PYX_ERR(0, 191, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_t_5); - - /* "DracoPy.pyx":192 - * raise EncodingFailedException('Invalid mesh') - * 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":193 - * except: - * if quant_origin != NULL: - * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< - * raise ValueError("Input invalid") - * - */ - PyMem_Free(__pyx_v_quant_origin); - - /* "DracoPy.pyx":192 - * raise EncodingFailedException('Invalid mesh') - * except: - * if quant_origin != NULL: # <<<<<<<<<<<<<< - * PyMem_Free(quant_origin) - * raise ValueError("Input invalid") - */ - } + __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, 220, __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, 220, __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, 220, __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, 220, __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, 220, __pyx_L3_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_7); + } + __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_7); + __pyx_t_7 = 0; - /* "DracoPy.pyx":194 - * if quant_origin != NULL: - * PyMem_Free(quant_origin) - * raise ValueError("Input invalid") # <<<<<<<<<<<<<< - * - * def encode_point_cloud_to_buffer(points, metadata: GeometryMetadataObject = None, + /* "DracoPy.pyx":221 + * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) + * for dim in range(num_dims): + * quant_origin[dim] = quantization_origin[dim] # <<<<<<<<<<<<<< + * # binary_metadata = encode_metadata(metadata) + * encoded_point_cloud = DracoPy.encode_point_cloud( */ - __pyx_t_21 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 194, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_21); - __Pyx_Raise(__pyx_t_21, 0, 0, 0); - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - __PYX_ERR(0, 194, __pyx_L6_except_error) - } - __pyx_L6_except_error:; + __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 221, __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, 221, __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, 221, __pyx_L3_error) + (__pyx_v_quant_origin[__pyx_t_12]) = __pyx_t_11; - /* "DracoPy.pyx":172 - * metadata = GeometryMetadataObject() - * cdef float* quant_origin = NULL - * try: # <<<<<<<<<<<<<< - * num_dims = 3 + /* "DracoPy.pyx":220 * if quantization_origin is not None: - */ - __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); - goto __pyx_L1_error; - __pyx_L8_try_return:; - __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); - goto __pyx_L0; - __pyx_L9_try_end:; - } - - /* "DracoPy.pyx":156 - * pass - * - * def encode_mesh_to_buffer(points, faces, metadata: GeometryMetadataObject = None, # <<<<<<<<<<<<<< - * quantization_bits=14, compression_level=1, - * quantization_range=-1, quantization_origin=None, - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_21); - __Pyx_XDECREF(__pyx_t_22); - __Pyx_XDECREF(__pyx_t_23); - __Pyx_AddTraceback("DracoPy.encode_mesh_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_XDECREF(__pyx_v_binary_metadata); - __Pyx_XDECREF(__pyx_v_metadata); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "DracoPy.pyx":196 - * raise ValueError("Input invalid") - * - * def encode_point_cloud_to_buffer(points, metadata: GeometryMetadataObject = None, # <<<<<<<<<<<<<< - * quantization_bits=14, compression_level=1, - * quantization_range=-1, quantization_origin=None, - */ - -/* 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 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_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_metadata = 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_metadata,&__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[1] = ((PyObject *)Py_None); - values[2] = ((PyObject *)__pyx_int_14); - values[3] = ((PyObject *)__pyx_int_1); - values[4] = ((PyObject *)__pyx_int_neg_1); - - /* "DracoPy.pyx":198 - * def encode_point_cloud_to_buffer(points, metadata: GeometryMetadataObject = None, - * quantization_bits=14, compression_level=1, - * quantization_range=-1, quantization_origin=None, # <<<<<<<<<<<<<< - * create_metadata=False): - * """ - */ - values[5] = ((PyObject *)Py_None); - - /* "DracoPy.pyx":199 - * 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. - */ - 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 (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_metadata); - 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_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--; } + * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) + * for dim in range(num_dims): # <<<<<<<<<<<<<< + * quant_origin[dim] = quantization_origin[dim] + * # binary_metadata = encode_metadata(metadata) + */ } + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "DracoPy.pyx":218 + * try: + * num_dims = 3 + * if quantization_origin is not None: # <<<<<<<<<<<<<< + * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) + * for dim in range(num_dims): + */ } - 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, 196, __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); - 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_metadata = 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]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("encode_point_cloud_to_buffer", 0, 1, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 196, __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_metadata, __pyx_v_quantization_bits, __pyx_v_compression_level, __pyx_v_quantization_range, __pyx_v_quantization_origin, __pyx_v_create_metadata); - /* "DracoPy.pyx":196 - * raise ValueError("Input invalid") - * - * def encode_point_cloud_to_buffer(points, metadata: GeometryMetadataObject = None, # <<<<<<<<<<<<<< - * quantization_bits=14, compression_level=1, - * quantization_range=-1, quantization_origin=None, + /* "DracoPy.pyx":224 + * # binary_metadata = encode_metadata(metadata) + * encoded_point_cloud = DracoPy.encode_point_cloud( + * points, quantization_bits, compression_level, # <<<<<<<<<<<<<< + * quantization_range, quant_origin, create_metadata) + * if quant_origin != NULL: */ + __pyx_t_13 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 224, __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, 224, __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, 224, __pyx_L3_error) - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "DracoPy.pyx":225 + * 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) + */ + __pyx_t_11 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_11 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 225, __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, 225, __pyx_L3_error) -static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_points, PyObject *__pyx_v_metadata, 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; - PyObject *__pyx_v_binary_metadata = NULL; - struct DracoFunctions::EncodedObject __pyx_v_encoded_point_cloud; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - 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; - PyObject *__pyx_t_8 = NULL; - size_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - PyObject *(*__pyx_t_11)(PyObject *); - float __pyx_t_12; - Py_ssize_t __pyx_t_13; - std::vector __pyx_t_14; - std::string __pyx_t_15; - int __pyx_t_16; - int __pyx_t_17; - bool __pyx_t_18; - struct DracoFunctions::EncodedObject __pyx_t_19; - 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_point_cloud_to_buffer", 0); - __Pyx_INCREF(__pyx_v_metadata); + /* "DracoPy.pyx":223 + * quant_origin[dim] = quantization_origin[dim] + * # binary_metadata = encode_metadata(metadata) + * encoded_point_cloud = DracoPy.encode_point_cloud( # <<<<<<<<<<<<<< + * points, quantization_bits, compression_level, + * quantization_range, quant_origin, create_metadata) + */ + 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, 223, __pyx_L3_error) + } + __pyx_v_encoded_point_cloud = __pyx_t_17; - /* "DracoPy.pyx":209 - * a point where each coordinate is the minimum of that coordinate among the input vertices. - * """ - * if metadata is None: # <<<<<<<<<<<<<< - * metadata = GeometryMetadataObject() - * cdef float* quant_origin = NULL + /* "DracoPy.pyx":226 + * 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: */ - __pyx_t_1 = (__pyx_v_metadata == Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_t_5 = ((__pyx_v_quant_origin != NULL) != 0); + if (__pyx_t_5) { - /* "DracoPy.pyx":210 - * """ - * if metadata is None: - * metadata = GeometryMetadataObject() # <<<<<<<<<<<<<< - * cdef float* quant_origin = NULL - * try: + /* "DracoPy.pyx":227 + * 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) + */ + PyMem_Free(__pyx_v_quant_origin); + + /* "DracoPy.pyx":226 + * 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: */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_GeometryMetadataObject); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); } - } - __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF_SET(__pyx_v_metadata, __pyx_t_3); - __pyx_t_3 = 0; - /* "DracoPy.pyx":209 - * a point where each coordinate is the minimum of that coordinate among the input vertices. - * """ - * if metadata is None: # <<<<<<<<<<<<<< - * metadata = GeometryMetadataObject() - * cdef float* quant_origin = NULL + /* "DracoPy.pyx":228 + * 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: - /* "DracoPy.pyx":211 - * if metadata is None: - * metadata = GeometryMetadataObject() - * cdef float* quant_origin = NULL # <<<<<<<<<<<<<< - * try: - * num_dims = 3 + /* "DracoPy.pyx":229 + * 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') */ - __pyx_v_quant_origin = NULL; + __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, 229, __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, 229, __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":228 + * 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":231 + * 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, 231, __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, 231, __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, 231, __pyx_L3_error) + + /* "DracoPy.pyx":230 + * 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; + } - /* "DracoPy.pyx":212 - * metadata = GeometryMetadataObject() + /* "DracoPy.pyx":216 + * """ * 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_6, &__pyx_t_7, &__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_8); - /*try:*/ { + } + __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":213 - * cdef float* quant_origin = NULL - * try: - * num_dims = 3 # <<<<<<<<<<<<<< - * if quantization_origin is not None: - * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) + /* "DracoPy.pyx":232 + * 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_INCREF(__pyx_int_3); - __pyx_v_num_dims = __pyx_int_3; + __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, 232, __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, 232, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_18); + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_7); - /* "DracoPy.pyx":214 - * 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":233 + * raise EncodingFailedException('Invalid point cloud') + * except EncodingFailedException: + * raise EncodingFailedException('Invalid point cloud') # <<<<<<<<<<<<<< + * except: + * if quant_origin != NULL: */ - __pyx_t_2 = (__pyx_v_quantization_origin != Py_None); - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { + __Pyx_GetModuleGlobalName(__pyx_t_20, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 233, __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); + } + } + __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, 233, __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, 233, __pyx_L5_except_error) + } - /* "DracoPy.pyx":215 - * 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] + /* "DracoPy.pyx":234 + * 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, 234, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_18); + + /* "DracoPy.pyx":235 + * 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":236 + * except: + * if quant_origin != NULL: + * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< + * raise ValueError("Input invalid") + * + */ + PyMem_Free(__pyx_v_quant_origin); + + /* "DracoPy.pyx":235 + * raise EncodingFailedException('Invalid point cloud') + * except: + * if quant_origin != NULL: # <<<<<<<<<<<<<< + * PyMem_Free(quant_origin) + * raise ValueError("Input invalid") + */ + } + + /* "DracoPy.pyx":237 + * if quant_origin != NULL: + * PyMem_Free(quant_origin) + * raise ValueError("Input invalid") # <<<<<<<<<<<<<< + * + * def raise_decoding_error(decoding_status): */ - __pyx_t_3 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 215, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 215, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_9 = __Pyx_PyInt_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_quant_origin = ((float *)PyMem_Malloc(__pyx_t_9)); + __pyx_t_19 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 237, __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, 237, __pyx_L5_except_error) + } + __pyx_L5_except_error:; - /* "DracoPy.pyx":216 + /* "DracoPy.pyx":216 + * """ + * 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] - * binary_metadata = encode_metadata(metadata) */ - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 216, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_4); - if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { - __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_10 = 0; - __pyx_t_11 = NULL; - } else { - __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 216, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 216, __pyx_L4_error) - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - for (;;) { - if (likely(!__pyx_t_11)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 216, __pyx_L4_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 216, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 216, __pyx_L4_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 216, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_11(__pyx_t_3); - 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(0, 216, __pyx_L4_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_4); - __pyx_t_4 = 0; + __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:; + } - /* "DracoPy.pyx":217 - * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) - * for dim in range(num_dims): - * quant_origin[dim] = quantization_origin[dim] # <<<<<<<<<<<<<< - * binary_metadata = encode_metadata(metadata) - * encoded_point_cloud = DracoPy.encode_point_cloud( + /* "DracoPy.pyx":202 + * raise ValueError("Input invalid") + * + * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< + * quantization_bits=14, compression_level=1, + * quantization_range=-1, quantization_origin=None, */ - __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 217, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 217, __pyx_L4_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 217, __pyx_L4_error) - (__pyx_v_quant_origin[__pyx_t_13]) = __pyx_t_12; - /* "DracoPy.pyx":216 - * 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] - * binary_metadata = encode_metadata(metadata) + /* 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); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "DracoPy.pyx":239 + * 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_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":214 - * try: - * num_dims = 3 - * if quantization_origin is not None: # <<<<<<<<<<<<<< - * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) - * for dim in range(num_dims): +/* 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)); + + /* 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) { + 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("raise_decoding_error", 0); + + /* "DracoPy.pyx":240 + * + * 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, 240, __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, 240, __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, 240, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":218 - * for dim in range(num_dims): - * quant_origin[dim] = quantization_origin[dim] - * binary_metadata = encode_metadata(metadata) # <<<<<<<<<<<<<< - * encoded_point_cloud = DracoPy.encode_point_cloud( - * points, binary_metadata, quantization_bits, compression_level, + /* "DracoPy.pyx":241 + * 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_4, __pyx_n_s_encode_metadata); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 218, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FileTypeException); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __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_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_5, __pyx_v_metadata) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_metadata); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 218, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_binary_metadata = __pyx_t_3; - __pyx_t_3 = 0; + } + __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, 241, __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, 241, __pyx_L1_error) - /* "DracoPy.pyx":220 - * binary_metadata = encode_metadata(metadata) - * encoded_point_cloud = DracoPy.encode_point_cloud( - * points, binary_metadata, quantization_bits, compression_level, # <<<<<<<<<<<<<< - * quantization_range, quant_origin, create_metadata) - * if quant_origin != NULL: + /* "DracoPy.pyx":240 + * + * 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_14 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L4_error) - __pyx_t_15 = __pyx_convert_string_from_py_std__in_string(__pyx_v_binary_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L4_error) - __pyx_t_16 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L4_error) - __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 220, __pyx_L4_error) + } - /* "DracoPy.pyx":221 - * encoded_point_cloud = DracoPy.encode_point_cloud( - * points, binary_metadata, quantization_bits, compression_level, - * quantization_range, quant_origin, create_metadata) # <<<<<<<<<<<<<< - * if quant_origin != NULL: - * PyMem_Free(quant_origin) + /* "DracoPy.pyx":242 + * 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_12 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 221, __pyx_L4_error) - __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_18 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 221, __pyx_L4_error) + __pyx_t_2 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::failed_during_decoding); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 242, __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, 242, __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, 242, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":219 - * quant_origin[dim] = quantization_origin[dim] - * binary_metadata = encode_metadata(metadata) - * encoded_point_cloud = DracoPy.encode_point_cloud( # <<<<<<<<<<<<<< - * points, binary_metadata, quantization_bits, compression_level, - * quantization_range, quant_origin, create_metadata) + /* "DracoPy.pyx":243 + * 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') */ - try { - __pyx_t_19 = DracoFunctions::encode_point_cloud(__pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_12, __pyx_v_quant_origin, __pyx_t_18); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 219, __pyx_L4_error) - } - __pyx_v_encoded_point_cloud = __pyx_t_19; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __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, 243, __pyx_L1_error) - /* "DracoPy.pyx":222 - * points, binary_metadata, 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":242 + * 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_1 = ((__pyx_v_quant_origin != NULL) != 0); - if (__pyx_t_1) { + } - /* "DracoPy.pyx":223 - * 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":244 + * 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') + * */ - PyMem_Free(__pyx_v_quant_origin); + __pyx_t_1 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::no_position_attribute); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __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, 244, __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, 244, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":222 - * points, binary_metadata, 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":245 + * 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): */ - } + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 245, __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, 245, __pyx_L1_error) - /* "DracoPy.pyx":224 - * 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: + /* "DracoPy.pyx":244 + * 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') + * */ - switch (__pyx_v_encoded_point_cloud.encode_status) { - case DracoFunctions::successful_encoding: + } - /* "DracoPy.pyx":225 - * 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":239 + * 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_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_encoded_point_cloud.buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 225, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 225, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L8_try_return; - /* "DracoPy.pyx":224 - * 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: + /* 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":247 + * 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: */ - break; - case DracoFunctions::failed_during_encoding: - /* "DracoPy.pyx":227 - * 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') +/* 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) { + 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)); + + /* 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; + 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; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("decode_buffer_to_mesh", 0); + + /* "DracoPy.pyx":248 + * + * 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) */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 227, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_u_Invalid_point_cloud) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_u_Invalid_point_cloud); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 227, __pyx_L4_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 227, __pyx_L4_error) + __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 248, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 248, __pyx_L1_error) + try { + __pyx_t_3 = DracoFunctions::decode_buffer(__pyx_t_1, __pyx_t_2); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 248, __pyx_L1_error) + } + __pyx_v_mesh_struct = __pyx_t_3; - /* "DracoPy.pyx":226 - * 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: + /* "DracoPy.pyx":249 + * 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: */ - break; - default: break; - } + __pyx_t_4 = ((__pyx_v_mesh_struct.decode_status == DracoFunctions::successful) != 0); + if (__pyx_t_4) { - /* "DracoPy.pyx":212 - * metadata = GeometryMetadataObject() - * cdef float* quant_origin = NULL - * try: # <<<<<<<<<<<<<< - * num_dims = 3 - * if quantization_origin is not None: + /* "DracoPy.pyx":250 + * 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, 250, __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, 250, __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_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __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; - goto __pyx_L9_try_end; - __pyx_L4_error:; - __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; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 250, __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":228 - * 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: + /* "DracoPy.pyx":249 + * 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: */ - __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_20, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 228, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_20); - __pyx_t_17 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_4, __pyx_t_20); - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - __Pyx_ErrRestore(__pyx_t_4, __pyx_t_3, __pyx_t_5); - __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_5 = 0; - if (__pyx_t_17) { - __Pyx_AddTraceback("DracoPy.encode_point_cloud_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 228, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_t_4); + } - /* "DracoPy.pyx":229 - * raise EncodingFailedException('Invalid point cloud') - * except EncodingFailedException: - * raise EncodingFailedException('Invalid point cloud') # <<<<<<<<<<<<<< - * except: - * if quant_origin != NULL: + /* "DracoPy.pyx":252 + * return DracoMesh(mesh_struct) + * else: + * raise_decoding_error(mesh_struct.decode_status) # <<<<<<<<<<<<<< + * + * def decode_point_cloud_buffer(buffer): */ - __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 229, __pyx_L6_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); - } + /*else*/ { + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_raise_decoding_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 252, __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, 252, __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_20 = (__pyx_t_22) ? __Pyx_PyObject_Call2Args(__pyx_t_21, __pyx_t_22, __pyx_kp_u_Invalid_point_cloud) : __Pyx_PyObject_CallOneArg(__pyx_t_21, __pyx_kp_u_Invalid_point_cloud); - __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0; - if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 229, __pyx_L6_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, 229, __pyx_L6_except_error) } + __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, 252, __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; + } - /* "DracoPy.pyx":230 - * except EncodingFailedException: - * raise EncodingFailedException('Invalid point cloud') - * except: # <<<<<<<<<<<<<< - * if quant_origin != NULL: - * PyMem_Free(quant_origin) + /* "DracoPy.pyx":247 + * 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: */ - /*except:*/ { - __Pyx_AddTraceback("DracoPy.encode_point_cloud_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5) < 0) __PYX_ERR(0, 230, __pyx_L6_except_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_t_5); - /* "DracoPy.pyx":231 - * raise EncodingFailedException('Invalid point cloud') - * except: - * if quant_origin != NULL: # <<<<<<<<<<<<<< - * PyMem_Free(quant_origin) - * raise ValueError("Input invalid") + /* 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_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "DracoPy.pyx":254 + * 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_t_1 = ((__pyx_v_quant_origin != NULL) != 0); - if (__pyx_t_1) { - /* "DracoPy.pyx":232 - * except: - * if quant_origin != NULL: - * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< - * raise ValueError("Input invalid") +/* 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; + __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_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("decode_point_cloud_buffer", 0); + + /* "DracoPy.pyx":255 * + * 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) + */ + __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 255, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 255, __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, 255, __pyx_L1_error) + } + __pyx_v_point_cloud_struct = __pyx_t_3; + + /* "DracoPy.pyx":256 + * 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: */ - PyMem_Free(__pyx_v_quant_origin); + __pyx_t_4 = ((__pyx_v_point_cloud_struct.decode_status == DracoFunctions::successful) != 0); + if (__pyx_t_4) { - /* "DracoPy.pyx":231 - * raise EncodingFailedException('Invalid point cloud') - * except: - * if quant_origin != NULL: # <<<<<<<<<<<<<< - * PyMem_Free(quant_origin) - * raise ValueError("Input invalid") + /* "DracoPy.pyx":257 + * 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) */ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 257, __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, 257, __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, 257, __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":233 - * if quant_origin != NULL: - * PyMem_Free(quant_origin) - * raise ValueError("Input invalid") # <<<<<<<<<<<<<< - * - * def raise_decoding_error(decoding_status): + /* "DracoPy.pyx":256 + * 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: */ - __pyx_t_20 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 233, __pyx_L6_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, 233, __pyx_L6_except_error) - } - __pyx_L6_except_error:; + } - /* "DracoPy.pyx":212 - * metadata = GeometryMetadataObject() - * cdef float* quant_origin = NULL - * try: # <<<<<<<<<<<<<< - * num_dims = 3 - * if quantization_origin is not None: + /* "DracoPy.pyx":259 + * return DracoPointCloud(point_cloud_struct) + * else: + * raise_decoding_error(point_cloud_struct.decode_status) # <<<<<<<<<<<<<< */ - __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); - goto __pyx_L1_error; - __pyx_L8_try_return:; - __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); - goto __pyx_L0; - __pyx_L9_try_end:; + /*else*/ { + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_raise_decoding_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 259, __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, 259, __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, 259, __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; } - /* "DracoPy.pyx":196 - * raise ValueError("Input invalid") + /* "DracoPy.pyx":254 + * raise_decoding_error(mesh_struct.decode_status) * - * def encode_point_cloud_to_buffer(points, metadata: GeometryMetadataObject = None, # <<<<<<<<<<<<<< - * quantization_bits=14, compression_level=1, - * quantization_range=-1, quantization_origin=None, + * 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: */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_20); - __Pyx_XDECREF(__pyx_t_21); - __Pyx_XDECREF(__pyx_t_22); - __Pyx_AddTraceback("DracoPy.encode_point_cloud_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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_XDECREF(__pyx_v_num_dims); - __Pyx_XDECREF(__pyx_v_dim); - __Pyx_XDECREF(__pyx_v_binary_metadata); - __Pyx_XDECREF(__pyx_v_metadata); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "DracoPy.pyx":235 - * raise ValueError("Input invalid") +/* "vector.from_py":45 * - * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< - * if decoding_status == DracoPy.decoding_status.not_draco_encoded: - * raise FileTypeException('Input mesh is not draco encoded') + * @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: */ -/* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_9raise_decoding_error(PyObject *__pyx_self, PyObject *__pyx_v_decoding_status); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_9raise_decoding_error = {"raise_decoding_error", (PyCFunction)__pyx_pw_7DracoPy_9raise_decoding_error, METH_O, 0}; -static PyObject *__pyx_pw_7DracoPy_9raise_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_8raise_decoding_error(__pyx_self, ((PyObject *)__pyx_v_decoding_status)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_7DracoPy_8raise_decoding_error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_decoding_status) { - PyObject *__pyx_r = NULL; +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; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; + 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("raise_decoding_error", 0); - - /* "DracoPy.pyx":236 - * - * 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, 236, __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, 236, __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, 236, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(__pyx_t_3)) { + __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_float", 0); - /* "DracoPy.pyx":237 - * 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') + /* "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_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FileTypeException); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 237, __pyx_L1_error) + 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_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_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_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, 237, __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, 237, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4); + __pyx_t_4 = 0; - /* "DracoPy.pyx":236 + /* "vector.from_py":48 + * cdef vector[X] v + * for item in o: + * v.push_back(item) # <<<<<<<<<<<<<< + * return v * - * 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":238 - * 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, 238, __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, 238, __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, 238, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(__pyx_t_3)) { - - /* "DracoPy.pyx":239 - * 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__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 239, __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, 239, __pyx_L1_error) + __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)); - /* "DracoPy.pyx":238 - * 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: + /* "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":240 - * 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, 240, __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, 240, __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, 240, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":241 - * 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') # <<<<<<<<<<<<<< + /* "vector.from_py":49 + * for item in o: + * v.push_back(item) + * return v # <<<<<<<<<<<<<< * - * 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, 241, __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, 241, __pyx_L1_error) - - /* "DracoPy.pyx":240 - * 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_r = __pyx_v_v; + goto __pyx_L0; - /* "DracoPy.pyx":235 - * raise ValueError("Input invalid") + /* "vector.from_py":45 * - * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< - * if decoding_status == DracoPy.decoding_status.not_draco_encoded: - * raise FileTypeException('Input mesh is not draco encoded') + * @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_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_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_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "DracoPy.pyx":243 - * 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: - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_11decode_buffer_to_mesh(PyObject *__pyx_self, PyObject *__pyx_v_buffer); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_11decode_buffer_to_mesh = {"decode_buffer_to_mesh", (PyCFunction)__pyx_pw_7DracoPy_11decode_buffer_to_mesh, METH_O, 0}; -static PyObject *__pyx_pw_7DracoPy_11decode_buffer_to_mesh(PyObject *__pyx_self, PyObject *__pyx_v_buffer) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("decode_buffer_to_mesh (wrapper)", 0); - __pyx_r = __pyx_pf_7DracoPy_10decode_buffer_to_mesh(__pyx_self, ((PyObject *)__pyx_v_buffer)); - - /* function exit code */ + __Pyx_XDECREF(__pyx_v_item); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_10decode_buffer_to_mesh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer) { - struct DracoFunctions::MeshObject __pyx_v_mesh_struct; - PyObject *__pyx_r = NULL; +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 - char const *__pyx_t_1; + PyObject *__pyx_t_1 = NULL; 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_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("decode_buffer_to_mesh", 0); + __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_uint32_t", 0); - /* "DracoPy.pyx":244 - * - * 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) + /* "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_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 244, __pyx_L1_error) - __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 244, __pyx_L1_error) - try { - __pyx_t_3 = DracoFunctions::decode_buffer(__pyx_t_1, __pyx_t_2); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 244, __pyx_L1_error) + 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) } - __pyx_v_mesh_struct = __pyx_t_3; + 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; - /* "DracoPy.pyx":245 - * 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: + /* "vector.from_py":48 + * cdef vector[X] v + * for item in o: + * v.push_back(item) # <<<<<<<<<<<<<< + * return v + * */ - __pyx_t_4 = ((__pyx_v_mesh_struct.decode_status == DracoFunctions::successful) != 0); - if (__pyx_t_4) { + __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)); - /* "DracoPy.pyx":246 - * 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) + /* "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_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_DracoMesh); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 246, __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, 246, __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, 246, __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; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":245 - * 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: + /* "vector.from_py":49 + * for item in o: + * v.push_back(item) + * return v # <<<<<<<<<<<<<< + * + * */ - } + __pyx_r = __pyx_v_v; + goto __pyx_L0; - /* "DracoPy.pyx":248 - * return DracoMesh(mesh_struct) - * else: - * raise_decoding_error(mesh_struct.decode_status) # <<<<<<<<<<<<<< + /* "vector.from_py":45 * - * def decode_point_cloud_buffer(buffer): + * @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: */ - /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_raise_decoding_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 248, __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, 248, __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, 248, __pyx_L1_error) + + /* 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; + 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); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + 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; - /* "DracoPy.pyx":243 - * raise ValueError('DracoPy only supports meshes with position attributes') + /* "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())] * - * def decode_buffer_to_mesh(buffer): # <<<<<<<<<<<<<< - * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) - * if mesh_struct.decode_status == DracoPy.decoding_status.successful: */ /* 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_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_r = NULL; + __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; } -/* "DracoPy.pyx":250 - * raise_decoding_error(mesh_struct.decode_status) +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())] # <<<<<<<<<<<<<< + * * - * 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_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; -/* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_13decode_point_cloud_buffer(PyObject *__pyx_self, PyObject *__pyx_v_buffer); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_13decode_point_cloud_buffer = {"decode_point_cloud_buffer", (PyCFunction)__pyx_pw_7DracoPy_13decode_point_cloud_buffer, METH_O, 0}; -static PyObject *__pyx_pw_7DracoPy_13decode_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_12decode_point_cloud_buffer(__pyx_self, ((PyObject *)__pyx_v_buffer)); + /* "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_pf_7DracoPy_12decode_point_cloud_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer) { - struct DracoFunctions::PointCloudObject __pyx_v_point_cloud_struct; +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 - 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; + size_t __pyx_t_2; + size_t __pyx_t_3; + size_t __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("decode_point_cloud_buffer", 0); + __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_unsigned_int", 0); - /* "DracoPy.pyx":251 + /* "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())] # <<<<<<<<<<<<<< + * * - * 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) - */ - __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 251, __pyx_L1_error) - __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 251, __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, 251, __pyx_L1_error) - } - __pyx_v_point_cloud_struct = __pyx_t_3; - - /* "DracoPy.pyx":252 - * 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: - */ - __pyx_t_4 = ((__pyx_v_point_cloud_struct.decode_status == DracoFunctions::successful) != 0); - if (__pyx_t_4) { - - /* "DracoPy.pyx":253 - * 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) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 253, __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, 253, __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, 253, __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":252 - * 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":255 - * return DracoPointCloud(point_cloud_struct) - * 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, 255, __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, 255, __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, 255, __pyx_L1_error) + __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); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + 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; - /* "DracoPy.pyx":250 - * raise_decoding_error(mesh_struct.decode_status) + /* "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())] * - * 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: */ /* 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_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_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; } -/* "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; +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 - char const *__pyx_t_1; + 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_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; + __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_double", 0); - /* "string.from_py":16 - * cdef Py_ssize_t length = 0 - * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) - * return string(data, length) # <<<<<<<<<<<<<< + /* "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_r = std::string(__pyx_v_data, __pyx_v_length); + __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; - /* "string.from_py":13 + /* "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())] * - * @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_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; } @@ -7406,425 +6005,196 @@ static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string * 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; -} - -/* "vector.from_py":45 - * - * @cname("__pyx_convert_vector_from_py_uint8_t") - * cdef vector[X] __pyx_convert_vector_from_py_uint8_t(object o) except *: # <<<<<<<<<<<<<< - * cdef vector[X] v - * for item in o: - */ - -static std::vector __pyx_convert_vector_from_py_uint8_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; - uint8_t __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_uint8_t", 0); - - /* "vector.from_py":47 - * cdef vector[X] __pyx_convert_vector_from_py_uint8_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_uint8_t(__pyx_v_item); if (unlikely((__pyx_t_5 == ((uint8_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 48, __pyx_L1_error) - __pyx_v_v.push_back(((uint8_t)__pyx_t_5)); - - /* "vector.from_py":47 - * cdef vector[X] __pyx_convert_vector_from_py_uint8_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_uint8_t") - * cdef vector[X] __pyx_convert_vector_from_py_uint8_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_uint8_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_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; + /* 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; +} - /* "vector.from_py":48 - * cdef vector[X] v - * for item in o: - * v.push_back(item) # <<<<<<<<<<<<<< - * return v +/* "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()) * */ - __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; +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); - /* "vector.from_py":49 - * for item in o: - * v.push_back(item) - * return v # <<<<<<<<<<<<<< - * + /* "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_r = __pyx_v_v; + __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; - /* "vector.from_py":45 + /* "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()) * - * @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_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_XDECREF(__pyx_v_item); + __Pyx_XGIVEREF(__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; +/* "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; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - uint32_t __pyx_t_5; + 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_vector_from_py_uint32_t", 0); + __Pyx_RefNannySetupContext("__pyx_convert_unordered_map_to_py_uint32_t____std_3a__3a_string", 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 + /* "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() */ - 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; + __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; - /* "vector.from_py":48 - * cdef vector[X] v - * for item in o: - * v.push_back(item) # <<<<<<<<<<<<<< - * return v - * + /* "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_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)); + __pyx_v_iter = __pyx_v_s.begin(); - /* "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 + /* "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)); } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "vector.from_py":49 - * for item in o: - * v.push_back(item) - * return v # <<<<<<<<<<<<<< + /* "map.to_py":209 + * o[key_value.first] = key_value.second + * cython.operator.preincrement(iter) + * return o # <<<<<<<<<<<<<< * * */ - __pyx_r = __pyx_v_v; + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_o); + __pyx_r = __pyx_v_o; goto __pyx_L0; - /* "vector.from_py":45 + /* "map.to_py":201 * - * @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: + * @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_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_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_item); + __Pyx_XDECREF(__pyx_v_o); + __Pyx_XGIVEREF(__pyx_r); __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): # <<<<<<<<<<<<<< + * @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_unsigned_char(const std::vector &__pyx_v_v) { +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 @@ -7836,11 +6206,11 @@ static PyObject *__pyx_convert_vector_to_py_unsigned_char(const std::vector &__pyx_v_v) { - size_t __pyx_v_i; +/* "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; - size_t __pyx_t_2; - size_t __pyx_t_3; - size_t __pyx_t_4; - PyObject *__pyx_t_5 = 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_vector_to_py_float", 0); + __Pyx_RefNannySetupContext("__pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_string", 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())] # <<<<<<<<<<<<<< + /* "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_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; + __Pyx_INCREF(__pyx_v_o); + __pyx_r = __pyx_v_o; 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())] + /* "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_5); - __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_float", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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_vector_to_py_unsigned_int(const std::vector &__pyx_v_v) { +/* "vector.to_py":60 + * + * @cname("__pyx_convert_vector_to_py_uint32_t") + * cdef object __pyx_convert_vector_to_py_uint32_t(vector[X]& v): # <<<<<<<<<<<<<< + * return [v[i] for i in range(v.size())] + * + */ + +static PyObject *__pyx_convert_vector_to_py_uint32_t(const std::vector &__pyx_v_v) { size_t __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -7950,11 +6392,11 @@ static PyObject *__pyx_convert_vector_to_py_unsigned_int(const std::vector &__pyx_v_v) { +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 @@ -8007,11 +6449,11 @@ static PyObject *__pyx_convert_vector_to_py_double(const std::vector &_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_double", 0); + __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_MetadataObject", 0); /* "vector.to_py":61 - * @cname("__pyx_convert_vector_to_py_double") - * cdef object __pyx_convert_vector_to_py_double(vector[X]& v): + * @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())] # <<<<<<<<<<<<<< * * @@ -8023,7 +6465,7 @@ static PyObject *__pyx_convert_vector_to_py_double(const std::vector &_ __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_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; @@ -8034,8 +6476,8 @@ static PyObject *__pyx_convert_vector_to_py_double(const std::vector &_ /* "vector.to_py":60 * - * @cname("__pyx_convert_vector_to_py_double") - * cdef object __pyx_convert_vector_to_py_double(vector[X]& v): # <<<<<<<<<<<<<< + * @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())] * */ @@ -8044,7 +6486,7 @@ static PyObject *__pyx_convert_vector_to_py_double(const std::vector &_ __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_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); @@ -8098,17 +6540,16 @@ static struct PyModuleDef __pyx_moduledef = { #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_n_s_AttributeMetadataObject, __pyx_k_AttributeMetadataObject, sizeof(__pyx_k_AttributeMetadataObject), 0, 0, 1, 1}, - {&__pyx_n_u_AttributeMetadataObject, __pyx_k_AttributeMetadataObject, sizeof(__pyx_k_AttributeMetadataObject), 0, 1, 0, 1}, - {&__pyx_n_s_AttributeMetadataObject___init, __pyx_k_AttributeMetadataObject___init, sizeof(__pyx_k_AttributeMetadataObject___init), 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_attributes, __pyx_k_DracoPointCloud_attributes, sizeof(__pyx_k_DracoPointCloud_attributes), 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}, @@ -8121,44 +6562,33 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_n_s_GeometryMetadataObject, __pyx_k_GeometryMetadataObject, sizeof(__pyx_k_GeometryMetadataObject), 0, 0, 1, 1}, - {&__pyx_n_s_GeometryMetadataObject___init, __pyx_k_GeometryMetadataObject___init, sizeof(__pyx_k_GeometryMetadataObject___init), 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_n_s_List, __pyx_k_List, sizeof(__pyx_k_List), 0, 0, 1, 1}, - {&__pyx_n_s_MetadataObject, __pyx_k_MetadataObject, sizeof(__pyx_k_MetadataObject), 0, 0, 1, 1}, - {&__pyx_n_u_MetadataObject, __pyx_k_MetadataObject, sizeof(__pyx_k_MetadataObject), 0, 1, 0, 1}, - {&__pyx_n_s_MetadataObject___init, __pyx_k_MetadataObject___init, sizeof(__pyx_k_MetadataObject___init), 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_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__14, __pyx_k__14, sizeof(__pyx_k__14), 0, 0, 1, 1}, - {&__pyx_n_s_append, __pyx_k_append, sizeof(__pyx_k_append), 0, 0, 1, 1}, - {&__pyx_n_s_attribute_metadata, __pyx_k_attribute_metadata, sizeof(__pyx_k_attribute_metadata), 0, 0, 1, 1}, - {&__pyx_n_s_attribute_metadatas, __pyx_k_attribute_metadatas, sizeof(__pyx_k_attribute_metadatas), 0, 0, 1, 1}, - {&__pyx_n_s_attribute_metadatas_len, __pyx_k_attribute_metadatas_len, sizeof(__pyx_k_attribute_metadatas_len), 0, 0, 1, 1}, + {&__pyx_n_s_attributes, __pyx_k_attributes, sizeof(__pyx_k_attributes), 0, 0, 1, 1}, + {&__pyx_n_u_attributes, __pyx_k_attributes, sizeof(__pyx_k_attributes), 0, 1, 0, 1}, {&__pyx_n_s_axis, __pyx_k_axis, sizeof(__pyx_k_axis), 0, 0, 1, 1}, - {&__pyx_n_s_binary_metadata, __pyx_k_binary_metadata, sizeof(__pyx_k_binary_metadata), 0, 0, 1, 1}, - {&__pyx_n_u_binary_metadata, __pyx_k_binary_metadata, sizeof(__pyx_k_binary_metadata), 0, 1, 0, 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, __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_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_metadata, __pyx_k_decode_metadata, sizeof(__pyx_k_decode_metadata), 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_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_metadata, __pyx_k_draco_metadata, sizeof(__pyx_k_draco_metadata), 0, 0, 1, 1}, - {&__pyx_n_s_draco_sub_metadata, __pyx_k_draco_sub_metadata, sizeof(__pyx_k_draco_sub_metadata), 0, 0, 1, 1}, + {&__pyx_n_s_element_size, __pyx_k_element_size, sizeof(__pyx_k_element_size), 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_metadata, __pyx_k_encode_metadata, sizeof(__pyx_k_encode_metadata), 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}, @@ -8167,26 +6597,22 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_entries, __pyx_k_entries, sizeof(__pyx_k_entries), 0, 0, 1, 1}, - {&__pyx_n_s_entries_len, __pyx_k_entries_len, sizeof(__pyx_k_entries_len), 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_geometry_metadata, __pyx_k_geometry_metadata, sizeof(__pyx_k_geometry_metadata), 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_u_int, __pyx_k_int, sizeof(__pyx_k_int), 0, 1, 0, 1}, {&__pyx_n_s_inverse_alpha, __pyx_k_inverse_alpha, sizeof(__pyx_k_inverse_alpha), 0, 0, 1, 1}, - {&__pyx_n_s_items, __pyx_k_items, sizeof(__pyx_k_items), 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_metadata, __pyx_k_metadata, sizeof(__pyx_k_metadata), 0, 0, 1, 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_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}, @@ -8209,30 +6635,21 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_reader, __pyx_k_reader, sizeof(__pyx_k_reader), 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_sub_metadata, __pyx_k_sub_metadata, sizeof(__pyx_k_sub_metadata), 0, 0, 1, 1}, - {&__pyx_n_s_sub_metadatas, __pyx_k_sub_metadatas, sizeof(__pyx_k_sub_metadatas), 0, 0, 1, 1}, - {&__pyx_n_s_sub_metadatas_len, __pyx_k_sub_metadatas_len, sizeof(__pyx_k_sub_metadatas_len), 0, 0, 1, 1}, - {&__pyx_n_s_super, __pyx_k_super, sizeof(__pyx_k_super), 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_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_to_parse_metadata, __pyx_k_to_parse_metadata, sizeof(__pyx_k_to_parse_metadata), 0, 0, 1, 1}, - {&__pyx_n_s_to_parse_metadata_next, __pyx_k_to_parse_metadata_next, sizeof(__pyx_k_to_parse_metadata_next), 0, 0, 1, 1}, - {&__pyx_n_s_to_parse_metadatas, __pyx_k_to_parse_metadatas, sizeof(__pyx_k_to_parse_metadatas), 0, 0, 1, 1}, {&__pyx_n_s_typing, __pyx_k_typing, sizeof(__pyx_k_typing), 0, 0, 1, 1}, {&__pyx_n_s_unique_id, __pyx_k_unique_id, sizeof(__pyx_k_unique_id), 0, 0, 1, 1}, {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1}, - {&__pyx_n_s_writer, __pyx_k_writer, sizeof(__pyx_k_writer), 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, 90, __pyx_L1_error) __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) __PYX_ERR(0, 108, __pyx_L1_error) - __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s_super); if (!__pyx_builtin_super) __PYX_ERR(0, 20, __pyx_L1_error) - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 39, __pyx_L1_error) - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 135, __pyx_L1_error) - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 239, __pyx_L1_error) + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 143, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 150, __pyx_L1_error) + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 243, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -8242,119 +6659,50 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "DracoPy.pyx":135 + /* "DracoPy.pyx":143 * 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_ = PyTuple_Pack(1, __pyx_kp_u_Specified_value_out_of_encoded_r); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 135, __pyx_L1_error) + __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_Specified_value_out_of_encoded_r); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 143, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_); - /* "DracoPy.pyx":194 + /* "DracoPy.pyx":200 * if quant_origin != NULL: * PyMem_Free(quant_origin) * raise ValueError("Input invalid") # <<<<<<<<<<<<<< * - * def encode_point_cloud_to_buffer(points, metadata: GeometryMetadataObject = None, + * def encode_point_cloud_to_buffer(points, */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_Input_invalid); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_Input_invalid); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); - /* "DracoPy.pyx":239 + /* "DracoPy.pyx":243 * 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, 239, __pyx_L1_error) + __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_Failed_to_decode_input_mesh_Data); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 243, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); - /* "DracoPy.pyx":241 + /* "DracoPy.pyx":245 * 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): */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_DracoPy_only_supports_meshes_wit); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 241, __pyx_L1_error) + __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_DracoPy_only_supports_meshes_wit); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 245, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4); - /* "DracoPy.pyx":10 - * - * class MetadataObject: - * def __init__(self, entries: Dict[str, bytes] = None, # <<<<<<<<<<<<<< - * sub_metadatas: Dict[str, 'MetadataObject'] = None): - * self.entries = entries if entries else {} - */ - __pyx_tuple__5 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_entries, __pyx_n_s_sub_metadatas); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 10, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); - __pyx_codeobj__6 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__5, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_init, 10, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__6)) __PYX_ERR(0, 10, __pyx_L1_error) - __pyx_tuple__7 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 10, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); - - /* "DracoPy.pyx":17 - * - * class AttributeMetadataObject(MetadataObject): - * def __init__(self, unique_id: int, # <<<<<<<<<<<<<< - * entries: Dict[str, bytes] = None, - * sub_metadatas: Dict[str, 'MetadataObject'] = None): - */ - __pyx_tuple__8 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_unique_id, __pyx_n_s_entries, __pyx_n_s_sub_metadatas); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); - __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 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_init, 17, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 17, __pyx_L1_error) - __pyx_tuple__10 = PyTuple_Pack(2, ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__10); - __Pyx_GIVEREF(__pyx_tuple__10); - - /* "DracoPy.pyx":25 - * - * class GeometryMetadataObject(MetadataObject): - * def __init__(self, entries: Dict[str, bytes] = None, # <<<<<<<<<<<<<< - * sub_metadatas: Dict[str, 'MetadataObject'] = None, - * attribute_metadatas: List['AttributeMetadataObject'] = None): - */ - __pyx_tuple__11 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_entries, __pyx_n_s_sub_metadatas, __pyx_n_s_attribute_metadatas); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__11); - __Pyx_GIVEREF(__pyx_tuple__11); - __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_init, 25, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 25, __pyx_L1_error) - __pyx_tuple__13 = PyTuple_Pack(3, ((PyObject *)Py_None), ((PyObject *)Py_None), ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__13); - __Pyx_GIVEREF(__pyx_tuple__13); - - /* "DracoPy.pyx":33 - * - * - * def decode_metadata(binary_metadata: bytes) -> MetadataObject: # <<<<<<<<<<<<<< - * reader = new DracoPy.MetadataReader(binary_metadata) - * geometry_metadata = GeometryMetadataObject() - */ - __pyx_tuple__15 = PyTuple_Pack(15, __pyx_n_s_binary_metadata, __pyx_n_s_reader, __pyx_n_s_geometry_metadata, __pyx_n_s_to_parse_metadatas, __pyx_n_s_attribute_metadatas_len, __pyx_n_s__14, __pyx_n_s_unique_id, __pyx_n_s_attribute_metadata, __pyx_n_s_to_parse_metadata_next, __pyx_n_s_metadata, __pyx_n_s_entries_len, __pyx_n_s_name_2, __pyx_n_s_value, __pyx_n_s_sub_metadatas_len, __pyx_n_s_sub_metadata); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 33, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__15); - __Pyx_GIVEREF(__pyx_tuple__15); - __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(1, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_metadata, 33, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 33, __pyx_L1_error) - - /* "DracoPy.pyx":65 - * return geometry_metadata - * - * def encode_metadata(geometry_metadata: GeometryMetadataObject) -> bytes: # <<<<<<<<<<<<<< - * cdef DracoPy.MetadataWriter writer - * to_parse_metadata = [geometry_metadata] - */ - __pyx_tuple__17 = PyTuple_Pack(9, __pyx_n_s_geometry_metadata, __pyx_n_s_writer, __pyx_n_s_to_parse_metadata, __pyx_n_s_attribute_metadata, __pyx_n_s_to_parse_metadata_next, __pyx_n_s_draco_metadata, __pyx_n_s_name_2, __pyx_n_s_value, __pyx_n_s_draco_sub_metadata); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__17); - __Pyx_GIVEREF(__pyx_tuple__17); - __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(1, 0, 9, 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_encode_metadata, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 65, __pyx_L1_error) - /* "DracoPy.pyx":90 * * @@ -8362,9 +6710,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * def __init__(self, data_struct): * self.data_struct = data_struct */ - __pyx_tuple__19 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 90, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__19); - __Pyx_GIVEREF(__pyx_tuple__19); + __pyx_tuple__5 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__5); + __Pyx_GIVEREF(__pyx_tuple__5); /* "DracoPy.pyx":91 * @@ -8373,22 +6721,22 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * self.data_struct = data_struct * if data_struct['encoding_options_set']: */ - __pyx_tuple__20 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_data_struct); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__20); - __Pyx_GIVEREF(__pyx_tuple__20); - __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_init, 91, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 91, __pyx_L1_error) + __pyx_tuple__6 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_data_struct); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 91, __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, 91, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 91, __pyx_L1_error) /* "DracoPy.pyx":100 - * self.metadata = decode_metadata(data_struct["binary_metadata"]) + * # self.metadata = decode_metadata(data_struct["binary_metadata"]) * * 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__22 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_value, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__22); - __Pyx_GIVEREF(__pyx_tuple__22); - __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_get_encoded_coordinate, 100, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 100, __pyx_L1_error) + __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, 100, __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, 100, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 100, __pyx_L1_error) /* "DracoPy.pyx":104 * return self.encoding_options.get_encoded_coordinate(value, axis) @@ -8397,10 +6745,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * if self.encoding_options is not None: * return self.encoding_options.get_encoded_point(point) */ - __pyx_tuple__24 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_point); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 104, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__24); - __Pyx_GIVEREF(__pyx_tuple__24); - __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_get_encoded_point, 104, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 104, __pyx_L1_error) + __pyx_tuple__10 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_point); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 104, __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, 104, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 104, __pyx_L1_error) /* "DracoPy.pyx":109 * @@ -8409,10 +6757,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return 3 * */ - __pyx_tuple__26 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 109, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__26); - __Pyx_GIVEREF(__pyx_tuple__26); - __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_num_axes, 109, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 109, __pyx_L1_error) + __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 109, __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, 109, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 109, __pyx_L1_error) /* "DracoPy.pyx":113 * @@ -8421,153 +6769,177 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return self.data_struct['points'] * */ - __pyx_tuple__28 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 113, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__28); - __Pyx_GIVEREF(__pyx_tuple__28); - __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_points, 113, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 113, __pyx_L1_error) + __pyx_tuple__14 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 113, __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, 113, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 113, __pyx_L1_error) + + /* "DracoPy.pyx":117 + * + * @property + * def metadatas(self): # <<<<<<<<<<<<<< + * return self.data_struct['metadatas'] + * + */ + __pyx_tuple__16 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 117, __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_metadatas, 117, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 117, __pyx_L1_error) + + /* "DracoPy.pyx":121 + * + * @property + * def attributes(self): # <<<<<<<<<<<<<< + * return self.data_struct['attributes'] + * + */ + __pyx_tuple__18 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 121, __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_attributes, 121, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 121, __pyx_L1_error) - /* "DracoPy.pyx":119 + /* "DracoPy.pyx":127 * class DracoMesh(DracoPointCloud): * @property * def faces(self): # <<<<<<<<<<<<<< * return self.data_struct['faces'] * */ - __pyx_tuple__30 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__30); - __Pyx_GIVEREF(__pyx_tuple__30); - __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_faces, 119, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 119, __pyx_L1_error) + __pyx_tuple__20 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__20); + __Pyx_GIVEREF(__pyx_tuple__20); + __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_faces, 127, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 127, __pyx_L1_error) - /* "DracoPy.pyx":123 + /* "DracoPy.pyx":131 * * @property * def normals(self): # <<<<<<<<<<<<<< * return self.data_struct['normals'] * */ - __pyx_tuple__32 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__32); - __Pyx_GIVEREF(__pyx_tuple__32); - __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_normals, 123, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 123, __pyx_L1_error) + __pyx_tuple__22 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__22); + __Pyx_GIVEREF(__pyx_tuple__22); + __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_normals, 131, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 131, __pyx_L1_error) - /* "DracoPy.pyx":126 + /* "DracoPy.pyx":134 * return self.data_struct['normals'] * * class EncodingOptions(object): # <<<<<<<<<<<<<< * def __init__(self, quantization_bits, quantization_range, quantization_origin): * self.quantization_bits = quantization_bits */ - __pyx_tuple__34 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 126, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__34); - __Pyx_GIVEREF(__pyx_tuple__34); + __pyx_tuple__24 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 134, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__24); + __Pyx_GIVEREF(__pyx_tuple__24); - /* "DracoPy.pyx":127 + /* "DracoPy.pyx":135 * * class EncodingOptions(object): * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< * self.quantization_bits = quantization_bits * self.quantization_range = quantization_range */ - __pyx_tuple__35 = 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__35)) __PYX_ERR(0, 127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__35); - __Pyx_GIVEREF(__pyx_tuple__35); - __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 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_init, 127, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 127, __pyx_L1_error) + __pyx_tuple__25 = 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__25)) __PYX_ERR(0, 135, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__25); + __Pyx_GIVEREF(__pyx_tuple__25); + __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(4, 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_init, 135, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 135, __pyx_L1_error) - /* "DracoPy.pyx":133 + /* "DracoPy.pyx":141 * 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__37 = 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__37)) __PYX_ERR(0, 133, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__37); - __Pyx_GIVEREF(__pyx_tuple__37); - __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_get_encoded_coordinate, 133, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 133, __pyx_L1_error) + __pyx_tuple__27 = 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__27)) __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__27); + __Pyx_GIVEREF(__pyx_tuple__27); + __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_get_encoded_coordinate, 141, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 141, __pyx_L1_error) - /* "DracoPy.pyx":140 + /* "DracoPy.pyx":148 * 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__39 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_point, __pyx_n_s_encoded_point, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__39); - __Pyx_GIVEREF(__pyx_tuple__39); - __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_get_encoded_point, 140, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 140, __pyx_L1_error) + __pyx_tuple__29 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_point, __pyx_n_s_encoded_point, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__29); + __Pyx_GIVEREF(__pyx_tuple__29); + __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 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_get_encoded_point, 148, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 148, __pyx_L1_error) - /* "DracoPy.pyx":147 + /* "DracoPy.pyx":155 * * @property * def num_axes(self): # <<<<<<<<<<<<<< * return 3 * */ - __pyx_tuple__41 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 147, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__41); - __Pyx_GIVEREF(__pyx_tuple__41); - __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_num_axes, 147, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 147, __pyx_L1_error) + __pyx_tuple__31 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 155, __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_num_axes, 155, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 155, __pyx_L1_error) - /* "DracoPy.pyx":156 + /* "DracoPy.pyx":164 * pass * - * def encode_mesh_to_buffer(points, faces, metadata: GeometryMetadataObject = None, # <<<<<<<<<<<<<< + * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, */ - __pyx_tuple__43 = PyTuple_Pack(13, __pyx_n_s_points, __pyx_n_s_faces, __pyx_n_s_metadata, __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_binary_metadata, __pyx_n_s_encoded_mesh); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__43); - __Pyx_GIVEREF(__pyx_tuple__43); - __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(8, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_encode_mesh_to_buffer, 156, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 156, __pyx_L1_error) + __pyx_tuple__33 = 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__33)) __PYX_ERR(0, 164, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__33); + __Pyx_GIVEREF(__pyx_tuple__33); + __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(7, 0, 11, 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_encode_mesh_to_buffer, 164, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 164, __pyx_L1_error) - /* "DracoPy.pyx":196 + /* "DracoPy.pyx":202 * raise ValueError("Input invalid") * - * def encode_point_cloud_to_buffer(points, metadata: GeometryMetadataObject = None, # <<<<<<<<<<<<<< + * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, */ - __pyx_tuple__45 = PyTuple_Pack(12, __pyx_n_s_points, __pyx_n_s_metadata, __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_binary_metadata, __pyx_n_s_encoded_point_cloud); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__45); - __Pyx_GIVEREF(__pyx_tuple__45); - __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(7, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_encode_point_cloud_to_buffer, 196, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 196, __pyx_L1_error) + __pyx_tuple__35 = 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__35)) __PYX_ERR(0, 202, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__35); + __Pyx_GIVEREF(__pyx_tuple__35); + __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(6, 0, 10, 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_encode_point_cloud_to_buffer, 202, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 202, __pyx_L1_error) - /* "DracoPy.pyx":235 + /* "DracoPy.pyx":239 * 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__47 = PyTuple_Pack(1, __pyx_n_s_decoding_status); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__47); - __Pyx_GIVEREF(__pyx_tuple__47); - __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_raise_decoding_error, 235, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) __PYX_ERR(0, 235, __pyx_L1_error) + __pyx_tuple__37 = PyTuple_Pack(1, __pyx_n_s_decoding_status); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 239, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__37); + __Pyx_GIVEREF(__pyx_tuple__37); + __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_raise_decoding_error, 239, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 239, __pyx_L1_error) - /* "DracoPy.pyx":243 + /* "DracoPy.pyx":247 * 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: */ - __pyx_tuple__49 = PyTuple_Pack(2, __pyx_n_s_buffer, __pyx_n_s_mesh_struct); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 243, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__49); - __Pyx_GIVEREF(__pyx_tuple__49); - __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_buffer_to_mesh, 243, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(0, 243, __pyx_L1_error) + __pyx_tuple__39 = PyTuple_Pack(2, __pyx_n_s_buffer, __pyx_n_s_mesh_struct); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 247, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__39); + __Pyx_GIVEREF(__pyx_tuple__39); + __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_buffer_to_mesh, 247, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 247, __pyx_L1_error) - /* "DracoPy.pyx":250 + /* "DracoPy.pyx":254 * 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_tuple__51 = PyTuple_Pack(2, __pyx_n_s_buffer, __pyx_n_s_point_cloud_struct); if (unlikely(!__pyx_tuple__51)) __PYX_ERR(0, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__51); - __Pyx_GIVEREF(__pyx_tuple__51); - __pyx_codeobj__52 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_point_cloud_buffer, 250, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__52)) __PYX_ERR(0, 250, __pyx_L1_error) + __pyx_tuple__41 = PyTuple_Pack(2, __pyx_n_s_buffer, __pyx_n_s_point_cloud_struct); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 254, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__41); + __Pyx_GIVEREF(__pyx_tuple__41); + __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_point_cloud_buffer, 254, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 254, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -8751,9 +7123,6 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec_DracoPy(PyObject *__pyx_pyinit_mod 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; - PyObject *__pyx_t_8 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -8891,7 +7260,7 @@ if (!__Pyx_RefNanny) { * cimport DracoPy * from math import floor # <<<<<<<<<<<<<< * - * + * # */ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); @@ -8907,354 +7276,6 @@ if (!__Pyx_RefNanny) { __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":9 - * - * - * class MetadataObject: # <<<<<<<<<<<<<< - * def __init__(self, entries: Dict[str, bytes] = None, - * sub_metadatas: Dict[str, 'MetadataObject'] = None): - */ - __pyx_t_1 = __Pyx_Py3MetaclassPrepare((PyObject *) NULL, __pyx_empty_tuple, __pyx_n_s_MetadataObject, __pyx_n_s_MetadataObject, (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); - - /* "DracoPy.pyx":10 - * - * class MetadataObject: - * def __init__(self, entries: Dict[str, bytes] = None, # <<<<<<<<<<<<<< - * sub_metadatas: Dict[str, 'MetadataObject'] = None): - * self.entries = entries if entries else {} - */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Dict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 10, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 10, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)(&PyUnicode_Type))); - __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)(&PyUnicode_Type))); - __Pyx_INCREF(((PyObject *)(&PyBytes_Type))); - __Pyx_GIVEREF(((PyObject *)(&PyBytes_Type))); - PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)(&PyBytes_Type))); - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 10, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_entries, __pyx_t_5) < 0) __PYX_ERR(0, 10, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "DracoPy.pyx":11 - * class MetadataObject: - * def __init__(self, entries: Dict[str, bytes] = None, - * sub_metadatas: Dict[str, 'MetadataObject'] = None): # <<<<<<<<<<<<<< - * self.entries = entries if entries else {} - * self.sub_metadatas = sub_metadatas if sub_metadatas else {} - */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 11, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 11, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)(&PyUnicode_Type))); - __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)(&PyUnicode_Type))); - __Pyx_INCREF(__pyx_n_u_MetadataObject); - __Pyx_GIVEREF(__pyx_n_u_MetadataObject); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_n_u_MetadataObject); - __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 11, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_sub_metadatas, __pyx_t_3) < 0) __PYX_ERR(0, 10, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "DracoPy.pyx":10 - * - * class MetadataObject: - * def __init__(self, entries: Dict[str, bytes] = None, # <<<<<<<<<<<<<< - * sub_metadatas: Dict[str, 'MetadataObject'] = None): - * self.entries = entries if entries else {} - */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_14MetadataObject_1__init__, 0, __pyx_n_s_MetadataObject___init, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__6)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 10, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_3, __pyx_tuple__7); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - 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; - - /* "DracoPy.pyx":9 - * - * - * class MetadataObject: # <<<<<<<<<<<<<< - * def __init__(self, entries: Dict[str, bytes] = None, - * sub_metadatas: Dict[str, 'MetadataObject'] = None): - */ - __pyx_t_3 = __Pyx_Py3ClassCreate(((PyObject*)&__Pyx_DefaultClassType), __pyx_n_s_MetadataObject, __pyx_empty_tuple, __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_MetadataObject, __pyx_t_3) < 0) __PYX_ERR(0, 9, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "DracoPy.pyx":16 - * - * - * class AttributeMetadataObject(MetadataObject): # <<<<<<<<<<<<<< - * def __init__(self, unique_id: int, - * entries: Dict[str, bytes] = None, - */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_MetadataObject); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 16, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_AttributeMetadataObject, __pyx_n_s_AttributeMetadataObject, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 16, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - - /* "DracoPy.pyx":17 - * - * class AttributeMetadataObject(MetadataObject): - * def __init__(self, unique_id: int, # <<<<<<<<<<<<<< - * entries: Dict[str, bytes] = None, - * sub_metadatas: Dict[str, 'MetadataObject'] = None): - */ - __pyx_t_5 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_unique_id, __pyx_n_u_int) < 0) __PYX_ERR(0, 17, __pyx_L1_error) - - /* "DracoPy.pyx":18 - * class AttributeMetadataObject(MetadataObject): - * def __init__(self, unique_id: int, - * entries: Dict[str, bytes] = None, # <<<<<<<<<<<<<< - * sub_metadatas: Dict[str, 'MetadataObject'] = None): - * super().__init__(entries, sub_metadatas) - */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 18, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 18, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_INCREF(((PyObject *)(&PyUnicode_Type))); - __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); - PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)(&PyUnicode_Type))); - __Pyx_INCREF(((PyObject *)(&PyBytes_Type))); - __Pyx_GIVEREF(((PyObject *)(&PyBytes_Type))); - PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)(&PyBytes_Type))); - __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_6, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 18, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_entries, __pyx_t_8) < 0) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "DracoPy.pyx":19 - * def __init__(self, unique_id: int, - * entries: Dict[str, bytes] = None, - * sub_metadatas: Dict[str, 'MetadataObject'] = None): # <<<<<<<<<<<<<< - * super().__init__(entries, sub_metadatas) - * self.unique_id = unique_id - */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_Dict); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_INCREF(((PyObject *)(&PyUnicode_Type))); - __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); - PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)(&PyUnicode_Type))); - __Pyx_INCREF(__pyx_n_u_MetadataObject); - __Pyx_GIVEREF(__pyx_n_u_MetadataObject); - PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_n_u_MetadataObject); - __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_sub_metadatas, __pyx_t_6) < 0) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "DracoPy.pyx":17 - * - * class AttributeMetadataObject(MetadataObject): - * def __init__(self, unique_id: int, # <<<<<<<<<<<<<< - * entries: Dict[str, bytes] = None, - * sub_metadatas: Dict[str, 'MetadataObject'] = None): - */ - __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_23AttributeMetadataObject_1__init__, 0, __pyx_n_s_AttributeMetadataObject___init, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(__pyx_t_6); - PyList_Append(__pyx_t_4, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_6, __pyx_tuple__10); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_5); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_6) < 0) __PYX_ERR(0, 17, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "DracoPy.pyx":16 - * - * - * class AttributeMetadataObject(MetadataObject): # <<<<<<<<<<<<<< - * def __init__(self, unique_id: int, - * entries: Dict[str, bytes] = None, - */ - __pyx_t_6 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_AttributeMetadataObject, __pyx_t_3, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 16, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (__Pyx_CyFunction_InitClassCell(__pyx_t_4, __pyx_t_6) < 0) __PYX_ERR(0, 16, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_AttributeMetadataObject, __pyx_t_6) < 0) __PYX_ERR(0, 16, __pyx_L1_error) - __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; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "DracoPy.pyx":24 - * - * - * class GeometryMetadataObject(MetadataObject): # <<<<<<<<<<<<<< - * def __init__(self, entries: Dict[str, bytes] = None, - * sub_metadatas: Dict[str, 'MetadataObject'] = None, - */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_MetadataObject); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_3, __pyx_t_1, __pyx_n_s_GeometryMetadataObject, __pyx_n_s_GeometryMetadataObject, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - - /* "DracoPy.pyx":25 - * - * class GeometryMetadataObject(MetadataObject): - * def __init__(self, entries: Dict[str, bytes] = None, # <<<<<<<<<<<<<< - * sub_metadatas: Dict[str, 'MetadataObject'] = None, - * attribute_metadatas: List['AttributeMetadataObject'] = None): - */ - __pyx_t_4 = __Pyx_PyDict_NewPresized(3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_INCREF(((PyObject *)(&PyUnicode_Type))); - __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); - PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)(&PyUnicode_Type))); - __Pyx_INCREF(((PyObject *)(&PyBytes_Type))); - __Pyx_GIVEREF(((PyObject *)(&PyBytes_Type))); - PyTuple_SET_ITEM(__pyx_t_7, 1, ((PyObject *)(&PyBytes_Type))); - __pyx_t_8 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_entries, __pyx_t_8) < 0) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - - /* "DracoPy.pyx":26 - * class GeometryMetadataObject(MetadataObject): - * def __init__(self, entries: Dict[str, bytes] = None, - * sub_metadatas: Dict[str, 'MetadataObject'] = None, # <<<<<<<<<<<<<< - * attribute_metadatas: List['AttributeMetadataObject'] = None): - * super().__init__(entries, sub_metadatas) - */ - __Pyx_GetModuleGlobalName(__pyx_t_8, __pyx_n_s_Dict); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 26, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 26, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_INCREF(((PyObject *)(&PyUnicode_Type))); - __Pyx_GIVEREF(((PyObject *)(&PyUnicode_Type))); - PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)(&PyUnicode_Type))); - __Pyx_INCREF(__pyx_n_u_MetadataObject); - __Pyx_GIVEREF(__pyx_n_u_MetadataObject); - PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_n_u_MetadataObject); - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_8, __pyx_t_7); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 26, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_sub_metadatas, __pyx_t_5) < 0) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "DracoPy.pyx":27 - * def __init__(self, entries: Dict[str, bytes] = None, - * sub_metadatas: Dict[str, 'MetadataObject'] = None, - * attribute_metadatas: List['AttributeMetadataObject'] = None): # <<<<<<<<<<<<<< - * super().__init__(entries, sub_metadatas) - * self.attribute_metadatas = attribute_metadatas if attribute_metadatas \ - */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_List); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 27, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyObject_Dict_GetItem(__pyx_t_5, __pyx_n_u_AttributeMetadataObject); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 27, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_attribute_metadatas, __pyx_t_7) < 0) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "DracoPy.pyx":25 - * - * class GeometryMetadataObject(MetadataObject): - * def __init__(self, entries: Dict[str, bytes] = None, # <<<<<<<<<<<<<< - * sub_metadatas: Dict[str, 'MetadataObject'] = None, - * attribute_metadatas: List['AttributeMetadataObject'] = None): - */ - __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_22GeometryMetadataObject_1__init__, 0, __pyx_n_s_GeometryMetadataObject___init, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__12)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_INCREF(__pyx_t_7); - PyList_Append(__pyx_t_6, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_7, __pyx_tuple__13); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_7, __pyx_t_4); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_7) < 0) __PYX_ERR(0, 25, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "DracoPy.pyx":24 - * - * - * class GeometryMetadataObject(MetadataObject): # <<<<<<<<<<<<<< - * def __init__(self, entries: Dict[str, bytes] = None, - * sub_metadatas: Dict[str, 'MetadataObject'] = None, - */ - __pyx_t_7 = __Pyx_Py3ClassCreate(__pyx_t_3, __pyx_n_s_GeometryMetadataObject, __pyx_t_1, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (__Pyx_CyFunction_InitClassCell(__pyx_t_6, __pyx_t_7) < 0) __PYX_ERR(0, 24, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s_GeometryMetadataObject, __pyx_t_7) < 0) __PYX_ERR(0, 24, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "DracoPy.pyx":33 - * - * - * def decode_metadata(binary_metadata: bytes) -> MetadataObject: # <<<<<<<<<<<<<< - * reader = new DracoPy.MetadataReader(binary_metadata) - * geometry_metadata = GeometryMetadataObject() - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_1decode_metadata, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 33, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode_metadata, __pyx_t_1) < 0) __PYX_ERR(0, 33, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "DracoPy.pyx":65 - * return geometry_metadata - * - * def encode_metadata(geometry_metadata: GeometryMetadataObject) -> bytes: # <<<<<<<<<<<<<< - * cdef DracoPy.MetadataWriter writer - * to_parse_metadata = [geometry_metadata] - */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_3encode_metadata, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_metadata, __pyx_t_1) < 0) __PYX_ERR(0, 65, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":90 * * @@ -9262,10 +7283,10 @@ if (!__Pyx_RefNanny) { * def __init__(self, data_struct): * self.data_struct = data_struct */ - __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__19); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error) + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__19, __pyx_n_s_DracoPointCloud, __pyx_n_s_DracoPointCloud, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__5, __pyx_n_s_DracoPointCloud, __pyx_n_s_DracoPointCloud, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); /* "DracoPy.pyx":91 * @@ -9274,22 +7295,22 @@ if (!__Pyx_RefNanny) { * self.data_struct = data_struct * if data_struct['encoding_options_set']: */ - __pyx_t_2 = __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__21)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 91, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __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, 91, __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, 91, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "DracoPy.pyx":100 - * self.metadata = decode_metadata(data_struct["binary_metadata"]) + * # self.metadata = decode_metadata(data_struct["binary_metadata"]) * * 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_2 = __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__23)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_get_encoded_coordinate, __pyx_t_2) < 0) __PYX_ERR(0, 100, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __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, 100, __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, 100, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "DracoPy.pyx":104 * return self.encoding_options.get_encoded_coordinate(value, axis) @@ -9298,10 +7319,10 @@ if (!__Pyx_RefNanny) { * if self.encoding_options is not None: * return self.encoding_options.get_encoded_point(point) */ - __pyx_t_2 = __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__25)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 104, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_get_encoded_point, __pyx_t_2) < 0) __PYX_ERR(0, 104, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __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, 104, __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, 104, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "DracoPy.pyx":109 * @@ -9310,8 +7331,8 @@ if (!__Pyx_RefNanny) { * return 3 * */ - __pyx_t_2 = __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__27)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 109, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __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, 109, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); /* "DracoPy.pyx":108 * return self.encoding_options.get_encoded_point(point) @@ -9320,11 +7341,11 @@ if (!__Pyx_RefNanny) { * def num_axes(self): * return 3 */ - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 108, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_num_axes, __pyx_t_7) < 0) __PYX_ERR(0, 109, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 108, __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, 109, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "DracoPy.pyx":113 * @@ -9333,21 +7354,67 @@ if (!__Pyx_RefNanny) { * return self.data_struct['points'] * */ - __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_9points, 0, __pyx_n_s_DracoPointCloud_points, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__29)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 113, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); + __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, 113, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); /* "DracoPy.pyx":112 * return 3 * * @property # <<<<<<<<<<<<<< - * def points(self): - * return self.data_struct['points'] + * 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, 112, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_points, __pyx_t_3) < 0) __PYX_ERR(0, 113, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "DracoPy.pyx":117 + * + * @property + * def metadatas(self): # <<<<<<<<<<<<<< + * return self.data_struct['metadatas'] + * + */ + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_11metadatas, 0, __pyx_n_s_DracoPointCloud_metadatas, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__17)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + + /* "DracoPy.pyx":116 + * return self.data_struct['points'] + * + * @property # <<<<<<<<<<<<<< + * def metadatas(self): + * return self.data_struct['metadatas'] + */ + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 116, __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_metadatas, __pyx_t_4) < 0) __PYX_ERR(0, 117, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "DracoPy.pyx":121 + * + * @property + * def attributes(self): # <<<<<<<<<<<<<< + * return self.data_struct['attributes'] + * + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_13attributes, 0, __pyx_n_s_DracoPointCloud_attributes, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__19)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + + /* "DracoPy.pyx":120 + * return self.data_struct['metadatas'] + * + * @property # <<<<<<<<<<<<<< + * def attributes(self): + * return self.data_struct['attributes'] */ - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_points, __pyx_t_2) < 0) __PYX_ERR(0, 113, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 120, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_attributes, __pyx_t_3) < 0) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "DracoPy.pyx":90 * @@ -9356,300 +7423,300 @@ if (!__Pyx_RefNanny) { * def __init__(self, data_struct): * self.data_struct = data_struct */ - __pyx_t_2 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoPointCloud, __pyx_tuple__19, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoPointCloud, __pyx_t_2) < 0) __PYX_ERR(0, 90, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoPointCloud, __pyx_tuple__5, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoPointCloud, __pyx_t_3) < 0) __PYX_ERR(0, 90, __pyx_L1_error) __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":117 + /* "DracoPy.pyx":125 * * * class DracoMesh(DracoPointCloud): # <<<<<<<<<<<<<< * @property * def faces(self): */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __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_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 117, __pyx_L1_error) + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_DracoMesh, __pyx_n_s_DracoMesh, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __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_3)) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); - /* "DracoPy.pyx":119 + /* "DracoPy.pyx":127 * class DracoMesh(DracoPointCloud): * @property * def faces(self): # <<<<<<<<<<<<<< * return self.data_struct['faces'] * */ - __pyx_t_7 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_9DracoMesh_1faces, 0, __pyx_n_s_DracoMesh_faces, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__31)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); + __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__21)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); - /* "DracoPy.pyx":118 + /* "DracoPy.pyx":126 * * class DracoMesh(DracoPointCloud): * @property # <<<<<<<<<<<<<< * def faces(self): * return self.data_struct['faces'] */ - __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 118, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_faces, __pyx_t_6) < 0) __PYX_ERR(0, 119, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 126, __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, 127, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "DracoPy.pyx":123 + /* "DracoPy.pyx":131 * * @property * def normals(self): # <<<<<<<<<<<<<< * return self.data_struct['normals'] * */ - __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_9DracoMesh_3normals, 0, __pyx_n_s_DracoMesh_normals, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); + __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__23)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); - /* "DracoPy.pyx":122 + /* "DracoPy.pyx":130 * return self.data_struct['faces'] * * @property # <<<<<<<<<<<<<< * def normals(self): * return self.data_struct['normals'] */ - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 122, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_normals, __pyx_t_7) < 0) __PYX_ERR(0, 123, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 130, __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, 131, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "DracoPy.pyx":117 + /* "DracoPy.pyx":125 * * * class DracoMesh(DracoPointCloud): # <<<<<<<<<<<<<< * @property * def faces(self): */ - __pyx_t_7 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoMesh, __pyx_t_3, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoMesh, __pyx_t_7) < 0) __PYX_ERR(0, 117, __pyx_L1_error) - __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; + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoMesh, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoMesh, __pyx_t_4) < 0) __PYX_ERR(0, 125, __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_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":126 + /* "DracoPy.pyx":134 * return self.data_struct['normals'] * * class EncodingOptions(object): # <<<<<<<<<<<<<< * def __init__(self, quantization_bits, quantization_range, quantization_origin): * self.quantization_bits = quantization_bits */ - __pyx_t_3 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__34); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 126, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_3, __pyx_tuple__34, __pyx_n_s_EncodingOptions, __pyx_n_s_EncodingOptions, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 126, __pyx_L1_error) + __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__24); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_tuple__24, __pyx_n_s_EncodingOptions, __pyx_n_s_EncodingOptions, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - /* "DracoPy.pyx":127 + /* "DracoPy.pyx":135 * * class EncodingOptions(object): * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< * self.quantization_bits = quantization_bits * self.quantization_range = quantization_range */ - __pyx_t_2 = __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__36)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_2) < 0) __PYX_ERR(0, 127, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __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__26)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 135, __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, 135, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":133 + /* "DracoPy.pyx":141 * 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_2 = __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__38)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 133, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_encoded_coordinate, __pyx_t_2) < 0) __PYX_ERR(0, 133, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __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__28)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 141, __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, 141, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":140 + /* "DracoPy.pyx":148 * 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_2 = __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__40)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_encoded_point, __pyx_t_2) < 0) __PYX_ERR(0, 140, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __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__30)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __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, 148, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":147 + /* "DracoPy.pyx":155 * * @property * def num_axes(self): # <<<<<<<<<<<<<< * return 3 * */ - __pyx_t_2 = __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__42)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 147, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __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__32)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 155, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); - /* "DracoPy.pyx":146 + /* "DracoPy.pyx":154 * return encoded_point * * @property # <<<<<<<<<<<<<< * def num_axes(self): * return 3 */ - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 146, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_num_axes, __pyx_t_7) < 0) __PYX_ERR(0, 147, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 154, __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, 155, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "DracoPy.pyx":126 + /* "DracoPy.pyx":134 * return self.data_struct['normals'] * * class EncodingOptions(object): # <<<<<<<<<<<<<< * def __init__(self, quantization_bits, quantization_range, quantization_origin): * self.quantization_bits = quantization_bits */ - __pyx_t_7 = __Pyx_Py3ClassCreate(__pyx_t_3, __pyx_n_s_EncodingOptions, __pyx_tuple__34, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 126, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingOptions, __pyx_t_7) < 0) __PYX_ERR(0, 126, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_EncodingOptions, __pyx_tuple__24, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 134, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingOptions, __pyx_t_4) < 0) __PYX_ERR(0, 134, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":150 + /* "DracoPy.pyx":158 * return 3 * * class FileTypeException(Exception): # <<<<<<<<<<<<<< * pass * */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 158, __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_3, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L1_error) + 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, 158, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_FileTypeException, __pyx_n_s_FileTypeException, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_FileTypeException, __pyx_t_3, __pyx_t_7, NULL, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_FileTypeException, __pyx_t_2) < 0) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __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_4)) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_FileTypeException, __pyx_t_2, __pyx_t_4, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_FileTypeException, __pyx_t_3) < 0) __PYX_ERR(0, 158, __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_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":153 + /* "DracoPy.pyx":161 * pass * * class EncodingFailedException(Exception): # <<<<<<<<<<<<<< * pass * */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 153, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 161, __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_3, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error) + 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, 161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_3, __pyx_n_s_EncodingFailedException, __pyx_n_s_EncodingFailedException, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 153, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_EncodingFailedException, __pyx_t_3, __pyx_t_7, NULL, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingFailedException, __pyx_t_2) < 0) __PYX_ERR(0, 153, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __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_4)) __PYX_ERR(0, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_EncodingFailedException, __pyx_t_2, __pyx_t_4, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingFailedException, __pyx_t_3) < 0) __PYX_ERR(0, 161, __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_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":156 + /* "DracoPy.pyx":164 * pass * - * def encode_mesh_to_buffer(points, faces, metadata: GeometryMetadataObject = None, # <<<<<<<<<<<<<< + * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, */ - __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_5encode_mesh_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_mesh_to_buffer, __pyx_t_3) < 0) __PYX_ERR(0, 156, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_1encode_mesh_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 164, __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, 164, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":196 + /* "DracoPy.pyx":202 * raise ValueError("Input invalid") * - * def encode_point_cloud_to_buffer(points, metadata: GeometryMetadataObject = None, # <<<<<<<<<<<<<< + * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, */ - __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_7encode_point_cloud_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_point_cloud_to_buffer, __pyx_t_3) < 0) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_3encode_point_cloud_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 202, __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, 202, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":235 + /* "DracoPy.pyx":239 * 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_t_3 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_9raise_decoding_error, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 235, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_raise_decoding_error, __pyx_t_3) < 0) __PYX_ERR(0, 235, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_5raise_decoding_error, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 239, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_raise_decoding_error, __pyx_t_2) < 0) __PYX_ERR(0, 239, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":243 + /* "DracoPy.pyx":247 * 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: */ - __pyx_t_3 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_11decode_buffer_to_mesh, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 243, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode_buffer_to_mesh, __pyx_t_3) < 0) __PYX_ERR(0, 243, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_7decode_buffer_to_mesh, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 247, __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, 247, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":250 + /* "DracoPy.pyx":254 * 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_t_3 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_13decode_point_cloud_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 250, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode_point_cloud_buffer, __pyx_t_3) < 0) __PYX_ERR(0, 250, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_9decode_point_cloud_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 254, __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, 254, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "DracoPy.pyx":1 * # distutils: language = c++ # <<<<<<<<<<<<<< * from typing import Dict, List * */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_3) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __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; /* "vector.to_py":60 * - * @cname("__pyx_convert_vector_to_py_double") - * cdef object __pyx_convert_vector_to_py_double(vector[X]& v): # <<<<<<<<<<<<<< + * @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())] * */ @@ -9663,9 +7730,6 @@ 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_7); - __Pyx_XDECREF(__pyx_t_8); if (__pyx_m) { if (__pyx_d) { __Pyx_AddTraceback("init DracoPy", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -9731,6 +7795,32 @@ static PyObject *__Pyx_GetBuiltinName(PyObject *name) { return result; } +/* RaiseArgTupleInvalid */ +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) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + /* RaiseDoubleKeywords */ static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, @@ -9847,32 +7937,6 @@ static int __Pyx_ParseOptionalKeywords( return -1; } -/* RaiseArgTupleInvalid */ -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) -{ - Py_ssize_t num_expected; - const char *more_or_less; - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; - } else { - num_expected = num_max; - more_or_less = "at most"; - } - if (exact) { - more_or_less = "exactly"; - } - PyErr_Format(PyExc_TypeError, - "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); -} - /* PyObjectSetAttrStr */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { @@ -9887,25 +7951,90 @@ static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr } #endif -/* PyObjectCall */ +/* DictGetItem */ +#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { + PyObject *value; + value = PyDict_GetItemWithError(d, key); + if (unlikely(!value)) { + if (!PyErr_Occurred()) { + if (unlikely(PyTuple_Check(key))) { + PyObject* args = PyTuple_Pack(1, key); + if (likely(args)) { + PyErr_SetObject(PyExc_KeyError, args); + Py_DECREF(args); + } + } else { + PyErr_SetObject(PyExc_KeyError, key); + } + } + return NULL; + } + Py_INCREF(value); + return value; +} +#endif + +/* PyDictVersioning */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); +#endif + } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +} +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); +} +#endif + +/* GetModuleGlobalName */ +#if CYTHON_USE_DICT_VERSIONS +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) +#else +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) +#endif +{ PyObject *result; - 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"); +#if !CYTHON_AVOID_BORROWED_REFS +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 + result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } else if (unlikely(PyErr_Occurred())) { + return NULL; } - return result; -} +#else + result = PyDict_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } +#endif +#else + result = PyObject_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } + PyErr_Clear(); #endif + return __Pyx_GetBuiltinName(name); +} /* PyFunctionFastCall */ #if CYTHON_FAST_PYCALL @@ -10049,604 +8178,112 @@ static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, P } #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; -} - -/* PyDictVersioning */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { - PyObject **dictptr = NULL; - Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; - if (offset) { +/* PyObjectCall */ #if CYTHON_COMPILING_IN_CPYTHON - dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); -#else - dictptr = _PyObject_GetDictPtr(obj); -#endif - } - return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; -} -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) - return 0; - return obj_dict_version == __Pyx_get_object_dict_version(obj); -} -#endif - -/* GetModuleGlobalName */ -#if CYTHON_USE_DICT_VERSIONS -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) -#else -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) -#endif -{ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { PyObject *result; -#if !CYTHON_AVOID_BORROWED_REFS -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 - result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } else if (unlikely(PyErr_Occurred())) { - return NULL; - } -#else - result = PyDict_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } -#endif -#else - result = PyObject_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } - PyErr_Clear(); -#endif - return __Pyx_GetBuiltinName(name); -} - -/* PyObjectCallMethO */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); + 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 = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#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 - -/* PyObjectCallOneArg */ -#if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); - } -#endif - if (likely(PyCFunction_Check(func))) { - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (__Pyx_PyFastCFunction_Check(func)) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); -#endif - } - } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -#endif - -/* PyObjectCall2Args */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { - PyObject *args, *result = NULL; - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyFunction_FastCall(function, args, 2); - } - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyCFunction_FastCall(function, args, 2); - } - #endif - args = PyTuple_New(2); - if (unlikely(!args)) goto done; - Py_INCREF(arg1); - PyTuple_SET_ITEM(args, 0, arg1); - Py_INCREF(arg2); - PyTuple_SET_ITEM(args, 1, arg2); - Py_INCREF(function); - result = __Pyx_PyObject_Call(function, args, NULL); - Py_DECREF(args); - Py_DECREF(function); -done: - return result; -} - -/* 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; -} - -/* PyObjectCallMethod1 */ -static PyObject* __Pyx__PyObject_CallMethod1(PyObject* method, PyObject* arg) { - PyObject *result = __Pyx_PyObject_CallOneArg(method, arg); - Py_DECREF(method); - return result; -} -static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { - PyObject *method = NULL, *result; - int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); - if (likely(is_method)) { - result = __Pyx_PyObject_Call2Args(method, obj, arg); - Py_DECREF(method); - return result; - } - if (unlikely(!method)) return NULL; - return __Pyx__PyObject_CallMethod1(method, arg); -} - -/* append */ -static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x) { - if (likely(PyList_CheckExact(L))) { - if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return -1; - } else { - PyObject* retval = __Pyx_PyObject_CallMethod1(L, __pyx_n_s_append, x); - if (unlikely(!retval)) - return -1; - Py_DECREF(retval); - } - return 0; -} - -/* 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 -} - -/* 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; + result = (*call)(func, arg, kw); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); } - if (unlikely(!method)) goto bad; - result = __Pyx_PyObject_CallNoArg(method); - Py_DECREF(method); -bad: return result; } +#endif -/* 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(); +/* PyObjectCall2Args */ +static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { + PyObject *args, *result = NULL; + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(function)) { + PyObject *args[2] = {arg1, arg2}; + return __Pyx_PyFunction_FastCall(function, args, 2); } - 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); + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(function)) { + PyObject *args[2] = {arg1, arg2}; + return __Pyx_PyCFunction_FastCall(function, args, 2); } + #endif + args = PyTuple_New(2); + if (unlikely(!args)) goto done; + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 0, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 1, arg2); + Py_INCREF(function); + result = __Pyx_PyObject_Call(function, args, NULL); + Py_DECREF(args); + Py_DECREF(function); +done: + return result; } -/* 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); +/* PyObjectCallMethO */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = PyCFunction_GET_FUNCTION(func); + self = PyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); } - *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; + return result; } - -/* 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 + +/* PyObjectCallOneArg */ +#if CYTHON_COMPILING_IN_CPYTHON +static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_New(1); + if (unlikely(!args)) return NULL; + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 0, arg); + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { +#if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCall(func, &arg, 1); } - *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 + if (likely(PyCFunction_Check(func))) { + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, arg); +#if CYTHON_FAST_PYCCALL + } else if (__Pyx_PyFastCFunction_Check(func)) { + return __Pyx_PyCFunction_FastCall(func, &arg, 1); #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; + return __Pyx__PyObject_CallOneArg(func, arg); } - -/* DictGetItem */ -#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY -static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { - PyObject *value; - value = PyDict_GetItemWithError(d, key); - if (unlikely(!value)) { - if (!PyErr_Occurred()) { - if (unlikely(PyTuple_Check(key))) { - PyObject* args = PyTuple_Pack(1, key); - if (likely(args)) { - PyErr_SetObject(PyExc_KeyError, args); - Py_DECREF(args); - } - } else { - PyErr_SetObject(PyExc_KeyError, key); - } - } - return NULL; - } - Py_INCREF(value); - return value; +#else +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_Pack(1, arg); + if (unlikely(!args)) return NULL; + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; } #endif @@ -11510,6 +9147,45 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) return value; } +/* CalculateMetaclass */ + static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { + Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases); + for (i=0; i < nbases; i++) { + PyTypeObject *tmptype; + PyObject *tmp = PyTuple_GET_ITEM(bases, i); + tmptype = Py_TYPE(tmp); +#if PY_MAJOR_VERSION < 3 + if (tmptype == &PyClass_Type) + continue; +#endif + if (!metaclass) { + metaclass = tmptype; + continue; + } + if (PyType_IsSubtype(metaclass, tmptype)) + continue; + if (PyType_IsSubtype(tmptype, metaclass)) { + metaclass = tmptype; + continue; + } + PyErr_SetString(PyExc_TypeError, + "metaclass conflict: " + "the metaclass of a derived class " + "must be a (non-strict) subclass " + "of the metaclasses of all its bases"); + return NULL; + } + if (!metaclass) { +#if PY_MAJOR_VERSION < 3 + metaclass = &PyClass_Type; +#else + metaclass = &PyType_Type; +#endif + } + Py_INCREF((PyObject*) metaclass); + return (PyObject*) metaclass; +} + /* FetchCommonType */ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) { PyObject* fake_module; @@ -12167,45 +9843,6 @@ static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, Py return op; } -/* CalculateMetaclass */ - static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { - Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases); - for (i=0; i < nbases; i++) { - PyTypeObject *tmptype; - PyObject *tmp = PyTuple_GET_ITEM(bases, i); - tmptype = Py_TYPE(tmp); -#if PY_MAJOR_VERSION < 3 - if (tmptype == &PyClass_Type) - continue; -#endif - if (!metaclass) { - metaclass = tmptype; - continue; - } - if (PyType_IsSubtype(metaclass, tmptype)) - continue; - if (PyType_IsSubtype(tmptype, metaclass)) { - metaclass = tmptype; - continue; - } - PyErr_SetString(PyExc_TypeError, - "metaclass conflict: " - "the metaclass of a derived class " - "must be a (non-strict) subclass " - "of the metaclasses of all its bases"); - return NULL; - } - if (!metaclass) { -#if PY_MAJOR_VERSION < 3 - metaclass = &PyClass_Type; -#else - metaclass = &PyType_Type; -#endif - } - Py_INCREF((PyObject*) metaclass); - return (PyObject*) metaclass; -} - /* Py3ClassCreate */ static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) { @@ -12273,27 +9910,6 @@ static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObj return result; } -/* CyFunctionClassCell */ - static int __Pyx_CyFunction_InitClassCell(PyObject *cyfunctions, PyObject *classobj) { - Py_ssize_t i, count = PyList_GET_SIZE(cyfunctions); - for (i = 0; i < count; i++) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) -#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - PyList_GET_ITEM(cyfunctions, i); -#else - PySequence_ITEM(cyfunctions, i); - if (unlikely(!m)) - return -1; -#endif - Py_INCREF(classobj); - m->func_classobj = classobj; -#if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) - Py_DECREF((PyObject*)m); -#endif - } - return 0; -} - /* CLineInTraceback */ #ifndef CYTHON_CLINE_IN_TRACEBACK static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) { @@ -12523,36 +10139,40 @@ 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_PointAttributeObject(struct DracoFunctions::PointAttributeObject s) { PyObject* res; PyObject* member; - res = __Pyx_PyDict_NewPresized(9); 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); - member = __pyx_convert_vector_to_py_unsigned_int(s.faces); if (unlikely(!member)) goto bad; - if (unlikely(PyDict_SetItem(res, __pyx_n_s_faces, member) < 0)) goto bad; - Py_DECREF(member); - member = __pyx_convert_vector_to_py_float(s.normals); if (unlikely(!member)) goto bad; - if (unlikely(PyDict_SetItem(res, __pyx_n_s_normals, member) < 0)) goto bad; - Py_DECREF(member); - member = __Pyx_PyBool_FromLong(s.encoding_options_set); if (unlikely(!member)) goto bad; - if (unlikely(PyDict_SetItem(res, __pyx_n_s_encoding_options_set, member) < 0)) goto bad; + 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_int(s.quantization_bits); if (unlikely(!member)) goto bad; - if (unlikely(PyDict_SetItem(res, __pyx_n_s_quantization_bits, member) < 0)) goto bad; + member = __Pyx_PyInt_From_uint32_t(s.element_size); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_element_size, member) < 0)) goto bad; Py_DECREF(member); - member = PyFloat_FromDouble(s.quantization_range); if (unlikely(!member)) goto bad; - if (unlikely(PyDict_SetItem(res, __pyx_n_s_quantization_range, member) < 0)) goto bad; + 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_convert_vector_to_py_double(s.quantization_origin); if (unlikely(!member)) goto bad; - if (unlikely(PyDict_SetItem(res, __pyx_n_s_quantization_origin, member) < 0)) goto bad; + member = __Pyx_PyInt_From_uint32_t(s.unique_id); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_unique_id, member) < 0)) goto bad; Py_DECREF(member); - 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; + return res; + bad: + Py_XDECREF(member); + Py_DECREF(res); + return NULL; + } + static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MetadataObject(struct DracoFunctions::MetadataObject s) { + PyObject* res; + PyObject* member; + res = __Pyx_PyDict_NewPresized(3); if (unlikely(!res)) return NULL; + member = __Pyx_PyInt_From_uint32_t(s.unique_id); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_unique_id, member) < 0)) goto bad; Py_DECREF(member); - member = __pyx_convert_PyObject_string_to_py_std__in_string(s.binary_metadata); if (unlikely(!member)) goto bad; - if (unlikely(PyDict_SetItem(res, __pyx_n_s_binary_metadata, member) < 0)) goto bad; + 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_vector_to_py_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: @@ -12560,13 +10180,19 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(s Py_DECREF(res); return NULL; } - static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointCloudObject(struct DracoFunctions::PointCloudObject s) { + static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(struct DracoFunctions::MeshObject s) { PyObject* res; PyObject* member; - res = __Pyx_PyDict_NewPresized(7); if (unlikely(!res)) return NULL; + 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); + member = __pyx_convert_vector_to_py_unsigned_int(s.faces); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_faces, member) < 0)) goto bad; + Py_DECREF(member); + member = __pyx_convert_vector_to_py_float(s.normals); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_normals, member) < 0)) goto bad; + Py_DECREF(member); member = __Pyx_PyBool_FromLong(s.encoding_options_set); if (unlikely(!member)) goto bad; if (unlikely(PyDict_SetItem(res, __pyx_n_s_encoding_options_set, member) < 0)) goto bad; Py_DECREF(member); @@ -12582,8 +10208,11 @@ 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_PyObject_string_to_py_std__in_string(s.binary_metadata); if (unlikely(!member)) goto bad; - if (unlikely(PyDict_SetItem(res, __pyx_n_s_binary_metadata, member) < 0)) goto bad; + member = __pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_PointAttributeObject(s.attributes); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_attributes, 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: @@ -12591,261 +10220,61 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(s Py_DECREF(res); return NULL; } - /* 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); - } -} - -/* CIntFromPy */ - static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) { -#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 PY_MAJOR_VERSION < 3 - if (likely(PyInt_Check(x))) { - if (sizeof(uint32_t) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(uint32_t, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (uint32_t) 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 (uint32_t) 0; - case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, digits[0]) - case 2: - if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) >= 2 * PyLong_SHIFT) { - return (uint32_t) (((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(uint32_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) >= 3 * PyLong_SHIFT) { - return (uint32_t) (((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(uint32_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_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(uint32_t) >= 4 * PyLong_SHIFT) { - return (uint32_t) (((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)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 (uint32_t) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(uint32_t) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(uint32_t, 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 (uint32_t) 0; - case -1: __PYX_VERIFY_RETURN_INT(uint32_t, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, +digits[0]) - case -2: - if (8 * sizeof(uint32_t) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { - return (uint32_t) (((uint32_t)-1)*(((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { - return (uint32_t) ((((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { - return (uint32_t) (((uint32_t)-1)*(((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(uint32_t) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { - return (uint32_t) ((((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_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(uint32_t) - 1 > 4 * PyLong_SHIFT) { - return (uint32_t) (((uint32_t)-1)*(((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(uint32_t) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_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(uint32_t) - 1 > 4 * PyLong_SHIFT) { - return (uint32_t) ((((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); - } - } - break; - } -#endif - if (sizeof(uint32_t) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(uint32_t, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(uint32_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 - uint32_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 (uint32_t) -1; - } - } else { - uint32_t val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (uint32_t) -1; - val = __Pyx_PyInt_As_uint32_t(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to uint32_t"); - return (uint32_t) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to uint32_t"); - return (uint32_t) -1; -} - -/* CIntFromPy */ - static CYTHON_INLINE uint8_t __Pyx_PyInt_As_uint8_t(PyObject *x) { + static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointCloudObject(struct DracoFunctions::PointCloudObject s) { + PyObject* res; + PyObject* member; + 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); + member = __Pyx_PyBool_FromLong(s.encoding_options_set); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_encoding_options_set, member) < 0)) goto bad; + Py_DECREF(member); + member = __Pyx_PyInt_From_int(s.quantization_bits); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_quantization_bits, member) < 0)) goto bad; + Py_DECREF(member); + member = PyFloat_FromDouble(s.quantization_range); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_quantization_range, member) < 0)) goto bad; + Py_DECREF(member); + member = __pyx_convert_vector_to_py_double(s.quantization_origin); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_quantization_origin, member) < 0)) goto bad; + Py_DECREF(member); + 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_vector_to_py_struct__DracoFunctions_3a__3a_PointAttributeObject(s.attributes); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_attributes, 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); + Py_DECREF(res); + return NULL; + } + /* 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 uint8_t neg_one = (uint8_t) -1, const_zero = (uint8_t) 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 PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(uint8_t) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(uint8_t, long, PyInt_AS_LONG(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 (uint8_t) val; + return (size_t) val; } } else #endif @@ -12854,32 +10283,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 (uint8_t) 0; - case 1: __PYX_VERIFY_RETURN_INT(uint8_t, digit, digits[0]) + case 0: return (size_t) 0; + case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0]) case 2: - if (8 * sizeof(uint8_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint8_t) >= 2 * PyLong_SHIFT) { - return (uint8_t) (((((uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])); + __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(uint8_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint8_t) >= 3 * PyLong_SHIFT) { - return (uint8_t) (((((((uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])); + __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(uint8_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_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(uint8_t) >= 4 * PyLong_SHIFT) { - return (uint8_t) (((((((((uint8_t)digits[3]) << PyLong_SHIFT) | (uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0])); + __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; @@ -12893,86 +10322,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 (uint8_t) -1; + return (size_t) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif - if (sizeof(uint8_t) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(uint8_t, unsigned long, PyLong_AsUnsignedLong(x)) + 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(uint8_t) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(uint8_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } 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 CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return (uint8_t) 0; - case -1: __PYX_VERIFY_RETURN_INT(uint8_t, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(uint8_t, digit, +digits[0]) + 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(uint8_t) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint8_t) - 1 > 2 * PyLong_SHIFT) { - return (uint8_t) (((uint8_t)-1)*(((((uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); + __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(uint8_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint8_t) - 1 > 2 * PyLong_SHIFT) { - return (uint8_t) ((((((uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); + __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(uint8_t) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint8_t) - 1 > 3 * PyLong_SHIFT) { - return (uint8_t) (((uint8_t)-1)*(((((((uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); + __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(uint8_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint8_t) - 1 > 3 * PyLong_SHIFT) { - return (uint8_t) ((((((((uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); + __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(uint8_t) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_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(uint8_t) - 1 > 4 * PyLong_SHIFT) { - return (uint8_t) (((uint8_t)-1)*(((((((((uint8_t)digits[3]) << PyLong_SHIFT) | (uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); + __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(uint8_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint8_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(uint8_t) - 1 > 4 * PyLong_SHIFT) { - return (uint8_t) ((((((((((uint8_t)digits[3]) << PyLong_SHIFT) | (uint8_t)digits[2]) << PyLong_SHIFT) | (uint8_t)digits[1]) << PyLong_SHIFT) | (uint8_t)digits[0]))); + __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(uint8_t) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(uint8_t, long, PyLong_AsLong(x)) + if (sizeof(size_t) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(uint8_t) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(uint8_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } @@ -12981,7 +10410,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 - uint8_t val; + size_t val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { @@ -13001,47 +10430,47 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(s return val; } #endif - return (uint8_t) -1; + return (size_t) -1; } } else { - uint8_t val; + size_t val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (uint8_t) -1; - val = __Pyx_PyInt_As_uint8_t(tmp); + if (!tmp) return (size_t) -1; + val = __Pyx_PyInt_As_size_t(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, - "value too large to convert to uint8_t"); - return (uint8_t) -1; + "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 uint8_t"); - return (uint8_t) -1; + "can't convert negative value to size_t"); + return (size_t) -1; } /* CIntFromPy */ - static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { + static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(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 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 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(uint32_t) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(uint32_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; + return (uint32_t) val; } } else #endif @@ -13050,32 +10479,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 (uint32_t) 0; + case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, digits[0]) case 2: - if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(uint32_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])); + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) >= 2 * PyLong_SHIFT) { + return (uint32_t) (((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); } } break; case 3: - if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(uint32_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])); + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) >= 3 * PyLong_SHIFT) { + return (uint32_t) (((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); } } break; case 4: - if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(uint32_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])); + __PYX_VERIFY_RETURN_INT(uint32_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(uint32_t) >= 4 * PyLong_SHIFT) { + return (uint32_t) (((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); } } break; @@ -13089,86 +10518,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 (size_t) -1; + return (uint32_t) -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(uint32_t) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, 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(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, 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 (uint32_t) 0; + case -1: __PYX_VERIFY_RETURN_INT(uint32_t, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, +digits[0]) case -2: - if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(uint32_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]))); + __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { + return (uint32_t) (((uint32_t)-1)*(((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); } } break; case 2: - if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(uint32_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]))); + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { + return (uint32_t) ((((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); } } break; case -3: - if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(uint32_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]))); + __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { + return (uint32_t) (((uint32_t)-1)*(((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); } } break; case 3: - if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(uint32_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]))); + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { + return (uint32_t) ((((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); } } break; case -4: - if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(uint32_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]))); + __PYX_VERIFY_RETURN_INT(uint32_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(uint32_t) - 1 > 4 * PyLong_SHIFT) { + return (uint32_t) (((uint32_t)-1)*(((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); } } break; case 4: - if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(uint32_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]))); + __PYX_VERIFY_RETURN_INT(uint32_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(uint32_t) - 1 > 4 * PyLong_SHIFT) { + return (uint32_t) ((((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); } } break; } #endif - if (sizeof(size_t) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x)) + if (sizeof(uint32_t) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, 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(uint32_t) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } @@ -13177,7 +10606,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; + uint32_t val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { @@ -13197,24 +10626,24 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(s return val; } #endif - return (size_t) -1; + return (uint32_t) -1; } } else { - size_t val; + uint32_t val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (size_t) -1; - val = __Pyx_PyInt_As_size_t(tmp); + if (!tmp) return (uint32_t) -1; + val = __Pyx_PyInt_As_uint32_t(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 uint32_t"); + return (uint32_t) -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 uint32_t"); + return (uint32_t) -1; } /* CIntFromPy */ @@ -13565,6 +10994,44 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(s } } +/* 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_long(long value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC diff --git a/src/DracoPy.h b/src/DracoPy.h index 4b67da5..7902b68 100644 --- a/src/DracoPy.h +++ b/src/DracoPy.h @@ -16,6 +16,19 @@ 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 { + uint32_t unique_id; + std::unordered_map entries; + std::vector sub_metadata_ids; + }; + + struct PointAttributeObject { + std::unordered_map data; + uint32_t element_size; + uint32_t dimension; + uint32_t unique_id; + }; + struct PointCloudObject { std::vector points; @@ -27,8 +40,8 @@ namespace DracoFunctions { decoding_status decode_status; - // not parsed metadata - std::string binary_metadata; + std::vector attributes; + std::vector metadatas; }; struct MeshObject : PointCloudObject { @@ -41,136 +54,154 @@ namespace DracoFunctions { encoding_status encode_status; }; - class MetadataReader { - public: - MetadataReader(const std::string& s): stream(s) {} - - uint32_t read_uint() { - uint32_t value; - stream.read(reinterpret_cast(&value), sizeof(uint32_t)); - return value; - } - - std::string read_bytes() { - const auto str_len = read_uint(); - std::string value; - value.resize(str_len); - stream.read(reinterpret_cast(value.data()), str_len); - return value; - } - - std::vector read_bytes_to_vec() { - const auto vec_len = read_uint(); - std::vector value; - value.resize(vec_len); - stream.read(reinterpret_cast(value.data()), vec_len); - return value; - } - - private: - std::stringstream stream; - }; - - class MetadataWriter { - public: - void write_uint(const uint32_t& value) { - stream.write(reinterpret_cast(&value), sizeof(uint32_t)); - } - - template - void write_bytes(const StdContainer& value) { - write_uint(static_cast(value.size())); - stream.write(reinterpret_cast(value.data()), value.size()); - } - - void write_bytes_from_str(const std::string& value) { - write_bytes(value); - } - - void write_bytes_from_vec(const std::vector& value) { - write_bytes(value); - } - - std::string get() { return stream.str(); } - - private: - std::stringstream stream; - }; - - std::string encode_metadata(const GeometryMetadata& geometry_metadata) { - MetadataWriter writer; - std::vector to_parse_metadata = - { {static_cast(&geometry_metadata)} }; - // consider attribute metadatas - const auto& attribute_metadatas = geometry_metadata.attribute_metadatas(); - writer.write_uint(static_cast(attribute_metadatas.size())); - for (const auto& attribute_metadata: attribute_metadatas) { - writer.write_uint(attribute_metadata->att_unique_id()); - to_parse_metadata.push_back( - static_cast(attribute_metadata.get())); - } - // encode metadatas level by level - for (std::vector to_parse_metadatas_next; - !to_parse_metadata.empty(); - to_parse_metadata = std::move(to_parse_metadatas_next)) { - for (const auto* draco_metadata: to_parse_metadata) { - // encode entries - const auto& entries = draco_metadata->entries(); - writer.write_uint(static_cast(entries.size())); - for (const auto& [name, value]: draco_metadata->entries()) { - writer.write_bytes(name); - writer.write_bytes(value.data()); - } - // consider sub metadatas - const auto& sub_metadatas = draco_metadata->sub_metadatas(); - writer.write_uint(static_cast(sub_metadatas.size())); - for (const auto& [name, draco_sub_metadata]: sub_metadatas) { - writer.write_bytes(name); - to_parse_metadatas_next.push_back(draco_sub_metadata.get()); + // class MetadataReader { + // public: + // MetadataReader(const std::string& s): stream(s) {} + + // uint32_t read_uint() { + // uint32_t value; + // stream.read(reinterpret_cast(&value), sizeof(uint32_t)); + // return value; + // } + + // std::string read_bytes() { + // const auto str_len = read_uint(); + // std::string value; + // value.resize(str_len); + // stream.read(reinterpret_cast(value.data()), str_len); + // return value; + // } + + // std::vector read_bytes_to_vec() { + // const auto vec_len = read_uint(); + // std::vector value; + // value.resize(vec_len); + // stream.read(reinterpret_cast(value.data()), vec_len); + // return value; + // } + + // private: + // std::stringstream stream; + // }; + + // class MetadataWriter { + // public: + // void write_uint(const uint32_t& value) { + // stream.write(reinterpret_cast(&value), sizeof(uint32_t)); + // } + + // template + // void write_bytes(const StdContainer& value) { + // write_uint(static_cast(value.size())); + // stream.write(reinterpret_cast(value.data()), value.size()); + // } + + // void write_bytes_from_str(const std::string& value) { + // write_bytes(value); + // } + + // void write_bytes_from_vec(const std::vector& value) { + // write_bytes(value); + // } + + // std::string get() { return stream.str(); } + + // private: + // std::stringstream stream; + // }; + + // std::string encode_metadata(const GeometryMetadata& geometry_metadata) { + // MetadataWriter writer; + // std::vector to_parse_metadata = + // { {static_cast(&geometry_metadata)} }; + // // consider attribute metadatas + // const auto& attribute_metadatas = geometry_metadata.attribute_metadatas(); + // writer.write_uint(static_cast(attribute_metadatas.size())); + // for (const auto& attribute_metadata: attribute_metadatas) { + // writer.write_uint(attribute_metadata->att_unique_id()); + // to_parse_metadata.push_back( + // static_cast(attribute_metadata.get())); + // } + // // encode metadatas level by level + // for (std::vector to_parse_metadatas_next; + // !to_parse_metadata.empty(); + // to_parse_metadata = std::move(to_parse_metadatas_next)) { + // for (const auto* draco_metadata: to_parse_metadata) { + // // encode entries + // const auto& entries = draco_metadata->entries(); + // writer.write_uint(static_cast(entries.size())); + // for (const auto& [name, value]: draco_metadata->entries()) { + // writer.write_bytes(name); + // writer.write_bytes(value.data()); + // } + // // consider sub metadatas + // const auto& sub_metadatas = draco_metadata->sub_metadatas(); + // writer.write_uint(static_cast(sub_metadatas.size())); + // for (const auto& [name, draco_sub_metadata]: sub_metadatas) { + // writer.write_bytes(name); + // to_parse_metadatas_next.push_back(draco_sub_metadata.get()); + // } + // } + // } + // return writer.get(); + // } + + // GeometryMetadata decode_metadata(const std::string& s) { + // MetadataReader reader(s); + // GeometryMetadata geometry_metadata; + // std::vector to_parse_metadata = { + // {static_cast(&geometry_metadata)} }; + // // consider attribute metadatas + // const auto attrbite_metadatas_len = reader.read_uint(); + // for (uint32_t i = 0; i < attrbite_metadatas_len; ++i) { + // auto attribute_metadata = std::make_unique(); + // const auto unique_id = reader.read_uint(); + // attribute_metadata->set_att_unique_id(unique_id); + // to_parse_metadata.push_back(attribute_metadata.get()); + // geometry_metadata.AddAttributeMetadata(std::move(attribute_metadata)); + // } + // // parse metadatas level by level + // for (std::vector to_parse_metadatas_next; + // !to_parse_metadata.empty(); + // to_parse_metadata = std::move(to_parse_metadatas_next)) { + // for (auto* metadata: to_parse_metadata) { + // // parse entries + // const auto entries_len = reader.read_uint(); + // for (uint32_t i = 0; i < entries_len; ++i) { + // std::string name = reader.read_bytes(); + // std::vector value = reader.read_bytes_to_vec(); + // metadata->AddEntryBinary(name, value); + // } + // // consider sub metadatas + // const auto sub_metadatas_len = reader.read_uint(); + // for (uint32_t i = 0; i < sub_metadatas_len; ++i) { + // auto sub_metadata = std::make_unique(); + // to_parse_metadatas_next.push_back(sub_metadata.get()); + // std::string name = reader.read_bytes(); + // metadata->AddSubMetadata(name, std::move(sub_metadata)); + // } + // } + // } + // return geometry_metadata; + // } + + std::vector decode_attributes(const PointCloud& pc) { + const int32_t attributes_len = pc.num_attributes(); + std::vector attribute_objects(attributes_len); + for (int i = 0; i < attributes_len; ++i) + if (const auto* attribute = pc.attribute(i)) + { + attribute_objects[i].dimension = attribute->num_components(); + attribute_objects[i].element_size = attribute->byte_stride(); + attribute_objects[i].unique_id = attribute->unique_id(); + int value_size = attribute->num_components() * attribute->byte_stride(); + for (PointIndex v(0); v < attribute->indices_map_size(); ++v) { + auto& value = attribute_objects[i].data[v.value()]; + value.resize(value_size); + attribute->GetMappedValue(v, value.data()); } } - } - return writer.get(); - } - - GeometryMetadata decode_metadata(const std::string& s) { - MetadataReader reader(s); - GeometryMetadata geometry_metadata; - std::vector to_parse_metadata = { - {static_cast(&geometry_metadata)} }; - // consider attribute metadatas - const auto attrbite_metadatas_len = reader.read_uint(); - for (uint32_t i = 0; i < attrbite_metadatas_len; ++i) { - auto attribute_metadata = std::make_unique(); - const auto unique_id = reader.read_uint(); - attribute_metadata->set_att_unique_id(unique_id); - to_parse_metadata.push_back(attribute_metadata.get()); - geometry_metadata.AddAttributeMetadata(std::move(attribute_metadata)); - } - // parse metadatas level by level - for (std::vector to_parse_metadatas_next; - !to_parse_metadata.empty(); - to_parse_metadata = std::move(to_parse_metadatas_next)) { - for (auto* metadata: to_parse_metadata) { - // parse entries - const auto entries_len = reader.read_uint(); - for (uint32_t i = 0; i < entries_len; ++i) { - std::string name = reader.read_bytes(); - std::vector value = reader.read_bytes_to_vec(); - metadata->AddEntryBinary(name, value); - } - // consider sub metadatas - const auto sub_metadatas_len = reader.read_uint(); - for (uint32_t i = 0; i < sub_metadatas_len; ++i) { - auto sub_metadata = std::make_unique(); - to_parse_metadatas_next.push_back(sub_metadata.get()); - std::string name = reader.read_bytes(); - metadata->AddSubMetadata(name, std::move(sub_metadata)); - } - } - } - return geometry_metadata; - + return attribute_objects; } MeshObject decode_buffer(const char *buffer, std::size_t buffer_len) { @@ -223,7 +254,7 @@ namespace DracoFunctions { metadata->GetEntryDoubleArray("quantization_origin", &(meshObject.quantization_origin))) { meshObject.encoding_options_set = true; } - meshObject.binary_metadata = encode_metadata(*metadata); + meshObject.attributes = decode_attributes(*mesh); } meshObject.decode_status = successful; return meshObject; @@ -272,8 +303,8 @@ namespace DracoFunctions { metadata->GetEntryDoubleArray("quantization_origin", &(pointCloudObject.quantization_origin))) { pointCloudObject.encoding_options_set = true; } - pointCloudObject.binary_metadata = encode_metadata(*metadata); } + pointCloudObject.attributes = decode_attributes(*point_cloud); pointCloudObject.decode_status = successful; return pointCloudObject; } @@ -303,7 +334,7 @@ namespace DracoFunctions { } EncodedObject encode_mesh(const std::vector &points, const - std::vector &faces, const std::string& binary_metadata, + std::vector &faces, int quantization_bits, int compression_level, float quantization_range, const float *quantization_origin, bool create_metadata) { TriangleSoupMeshBuilder mb; mb.Start(faces.size()); @@ -334,8 +365,7 @@ namespace DracoFunctions { return encodedMeshObject; } - EncodedObject encode_point_cloud(const std::vector &points, - const std::string& binary_metadata, int quantization_bits, + EncodedObject encode_point_cloud(const std::vector &points, int quantization_bits, int compression_level, float quantization_range, const float *quantization_origin, bool create_metadata) { int num_points = points.size() / 3; PointCloudBuilder pcb; diff --git a/src/DracoPy.pxd b/src/DracoPy.pxd index a3c8978..f804664 100644 --- a/src/DracoPy.pxd +++ b/src/DracoPy.pxd @@ -1,5 +1,6 @@ from libcpp.vector cimport vector from libcpp.string cimport string +from libcpp.unordered_map cimport unordered_map from libc.stdint cimport uint32_t, uint8_t from libcpp cimport bool @@ -12,6 +13,17 @@ cdef extern from "DracoPy.h" namespace "DracoFunctions": cdef enum encoding_status: successful_encoding, failed_during_encoding + + cdef struct MetadataObject: + uint32_t unique_id + unordered_map[string, string] entries + vector[uint32_t] sub_metadata_ids + + cdef struct PointAttributeObject: + unordered_map[uint32_t, string] data + uint32_t element_size + uint32_t dimension + uint32_t unique_id cdef struct PointCloudObject: vector[float] points @@ -25,7 +37,8 @@ cdef extern from "DracoPy.h" namespace "DracoFunctions": # Represents the decoding success or error message decoding_status decode_status - string binary_metadata + vector[PointAttributeObject] attributes + vector[MetadataObject] metadatas cdef struct MeshObject: vector[float] points @@ -43,7 +56,8 @@ cdef extern from "DracoPy.h" namespace "DracoFunctions": # Represents the decoding success or error message decoding_status decode_status - string binary_metadata + vector[PointAttributeObject] attributes + vector[MetadataObject] metadatas cdef struct EncodedObject: vector[unsigned char] buffer @@ -66,13 +80,13 @@ cdef extern from "DracoPy.h" namespace "DracoFunctions": PointCloudObject decode_buffer_to_point_cloud(const char *buffer, size_t buffer_len) except + EncodedObject encode_mesh( - vector[float] points, vector[uint32_t] faces, string binary_metadata, + 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_point_cloud( - vector[float] points, string binary_metadata, + vector[float] points, int quantization_bits, int compression_level, float quantization_range, const float *quantization_origin, bool create_metadata) except + diff --git a/src/DracoPy.pyx b/src/DracoPy.pyx index 39557a1..dd7486c 100644 --- a/src/DracoPy.pyx +++ b/src/DracoPy.pyx @@ -5,86 +5,86 @@ from cpython.mem cimport PyMem_Malloc, PyMem_Free cimport DracoPy from math import floor +# +# class MetadataObject: +# def __init__(self, entries: Dict[str, bytes] = None, +# sub_metadatas: Dict[str, 'MetadataObject'] = None): +# self.entries = entries if entries else {} +# self.sub_metadatas = sub_metadatas if sub_metadatas else {} +# +# +# class AttributeMetadataObject(MetadataObject): +# def __init__(self, unique_id: int, +# entries: Dict[str, bytes] = None, +# sub_metadatas: Dict[str, 'MetadataObject'] = None): +# super().__init__(entries, sub_metadatas) +# self.unique_id = unique_id +# +# +# class GeometryMetadataObject(MetadataObject): +# def __init__(self, entries: Dict[str, bytes] = None, +# sub_metadatas: Dict[str, 'MetadataObject'] = None, +# attribute_metadatas: List['AttributeMetadataObject'] = None): +# super().__init__(entries, sub_metadatas) +# self.attribute_metadatas = attribute_metadatas if attribute_metadatas \ +# else [] -class MetadataObject: - def __init__(self, entries: Dict[str, bytes] = None, - sub_metadatas: Dict[str, 'MetadataObject'] = None): - self.entries = entries if entries else {} - self.sub_metadatas = sub_metadatas if sub_metadatas else {} - - -class AttributeMetadataObject(MetadataObject): - def __init__(self, unique_id: int, - entries: Dict[str, bytes] = None, - sub_metadatas: Dict[str, 'MetadataObject'] = None): - super().__init__(entries, sub_metadatas) - self.unique_id = unique_id - - -class GeometryMetadataObject(MetadataObject): - def __init__(self, entries: Dict[str, bytes] = None, - sub_metadatas: Dict[str, 'MetadataObject'] = None, - attribute_metadatas: List['AttributeMetadataObject'] = None): - super().__init__(entries, sub_metadatas) - self.attribute_metadatas = attribute_metadatas if attribute_metadatas \ - else [] - - -def decode_metadata(binary_metadata: bytes) -> MetadataObject: - reader = new DracoPy.MetadataReader(binary_metadata) - geometry_metadata = GeometryMetadataObject() - to_parse_metadatas = [geometry_metadata] - # consider attribute metadatas - attribute_metadatas_len = reader.read_uint() - for _ in range(attribute_metadatas_len): - unique_id = reader.read_uint() - attribute_metadata = AttributeMetadataObject(unique_id) - geometry_metadata.attribute_metadatas.append(attribute_metadata) - to_parse_metadatas.append(attribute_metadata) - # parse metadatas level by level - while to_parse_metadatas: - to_parse_metadata_next = [] - for metadata in to_parse_metadatas: - # parse entries - entries_len = reader.read_uint() - for _ in range(entries_len): - name = reader.read_bytes() - value = reader.read_bytes() - metadata.entries[name] = value - sub_metadatas_len = reader.read_uint() - # consider sub metadatas - for _ in range(sub_metadatas_len): - name = reader.read_bytes() - sub_metadata = MetadataObject() - metadata.sub_metadatas[name] = sub_metadata - to_parse_metadata_next.append(sub_metadata) - to_parse_metadatas = to_parse_metadata_next - del reader - return geometry_metadata - -def encode_metadata(geometry_metadata: GeometryMetadataObject) -> bytes: - cdef DracoPy.MetadataWriter writer - to_parse_metadata = [geometry_metadata] - # consider attribute metadatas - writer.write_uint(len(geometry_metadata.attribute_metadatas)) - for attribute_metadata in geometry_metadata.attribute_metadatas: - writer.write_uint(attribute_metadata.unique_id) - to_parse_metadata.append(attribute_metadata) - # encode metadatas level by level - while to_parse_metadata: - to_parse_metadata_next = [] - for draco_metadata in to_parse_metadata: - # encode entries - writer.write_uint(len(draco_metadata.entries)) - for name, value in draco_metadata.entries.items(): - writer.write_bytes_from_str(name) - writer.write_bytes_from_vec(value) - # consider sub metadatas - writer.write_uint(len(draco_metadata.sub_metadatas)) - for name, draco_sub_metadata in draco_metadata.sub_metadatas.items(): - writer.write_bytes_from_str(name) - to_parse_metadata_next.append(draco_sub_metadata) - return writer.get() +# +# def decode_metadata(binary_metadata: bytes) -> MetadataObject: +# reader = new DracoPy.MetadataReader(binary_metadata) +# geometry_metadata = GeometryMetadataObject() +# to_parse_metadatas = [geometry_metadata] +# # consider attribute metadatas +# attribute_metadatas_len = reader.read_uint() +# for _ in range(attribute_metadatas_len): +# unique_id = reader.read_uint() +# attribute_metadata = AttributeMetadataObject(unique_id) +# geometry_metadata.attribute_metadatas.append(attribute_metadata) +# to_parse_metadatas.append(attribute_metadata) +# # parse metadatas level by level +# while to_parse_metadatas: +# to_parse_metadata_next = [] +# for metadata in to_parse_metadatas: +# # parse entries +# entries_len = reader.read_uint() +# for _ in range(entries_len): +# name = reader.read_bytes() +# value = reader.read_bytes() +# metadata.entries[name] = value +# sub_metadatas_len = reader.read_uint() +# # consider sub metadatas +# for _ in range(sub_metadatas_len): +# name = reader.read_bytes() +# sub_metadata = MetadataObject() +# metadata.sub_metadatas[name] = sub_metadata +# to_parse_metadata_next.append(sub_metadata) +# to_parse_metadatas = to_parse_metadata_next +# del reader +# return geometry_metadata +# +# def encode_metadata(geometry_metadata: GeometryMetadataObject) -> bytes: +# cdef DracoPy.MetadataWriter writer +# to_parse_metadata = [geometry_metadata] +# # consider attribute metadatas +# writer.write_uint(len(geometry_metadata.attribute_metadatas)) +# for attribute_metadata in geometry_metadata.attribute_metadatas: +# writer.write_uint(attribute_metadata.unique_id) +# to_parse_metadata.append(attribute_metadata) +# # encode metadatas level by level +# while to_parse_metadata: +# to_parse_metadata_next = [] +# for draco_metadata in to_parse_metadata: +# # encode entries +# writer.write_uint(len(draco_metadata.entries)) +# for name, value in draco_metadata.entries.items(): +# writer.write_bytes_from_str(name) +# writer.write_bytes_from_vec(value) +# # consider sub metadatas +# writer.write_uint(len(draco_metadata.sub_metadatas)) +# for name, draco_sub_metadata in draco_metadata.sub_metadatas.items(): +# writer.write_bytes_from_str(name) +# to_parse_metadata_next.append(draco_sub_metadata) +# return writer.get() class DracoPointCloud(object): @@ -95,7 +95,7 @@ class DracoPointCloud(object): data_struct['quantization_range'], data_struct['quantization_origin']) else: self.encoding_options = None - self.metadata = decode_metadata(data_struct["binary_metadata"]) + # self.metadata = decode_metadata(data_struct["binary_metadata"]) def get_encoded_coordinate(self, value, axis): if self.encoding_options is not None: @@ -113,6 +113,14 @@ class DracoPointCloud(object): def points(self): return self.data_struct['points'] + @property + def metadatas(self): + return self.data_struct['metadatas'] + + @property + def attributes(self): + return self.data_struct['attributes'] + class DracoMesh(DracoPointCloud): @property @@ -153,7 +161,7 @@ class FileTypeException(Exception): class EncodingFailedException(Exception): pass -def encode_mesh_to_buffer(points, faces, metadata: GeometryMetadataObject = None, +def encode_mesh_to_buffer(points, faces, quantization_bits=14, compression_level=1, quantization_range=-1, quantization_origin=None, create_metadata=False): @@ -166,8 +174,6 @@ def encode_mesh_to_buffer(points, faces, metadata: GeometryMetadataObject = None 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. """ - if metadata is None: - metadata = GeometryMetadataObject() cdef float* quant_origin = NULL try: num_dims = 3 @@ -175,8 +181,8 @@ def encode_mesh_to_buffer(points, faces, metadata: GeometryMetadataObject = None quant_origin = PyMem_Malloc(sizeof(float) * num_dims) for dim in range(num_dims): quant_origin[dim] = quantization_origin[dim] - binary_metadata = encode_metadata(metadata) - encoded_mesh = DracoPy.encode_mesh(points, faces, binary_metadata, + # binary_metadata = encode_metadata(metadata) + encoded_mesh = DracoPy.encode_mesh(points, faces, quantization_bits, compression_level, quantization_range, quant_origin, create_metadata) @@ -193,7 +199,7 @@ def encode_mesh_to_buffer(points, faces, metadata: GeometryMetadataObject = None PyMem_Free(quant_origin) raise ValueError("Input invalid") -def encode_point_cloud_to_buffer(points, metadata: GeometryMetadataObject = None, +def encode_point_cloud_to_buffer(points, quantization_bits=14, compression_level=1, quantization_range=-1, quantization_origin=None, create_metadata=False): @@ -206,8 +212,6 @@ def encode_point_cloud_to_buffer(points, metadata: GeometryMetadataObject = None 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. """ - if metadata is None: - metadata = GeometryMetadataObject() cdef float* quant_origin = NULL try: num_dims = 3 @@ -215,9 +219,9 @@ def encode_point_cloud_to_buffer(points, metadata: GeometryMetadataObject = None quant_origin = PyMem_Malloc(sizeof(float) * num_dims) for dim in range(num_dims): quant_origin[dim] = quantization_origin[dim] - binary_metadata = encode_metadata(metadata) + # binary_metadata = encode_metadata(metadata) encoded_point_cloud = DracoPy.encode_point_cloud( - points, binary_metadata, quantization_bits, compression_level, + points, quantization_bits, compression_level, quantization_range, quant_origin, create_metadata) if quant_origin != NULL: PyMem_Free(quant_origin) From 2c9e9fb39f581f3665f6ddf77727a494565b1d00 Mon Sep 17 00:00:00 2001 From: Andrey Romanov Date: Fri, 22 Oct 2021 23:00:02 +0300 Subject: [PATCH 05/21] fully support decoding --- src/DracoPy.cpp | 387 +++++++++++++++++++++++++++++++----------------- src/DracoPy.h | 199 ++++++++----------------- src/DracoPy.pxd | 20 ++- src/DracoPy.pyx | 87 +---------- 4 files changed, 329 insertions(+), 364 deletions(-) diff --git a/src/DracoPy.cpp b/src/DracoPy.cpp index d4cd74a..2d78168 100644 --- a/src/DracoPy.cpp +++ b/src/DracoPy.cpp @@ -1389,7 +1389,8 @@ static void __Pyx_CppExn2PyErr() { #endif 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_MetadataObject(struct DracoFunctions::MetadataObject s); +static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(struct DracoFunctions::AttributeMetadataObject 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 */ @@ -1460,8 +1461,8 @@ static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_st 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 PyObject *__pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_string(std::unordered_map const &); /*proto*/ -static PyObject *__pyx_convert_vector_to_py_uint32_t(const std::vector &); /*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_std_3a__3a_string____uint32_t(std::unordered_map const &); /*proto*/ +static PyObject *__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(const std::vector &); /*proto*/ #define __Pyx_MODULE_NAME "DracoPy" extern int __pyx_module_is_main_DracoPy; int __pyx_module_is_main_DracoPy = 0; @@ -1494,11 +1495,13 @@ static const char __pyx_k_import[] = "__import__"; static const char __pyx_k_module[] = "__module__"; static const char __pyx_k_object[] = "object"; static const char __pyx_k_points[] = "points"; +static const char __pyx_k_return[] = "return"; static const char __pyx_k_typing[] = "typing"; static const char __pyx_k_DracoPy[] = "DracoPy"; static const char __pyx_k_entries[] = "entries"; static const char __pyx_k_normals[] = "normals"; static const char __pyx_k_prepare[] = "__prepare__"; +static const char __pyx_k_tree_id[] = "tree_id"; 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"; @@ -1507,7 +1510,6 @@ static const char __pyx_k_DracoMesh[] = "DracoMesh"; static const char __pyx_k_TypeError[] = "TypeError"; static const char __pyx_k_dimension[] = "dimension"; static const char __pyx_k_metaclass[] = "__metaclass__"; -static const char __pyx_k_metadatas[] = "metadatas"; static const char __pyx_k_unique_id[] = "unique_id"; static const char __pyx_k_ValueError[] = "ValueError"; static const char __pyx_k_attributes[] = "attributes"; @@ -1534,14 +1536,17 @@ 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_cline_in_traceback[] = "cline_in_traceback"; 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_attribute_metadatas[] = "attribute_metadatas"; static const char __pyx_k_encoded_point_cloud[] = "encoded_point_cloud"; static const char __pyx_k_quantization_origin[] = "quantization_origin"; +static const char __pyx_k_PointAttributeObject[] = "PointAttributeObject"; 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_decode_buffer_to_mesh[] = "decode_buffer_to_mesh"; @@ -1549,15 +1554,16 @@ 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_GeometryMetadataObject[] = "GeometryMetadataObject"; static const char __pyx_k_get_encoded_coordinate[] = "get_encoded_coordinate"; static const char __pyx_k_EncodingFailedException[] = "EncodingFailedException"; 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_DracoPointCloud_metadatas[] = "DracoPointCloud.metadatas"; static const char __pyx_k_decode_point_cloud_buffer[] = "decode_point_cloud_buffer"; static const char __pyx_k_DracoPointCloud_attributes[] = "DracoPointCloud.attributes"; static const char __pyx_k_encode_point_cloud_to_buffer[] = "encode_point_cloud_to_buffer"; 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"; @@ -1572,9 +1578,9 @@ 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_attributes; +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; @@ -1587,14 +1593,17 @@ static PyObject *__pyx_n_s_EncodingOptions_get_encoded_poin; static PyObject *__pyx_n_s_EncodingOptions_num_axes; static PyObject *__pyx_kp_u_Failed_to_decode_input_mesh_Data; static PyObject *__pyx_n_s_FileTypeException; +static PyObject *__pyx_n_u_GeometryMetadataObject; 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_List; +static PyObject *__pyx_n_u_PointAttributeObject; static PyObject *__pyx_kp_u_Specified_value_out_of_encoded_r; static PyObject *__pyx_n_s_TypeError; static PyObject *__pyx_n_s_ValueError; +static PyObject *__pyx_n_s_attribute_metadatas; static PyObject *__pyx_n_s_attributes; static PyObject *__pyx_n_u_attributes; static PyObject *__pyx_n_s_axis; @@ -1625,6 +1634,8 @@ static PyObject *__pyx_n_s_entries; static PyObject *__pyx_n_s_faces; static PyObject *__pyx_n_u_faces; static PyObject *__pyx_n_s_floor; +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_import; @@ -1634,8 +1645,6 @@ static PyObject *__pyx_n_s_main; static PyObject *__pyx_n_s_math; static PyObject *__pyx_n_s_mesh_struct; static PyObject *__pyx_n_s_metaclass; -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_normals; @@ -1660,10 +1669,12 @@ 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_return; static PyObject *__pyx_n_s_self; static PyObject *__pyx_kp_s_src_DracoPy_pyx; static PyObject *__pyx_n_s_sub_metadata_ids; static PyObject *__pyx_n_s_test; +static PyObject *__pyx_n_s_tree_id; static PyObject *__pyx_n_s_typing; static PyObject *__pyx_n_s_unique_id; static PyObject *__pyx_n_s_value; @@ -1672,7 +1683,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_2get_encoded_coordinate(CYT 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_10metadatas(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_12attributes(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 */ @@ -2482,26 +2493,26 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_8points(CYTHON_UNUSED PyObj /* "DracoPy.pyx":117 * * @property - * def metadatas(self): # <<<<<<<<<<<<<< - * return self.data_struct['metadatas'] + * def geometry_metadata(self) -> 'GeometryMetadataObject': # <<<<<<<<<<<<<< + * return self.data_struct['geometry_metadata'] * */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_11metadatas(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_15DracoPointCloud_11metadatas = {"metadatas", (PyCFunction)__pyx_pw_7DracoPy_15DracoPointCloud_11metadatas, METH_O, 0}; -static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_11metadatas(PyObject *__pyx_self, PyObject *__pyx_v_self) { +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("metadatas (wrapper)", 0); - __pyx_r = __pyx_pf_7DracoPy_15DracoPointCloud_10metadatas(__pyx_self, ((PyObject *)__pyx_v_self)); + __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_10metadatas(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { +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; @@ -2509,19 +2520,19 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_10metadatas(CYTHON_UNUSED P int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("metadatas", 0); + __Pyx_RefNannySetupContext("geometry_metadata", 0); /* "DracoPy.pyx":118 * @property - * def metadatas(self): - * return self.data_struct['metadatas'] # <<<<<<<<<<<<<< + * def geometry_metadata(self) -> 'GeometryMetadataObject': + * return self.data_struct['geometry_metadata'] # <<<<<<<<<<<<<< * * @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, 118, __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, 118, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_geometry_metadata); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; @@ -2531,8 +2542,8 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_10metadatas(CYTHON_UNUSED P /* "DracoPy.pyx":117 * * @property - * def metadatas(self): # <<<<<<<<<<<<<< - * return self.data_struct['metadatas'] + * def geometry_metadata(self) -> 'GeometryMetadataObject': # <<<<<<<<<<<<<< + * return self.data_struct['geometry_metadata'] * */ @@ -2540,7 +2551,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_10metadatas(CYTHON_UNUSED P __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("DracoPy.DracoPointCloud.metadatas", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("DracoPy.DracoPointCloud.geometry_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2551,7 +2562,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_10metadatas(CYTHON_UNUSED P /* "DracoPy.pyx":121 * * @property - * def attributes(self): # <<<<<<<<<<<<<< + * def attributes(self) -> List['PointAttributeObject']: # <<<<<<<<<<<<<< * return self.data_struct['attributes'] * */ @@ -2582,7 +2593,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_12attributes(CYTHON_UNUSED /* "DracoPy.pyx":122 * @property - * def attributes(self): + * def attributes(self) -> List['PointAttributeObject']: * return self.data_struct['attributes'] # <<<<<<<<<<<<<< * * @@ -2600,7 +2611,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_12attributes(CYTHON_UNUSED /* "DracoPy.pyx":121 * * @property - * def attributes(self): # <<<<<<<<<<<<<< + * def attributes(self) -> List['PointAttributeObject']: # <<<<<<<<<<<<<< * return self.data_struct['attributes'] * */ @@ -6372,72 +6383,128 @@ static PyObject *__pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__ return __pyx_r; } -/* "vector.to_py":60 - * - * @cname("__pyx_convert_vector_to_py_uint32_t") - * cdef object __pyx_convert_vector_to_py_uint32_t(vector[X]& v): # <<<<<<<<<<<<<< - * return [v[i] for i in range(v.size())] - * - */ - -static PyObject *__pyx_convert_vector_to_py_uint32_t(const std::vector &__pyx_v_v) { - size_t __pyx_v_i; +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; - size_t __pyx_t_2; - size_t __pyx_t_3; - size_t __pyx_t_4; - PyObject *__pyx_t_5 = 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_vector_to_py_uint32_t", 0); + __Pyx_RefNannySetupContext("__pyx_convert_unordered_map_to_py_std_3a__3a_string____uint32_t", 0); - /* "vector.to_py":61 - * @cname("__pyx_convert_vector_to_py_uint32_t") - * cdef object __pyx_convert_vector_to_py_uint32_t(vector[X]& v): - * return [v[i] for i in range(v.size())] # <<<<<<<<<<<<<< + /* "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_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_uint32_t((__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; + __Pyx_INCREF(__pyx_v_o); + __pyx_r = __pyx_v_o; goto __pyx_L0; - /* "vector.to_py":60 - * - * @cname("__pyx_convert_vector_to_py_uint32_t") - * cdef object __pyx_convert_vector_to_py_uint32_t(vector[X]& v): # <<<<<<<<<<<<<< - * return [v[i] for i in range(v.size())] + /* "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_5); - __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_uint32_t", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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; } -static PyObject *__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_MetadataObject(const std::vector &__pyx_v_v) { +/* "vector.to_py":60 + * + * @cname("__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject") + * cdef object __pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(vector[X]& v): # <<<<<<<<<<<<<< + * return [v[i] for i in range(v.size())] + * + */ + +static PyObject *__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(const std::vector &__pyx_v_v) { size_t __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -6449,11 +6516,11 @@ static PyObject *__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_Metada 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); + __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject", 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): + * @cname("__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject") + * cdef object __pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(vector[X]& v): * return [v[i] for i in range(v.size())] # <<<<<<<<<<<<<< * * @@ -6465,7 +6532,7 @@ static PyObject *__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_Metada __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_t_5 = __pyx_convert__to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject((__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; @@ -6476,8 +6543,8 @@ static PyObject *__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_Metada /* "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): # <<<<<<<<<<<<<< + * @cname("__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject") + * cdef object __pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(vector[X]& v): # <<<<<<<<<<<<<< * return [v[i] for i in range(v.size())] * */ @@ -6486,7 +6553,7 @@ static PyObject *__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_Metada __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_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -6547,9 +6614,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_attributes, __pyx_k_DracoPointCloud_attributes, sizeof(__pyx_k_DracoPointCloud_attributes), 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}, @@ -6562,14 +6629,17 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_n_u_GeometryMetadataObject, __pyx_k_GeometryMetadataObject, sizeof(__pyx_k_GeometryMetadataObject), 0, 1, 0, 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_n_s_List, __pyx_k_List, sizeof(__pyx_k_List), 0, 0, 1, 1}, + {&__pyx_n_u_PointAttributeObject, __pyx_k_PointAttributeObject, sizeof(__pyx_k_PointAttributeObject), 0, 1, 0, 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_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_attribute_metadatas, __pyx_k_attribute_metadatas, sizeof(__pyx_k_attribute_metadatas), 0, 0, 1, 1}, {&__pyx_n_s_attributes, __pyx_k_attributes, sizeof(__pyx_k_attributes), 0, 0, 1, 1}, {&__pyx_n_u_attributes, __pyx_k_attributes, sizeof(__pyx_k_attributes), 0, 1, 0, 1}, {&__pyx_n_s_axis, __pyx_k_axis, sizeof(__pyx_k_axis), 0, 0, 1, 1}, @@ -6600,6 +6670,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_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_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, @@ -6609,8 +6681,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_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_normals, __pyx_k_normals, sizeof(__pyx_k_normals), 0, 0, 1, 1}, @@ -6635,10 +6705,12 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_return, __pyx_k_return, sizeof(__pyx_k_return), 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_sub_metadata_ids, __pyx_k_sub_metadata_ids, sizeof(__pyx_k_sub_metadata_ids), 0, 0, 1, 1}, {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_tree_id, __pyx_k_tree_id, sizeof(__pyx_k_tree_id), 0, 0, 1, 1}, {&__pyx_n_s_typing, __pyx_k_typing, sizeof(__pyx_k_typing), 0, 0, 1, 1}, {&__pyx_n_s_unique_id, __pyx_k_unique_id, sizeof(__pyx_k_unique_id), 0, 0, 1, 1}, {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1}, @@ -6777,19 +6849,19 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { /* "DracoPy.pyx":117 * * @property - * def metadatas(self): # <<<<<<<<<<<<<< - * return self.data_struct['metadatas'] + * def geometry_metadata(self) -> 'GeometryMetadataObject': # <<<<<<<<<<<<<< + * return self.data_struct['geometry_metadata'] * */ __pyx_tuple__16 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 117, __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_metadatas, 117, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 117, __pyx_L1_error) + __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_geometry_metadata, 117, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 117, __pyx_L1_error) /* "DracoPy.pyx":121 * * @property - * def attributes(self): # <<<<<<<<<<<<<< + * def attributes(self) -> List['PointAttributeObject']: # <<<<<<<<<<<<<< * return self.data_struct['attributes'] * */ @@ -7373,46 +7445,62 @@ if (!__Pyx_RefNanny) { /* "DracoPy.pyx":117 * * @property - * def metadatas(self): # <<<<<<<<<<<<<< - * return self.data_struct['metadatas'] + * def geometry_metadata(self) -> 'GeometryMetadataObject': # <<<<<<<<<<<<<< + * return self.data_struct['geometry_metadata'] * */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_11metadatas, 0, __pyx_n_s_DracoPointCloud_metadatas, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__17)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 117, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 117, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_u_GeometryMetadataObject) < 0) __PYX_ERR(0, 117, __pyx_L1_error) + __pyx_t_4 = __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__17)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "DracoPy.pyx":116 * return self.data_struct['points'] * * @property # <<<<<<<<<<<<<< - * def metadatas(self): - * return self.data_struct['metadatas'] + * def geometry_metadata(self) -> 'GeometryMetadataObject': + * return self.data_struct['geometry_metadata'] */ - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 116, __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_metadatas, __pyx_t_4) < 0) __PYX_ERR(0, 117, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 116, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_geometry_metadata, __pyx_t_3) < 0) __PYX_ERR(0, 117, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "DracoPy.pyx":121 * * @property - * def attributes(self): # <<<<<<<<<<<<<< + * def attributes(self) -> List['PointAttributeObject']: # <<<<<<<<<<<<<< * return self.data_struct['attributes'] * */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_13attributes, 0, __pyx_n_s_DracoPointCloud_attributes, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__19)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_List); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_t_4, __pyx_n_u_PointAttributeObject); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_t_5) < 0) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_13attributes, 0, __pyx_n_s_DracoPointCloud_attributes, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__19)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "DracoPy.pyx":120 - * return self.data_struct['metadatas'] + * return self.data_struct['geometry_metadata'] * * @property # <<<<<<<<<<<<<< - * def attributes(self): + * def attributes(self) -> List['PointAttributeObject']: * return self.data_struct['attributes'] */ - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 120, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_attributes, __pyx_t_3) < 0) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -7456,8 +7544,8 @@ if (!__Pyx_RefNanny) { * return self.data_struct['faces'] * */ - __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__21)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 127, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_9DracoMesh_1faces, 0, __pyx_n_s_DracoMesh_faces, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__21)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); /* "DracoPy.pyx":126 * @@ -7466,11 +7554,11 @@ if (!__Pyx_RefNanny) { * def faces(self): * return self.data_struct['faces'] */ - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 126, __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, 127, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 126, __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_faces, __pyx_t_4) < 0) __PYX_ERR(0, 127, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "DracoPy.pyx":131 * @@ -7479,8 +7567,8 @@ if (!__Pyx_RefNanny) { * 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__23)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 131, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_9DracoMesh_3normals, 0, __pyx_n_s_DracoMesh_normals, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__23)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); /* "DracoPy.pyx":130 * return self.data_struct['faces'] @@ -7489,11 +7577,11 @@ if (!__Pyx_RefNanny) { * def normals(self): * return self.data_struct['normals'] */ - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 130, __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, 131, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 130, __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_normals, __pyx_t_5) < 0) __PYX_ERR(0, 131, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; /* "DracoPy.pyx":125 * @@ -7502,10 +7590,10 @@ if (!__Pyx_RefNanny) { * @property * def faces(self): */ - __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoMesh, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 125, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoMesh, __pyx_t_4) < 0) __PYX_ERR(0, 125, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoMesh, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoMesh, __pyx_t_5) < 0) __PYX_ERR(0, 125, __pyx_L1_error) + __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_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -7575,11 +7663,11 @@ if (!__Pyx_RefNanny) { * 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, 154, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 154, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __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, 155, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_num_axes, __pyx_t_5) < 0) __PYX_ERR(0, 155, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; /* "DracoPy.pyx":134 * return self.data_struct['normals'] @@ -7588,10 +7676,10 @@ if (!__Pyx_RefNanny) { * def __init__(self, quantization_bits, quantization_range, quantization_origin): * self.quantization_bits = quantization_bits */ - __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_EncodingOptions, __pyx_tuple__24, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 134, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingOptions, __pyx_t_4) < 0) __PYX_ERR(0, 134, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_EncodingOptions, __pyx_tuple__24, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 134, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingOptions, __pyx_t_5) < 0) __PYX_ERR(0, 134, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -7609,13 +7697,13 @@ if (!__Pyx_RefNanny) { 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, 158, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __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_4)) __PYX_ERR(0, 158, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_FileTypeException, __pyx_t_2, __pyx_t_4, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 158, __pyx_L1_error) + __pyx_t_5 = __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_5)) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_FileTypeException, __pyx_t_2, __pyx_t_5, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 158, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_d, __pyx_n_s_FileTypeException, __pyx_t_3) < 0) __PYX_ERR(0, 158, __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_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -7633,13 +7721,13 @@ if (!__Pyx_RefNanny) { 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, 161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __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_4)) __PYX_ERR(0, 161, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_EncodingFailedException, __pyx_t_2, __pyx_t_4, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 161, __pyx_L1_error) + __pyx_t_5 = __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_5)) __PYX_ERR(0, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_EncodingFailedException, __pyx_t_2, __pyx_t_5, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingFailedException, __pyx_t_3) < 0) __PYX_ERR(0, 161, __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_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -7715,8 +7803,8 @@ if (!__Pyx_RefNanny) { /* "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): # <<<<<<<<<<<<<< + * @cname("__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject") + * cdef object __pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(vector[X]& v): # <<<<<<<<<<<<<< * return [v[i] for i in range(v.size())] * */ @@ -10161,19 +10249,44 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu Py_DECREF(res); return NULL; } - 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_AttributeMetadataObject(struct DracoFunctions::AttributeMetadataObject s) { PyObject* res; PyObject* member; - res = __Pyx_PyDict_NewPresized(3); if (unlikely(!res)) return NULL; + res = __Pyx_PyDict_NewPresized(4); if (unlikely(!res)) return NULL; + member = __Pyx_PyInt_From_uint32_t(s.tree_id); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_tree_id, member) < 0)) goto bad; + Py_DECREF(member); + 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); member = __Pyx_PyInt_From_uint32_t(s.unique_id); if (unlikely(!member)) goto bad; if (unlikely(PyDict_SetItem(res, __pyx_n_s_unique_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(4); if (unlikely(!res)) return NULL; + member = __Pyx_PyInt_From_uint32_t(s.tree_id); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_tree_id, member) < 0)) goto bad; + Py_DECREF(member); 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_vector_to_py_uint32_t(s.sub_metadata_ids); if (unlikely(!member)) goto bad; + 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); + member = __pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(s.attribute_metadatas); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_attribute_metadatas, member) < 0)) goto bad; + Py_DECREF(member); return res; bad: Py_XDECREF(member); @@ -10211,8 +10324,8 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu member = __pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_PointAttributeObject(s.attributes); if (unlikely(!member)) goto bad; if (unlikely(PyDict_SetItem(res, __pyx_n_s_attributes, 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; + 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); return res; bad: @@ -10245,8 +10358,8 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu member = __pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_PointAttributeObject(s.attributes); if (unlikely(!member)) goto bad; if (unlikely(PyDict_SetItem(res, __pyx_n_s_attributes, 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; + 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); return res; bad: diff --git a/src/DracoPy.h b/src/DracoPy.h index 7902b68..d6901b4 100644 --- a/src/DracoPy.h +++ b/src/DracoPy.h @@ -17,9 +17,13 @@ namespace DracoFunctions { enum encoding_status { successful_encoding, failed_during_encoding }; struct MetadataObject { - uint32_t unique_id; + uint32_t tree_id; // id to help build tree structure std::unordered_map entries; - std::vector sub_metadata_ids; + std::unordered_map sub_metadata_ids; + }; + + struct AttributeMetadataObject: MetadataObject { + uint32_t unique_id; }; struct PointAttributeObject { @@ -29,6 +33,10 @@ namespace DracoFunctions { uint32_t unique_id; }; + struct GeometryMetadataObject: MetadataObject { + std::vector attribute_metadatas; + }; + struct PointCloudObject { std::vector points; @@ -41,7 +49,7 @@ namespace DracoFunctions { decoding_status decode_status; std::vector attributes; - std::vector metadatas; + GeometryMetadataObject geometry_metadata; }; struct MeshObject : PointCloudObject { @@ -54,147 +62,16 @@ namespace DracoFunctions { encoding_status encode_status; }; - // class MetadataReader { - // public: - // MetadataReader(const std::string& s): stream(s) {} - - // uint32_t read_uint() { - // uint32_t value; - // stream.read(reinterpret_cast(&value), sizeof(uint32_t)); - // return value; - // } - - // std::string read_bytes() { - // const auto str_len = read_uint(); - // std::string value; - // value.resize(str_len); - // stream.read(reinterpret_cast(value.data()), str_len); - // return value; - // } - - // std::vector read_bytes_to_vec() { - // const auto vec_len = read_uint(); - // std::vector value; - // value.resize(vec_len); - // stream.read(reinterpret_cast(value.data()), vec_len); - // return value; - // } - - // private: - // std::stringstream stream; - // }; - - // class MetadataWriter { - // public: - // void write_uint(const uint32_t& value) { - // stream.write(reinterpret_cast(&value), sizeof(uint32_t)); - // } - - // template - // void write_bytes(const StdContainer& value) { - // write_uint(static_cast(value.size())); - // stream.write(reinterpret_cast(value.data()), value.size()); - // } - - // void write_bytes_from_str(const std::string& value) { - // write_bytes(value); - // } - - // void write_bytes_from_vec(const std::vector& value) { - // write_bytes(value); - // } - - // std::string get() { return stream.str(); } - - // private: - // std::stringstream stream; - // }; - - // std::string encode_metadata(const GeometryMetadata& geometry_metadata) { - // MetadataWriter writer; - // std::vector to_parse_metadata = - // { {static_cast(&geometry_metadata)} }; - // // consider attribute metadatas - // const auto& attribute_metadatas = geometry_metadata.attribute_metadatas(); - // writer.write_uint(static_cast(attribute_metadatas.size())); - // for (const auto& attribute_metadata: attribute_metadatas) { - // writer.write_uint(attribute_metadata->att_unique_id()); - // to_parse_metadata.push_back( - // static_cast(attribute_metadata.get())); - // } - // // encode metadatas level by level - // for (std::vector to_parse_metadatas_next; - // !to_parse_metadata.empty(); - // to_parse_metadata = std::move(to_parse_metadatas_next)) { - // for (const auto* draco_metadata: to_parse_metadata) { - // // encode entries - // const auto& entries = draco_metadata->entries(); - // writer.write_uint(static_cast(entries.size())); - // for (const auto& [name, value]: draco_metadata->entries()) { - // writer.write_bytes(name); - // writer.write_bytes(value.data()); - // } - // // consider sub metadatas - // const auto& sub_metadatas = draco_metadata->sub_metadatas(); - // writer.write_uint(static_cast(sub_metadatas.size())); - // for (const auto& [name, draco_sub_metadata]: sub_metadatas) { - // writer.write_bytes(name); - // to_parse_metadatas_next.push_back(draco_sub_metadata.get()); - // } - // } - // } - // return writer.get(); - // } - - // GeometryMetadata decode_metadata(const std::string& s) { - // MetadataReader reader(s); - // GeometryMetadata geometry_metadata; - // std::vector to_parse_metadata = { - // {static_cast(&geometry_metadata)} }; - // // consider attribute metadatas - // const auto attrbite_metadatas_len = reader.read_uint(); - // for (uint32_t i = 0; i < attrbite_metadatas_len; ++i) { - // auto attribute_metadata = std::make_unique(); - // const auto unique_id = reader.read_uint(); - // attribute_metadata->set_att_unique_id(unique_id); - // to_parse_metadata.push_back(attribute_metadata.get()); - // geometry_metadata.AddAttributeMetadata(std::move(attribute_metadata)); - // } - // // parse metadatas level by level - // for (std::vector to_parse_metadatas_next; - // !to_parse_metadata.empty(); - // to_parse_metadata = std::move(to_parse_metadatas_next)) { - // for (auto* metadata: to_parse_metadata) { - // // parse entries - // const auto entries_len = reader.read_uint(); - // for (uint32_t i = 0; i < entries_len; ++i) { - // std::string name = reader.read_bytes(); - // std::vector value = reader.read_bytes_to_vec(); - // metadata->AddEntryBinary(name, value); - // } - // // consider sub metadatas - // const auto sub_metadatas_len = reader.read_uint(); - // for (uint32_t i = 0; i < sub_metadatas_len; ++i) { - // auto sub_metadata = std::make_unique(); - // to_parse_metadatas_next.push_back(sub_metadata.get()); - // std::string name = reader.read_bytes(); - // metadata->AddSubMetadata(name, std::move(sub_metadata)); - // } - // } - // } - // return geometry_metadata; - // } - std::vector decode_attributes(const PointCloud& pc) { const int32_t attributes_len = pc.num_attributes(); std::vector attribute_objects(attributes_len); for (int i = 0; i < attributes_len; ++i) if (const auto* attribute = pc.attribute(i)) { - attribute_objects[i].dimension = attribute->num_components(); - attribute_objects[i].element_size = attribute->byte_stride(); - attribute_objects[i].unique_id = attribute->unique_id(); - int value_size = attribute->num_components() * attribute->byte_stride(); + attribute_objects[i].dimension = static_cast(attribute->num_components()); + attribute_objects[i].element_size = static_cast(attribute->byte_stride()); + attribute_objects[i].unique_id = static_cast(attribute->unique_id()); + const auto value_size = attribute->num_components() * attribute->byte_stride(); for (PointIndex v(0); v < attribute->indices_map_size(); ++v) { auto& value = attribute_objects[i].data[v.value()]; value.resize(value_size); @@ -204,6 +81,48 @@ namespace DracoFunctions { return attribute_objects; } + void decode_metadata(const Metadata& metadata, MetadataObject& main_metadata_object) { + main_metadata_object.tree_id = 0; + using MetadataPair = std::pair; + std::vector to_parse_metadata = { {&metadata, &main_metadata_object} }; + std::vector metadata_objects; + uint32_t metadata_idx = 0; + for (std::vector to_parse_metadatas_next; !to_parse_metadata.empty(); + to_parse_metadata = std::move(to_parse_metadatas_next)) { + for (auto [metadata, metadata_object]: to_parse_metadata) { + // consider entries + for (const auto& [name, vec_value]: metadata->entries()) { + 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); + metadata_object->entries[name] = std::move(str_value); + } + // consider sub metadatas + for (const auto& [name, sub_metadata]: metadata->sub_metadatas()) { + MetadataObject sub_metadata_object; + sub_metadata_object.tree_id = ++metadata_idx; + metadata_object->sub_metadata_ids[name] = sub_metadata_object.tree_id; + metadata_objects.push_back(std::move(sub_metadata_object)); + to_parse_metadatas_next.push_back({sub_metadata.get(), &sub_metadata_object}); + } + } + } + } + + GeometryMetadataObject decode_geometry_metadata(const GeometryMetadata& geometry_metadata) { + GeometryMetadataObject geometry_metadata_object; + decode_metadata(static_cast(geometry_metadata), + static_cast(geometry_metadata_object)); + for (const auto& attribute_metadata: geometry_metadata.attribute_metadatas()) { + AttributeMetadataObject attribute_metadata_object; + attribute_metadata_object.unique_id = attribute_metadata->att_unique_id(); + decode_metadata(static_cast(*attribute_metadata.get()), + static_cast(attribute_metadata_object)); + geometry_metadata_object.attribute_metadatas.push_back(std::move(attribute_metadata_object)); + } + return geometry_metadata_object; + } + MeshObject decode_buffer(const char *buffer, std::size_t buffer_len) { MeshObject meshObject; DecoderBuffer decoderBuffer; @@ -254,8 +173,9 @@ namespace DracoFunctions { metadata->GetEntryDoubleArray("quantization_origin", &(meshObject.quantization_origin))) { meshObject.encoding_options_set = true; } - meshObject.attributes = decode_attributes(*mesh); + meshObject.geometry_metadata = decode_geometry_metadata(*metadata); } + meshObject.attributes = decode_attributes(*mesh); meshObject.decode_status = successful; return meshObject; } @@ -303,6 +223,7 @@ namespace DracoFunctions { metadata->GetEntryDoubleArray("quantization_origin", &(pointCloudObject.quantization_origin))) { pointCloudObject.encoding_options_set = true; } + pointCloudObject.geometry_metadata = decode_geometry_metadata(*metadata); } pointCloudObject.attributes = decode_attributes(*point_cloud); pointCloudObject.decode_status = successful; diff --git a/src/DracoPy.pxd b/src/DracoPy.pxd index f804664..31d228b 100644 --- a/src/DracoPy.pxd +++ b/src/DracoPy.pxd @@ -15,15 +15,27 @@ cdef extern from "DracoPy.h" namespace "DracoFunctions": successful_encoding, failed_during_encoding cdef struct MetadataObject: - uint32_t unique_id + uint32_t tree_id + unordered_map[string, string] entries + unordered_map[string, uint32_t] sub_metadata_ids + + cdef struct AttributeMetadataObject: + uint32_t tree_id unordered_map[string, string] entries - vector[uint32_t] sub_metadata_ids + unordered_map[string, uint32_t] sub_metadata_ids + uint32_t unique_id cdef struct PointAttributeObject: unordered_map[uint32_t, string] data uint32_t element_size uint32_t dimension uint32_t unique_id + + cdef struct GeometryMetadataObject: + uint32_t tree_id + unordered_map[string, string] entries + unordered_map[string, uint32_t] sub_metadata_ids + vector[AttributeMetadataObject] attribute_metadatas cdef struct PointCloudObject: vector[float] points @@ -38,7 +50,7 @@ cdef extern from "DracoPy.h" namespace "DracoFunctions": decoding_status decode_status vector[PointAttributeObject] attributes - vector[MetadataObject] metadatas + GeometryMetadataObject geometry_metadata cdef struct MeshObject: vector[float] points @@ -57,7 +69,7 @@ cdef extern from "DracoPy.h" namespace "DracoFunctions": decoding_status decode_status vector[PointAttributeObject] attributes - vector[MetadataObject] metadatas + GeometryMetadataObject geometry_metadata cdef struct EncodedObject: vector[unsigned char] buffer diff --git a/src/DracoPy.pyx b/src/DracoPy.pyx index dd7486c..764aaba 100644 --- a/src/DracoPy.pyx +++ b/src/DracoPy.pyx @@ -5,87 +5,6 @@ from cpython.mem cimport PyMem_Malloc, PyMem_Free cimport DracoPy from math import floor -# -# class MetadataObject: -# def __init__(self, entries: Dict[str, bytes] = None, -# sub_metadatas: Dict[str, 'MetadataObject'] = None): -# self.entries = entries if entries else {} -# self.sub_metadatas = sub_metadatas if sub_metadatas else {} -# -# -# class AttributeMetadataObject(MetadataObject): -# def __init__(self, unique_id: int, -# entries: Dict[str, bytes] = None, -# sub_metadatas: Dict[str, 'MetadataObject'] = None): -# super().__init__(entries, sub_metadatas) -# self.unique_id = unique_id -# -# -# class GeometryMetadataObject(MetadataObject): -# def __init__(self, entries: Dict[str, bytes] = None, -# sub_metadatas: Dict[str, 'MetadataObject'] = None, -# attribute_metadatas: List['AttributeMetadataObject'] = None): -# super().__init__(entries, sub_metadatas) -# self.attribute_metadatas = attribute_metadatas if attribute_metadatas \ -# else [] - -# -# def decode_metadata(binary_metadata: bytes) -> MetadataObject: -# reader = new DracoPy.MetadataReader(binary_metadata) -# geometry_metadata = GeometryMetadataObject() -# to_parse_metadatas = [geometry_metadata] -# # consider attribute metadatas -# attribute_metadatas_len = reader.read_uint() -# for _ in range(attribute_metadatas_len): -# unique_id = reader.read_uint() -# attribute_metadata = AttributeMetadataObject(unique_id) -# geometry_metadata.attribute_metadatas.append(attribute_metadata) -# to_parse_metadatas.append(attribute_metadata) -# # parse metadatas level by level -# while to_parse_metadatas: -# to_parse_metadata_next = [] -# for metadata in to_parse_metadatas: -# # parse entries -# entries_len = reader.read_uint() -# for _ in range(entries_len): -# name = reader.read_bytes() -# value = reader.read_bytes() -# metadata.entries[name] = value -# sub_metadatas_len = reader.read_uint() -# # consider sub metadatas -# for _ in range(sub_metadatas_len): -# name = reader.read_bytes() -# sub_metadata = MetadataObject() -# metadata.sub_metadatas[name] = sub_metadata -# to_parse_metadata_next.append(sub_metadata) -# to_parse_metadatas = to_parse_metadata_next -# del reader -# return geometry_metadata -# -# def encode_metadata(geometry_metadata: GeometryMetadataObject) -> bytes: -# cdef DracoPy.MetadataWriter writer -# to_parse_metadata = [geometry_metadata] -# # consider attribute metadatas -# writer.write_uint(len(geometry_metadata.attribute_metadatas)) -# for attribute_metadata in geometry_metadata.attribute_metadatas: -# writer.write_uint(attribute_metadata.unique_id) -# to_parse_metadata.append(attribute_metadata) -# # encode metadatas level by level -# while to_parse_metadata: -# to_parse_metadata_next = [] -# for draco_metadata in to_parse_metadata: -# # encode entries -# writer.write_uint(len(draco_metadata.entries)) -# for name, value in draco_metadata.entries.items(): -# writer.write_bytes_from_str(name) -# writer.write_bytes_from_vec(value) -# # consider sub metadatas -# writer.write_uint(len(draco_metadata.sub_metadatas)) -# for name, draco_sub_metadata in draco_metadata.sub_metadatas.items(): -# writer.write_bytes_from_str(name) -# to_parse_metadata_next.append(draco_sub_metadata) -# return writer.get() - class DracoPointCloud(object): def __init__(self, data_struct): @@ -114,11 +33,11 @@ class DracoPointCloud(object): return self.data_struct['points'] @property - def metadatas(self): - return self.data_struct['metadatas'] + def geometry_metadata(self) -> 'GeometryMetadataObject': + return self.data_struct['geometry_metadata'] @property - def attributes(self): + def attributes(self) -> List['PointAttributeObject']: return self.data_struct['attributes'] From 03544ee969b1a06c3aa785df0b5e34af10947414 Mon Sep 17 00:00:00 2001 From: Andrey Romanov Date: Fri, 22 Oct 2021 23:45:37 +0300 Subject: [PATCH 06/21] recover draco:: --- src/DracoPy.cpp | 1141 ++++++++++++++++++++++++----------------------- src/DracoPy.h | 97 ++-- src/DracoPy.pxd | 18 +- 3 files changed, 657 insertions(+), 599 deletions(-) diff --git a/src/DracoPy.cpp b/src/DracoPy.cpp index 2d78168..4616d47 100644 --- a/src/DracoPy.cpp +++ b/src/DracoPy.cpp @@ -1417,6 +1417,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value); +/* CIntToPy.proto */ +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_long(long value); @@ -1502,6 +1505,7 @@ static const char __pyx_k_entries[] = "entries"; static const char __pyx_k_normals[] = "normals"; static const char __pyx_k_prepare[] = "__prepare__"; static const char __pyx_k_tree_id[] = "tree_id"; +static const char __pyx_k_datatype[] = "datatype"; 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"; @@ -1517,7 +1521,6 @@ static const char __pyx_k_difference[] = "difference"; static const char __pyx_k_data_struct[] = "data_struct"; static const char __pyx_k_mesh_struct[] = "mesh_struct"; static const char __pyx_k_Invalid_mesh[] = "Invalid mesh"; -static const char __pyx_k_element_size[] = "element_size"; static const char __pyx_k_encoded_mesh[] = "encoded_mesh"; static const char __pyx_k_quant_origin[] = "quant_origin"; static const char __pyx_k_Input_invalid[] = "Input invalid"; @@ -1613,6 +1616,7 @@ static PyObject *__pyx_n_s_compression_level; static PyObject *__pyx_n_s_create_metadata; static PyObject *__pyx_n_s_data; static PyObject *__pyx_n_s_data_struct; +static PyObject *__pyx_n_s_datatype; 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; @@ -1621,7 +1625,6 @@ 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_element_size; 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; @@ -1746,7 +1749,7 @@ static PyObject *__pyx_codeobj__40; static PyObject *__pyx_codeobj__42; /* Late includes */ -/* "DracoPy.pyx":91 +/* "DracoPy.pyx":10 * * class DracoPointCloud(object): * def __init__(self, data_struct): # <<<<<<<<<<<<<< @@ -1789,11 +1792,11 @@ static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_1__init__(PyObject *__pyx_s case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data_struct)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 91, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 10, __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, 91, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 10, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -1806,7 +1809,7 @@ static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_1__init__(PyObject *__pyx_s } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 91, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 10, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("DracoPy.DracoPointCloud.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -1836,50 +1839,50 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyOb int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "DracoPy.pyx":92 + /* "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'], */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_data_struct, __pyx_v_data_struct) < 0) __PYX_ERR(0, 92, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_data_struct, __pyx_v_data_struct) < 0) __PYX_ERR(0, 11, __pyx_L1_error) - /* "DracoPy.pyx":93 + /* "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']) */ - __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, 93, __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, 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, 93, __pyx_L1_error) + __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":94 + /* "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, 94, __pyx_L1_error) + __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, 94, __pyx_L1_error) + __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); - /* "DracoPy.pyx":95 + /* "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 */ - __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data_struct, __pyx_n_u_quantization_range); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 95, __pyx_L1_error) + __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, 95, __pyx_L1_error) + __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; @@ -1896,7 +1899,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyOb #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, 94, __pyx_L1_error) + __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; @@ -1907,7 +1910,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyOb #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, 94, __pyx_L1_error) + __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; @@ -1916,7 +1919,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyOb } else #endif { - __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 94, __pyx_L1_error) + __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; @@ -1930,23 +1933,23 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyOb __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, 94, __pyx_L1_error) + __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; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":94 + /* "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, 94, __pyx_L1_error) + 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; - /* "DracoPy.pyx":93 + /* "DracoPy.pyx":12 * def __init__(self, data_struct): * self.data_struct = data_struct * if data_struct['encoding_options_set']: # <<<<<<<<<<<<<< @@ -1956,7 +1959,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyOb goto __pyx_L3; } - /* "DracoPy.pyx":97 + /* "DracoPy.pyx":16 * data_struct['quantization_range'], data_struct['quantization_origin']) * else: * self.encoding_options = None # <<<<<<<<<<<<<< @@ -1964,11 +1967,11 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyOb * */ /*else*/ { - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options, Py_None) < 0) __PYX_ERR(0, 97, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options, Py_None) < 0) __PYX_ERR(0, 16, __pyx_L1_error) } __pyx_L3:; - /* "DracoPy.pyx":91 + /* "DracoPy.pyx":10 * * class DracoPointCloud(object): * def __init__(self, data_struct): # <<<<<<<<<<<<<< @@ -1995,7 +1998,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyOb return __pyx_r; } -/* "DracoPy.pyx":100 +/* "DracoPy.pyx":19 * # self.metadata = decode_metadata(data_struct["binary_metadata"]) * * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< @@ -2041,17 +2044,17 @@ static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_3get_encoded_coordinate(PyO 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, 100, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, 1); __PYX_ERR(0, 19, __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, 100, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, 2); __PYX_ERR(0, 19, __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, 100, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_encoded_coordinate") < 0)) __PYX_ERR(0, 19, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -2066,7 +2069,7 @@ static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_3get_encoded_coordinate(PyO } 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, 100, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 19, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("DracoPy.DracoPointCloud.get_encoded_coordinate", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -2094,21 +2097,21 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_2get_encoded_coordinate(CYT int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_encoded_coordinate", 0); - /* "DracoPy.pyx":101 + /* "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) * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 101, __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, 20, __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":102 + /* "DracoPy.pyx":21 * def get_encoded_coordinate(self, value, axis): * if self.encoding_options is not None: * return self.encoding_options.get_encoded_coordinate(value, axis) # <<<<<<<<<<<<<< @@ -2116,9 +2119,9 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_2get_encoded_coordinate(CYT * 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, 102, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 21, __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, 102, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get_encoded_coordinate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 21, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; @@ -2136,7 +2139,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_2get_encoded_coordinate(CYT #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, 102, __pyx_L1_error) + __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, 21, __pyx_L1_error) __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_GOTREF(__pyx_t_1); } else @@ -2144,13 +2147,13 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_2get_encoded_coordinate(CYT #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, 102, __pyx_L1_error) + __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, 21, __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, 102, __pyx_L1_error) + __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 21, __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; @@ -2161,7 +2164,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_2get_encoded_coordinate(CYT __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, 102, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } @@ -2170,7 +2173,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_2get_encoded_coordinate(CYT __pyx_t_1 = 0; goto __pyx_L0; - /* "DracoPy.pyx":101 + /* "DracoPy.pyx":20 * * def get_encoded_coordinate(self, value, axis): * if self.encoding_options is not None: # <<<<<<<<<<<<<< @@ -2179,7 +2182,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_2get_encoded_coordinate(CYT */ } - /* "DracoPy.pyx":100 + /* "DracoPy.pyx":19 * # self.metadata = decode_metadata(data_struct["binary_metadata"]) * * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< @@ -2203,7 +2206,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_2get_encoded_coordinate(CYT return __pyx_r; } -/* "DracoPy.pyx":104 +/* "DracoPy.pyx":23 * return self.encoding_options.get_encoded_coordinate(value, axis) * * def get_encoded_point(self, point): # <<<<<<<<<<<<<< @@ -2246,11 +2249,11 @@ static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_5get_encoded_point(PyObject 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, 104, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_point", 1, 2, 2, 1); __PYX_ERR(0, 23, __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, 104, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_encoded_point") < 0)) __PYX_ERR(0, 23, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -2263,7 +2266,7 @@ static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_5get_encoded_point(PyObject } 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, 104, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_point", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 23, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("DracoPy.DracoPointCloud.get_encoded_point", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -2289,21 +2292,21 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_4get_encoded_point(CYTHON_U int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_encoded_point", 0); - /* "DracoPy.pyx":105 + /* "DracoPy.pyx":24 * * def get_encoded_point(self, point): * if self.encoding_options is not None: # <<<<<<<<<<<<<< * return self.encoding_options.get_encoded_point(point) * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 105, __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, 24, __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":106 + /* "DracoPy.pyx":25 * def get_encoded_point(self, point): * if self.encoding_options is not None: * return self.encoding_options.get_encoded_point(point) # <<<<<<<<<<<<<< @@ -2311,9 +2314,9 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_4get_encoded_point(CYTHON_U * @property */ __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, 106, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 25, __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, 106, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get_encoded_point); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 25, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; @@ -2328,14 +2331,14 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_4get_encoded_point(CYTHON_U } __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, 106, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 25, __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":105 + /* "DracoPy.pyx":24 * * def get_encoded_point(self, point): * if self.encoding_options is not None: # <<<<<<<<<<<<<< @@ -2344,7 +2347,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_4get_encoded_point(CYTHON_U */ } - /* "DracoPy.pyx":104 + /* "DracoPy.pyx":23 * return self.encoding_options.get_encoded_coordinate(value, axis) * * def get_encoded_point(self, point): # <<<<<<<<<<<<<< @@ -2367,7 +2370,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_4get_encoded_point(CYTHON_U return __pyx_r; } -/* "DracoPy.pyx":109 +/* "DracoPy.pyx":28 * * @property * def num_axes(self): # <<<<<<<<<<<<<< @@ -2394,7 +2397,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_6num_axes(CYTHON_UNUSED PyO __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("num_axes", 0); - /* "DracoPy.pyx":110 + /* "DracoPy.pyx":29 * @property * def num_axes(self): * return 3 # <<<<<<<<<<<<<< @@ -2406,7 +2409,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_6num_axes(CYTHON_UNUSED PyO __pyx_r = __pyx_int_3; goto __pyx_L0; - /* "DracoPy.pyx":109 + /* "DracoPy.pyx":28 * * @property * def num_axes(self): # <<<<<<<<<<<<<< @@ -2421,7 +2424,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_6num_axes(CYTHON_UNUSED PyO return __pyx_r; } -/* "DracoPy.pyx":113 +/* "DracoPy.pyx":32 * * @property * def points(self): # <<<<<<<<<<<<<< @@ -2453,7 +2456,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_8points(CYTHON_UNUSED PyObj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("points", 0); - /* "DracoPy.pyx":114 + /* "DracoPy.pyx":33 * @property * def points(self): * return self.data_struct['points'] # <<<<<<<<<<<<<< @@ -2461,16 +2464,16 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_8points(CYTHON_UNUSED PyObj * @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, 114, __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, 33, __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, 114, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_points); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 33, __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":113 + /* "DracoPy.pyx":32 * * @property * def points(self): # <<<<<<<<<<<<<< @@ -2490,7 +2493,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_8points(CYTHON_UNUSED PyObj return __pyx_r; } -/* "DracoPy.pyx":117 +/* "DracoPy.pyx":36 * * @property * def geometry_metadata(self) -> 'GeometryMetadataObject': # <<<<<<<<<<<<<< @@ -2522,7 +2525,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_10geometry_metadata(CYTHON_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("geometry_metadata", 0); - /* "DracoPy.pyx":118 + /* "DracoPy.pyx":37 * @property * def geometry_metadata(self) -> 'GeometryMetadataObject': * return self.data_struct['geometry_metadata'] # <<<<<<<<<<<<<< @@ -2530,16 +2533,16 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_10geometry_metadata(CYTHON_ * @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, 118, __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, 37, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_geometry_metadata); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 118, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_geometry_metadata); 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":117 + /* "DracoPy.pyx":36 * * @property * def geometry_metadata(self) -> 'GeometryMetadataObject': # <<<<<<<<<<<<<< @@ -2559,7 +2562,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_10geometry_metadata(CYTHON_ return __pyx_r; } -/* "DracoPy.pyx":121 +/* "DracoPy.pyx":40 * * @property * def attributes(self) -> List['PointAttributeObject']: # <<<<<<<<<<<<<< @@ -2591,7 +2594,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_12attributes(CYTHON_UNUSED int __pyx_clineno = 0; __Pyx_RefNannySetupContext("attributes", 0); - /* "DracoPy.pyx":122 + /* "DracoPy.pyx":41 * @property * def attributes(self) -> List['PointAttributeObject']: * return self.data_struct['attributes'] # <<<<<<<<<<<<<< @@ -2599,16 +2602,16 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_12attributes(CYTHON_UNUSED * */ __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, 122, __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, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_attributes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 122, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_attributes); 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; goto __pyx_L0; - /* "DracoPy.pyx":121 + /* "DracoPy.pyx":40 * * @property * def attributes(self) -> List['PointAttributeObject']: # <<<<<<<<<<<<<< @@ -2628,7 +2631,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_12attributes(CYTHON_UNUSED return __pyx_r; } -/* "DracoPy.pyx":127 +/* "DracoPy.pyx":46 * class DracoMesh(DracoPointCloud): * @property * def faces(self): # <<<<<<<<<<<<<< @@ -2660,7 +2663,7 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_faces(CYTHON_UNUSED PyObject *__py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("faces", 0); - /* "DracoPy.pyx":128 + /* "DracoPy.pyx":47 * @property * def faces(self): * return self.data_struct['faces'] # <<<<<<<<<<<<<< @@ -2668,16 +2671,16 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_faces(CYTHON_UNUSED PyObject *__py * @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, 128, __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, 47, __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, 128, __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, 47, __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":127 + /* "DracoPy.pyx":46 * class DracoMesh(DracoPointCloud): * @property * def faces(self): # <<<<<<<<<<<<<< @@ -2697,7 +2700,7 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_faces(CYTHON_UNUSED PyObject *__py return __pyx_r; } -/* "DracoPy.pyx":131 +/* "DracoPy.pyx":50 * * @property * def normals(self): # <<<<<<<<<<<<<< @@ -2729,7 +2732,7 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_2normals(CYTHON_UNUSED PyObject *_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("normals", 0); - /* "DracoPy.pyx":132 + /* "DracoPy.pyx":51 * @property * def normals(self): * return self.data_struct['normals'] # <<<<<<<<<<<<<< @@ -2737,16 +2740,16 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_2normals(CYTHON_UNUSED PyObject *_ * 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, 132, __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, 51, __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, 132, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_normals); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __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":131 + /* "DracoPy.pyx":50 * * @property * def normals(self): # <<<<<<<<<<<<<< @@ -2766,7 +2769,7 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_2normals(CYTHON_UNUSED PyObject *_ return __pyx_r; } -/* "DracoPy.pyx":135 +/* "DracoPy.pyx":54 * * class EncodingOptions(object): * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< @@ -2815,23 +2818,23 @@ static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_1__init__(PyObject *__pyx_s 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, 135, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); __PYX_ERR(0, 54, __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, 135, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 2); __PYX_ERR(0, 54, __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("__init__", 1, 4, 4, 3); __PYX_ERR(0, 135, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 3); __PYX_ERR(0, 54, __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, 135, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 54, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; @@ -2848,7 +2851,7 @@ static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_1__init__(PyObject *__pyx_s } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 135, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 54, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("DracoPy.EncodingOptions.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -2871,52 +2874,52 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions___init__(CYTHON_UNUSED PyOb int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "DracoPy.pyx":136 + /* "DracoPy.pyx":55 * 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, 136, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_quantization_bits, __pyx_v_quantization_bits) < 0) __PYX_ERR(0, 55, __pyx_L1_error) - /* "DracoPy.pyx":137 + /* "DracoPy.pyx":56 * 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, 137, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_quantization_range, __pyx_v_quantization_range) < 0) __PYX_ERR(0, 56, __pyx_L1_error) - /* "DracoPy.pyx":138 + /* "DracoPy.pyx":57 * 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_origin, __pyx_v_quantization_origin) < 0) __PYX_ERR(0, 138, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin, __pyx_v_quantization_origin) < 0) __PYX_ERR(0, 57, __pyx_L1_error) - /* "DracoPy.pyx":139 + /* "DracoPy.pyx":58 * 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): */ - __pyx_t_1 = __Pyx_PyNumber_PowerOf2(__pyx_int_2, __pyx_v_quantization_bits, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyNumber_PowerOf2(__pyx_int_2, __pyx_v_quantization_bits, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 58, __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, 139, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_SubtractObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 58, __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, 139, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_quantization_range, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 58, __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, 139, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_inverse_alpha, __pyx_t_1) < 0) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":135 + /* "DracoPy.pyx":54 * * class EncodingOptions(object): * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< @@ -2938,7 +2941,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions___init__(CYTHON_UNUSED PyOb return __pyx_r; } -/* "DracoPy.pyx":141 +/* "DracoPy.pyx":60 * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) * * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< @@ -2984,17 +2987,17 @@ static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_3get_encoded_coordinate(PyO 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, 141, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, 1); __PYX_ERR(0, 60, __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, 141, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, 2); __PYX_ERR(0, 60, __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, 141, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_encoded_coordinate") < 0)) __PYX_ERR(0, 60, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -3009,7 +3012,7 @@ static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_3get_encoded_coordinate(PyO } 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, 141, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 60, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("DracoPy.EncodingOptions.get_encoded_coordinate", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3038,60 +3041,60 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_2get_encoded_coordinate(CYT int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_encoded_coordinate", 0); - /* "DracoPy.pyx":142 + /* "DracoPy.pyx":61 * * 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_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 142, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __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, 142, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_axis); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 61, __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, 142, __pyx_L1_error) + __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, 61, __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, 142, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 61, __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, 142, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __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, 142, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_axis); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 61, __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, 142, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_range); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __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, 142, __pyx_L1_error) + __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_t_2); 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; __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, 142, __pyx_L1_error) + __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, 61, __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, 142, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 61, __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":143 + /* "DracoPy.pyx":62 * 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, 143, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __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, 143, __pyx_L1_error) + __PYX_ERR(0, 62, __pyx_L1_error) - /* "DracoPy.pyx":142 + /* "DracoPy.pyx":61 * * def get_encoded_coordinate(self, value, axis): * if value < self.quantization_origin[axis] or value > (self.quantization_origin[axis] + self.quantization_range): # <<<<<<<<<<<<<< @@ -3100,39 +3103,39 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_2get_encoded_coordinate(CYT */ } - /* "DracoPy.pyx":144 + /* "DracoPy.pyx":63 * 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_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 144, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 63, __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, 144, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_axis); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 63, __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, 144, __pyx_L1_error) + __pyx_t_2 = PyNumber_Subtract(__pyx_v_value, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 63, __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":145 + /* "DracoPy.pyx":64 * 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_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_floor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 145, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_floor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 64, __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, 145, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_inverse_alpha); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 64, __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, 145, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_v_difference, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 64, __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, 145, __pyx_L1_error) + __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, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; @@ -3148,13 +3151,13 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_2get_encoded_coordinate(CYT __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, 145, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __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":146 + /* "DracoPy.pyx":65 * 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) # <<<<<<<<<<<<<< @@ -3162,17 +3165,17 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_2get_encoded_coordinate(CYT * 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, 146, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __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, 146, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_axis); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 65, __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, 146, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_inverse_alpha); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __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, 146, __pyx_L1_error) + __pyx_t_3 = PyNumber_Multiply(__pyx_v_quantized_index, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __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, 146, __pyx_L1_error) + __pyx_t_2 = PyNumber_Add(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __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; @@ -3180,7 +3183,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_2get_encoded_coordinate(CYT __pyx_t_2 = 0; goto __pyx_L0; - /* "DracoPy.pyx":141 + /* "DracoPy.pyx":60 * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) * * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< @@ -3204,7 +3207,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_2get_encoded_coordinate(CYT return __pyx_r; } -/* "DracoPy.pyx":148 +/* "DracoPy.pyx":67 * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) * * def get_encoded_point(self, point): # <<<<<<<<<<<<<< @@ -3247,11 +3250,11 @@ static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_5get_encoded_point(PyObject 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, 148, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_point", 1, 2, 2, 1); __PYX_ERR(0, 67, __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, 148, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_encoded_point") < 0)) __PYX_ERR(0, 67, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -3264,7 +3267,7 @@ static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_5get_encoded_point(PyObject } 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, 148, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_point", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 67, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("DracoPy.EncodingOptions.get_encoded_point", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3297,37 +3300,37 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_encoded_point", 0); - /* "DracoPy.pyx":149 + /* "DracoPy.pyx":68 * * 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, 149, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_encoded_point = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":150 + /* "DracoPy.pyx":69 * 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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_num_axes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_num_axes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __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, 150, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __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, 150, __pyx_L1_error) + __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __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, 150, __pyx_L1_error) + __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 69, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; for (;;) { @@ -3335,17 +3338,17 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U 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, 150, __pyx_L1_error) + __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, 69, __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, 150, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __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, 150, __pyx_L1_error) + __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, 69, __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, 150, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif } @@ -3355,7 +3358,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 150, __pyx_L1_error) + else __PYX_ERR(0, 69, __pyx_L1_error) } break; } @@ -3364,16 +3367,16 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U __Pyx_XDECREF_SET(__pyx_v_axis, __pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":151 + /* "DracoPy.pyx":70 * 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, 151, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_encoded_coordinate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 70, __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, 151, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_point, __pyx_v_axis); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; __pyx_t_8 = 0; @@ -3390,7 +3393,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U #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, 151, __pyx_L1_error) + __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, 70, __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; @@ -3399,14 +3402,14 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U #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, 151, __pyx_L1_error) + __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, 70, __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, 151, __pyx_L1_error) + __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 70, __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; @@ -3417,15 +3420,15 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U __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, 151, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __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, 151, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_encoded_point, __pyx_t_2); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":150 + /* "DracoPy.pyx":69 * def get_encoded_point(self, point): * encoded_point = [] * for axis in range(self.num_axes): # <<<<<<<<<<<<<< @@ -3435,7 +3438,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":152 + /* "DracoPy.pyx":71 * for axis in range(self.num_axes): * encoded_point.append(self.get_encoded_coordinate(point[axis], axis)) * return encoded_point # <<<<<<<<<<<<<< @@ -3447,7 +3450,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U __pyx_r = __pyx_v_encoded_point; goto __pyx_L0; - /* "DracoPy.pyx":148 + /* "DracoPy.pyx":67 * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) * * def get_encoded_point(self, point): # <<<<<<<<<<<<<< @@ -3473,7 +3476,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U return __pyx_r; } -/* "DracoPy.pyx":155 +/* "DracoPy.pyx":74 * * @property * def num_axes(self): # <<<<<<<<<<<<<< @@ -3500,7 +3503,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_6num_axes(CYTHON_UNUSED PyO __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("num_axes", 0); - /* "DracoPy.pyx":156 + /* "DracoPy.pyx":75 * @property * def num_axes(self): * return 3 # <<<<<<<<<<<<<< @@ -3512,7 +3515,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_6num_axes(CYTHON_UNUSED PyO __pyx_r = __pyx_int_3; goto __pyx_L0; - /* "DracoPy.pyx":155 + /* "DracoPy.pyx":74 * * @property * def num_axes(self): # <<<<<<<<<<<<<< @@ -3527,7 +3530,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_6num_axes(CYTHON_UNUSED PyO return __pyx_r; } -/* "DracoPy.pyx":164 +/* "DracoPy.pyx":83 * pass * * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< @@ -3560,7 +3563,7 @@ static PyObject *__pyx_pw_7DracoPy_1encode_mesh_to_buffer(PyObject *__pyx_self, values[3] = ((PyObject *)__pyx_int_1); values[4] = ((PyObject *)__pyx_int_neg_1); - /* "DracoPy.pyx":166 + /* "DracoPy.pyx":85 * def encode_mesh_to_buffer(points, faces, * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, # <<<<<<<<<<<<<< @@ -3569,7 +3572,7 @@ static PyObject *__pyx_pw_7DracoPy_1encode_mesh_to_buffer(PyObject *__pyx_self, */ values[5] = ((PyObject *)Py_None); - /* "DracoPy.pyx":167 + /* "DracoPy.pyx":86 * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, * create_metadata=False): # <<<<<<<<<<<<<< @@ -3607,7 +3610,7 @@ static PyObject *__pyx_pw_7DracoPy_1encode_mesh_to_buffer(PyObject *__pyx_self, 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, 164, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 2, 7, 1); __PYX_ERR(0, 83, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -3641,7 +3644,7 @@ static PyObject *__pyx_pw_7DracoPy_1encode_mesh_to_buffer(PyObject *__pyx_self, } } 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, 164, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode_mesh_to_buffer") < 0)) __PYX_ERR(0, 83, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3671,7 +3674,7 @@ static PyObject *__pyx_pw_7DracoPy_1encode_mesh_to_buffer(PyObject *__pyx_self, } 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, 164, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 2, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 83, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("DracoPy.encode_mesh_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3679,7 +3682,7 @@ static PyObject *__pyx_pw_7DracoPy_1encode_mesh_to_buffer(PyObject *__pyx_self, __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); - /* "DracoPy.pyx":164 + /* "DracoPy.pyx":83 * pass * * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< @@ -3726,7 +3729,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject int __pyx_clineno = 0; __Pyx_RefNannySetupContext("encode_mesh_to_buffer", 0); - /* "DracoPy.pyx":177 + /* "DracoPy.pyx":96 * a point where each coordinate is the minimum of that coordinate among the input vertices. * """ * cdef float* quant_origin = NULL # <<<<<<<<<<<<<< @@ -3735,7 +3738,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ __pyx_v_quant_origin = NULL; - /* "DracoPy.pyx":178 + /* "DracoPy.pyx":97 * """ * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -3751,7 +3754,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { - /* "DracoPy.pyx":179 + /* "DracoPy.pyx":98 * cdef float* quant_origin = NULL * try: * num_dims = 3 # <<<<<<<<<<<<<< @@ -3761,7 +3764,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_INCREF(__pyx_int_3); __pyx_v_num_dims = __pyx_int_3; - /* "DracoPy.pyx":180 + /* "DracoPy.pyx":99 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -3772,38 +3775,38 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_5 = (__pyx_t_4 != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":181 + /* "DracoPy.pyx":100 * 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, 181, __pyx_L3_error) + __pyx_t_6 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 100, __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, 181, __pyx_L3_error) + __pyx_t_7 = PyNumber_Multiply(__pyx_t_6, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 100, __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, 181, __pyx_L3_error) + __pyx_t_8 = __Pyx_PyInt_As_size_t(__pyx_t_7); if (unlikely((__pyx_t_8 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 100, __pyx_L3_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_quant_origin = ((float *)PyMem_Malloc(__pyx_t_8)); - /* "DracoPy.pyx":182 + /* "DracoPy.pyx":101 * 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] * # binary_metadata = encode_metadata(metadata) */ - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 182, __pyx_L3_error) + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 101, __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, 182, __pyx_L3_error) + __pyx_t_9 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 101, __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, 182, __pyx_L3_error) + __pyx_t_10 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 101, __pyx_L3_error) } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; for (;;) { @@ -3811,17 +3814,17 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject 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, 182, __pyx_L3_error) + __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, 101, __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, 182, __pyx_L3_error) + __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 101, __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, 182, __pyx_L3_error) + __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, 101, __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, 182, __pyx_L3_error) + __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 101, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_7); #endif } @@ -3831,7 +3834,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 182, __pyx_L3_error) + else __PYX_ERR(0, 101, __pyx_L3_error) } break; } @@ -3840,21 +3843,21 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_7); __pyx_t_7 = 0; - /* "DracoPy.pyx":183 + /* "DracoPy.pyx":102 * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) * for dim in range(num_dims): * quant_origin[dim] = quantization_origin[dim] # <<<<<<<<<<<<<< * # binary_metadata = encode_metadata(metadata) * encoded_mesh = DracoPy.encode_mesh(points, faces, */ - __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 183, __pyx_L3_error) + __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 102, __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, 183, __pyx_L3_error) + __pyx_t_11 = __pyx_PyFloat_AsFloat(__pyx_t_7); if (unlikely((__pyx_t_11 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 102, __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, 183, __pyx_L3_error) + __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 102, __pyx_L3_error) (__pyx_v_quant_origin[__pyx_t_12]) = __pyx_t_11; - /* "DracoPy.pyx":182 + /* "DracoPy.pyx":101 * if quantization_origin is not None: * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) * for dim in range(num_dims): # <<<<<<<<<<<<<< @@ -3864,7 +3867,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "DracoPy.pyx":180 + /* "DracoPy.pyx":99 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -3873,45 +3876,45 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":185 + /* "DracoPy.pyx":104 * quant_origin[dim] = quantization_origin[dim] * # binary_metadata = encode_metadata(metadata) * encoded_mesh = DracoPy.encode_mesh(points, faces, # <<<<<<<<<<<<<< * quantization_bits, compression_level, * quantization_range, quant_origin, */ - __pyx_t_13 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L3_error) - __pyx_t_14 = __pyx_convert_vector_from_py_uint32_t(__pyx_v_faces); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L3_error) + __pyx_t_13 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L3_error) + __pyx_t_14 = __pyx_convert_vector_from_py_uint32_t(__pyx_v_faces); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L3_error) - /* "DracoPy.pyx":186 + /* "DracoPy.pyx":105 * # binary_metadata = encode_metadata(metadata) * encoded_mesh = DracoPy.encode_mesh(points, faces, * quantization_bits, compression_level, # <<<<<<<<<<<<<< * quantization_range, quant_origin, * create_metadata) */ - __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 186, __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, 186, __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, 105, __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, 105, __pyx_L3_error) - /* "DracoPy.pyx":187 + /* "DracoPy.pyx":106 * encoded_mesh = DracoPy.encode_mesh(points, faces, * quantization_bits, compression_level, * quantization_range, quant_origin, # <<<<<<<<<<<<<< * create_metadata) * if quant_origin != NULL: */ - __pyx_t_11 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_11 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 187, __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, 106, __pyx_L3_error) - /* "DracoPy.pyx":188 + /* "DracoPy.pyx":107 * quantization_bits, compression_level, * quantization_range, quant_origin, * create_metadata) # <<<<<<<<<<<<<< * if quant_origin != NULL: * PyMem_Free(quant_origin) */ - __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_17 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 188, __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, 107, __pyx_L3_error) - /* "DracoPy.pyx":185 + /* "DracoPy.pyx":104 * quant_origin[dim] = quantization_origin[dim] * # binary_metadata = encode_metadata(metadata) * encoded_mesh = DracoPy.encode_mesh(points, faces, # <<<<<<<<<<<<<< @@ -3922,11 +3925,11 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __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, 185, __pyx_L3_error) + __PYX_ERR(0, 104, __pyx_L3_error) } __pyx_v_encoded_mesh = __pyx_t_18; - /* "DracoPy.pyx":189 + /* "DracoPy.pyx":108 * quantization_range, quant_origin, * create_metadata) * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -3936,7 +3939,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_5 = ((__pyx_v_quant_origin != NULL) != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":190 + /* "DracoPy.pyx":109 * create_metadata) * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -3945,7 +3948,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":189 + /* "DracoPy.pyx":108 * quantization_range, quant_origin, * create_metadata) * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -3954,7 +3957,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":191 + /* "DracoPy.pyx":110 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -3964,7 +3967,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject switch (__pyx_v_encoded_mesh.encode_status) { case DracoFunctions::successful_encoding: - /* "DracoPy.pyx":192 + /* "DracoPy.pyx":111 * PyMem_Free(quant_origin) * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: * return bytes(encoded_mesh.buffer) # <<<<<<<<<<<<<< @@ -3972,16 +3975,16 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject * 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, 192, __pyx_L3_error) + __pyx_t_6 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_encoded_mesh.buffer); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 111, __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, 192, __pyx_L3_error) + __pyx_t_7 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 111, __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":191 + /* "DracoPy.pyx":110 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -3991,14 +3994,14 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject break; case DracoFunctions::failed_during_encoding: - /* "DracoPy.pyx":194 + /* "DracoPy.pyx":113 * 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, 194, __pyx_L3_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 113, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_19 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -4012,14 +4015,14 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject } __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, 194, __pyx_L3_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 113, __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, 194, __pyx_L3_error) + __PYX_ERR(0, 113, __pyx_L3_error) - /* "DracoPy.pyx":193 + /* "DracoPy.pyx":112 * 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: # <<<<<<<<<<<<<< @@ -4030,7 +4033,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject default: break; } - /* "DracoPy.pyx":178 + /* "DracoPy.pyx":97 * """ * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -4047,7 +4050,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "DracoPy.pyx":195 + /* "DracoPy.pyx":114 * elif encoded_mesh.encode_status == DracoPy.encoding_status.failed_during_encoding: * raise EncodingFailedException('Invalid mesh') * except EncodingFailedException: # <<<<<<<<<<<<<< @@ -4055,7 +4058,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject * 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, 195, __pyx_L5_except_error) + __Pyx_GetModuleGlobalName(__pyx_t_20, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 114, __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; @@ -4063,19 +4066,19 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __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, 195, __pyx_L5_except_error) + if (__Pyx_GetException(&__pyx_t_19, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 114, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_19); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); - /* "DracoPy.pyx":196 + /* "DracoPy.pyx":115 * 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, 196, __pyx_L5_except_error) + __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 115, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_21); __pyx_t_22 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_21))) { @@ -4089,15 +4092,15 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject } __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, 196, __pyx_L5_except_error) + if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 115, __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, 196, __pyx_L5_except_error) + __PYX_ERR(0, 115, __pyx_L5_except_error) } - /* "DracoPy.pyx":197 + /* "DracoPy.pyx":116 * except EncodingFailedException: * raise EncodingFailedException('Invalid mesh') * except: # <<<<<<<<<<<<<< @@ -4106,12 +4109,12 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ /*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, 197, __pyx_L5_except_error) + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_19) < 0) __PYX_ERR(0, 116, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_19); - /* "DracoPy.pyx":198 + /* "DracoPy.pyx":117 * raise EncodingFailedException('Invalid mesh') * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -4121,7 +4124,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_5 = ((__pyx_v_quant_origin != NULL) != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":199 + /* "DracoPy.pyx":118 * except: * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -4130,7 +4133,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":198 + /* "DracoPy.pyx":117 * raise EncodingFailedException('Invalid mesh') * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -4139,22 +4142,22 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":200 + /* "DracoPy.pyx":119 * if quant_origin != NULL: * PyMem_Free(quant_origin) * raise ValueError("Input invalid") # <<<<<<<<<<<<<< * * def encode_point_cloud_to_buffer(points, */ - __pyx_t_20 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 200, __pyx_L5_except_error) + __pyx_t_20 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 119, __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, 200, __pyx_L5_except_error) + __PYX_ERR(0, 119, __pyx_L5_except_error) } __pyx_L5_except_error:; - /* "DracoPy.pyx":178 + /* "DracoPy.pyx":97 * """ * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -4175,7 +4178,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_L8_try_end:; } - /* "DracoPy.pyx":164 + /* "DracoPy.pyx":83 * pass * * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< @@ -4203,7 +4206,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject return __pyx_r; } -/* "DracoPy.pyx":202 +/* "DracoPy.pyx":121 * raise ValueError("Input invalid") * * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< @@ -4235,7 +4238,7 @@ static PyObject *__pyx_pw_7DracoPy_3encode_point_cloud_to_buffer(PyObject *__pyx values[2] = ((PyObject *)__pyx_int_1); values[3] = ((PyObject *)__pyx_int_neg_1); - /* "DracoPy.pyx":204 + /* "DracoPy.pyx":123 * def encode_point_cloud_to_buffer(points, * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, # <<<<<<<<<<<<<< @@ -4244,7 +4247,7 @@ static PyObject *__pyx_pw_7DracoPy_3encode_point_cloud_to_buffer(PyObject *__pyx */ values[4] = ((PyObject *)Py_None); - /* "DracoPy.pyx":205 + /* "DracoPy.pyx":124 * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, * create_metadata=False): # <<<<<<<<<<<<<< @@ -4308,7 +4311,7 @@ static PyObject *__pyx_pw_7DracoPy_3encode_point_cloud_to_buffer(PyObject *__pyx } } 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, 202, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode_point_cloud_to_buffer") < 0)) __PYX_ERR(0, 121, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -4336,7 +4339,7 @@ static PyObject *__pyx_pw_7DracoPy_3encode_point_cloud_to_buffer(PyObject *__pyx } 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, 202, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode_point_cloud_to_buffer", 0, 1, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 121, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("DracoPy.encode_point_cloud_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -4344,7 +4347,7 @@ static PyObject *__pyx_pw_7DracoPy_3encode_point_cloud_to_buffer(PyObject *__pyx __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); - /* "DracoPy.pyx":202 + /* "DracoPy.pyx":121 * raise ValueError("Input invalid") * * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< @@ -4390,7 +4393,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P int __pyx_clineno = 0; __Pyx_RefNannySetupContext("encode_point_cloud_to_buffer", 0); - /* "DracoPy.pyx":215 + /* "DracoPy.pyx":134 * a point where each coordinate is the minimum of that coordinate among the input vertices. * """ * cdef float* quant_origin = NULL # <<<<<<<<<<<<<< @@ -4399,7 +4402,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ __pyx_v_quant_origin = NULL; - /* "DracoPy.pyx":216 + /* "DracoPy.pyx":135 * """ * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -4415,7 +4418,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { - /* "DracoPy.pyx":217 + /* "DracoPy.pyx":136 * cdef float* quant_origin = NULL * try: * num_dims = 3 # <<<<<<<<<<<<<< @@ -4425,7 +4428,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_INCREF(__pyx_int_3); __pyx_v_num_dims = __pyx_int_3; - /* "DracoPy.pyx":218 + /* "DracoPy.pyx":137 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -4436,38 +4439,38 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_5 = (__pyx_t_4 != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":219 + /* "DracoPy.pyx":138 * 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, 219, __pyx_L3_error) + __pyx_t_6 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 138, __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, 219, __pyx_L3_error) + __pyx_t_7 = PyNumber_Multiply(__pyx_t_6, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 138, __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, 219, __pyx_L3_error) + __pyx_t_8 = __Pyx_PyInt_As_size_t(__pyx_t_7); if (unlikely((__pyx_t_8 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 138, __pyx_L3_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_quant_origin = ((float *)PyMem_Malloc(__pyx_t_8)); - /* "DracoPy.pyx":220 + /* "DracoPy.pyx":139 * 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] * # binary_metadata = encode_metadata(metadata) */ - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 220, __pyx_L3_error) + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 139, __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, 220, __pyx_L3_error) + __pyx_t_9 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 139, __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, 220, __pyx_L3_error) + __pyx_t_10 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 139, __pyx_L3_error) } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; for (;;) { @@ -4475,17 +4478,17 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P 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, 220, __pyx_L3_error) + __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, 139, __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, 220, __pyx_L3_error) + __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 139, __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, 220, __pyx_L3_error) + __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, 139, __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, 220, __pyx_L3_error) + __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 139, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_7); #endif } @@ -4495,7 +4498,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 220, __pyx_L3_error) + else __PYX_ERR(0, 139, __pyx_L3_error) } break; } @@ -4504,21 +4507,21 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_7); __pyx_t_7 = 0; - /* "DracoPy.pyx":221 + /* "DracoPy.pyx":140 * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) * for dim in range(num_dims): * quant_origin[dim] = quantization_origin[dim] # <<<<<<<<<<<<<< * # binary_metadata = encode_metadata(metadata) * encoded_point_cloud = DracoPy.encode_point_cloud( */ - __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 221, __pyx_L3_error) + __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 140, __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, 221, __pyx_L3_error) + __pyx_t_11 = __pyx_PyFloat_AsFloat(__pyx_t_7); if (unlikely((__pyx_t_11 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 140, __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, 221, __pyx_L3_error) + __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 140, __pyx_L3_error) (__pyx_v_quant_origin[__pyx_t_12]) = __pyx_t_11; - /* "DracoPy.pyx":220 + /* "DracoPy.pyx":139 * if quantization_origin is not None: * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) * for dim in range(num_dims): # <<<<<<<<<<<<<< @@ -4528,7 +4531,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "DracoPy.pyx":218 + /* "DracoPy.pyx":137 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -4537,28 +4540,28 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ } - /* "DracoPy.pyx":224 + /* "DracoPy.pyx":143 * # binary_metadata = encode_metadata(metadata) * encoded_point_cloud = DracoPy.encode_point_cloud( * points, quantization_bits, compression_level, # <<<<<<<<<<<<<< * quantization_range, quant_origin, create_metadata) * if quant_origin != NULL: */ - __pyx_t_13 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 224, __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, 224, __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, 224, __pyx_L3_error) + __pyx_t_13 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 143, __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, 143, __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, 143, __pyx_L3_error) - /* "DracoPy.pyx":225 + /* "DracoPy.pyx":144 * 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) */ - __pyx_t_11 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_11 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 225, __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, 225, __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, 144, __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, 144, __pyx_L3_error) - /* "DracoPy.pyx":223 + /* "DracoPy.pyx":142 * quant_origin[dim] = quantization_origin[dim] * # binary_metadata = encode_metadata(metadata) * encoded_point_cloud = DracoPy.encode_point_cloud( # <<<<<<<<<<<<<< @@ -4569,11 +4572,11 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __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, 223, __pyx_L3_error) + __PYX_ERR(0, 142, __pyx_L3_error) } __pyx_v_encoded_point_cloud = __pyx_t_17; - /* "DracoPy.pyx":226 + /* "DracoPy.pyx":145 * points, quantization_bits, compression_level, * quantization_range, quant_origin, create_metadata) * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -4583,7 +4586,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_5 = ((__pyx_v_quant_origin != NULL) != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":227 + /* "DracoPy.pyx":146 * quantization_range, quant_origin, create_metadata) * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -4592,7 +4595,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":226 + /* "DracoPy.pyx":145 * points, quantization_bits, compression_level, * quantization_range, quant_origin, create_metadata) * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -4601,7 +4604,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ } - /* "DracoPy.pyx":228 + /* "DracoPy.pyx":147 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -4611,7 +4614,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P switch (__pyx_v_encoded_point_cloud.encode_status) { case DracoFunctions::successful_encoding: - /* "DracoPy.pyx":229 + /* "DracoPy.pyx":148 * PyMem_Free(quant_origin) * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: * return bytes(encoded_point_cloud.buffer) # <<<<<<<<<<<<<< @@ -4619,16 +4622,16 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P * raise EncodingFailedException('Invalid point cloud') */ __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, 229, __pyx_L3_error) + __pyx_t_6 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_encoded_point_cloud.buffer); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 148, __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, 229, __pyx_L3_error) + __pyx_t_7 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 148, __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":228 + /* "DracoPy.pyx":147 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -4638,14 +4641,14 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P break; case DracoFunctions::failed_during_encoding: - /* "DracoPy.pyx":231 + /* "DracoPy.pyx":150 * 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, 231, __pyx_L3_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 150, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_18 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -4659,14 +4662,14 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P } __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, 231, __pyx_L3_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 150, __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, 231, __pyx_L3_error) + __PYX_ERR(0, 150, __pyx_L3_error) - /* "DracoPy.pyx":230 + /* "DracoPy.pyx":149 * 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: # <<<<<<<<<<<<<< @@ -4677,7 +4680,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P default: break; } - /* "DracoPy.pyx":216 + /* "DracoPy.pyx":135 * """ * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -4694,7 +4697,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "DracoPy.pyx":232 + /* "DracoPy.pyx":151 * elif encoded_point_cloud.encode_status == DracoPy.encoding_status.failed_during_encoding: * raise EncodingFailedException('Invalid point cloud') * except EncodingFailedException: # <<<<<<<<<<<<<< @@ -4702,7 +4705,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P * 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, 232, __pyx_L5_except_error) + __Pyx_GetModuleGlobalName(__pyx_t_19, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 151, __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; @@ -4710,19 +4713,19 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __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, 232, __pyx_L5_except_error) + if (__Pyx_GetException(&__pyx_t_18, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 151, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_18); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); - /* "DracoPy.pyx":233 + /* "DracoPy.pyx":152 * 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, 233, __pyx_L5_except_error) + __Pyx_GetModuleGlobalName(__pyx_t_20, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 152, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_20); __pyx_t_21 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) { @@ -4736,15 +4739,15 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P } __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, 233, __pyx_L5_except_error) + if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 152, __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, 233, __pyx_L5_except_error) + __PYX_ERR(0, 152, __pyx_L5_except_error) } - /* "DracoPy.pyx":234 + /* "DracoPy.pyx":153 * except EncodingFailedException: * raise EncodingFailedException('Invalid point cloud') * except: # <<<<<<<<<<<<<< @@ -4753,12 +4756,12 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ /*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, 234, __pyx_L5_except_error) + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_18) < 0) __PYX_ERR(0, 153, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_18); - /* "DracoPy.pyx":235 + /* "DracoPy.pyx":154 * raise EncodingFailedException('Invalid point cloud') * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -4768,7 +4771,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_5 = ((__pyx_v_quant_origin != NULL) != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":236 + /* "DracoPy.pyx":155 * except: * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -4777,7 +4780,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":235 + /* "DracoPy.pyx":154 * raise EncodingFailedException('Invalid point cloud') * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -4786,22 +4789,22 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ } - /* "DracoPy.pyx":237 + /* "DracoPy.pyx":156 * 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, 237, __pyx_L5_except_error) + __pyx_t_19 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 156, __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, 237, __pyx_L5_except_error) + __PYX_ERR(0, 156, __pyx_L5_except_error) } __pyx_L5_except_error:; - /* "DracoPy.pyx":216 + /* "DracoPy.pyx":135 * """ * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -4822,7 +4825,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_L8_try_end:; } - /* "DracoPy.pyx":202 + /* "DracoPy.pyx":121 * raise ValueError("Input invalid") * * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< @@ -4850,7 +4853,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P return __pyx_r; } -/* "DracoPy.pyx":239 +/* "DracoPy.pyx":158 * raise ValueError("Input invalid") * * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< @@ -4884,29 +4887,29 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject int __pyx_clineno = 0; __Pyx_RefNannySetupContext("raise_decoding_error", 0); - /* "DracoPy.pyx":240 + /* "DracoPy.pyx":159 * * 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, 240, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::not_draco_encoded); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __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, 240, __pyx_L1_error) + __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, 159, __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, 240, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 159, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":241 + /* "DracoPy.pyx":160 * 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, 241, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FileTypeException); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { @@ -4920,14 +4923,14 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject } __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, 241, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 160, __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, 241, __pyx_L1_error) + __PYX_ERR(0, 160, __pyx_L1_error) - /* "DracoPy.pyx":240 + /* "DracoPy.pyx":159 * * def raise_decoding_error(decoding_status): * if decoding_status == DracoPy.decoding_status.not_draco_encoded: # <<<<<<<<<<<<<< @@ -4936,35 +4939,35 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":242 + /* "DracoPy.pyx":161 * 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, 242, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::failed_during_decoding); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 161, __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, 242, __pyx_L1_error) + __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, 161, __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, 242, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":243 + /* "DracoPy.pyx":162 * 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__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __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, 243, __pyx_L1_error) + __PYX_ERR(0, 162, __pyx_L1_error) - /* "DracoPy.pyx":242 + /* "DracoPy.pyx":161 * 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: # <<<<<<<<<<<<<< @@ -4973,35 +4976,35 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":244 + /* "DracoPy.pyx":163 * 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, 244, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::no_position_attribute); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __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, 244, __pyx_L1_error) + __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, 163, __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, 244, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 163, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":245 + /* "DracoPy.pyx":164 * 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): */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 245, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 164, __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, 245, __pyx_L1_error) + __PYX_ERR(0, 164, __pyx_L1_error) - /* "DracoPy.pyx":244 + /* "DracoPy.pyx":163 * 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: # <<<<<<<<<<<<<< @@ -5010,7 +5013,7 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":239 + /* "DracoPy.pyx":158 * raise ValueError("Input invalid") * * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< @@ -5033,7 +5036,7 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject return __pyx_r; } -/* "DracoPy.pyx":247 +/* "DracoPy.pyx":166 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer): # <<<<<<<<<<<<<< @@ -5072,24 +5075,24 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject int __pyx_clineno = 0; __Pyx_RefNannySetupContext("decode_buffer_to_mesh", 0); - /* "DracoPy.pyx":248 + /* "DracoPy.pyx":167 * * 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) */ - __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 248, __pyx_L1_error) - __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 248, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 167, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 167, __pyx_L1_error) try { __pyx_t_3 = DracoFunctions::decode_buffer(__pyx_t_1, __pyx_t_2); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 248, __pyx_L1_error) + __PYX_ERR(0, 167, __pyx_L1_error) } __pyx_v_mesh_struct = __pyx_t_3; - /* "DracoPy.pyx":249 + /* "DracoPy.pyx":168 * def decode_buffer_to_mesh(buffer): * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< @@ -5099,7 +5102,7 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject __pyx_t_4 = ((__pyx_v_mesh_struct.decode_status == DracoFunctions::successful) != 0); if (__pyx_t_4) { - /* "DracoPy.pyx":250 + /* "DracoPy.pyx":169 * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: * return DracoMesh(mesh_struct) # <<<<<<<<<<<<<< @@ -5107,9 +5110,9 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject * 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, 250, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_DracoMesh); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 169, __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, 250, __pyx_L1_error) + __pyx_t_7 = __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(__pyx_v_mesh_struct); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -5124,14 +5127,14 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject __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, 250, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 169, __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":249 + /* "DracoPy.pyx":168 * def decode_buffer_to_mesh(buffer): * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< @@ -5140,7 +5143,7 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":252 + /* "DracoPy.pyx":171 * return DracoMesh(mesh_struct) * else: * raise_decoding_error(mesh_struct.decode_status) # <<<<<<<<<<<<<< @@ -5148,9 +5151,9 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject * 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, 252, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_raise_decoding_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 171, __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, 252, __pyx_L1_error) + __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, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -5165,13 +5168,13 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject __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, 252, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 171, __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; } - /* "DracoPy.pyx":247 + /* "DracoPy.pyx":166 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer): # <<<<<<<<<<<<<< @@ -5195,7 +5198,7 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject return __pyx_r; } -/* "DracoPy.pyx":254 +/* "DracoPy.pyx":173 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer): # <<<<<<<<<<<<<< @@ -5234,24 +5237,24 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb int __pyx_clineno = 0; __Pyx_RefNannySetupContext("decode_point_cloud_buffer", 0); - /* "DracoPy.pyx":255 + /* "DracoPy.pyx":174 * * 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) */ - __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 255, __pyx_L1_error) - __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 255, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 174, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 174, __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, 255, __pyx_L1_error) + __PYX_ERR(0, 174, __pyx_L1_error) } __pyx_v_point_cloud_struct = __pyx_t_3; - /* "DracoPy.pyx":256 + /* "DracoPy.pyx":175 * 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: # <<<<<<<<<<<<<< @@ -5261,7 +5264,7 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb __pyx_t_4 = ((__pyx_v_point_cloud_struct.decode_status == DracoFunctions::successful) != 0); if (__pyx_t_4) { - /* "DracoPy.pyx":257 + /* "DracoPy.pyx":176 * 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) # <<<<<<<<<<<<<< @@ -5269,9 +5272,9 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb * raise_decoding_error(point_cloud_struct.decode_status) */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 257, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 176, __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, 257, __pyx_L1_error) + __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, 176, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -5286,14 +5289,14 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb __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, 257, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 176, __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":256 + /* "DracoPy.pyx":175 * 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: # <<<<<<<<<<<<<< @@ -5302,15 +5305,15 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb */ } - /* "DracoPy.pyx":259 + /* "DracoPy.pyx":178 * return DracoPointCloud(point_cloud_struct) * 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, 259, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_raise_decoding_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 178, __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, 259, __pyx_L1_error) + __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, 178, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -5325,13 +5328,13 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb __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, 259, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 178, __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; } - /* "DracoPy.pyx":254 + /* "DracoPy.pyx":173 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer): # <<<<<<<<<<<<<< @@ -6649,6 +6652,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_create_metadata, __pyx_k_create_metadata, sizeof(__pyx_k_create_metadata), 0, 0, 1, 1}, {&__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_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}, @@ -6657,7 +6661,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_dim, __pyx_k_dim, sizeof(__pyx_k_dim), 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_element_size, __pyx_k_element_size, sizeof(__pyx_k_element_size), 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}, @@ -6717,11 +6720,11 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {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, 90, __pyx_L1_error) - __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) __PYX_ERR(0, 108, __pyx_L1_error) - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 143, __pyx_L1_error) - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 150, __pyx_L1_error) - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 243, __pyx_L1_error) + __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, 27, __pyx_L1_error) + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 62, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 69, __pyx_L1_error) + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 162, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -6731,287 +6734,287 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "DracoPy.pyx":143 + /* "DracoPy.pyx":62 * 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_ = PyTuple_Pack(1, __pyx_kp_u_Specified_value_out_of_encoded_r); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 143, __pyx_L1_error) + __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_Specified_value_out_of_encoded_r); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_); - /* "DracoPy.pyx":200 + /* "DracoPy.pyx":119 * if quant_origin != NULL: * PyMem_Free(quant_origin) * raise ValueError("Input invalid") # <<<<<<<<<<<<<< * * def encode_point_cloud_to_buffer(points, */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_Input_invalid); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 200, __pyx_L1_error) + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_Input_invalid); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 119, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); - /* "DracoPy.pyx":243 + /* "DracoPy.pyx":162 * 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, 243, __pyx_L1_error) + __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_Failed_to_decode_input_mesh_Data); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); - /* "DracoPy.pyx":245 + /* "DracoPy.pyx":164 * 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): */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_DracoPy_only_supports_meshes_wit); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 245, __pyx_L1_error) + __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_DracoPy_only_supports_meshes_wit); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4); - /* "DracoPy.pyx":90 + /* "DracoPy.pyx":9 * * * class DracoPointCloud(object): # <<<<<<<<<<<<<< * def __init__(self, data_struct): * self.data_struct = data_struct */ - __pyx_tuple__5 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 90, __pyx_L1_error) + __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); - /* "DracoPy.pyx":91 + /* "DracoPy.pyx":10 * * class DracoPointCloud(object): * def __init__(self, data_struct): # <<<<<<<<<<<<<< * self.data_struct = data_struct * if data_struct['encoding_options_set']: */ - __pyx_tuple__6 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_data_struct); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 91, __pyx_L1_error) + __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, 91, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 91, __pyx_L1_error) + __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) - /* "DracoPy.pyx":100 + /* "DracoPy.pyx":19 * # self.metadata = decode_metadata(data_struct["binary_metadata"]) * * 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__8 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_value, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 100, __pyx_L1_error) + __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, 19, __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, 100, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 100, __pyx_L1_error) + __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, 19, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 19, __pyx_L1_error) - /* "DracoPy.pyx":104 + /* "DracoPy.pyx":23 * 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__10 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_point); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 104, __pyx_L1_error) + __pyx_tuple__10 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_point); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 23, __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, 104, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 104, __pyx_L1_error) + __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, 23, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 23, __pyx_L1_error) - /* "DracoPy.pyx":109 + /* "DracoPy.pyx":28 * * @property * def num_axes(self): # <<<<<<<<<<<<<< * return 3 * */ - __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 109, __pyx_L1_error) + __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 28, __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, 109, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 109, __pyx_L1_error) + __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, 28, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 28, __pyx_L1_error) - /* "DracoPy.pyx":113 + /* "DracoPy.pyx":32 * * @property * def points(self): # <<<<<<<<<<<<<< * return self.data_struct['points'] * */ - __pyx_tuple__14 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 113, __pyx_L1_error) + __pyx_tuple__14 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 32, __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, 113, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 113, __pyx_L1_error) + __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, 32, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 32, __pyx_L1_error) - /* "DracoPy.pyx":117 + /* "DracoPy.pyx":36 * * @property * def geometry_metadata(self) -> 'GeometryMetadataObject': # <<<<<<<<<<<<<< * return self.data_struct['geometry_metadata'] * */ - __pyx_tuple__16 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 117, __pyx_L1_error) + __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_geometry_metadata, 117, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 117, __pyx_L1_error) + __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_geometry_metadata, 36, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 36, __pyx_L1_error) - /* "DracoPy.pyx":121 + /* "DracoPy.pyx":40 * * @property * def attributes(self) -> List['PointAttributeObject']: # <<<<<<<<<<<<<< * return self.data_struct['attributes'] * */ - __pyx_tuple__18 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 121, __pyx_L1_error) + __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_attributes, 121, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 121, __pyx_L1_error) + __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_attributes, 40, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 40, __pyx_L1_error) - /* "DracoPy.pyx":127 + /* "DracoPy.pyx":46 * class DracoMesh(DracoPointCloud): * @property * def faces(self): # <<<<<<<<<<<<<< * return self.data_struct['faces'] * */ - __pyx_tuple__20 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 127, __pyx_L1_error) + __pyx_tuple__20 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__20); __Pyx_GIVEREF(__pyx_tuple__20); - __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_faces, 127, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 127, __pyx_L1_error) + __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_faces, 46, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 46, __pyx_L1_error) - /* "DracoPy.pyx":131 + /* "DracoPy.pyx":50 * * @property * def normals(self): # <<<<<<<<<<<<<< * return self.data_struct['normals'] * */ - __pyx_tuple__22 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 131, __pyx_L1_error) + __pyx_tuple__22 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__22); __Pyx_GIVEREF(__pyx_tuple__22); - __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_normals, 131, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 131, __pyx_L1_error) + __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_normals, 50, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 50, __pyx_L1_error) - /* "DracoPy.pyx":134 + /* "DracoPy.pyx":53 * return self.data_struct['normals'] * * class EncodingOptions(object): # <<<<<<<<<<<<<< * def __init__(self, quantization_bits, quantization_range, quantization_origin): * self.quantization_bits = quantization_bits */ - __pyx_tuple__24 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 134, __pyx_L1_error) + __pyx_tuple__24 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__24); __Pyx_GIVEREF(__pyx_tuple__24); - /* "DracoPy.pyx":135 + /* "DracoPy.pyx":54 * * class EncodingOptions(object): * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< * self.quantization_bits = quantization_bits * self.quantization_range = quantization_range */ - __pyx_tuple__25 = 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__25)) __PYX_ERR(0, 135, __pyx_L1_error) + __pyx_tuple__25 = 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__25)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__25); __Pyx_GIVEREF(__pyx_tuple__25); - __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(4, 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_init, 135, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 135, __pyx_L1_error) + __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(4, 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_init, 54, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 54, __pyx_L1_error) - /* "DracoPy.pyx":141 + /* "DracoPy.pyx":60 * 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__27 = 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__27)) __PYX_ERR(0, 141, __pyx_L1_error) + __pyx_tuple__27 = 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__27)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__27); __Pyx_GIVEREF(__pyx_tuple__27); - __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_get_encoded_coordinate, 141, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 141, __pyx_L1_error) + __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_get_encoded_coordinate, 60, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 60, __pyx_L1_error) - /* "DracoPy.pyx":148 + /* "DracoPy.pyx":67 * 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__29 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_point, __pyx_n_s_encoded_point, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_tuple__29 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_point, __pyx_n_s_encoded_point, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__29); __Pyx_GIVEREF(__pyx_tuple__29); - __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 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_get_encoded_point, 148, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 148, __pyx_L1_error) + __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 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_get_encoded_point, 67, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 67, __pyx_L1_error) - /* "DracoPy.pyx":155 + /* "DracoPy.pyx":74 * * @property * def num_axes(self): # <<<<<<<<<<<<<< * return 3 * */ - __pyx_tuple__31 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 155, __pyx_L1_error) + __pyx_tuple__31 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 74, __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_num_axes, 155, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 155, __pyx_L1_error) + __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_num_axes, 74, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 74, __pyx_L1_error) - /* "DracoPy.pyx":164 + /* "DracoPy.pyx":83 * pass * * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, */ - __pyx_tuple__33 = 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__33)) __PYX_ERR(0, 164, __pyx_L1_error) + __pyx_tuple__33 = 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__33)) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__33); __Pyx_GIVEREF(__pyx_tuple__33); - __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(7, 0, 11, 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_encode_mesh_to_buffer, 164, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 164, __pyx_L1_error) + __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(7, 0, 11, 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_encode_mesh_to_buffer, 83, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 83, __pyx_L1_error) - /* "DracoPy.pyx":202 + /* "DracoPy.pyx":121 * raise ValueError("Input invalid") * * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, */ - __pyx_tuple__35 = 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__35)) __PYX_ERR(0, 202, __pyx_L1_error) + __pyx_tuple__35 = 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__35)) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__35); __Pyx_GIVEREF(__pyx_tuple__35); - __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(6, 0, 10, 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_encode_point_cloud_to_buffer, 202, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 202, __pyx_L1_error) + __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(6, 0, 10, 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_encode_point_cloud_to_buffer, 121, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 121, __pyx_L1_error) - /* "DracoPy.pyx":239 + /* "DracoPy.pyx":158 * 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__37 = PyTuple_Pack(1, __pyx_n_s_decoding_status); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 239, __pyx_L1_error) + __pyx_tuple__37 = PyTuple_Pack(1, __pyx_n_s_decoding_status); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 158, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__37); __Pyx_GIVEREF(__pyx_tuple__37); - __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_raise_decoding_error, 239, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 239, __pyx_L1_error) + __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_raise_decoding_error, 158, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 158, __pyx_L1_error) - /* "DracoPy.pyx":247 + /* "DracoPy.pyx":166 * 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: */ - __pyx_tuple__39 = PyTuple_Pack(2, __pyx_n_s_buffer, __pyx_n_s_mesh_struct); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 247, __pyx_L1_error) + __pyx_tuple__39 = PyTuple_Pack(2, __pyx_n_s_buffer, __pyx_n_s_mesh_struct); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__39); __Pyx_GIVEREF(__pyx_tuple__39); - __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_buffer_to_mesh, 247, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 247, __pyx_L1_error) + __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_buffer_to_mesh, 166, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 166, __pyx_L1_error) - /* "DracoPy.pyx":254 + /* "DracoPy.pyx":173 * 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_tuple__41 = PyTuple_Pack(2, __pyx_n_s_buffer, __pyx_n_s_point_cloud_struct); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 254, __pyx_L1_error) + __pyx_tuple__41 = PyTuple_Pack(2, __pyx_n_s_buffer, __pyx_n_s_point_cloud_struct); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__41); __Pyx_GIVEREF(__pyx_tuple__41); - __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_point_cloud_buffer, 254, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 254, __pyx_L1_error) + __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_point_cloud_buffer, 173, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -7332,7 +7335,7 @@ if (!__Pyx_RefNanny) { * cimport DracoPy * from math import floor # <<<<<<<<<<<<<< * - * # + * */ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); @@ -7348,447 +7351,447 @@ if (!__Pyx_RefNanny) { __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":90 + /* "DracoPy.pyx":9 * * * class DracoPointCloud(object): # <<<<<<<<<<<<<< * def __init__(self, data_struct): * self.data_struct = data_struct */ - __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 90, __pyx_L1_error) + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__5, __pyx_n_s_DracoPointCloud, __pyx_n_s_DracoPointCloud, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error) + __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__5, __pyx_n_s_DracoPointCloud, __pyx_n_s_DracoPointCloud, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - /* "DracoPy.pyx":91 + /* "DracoPy.pyx":10 * * 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__7)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error) + __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_2, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 91, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 10, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":100 + /* "DracoPy.pyx":19 * # self.metadata = decode_metadata(data_struct["binary_metadata"]) * * 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__9)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 100, __pyx_L1_error) + __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, 19, __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, 100, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_get_encoded_coordinate, __pyx_t_3) < 0) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":104 + /* "DracoPy.pyx":23 * 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__11)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 104, __pyx_L1_error) + __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, 23, __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, 104, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_get_encoded_point, __pyx_t_3) < 0) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":109 + /* "DracoPy.pyx":28 * * @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__13)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 109, __pyx_L1_error) + __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, 28, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - /* "DracoPy.pyx":108 + /* "DracoPy.pyx":27 * 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, 108, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 27, __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, 109, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_num_axes, __pyx_t_4) < 0) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "DracoPy.pyx":113 + /* "DracoPy.pyx":32 * * @property * def points(self): # <<<<<<<<<<<<<< * return self.data_struct['points'] * */ - __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, 113, __pyx_L1_error) + __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, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - /* "DracoPy.pyx":112 + /* "DracoPy.pyx":31 * return 3 * * @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, 112, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 31, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_points, __pyx_t_3) < 0) __PYX_ERR(0, 113, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_points, __pyx_t_3) < 0) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":117 + /* "DracoPy.pyx":36 * * @property * def geometry_metadata(self) -> 'GeometryMetadataObject': # <<<<<<<<<<<<<< * return self.data_struct['geometry_metadata'] * */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 117, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_u_GeometryMetadataObject) < 0) __PYX_ERR(0, 117, __pyx_L1_error) - __pyx_t_4 = __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__17)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 117, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_u_GeometryMetadataObject) < 0) __PYX_ERR(0, 36, __pyx_L1_error) + __pyx_t_4 = __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__17)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":116 + /* "DracoPy.pyx":35 * return self.data_struct['points'] * * @property # <<<<<<<<<<<<<< * def geometry_metadata(self) -> 'GeometryMetadataObject': * return self.data_struct['geometry_metadata'] */ - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 116, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_geometry_metadata, __pyx_t_3) < 0) __PYX_ERR(0, 117, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_geometry_metadata, __pyx_t_3) < 0) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":121 + /* "DracoPy.pyx":40 * * @property * def attributes(self) -> List['PointAttributeObject']: # <<<<<<<<<<<<<< * return self.data_struct['attributes'] * */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_List); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 121, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_List); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_t_4, __pyx_n_u_PointAttributeObject); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_t_4, __pyx_n_u_PointAttributeObject); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_t_5) < 0) __PYX_ERR(0, 121, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_t_5) < 0) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_13attributes, 0, __pyx_n_s_DracoPointCloud_attributes, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__19)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 121, __pyx_L1_error) + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_13attributes, 0, __pyx_n_s_DracoPointCloud_attributes, 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); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":120 + /* "DracoPy.pyx":39 * return self.data_struct['geometry_metadata'] * * @property # <<<<<<<<<<<<<< * def attributes(self) -> List['PointAttributeObject']: * return self.data_struct['attributes'] */ - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 120, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_attributes, __pyx_t_3) < 0) __PYX_ERR(0, 121, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_attributes, __pyx_t_3) < 0) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":90 + /* "DracoPy.pyx":9 * * * class DracoPointCloud(object): # <<<<<<<<<<<<<< * def __init__(self, data_struct): * self.data_struct = data_struct */ - __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoPointCloud, __pyx_tuple__5, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 90, __pyx_L1_error) + __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoPointCloud, __pyx_tuple__5, __pyx_t_2, 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, 90, __pyx_L1_error) + 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_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":125 + /* "DracoPy.pyx":44 * * * class DracoMesh(DracoPointCloud): # <<<<<<<<<<<<<< * @property * def faces(self): */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 125, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __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, 125, __pyx_L1_error) + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __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_3)) __PYX_ERR(0, 125, __pyx_L1_error) + __pyx_t_3 = __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_3)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - /* "DracoPy.pyx":127 + /* "DracoPy.pyx":46 * class DracoMesh(DracoPointCloud): * @property * def faces(self): # <<<<<<<<<<<<<< * return self.data_struct['faces'] * */ - __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_9DracoMesh_1faces, 0, __pyx_n_s_DracoMesh_faces, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__21)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 127, __pyx_L1_error) + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_9DracoMesh_1faces, 0, __pyx_n_s_DracoMesh_faces, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__21)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - /* "DracoPy.pyx":126 + /* "DracoPy.pyx":45 * * class DracoMesh(DracoPointCloud): * @property # <<<<<<<<<<<<<< * def faces(self): * return self.data_struct['faces'] */ - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 126, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 45, __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_faces, __pyx_t_4) < 0) __PYX_ERR(0, 127, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_faces, __pyx_t_4) < 0) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "DracoPy.pyx":131 + /* "DracoPy.pyx":50 * * @property * def normals(self): # <<<<<<<<<<<<<< * return self.data_struct['normals'] * */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_9DracoMesh_3normals, 0, __pyx_n_s_DracoMesh_normals, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__23)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 131, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_9DracoMesh_3normals, 0, __pyx_n_s_DracoMesh_normals, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__23)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - /* "DracoPy.pyx":130 + /* "DracoPy.pyx":49 * return self.data_struct['faces'] * * @property # <<<<<<<<<<<<<< * def normals(self): * return self.data_struct['normals'] */ - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 130, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 49, __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_normals, __pyx_t_5) < 0) __PYX_ERR(0, 131, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_normals, __pyx_t_5) < 0) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "DracoPy.pyx":125 + /* "DracoPy.pyx":44 * * * class DracoMesh(DracoPointCloud): # <<<<<<<<<<<<<< * @property * def faces(self): */ - __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoMesh, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 125, __pyx_L1_error) + __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoMesh, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoMesh, __pyx_t_5) < 0) __PYX_ERR(0, 125, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoMesh, __pyx_t_5) < 0) __PYX_ERR(0, 44, __pyx_L1_error) __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_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":134 + /* "DracoPy.pyx":53 * return self.data_struct['normals'] * * 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__24); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error) + __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__24); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_tuple__24, __pyx_n_s_EncodingOptions, __pyx_n_s_EncodingOptions, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error) + __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_tuple__24, __pyx_n_s_EncodingOptions, __pyx_n_s_EncodingOptions, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - /* "DracoPy.pyx":135 + /* "DracoPy.pyx":54 * * class EncodingOptions(object): * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< * self.quantization_bits = quantization_bits * self.quantization_range = quantization_range */ - __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__26)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 135, __pyx_L1_error) + __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__26)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __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, 135, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":141 + /* "DracoPy.pyx":60 * 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_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__28)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 141, __pyx_L1_error) + __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__28)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 60, __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, 141, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_encoded_coordinate, __pyx_t_3) < 0) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":148 + /* "DracoPy.pyx":67 * 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_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__30)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error) + __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__30)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 67, __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, 148, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_encoded_point, __pyx_t_3) < 0) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":155 + /* "DracoPy.pyx":74 * * @property * def num_axes(self): # <<<<<<<<<<<<<< * return 3 * */ - __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__32)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 155, __pyx_L1_error) + __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__32)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - /* "DracoPy.pyx":154 + /* "DracoPy.pyx":73 * return encoded_point * * @property # <<<<<<<<<<<<<< * def num_axes(self): * return 3 */ - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 154, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_num_axes, __pyx_t_5) < 0) __PYX_ERR(0, 155, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_num_axes, __pyx_t_5) < 0) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "DracoPy.pyx":134 + /* "DracoPy.pyx":53 * return self.data_struct['normals'] * * class EncodingOptions(object): # <<<<<<<<<<<<<< * def __init__(self, quantization_bits, quantization_range, quantization_origin): * self.quantization_bits = quantization_bits */ - __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_EncodingOptions, __pyx_tuple__24, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 134, __pyx_L1_error) + __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_EncodingOptions, __pyx_tuple__24, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingOptions, __pyx_t_5) < 0) __PYX_ERR(0, 134, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingOptions, __pyx_t_5) < 0) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":158 + /* "DracoPy.pyx":77 * return 3 * * class FileTypeException(Exception): # <<<<<<<<<<<<<< * pass * */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 158, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __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, 158, __pyx_L1_error) + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __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_5)) __PYX_ERR(0, 158, __pyx_L1_error) + __pyx_t_5 = __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_5)) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_FileTypeException, __pyx_t_2, __pyx_t_5, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 158, __pyx_L1_error) + __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_FileTypeException, __pyx_t_2, __pyx_t_5, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_FileTypeException, __pyx_t_3) < 0) __PYX_ERR(0, 158, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_FileTypeException, __pyx_t_3) < 0) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":161 + /* "DracoPy.pyx":80 * pass * * class EncodingFailedException(Exception): # <<<<<<<<<<<<<< * pass * */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 161, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __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, 161, __pyx_L1_error) + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __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_5)) __PYX_ERR(0, 161, __pyx_L1_error) + __pyx_t_5 = __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_5)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_EncodingFailedException, __pyx_t_2, __pyx_t_5, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 161, __pyx_L1_error) + __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_EncodingFailedException, __pyx_t_2, __pyx_t_5, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingFailedException, __pyx_t_3) < 0) __PYX_ERR(0, 161, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingFailedException, __pyx_t_3) < 0) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":164 + /* "DracoPy.pyx":83 * pass * * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_1encode_mesh_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 164, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_1encode_mesh_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __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, 164, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_mesh_to_buffer, __pyx_t_2) < 0) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":202 + /* "DracoPy.pyx":121 * raise ValueError("Input invalid") * * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_3encode_point_cloud_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 202, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_3encode_point_cloud_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __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, 202, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_point_cloud_to_buffer, __pyx_t_2) < 0) __PYX_ERR(0, 121, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":239 + /* "DracoPy.pyx":158 * 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_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_5raise_decoding_error, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 239, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_5raise_decoding_error, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 158, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_raise_decoding_error, __pyx_t_2) < 0) __PYX_ERR(0, 239, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_raise_decoding_error, __pyx_t_2) < 0) __PYX_ERR(0, 158, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":247 + /* "DracoPy.pyx":166 * 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: */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_7decode_buffer_to_mesh, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 247, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_7decode_buffer_to_mesh, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 166, __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, 247, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode_buffer_to_mesh, __pyx_t_2) < 0) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":254 + /* "DracoPy.pyx":173 * 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_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_9decode_point_cloud_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 254, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_9decode_point_cloud_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __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, 254, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode_point_cloud_buffer, __pyx_t_2) < 0) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "DracoPy.pyx":1 @@ -10234,8 +10237,8 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu 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_uint32_t(s.element_size); if (unlikely(!member)) goto bad; - if (unlikely(PyDict_SetItem(res, __pyx_n_s_element_size, member) < 0)) goto bad; + 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; @@ -11145,6 +11148,44 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu } } +/* 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 */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC diff --git a/src/DracoPy.h b/src/DracoPy.h index d6901b4..31d86f1 100644 --- a/src/DracoPy.h +++ b/src/DracoPy.h @@ -1,5 +1,5 @@ -#include -#include +#include +#include #include #include @@ -11,8 +11,6 @@ #include "draco/point_cloud/point_cloud_builder.h" namespace DracoFunctions { - using namespace draco; - enum decoding_status { successful, not_draco_encoded, no_position_attribute, failed_during_decoding }; enum encoding_status { successful_encoding, failed_during_encoding }; @@ -28,7 +26,7 @@ namespace DracoFunctions { struct PointAttributeObject { std::unordered_map data; - uint32_t element_size; + draco::DataType datatype; uint32_t dimension; uint32_t unique_id; }; @@ -62,17 +60,17 @@ namespace DracoFunctions { encoding_status encode_status; }; - std::vector decode_attributes(const PointCloud& pc) { + std::vector decode_attributes(const draco::PointCloud& pc) { const int32_t attributes_len = pc.num_attributes(); std::vector attribute_objects(attributes_len); for (int i = 0; i < attributes_len; ++i) if (const auto* attribute = pc.attribute(i)) { attribute_objects[i].dimension = static_cast(attribute->num_components()); - attribute_objects[i].element_size = static_cast(attribute->byte_stride()); + attribute_objects[i].datatype = attribute->data_type(); attribute_objects[i].unique_id = static_cast(attribute->unique_id()); const auto value_size = attribute->num_components() * attribute->byte_stride(); - for (PointIndex v(0); v < attribute->indices_map_size(); ++v) { + for (draco::PointIndex v(0); v < attribute->indices_map_size(); ++v) { auto& value = attribute_objects[i].data[v.value()]; value.resize(value_size); attribute->GetMappedValue(v, value.data()); @@ -81,9 +79,9 @@ namespace DracoFunctions { return attribute_objects; } - void decode_metadata(const Metadata& metadata, MetadataObject& main_metadata_object) { + void decode_metadata(const draco::Metadata& metadata, MetadataObject& main_metadata_object) { main_metadata_object.tree_id = 0; - using MetadataPair = std::pair; + using MetadataPair = std::pair; std::vector to_parse_metadata = { {&metadata, &main_metadata_object} }; std::vector metadata_objects; uint32_t metadata_idx = 0; @@ -109,14 +107,14 @@ namespace DracoFunctions { } } - GeometryMetadataObject decode_geometry_metadata(const GeometryMetadata& geometry_metadata) { + GeometryMetadataObject decode_geometry_metadata(const draco::GeometryMetadata& geometry_metadata) { GeometryMetadataObject geometry_metadata_object; - decode_metadata(static_cast(geometry_metadata), + decode_metadata(static_cast(geometry_metadata), static_cast(geometry_metadata_object)); for (const auto& attribute_metadata: geometry_metadata.attribute_metadatas()) { AttributeMetadataObject attribute_metadata_object; attribute_metadata_object.unique_id = attribute_metadata->att_unique_id(); - decode_metadata(static_cast(*attribute_metadata.get()), + decode_metadata(static_cast(*attribute_metadata.get()), static_cast(attribute_metadata_object)); geometry_metadata_object.attribute_metadatas.push_back(std::move(attribute_metadata_object)); } @@ -125,9 +123,9 @@ namespace DracoFunctions { MeshObject decode_buffer(const char *buffer, std::size_t buffer_len) { MeshObject meshObject; - DecoderBuffer decoderBuffer; + draco::DecoderBuffer decoderBuffer; decoderBuffer.Init(buffer, buffer_len); - Decoder decoder; + draco::Decoder decoder; auto statusor = decoder.DecodeMeshFromBuffer(&decoderBuffer); if (!statusor.ok()) { std::string status_string = statusor.status().error_msg_string(); @@ -139,9 +137,9 @@ namespace DracoFunctions { } return meshObject; } - std::unique_ptr in_mesh = std::move(statusor).value(); - Mesh *mesh = in_mesh.get(); - const int pos_att_id = mesh->GetNamedAttributeId(GeometryAttribute::POSITION); + std::unique_ptr in_mesh = std::move(statusor).value(); + draco::Mesh *mesh = in_mesh.get(); + const int pos_att_id = mesh->GetNamedAttributeId(draco::GeometryAttribute::POSITION); if (pos_att_id < 0) { meshObject.decode_status = no_position_attribute; return meshObject; @@ -150,7 +148,7 @@ namespace DracoFunctions { meshObject.faces.reserve(3 * mesh->num_faces()); const auto *const pos_att = mesh->attribute(pos_att_id); std::array pos_val; - for (PointIndex v(0); v < mesh->num_points(); ++v) { + for (draco::PointIndex v(0); v < mesh->num_points(); ++v) { if (!pos_att->ConvertValue(pos_att->mapped_index(v), &pos_val[0])) { meshObject.decode_status = no_position_attribute; return meshObject; @@ -159,13 +157,13 @@ namespace DracoFunctions { meshObject.points.push_back(pos_val[1]); meshObject.points.push_back(pos_val[2]); } - for (FaceIndex i(0); i < mesh->num_faces(); ++i) { + for (draco::FaceIndex i(0); i < mesh->num_faces(); ++i) { const auto &f = mesh->face(i); meshObject.faces.push_back(*(reinterpret_cast(&(f[0])))); meshObject.faces.push_back(*(reinterpret_cast(&(f[1])))); meshObject.faces.push_back(*(reinterpret_cast(&(f[2])))); } - const GeometryMetadata *metadata = mesh->GetMetadata(); + const draco::GeometryMetadata *metadata = mesh->GetMetadata(); meshObject.encoding_options_set = false; if (metadata) { metadata->GetEntryInt("quantization_bits", &(meshObject.quantization_bits)); @@ -182,9 +180,9 @@ namespace DracoFunctions { PointCloudObject decode_buffer_to_point_cloud(const char *buffer, std::size_t buffer_len) { PointCloudObject pointCloudObject; - DecoderBuffer decoderBuffer; + draco::DecoderBuffer decoderBuffer; decoderBuffer.Init(buffer, buffer_len); - Decoder decoder; + draco::Decoder decoder; auto statusor = decoder.DecodePointCloudFromBuffer(&decoderBuffer); if (!statusor.ok()) { std::string status_string = statusor.status().error_msg_string(); @@ -196,9 +194,9 @@ namespace DracoFunctions { } return pointCloudObject; } - std::unique_ptr in_point_cloud = std::move(statusor).value(); - PointCloud *point_cloud = in_point_cloud.get(); - const int pos_att_id = point_cloud->GetNamedAttributeId(GeometryAttribute::POSITION); + std::unique_ptr in_point_cloud = std::move(statusor).value(); + draco::PointCloud *point_cloud = in_point_cloud.get(); + const int pos_att_id = point_cloud->GetNamedAttributeId(draco::GeometryAttribute::POSITION); if (pos_att_id < 0) { pointCloudObject.decode_status = no_position_attribute; return pointCloudObject; @@ -206,7 +204,7 @@ namespace DracoFunctions { pointCloudObject.points.reserve(3 * point_cloud->num_points()); const auto *const pos_att = point_cloud->attribute(pos_att_id); std::array pos_val; - for (PointIndex v(0); v < point_cloud->num_points(); ++v) { + for (draco::PointIndex v(0); v < point_cloud->num_points(); ++v) { if (!pos_att->ConvertValue(pos_att->mapped_index(v), &pos_val[0])) { pointCloudObject.decode_status = no_position_attribute; return pointCloudObject; @@ -215,7 +213,7 @@ namespace DracoFunctions { pointCloudObject.points.push_back(pos_val[1]); pointCloudObject.points.push_back(pos_val[2]); } - const GeometryMetadata *metadata = point_cloud->GetMetadata(); + const draco::GeometryMetadata *metadata = point_cloud->GetMetadata(); pointCloudObject.encoding_options_set = false; if (metadata) { metadata->GetEntryInt("quantization_bits", &(pointCloudObject.quantization_bits)); @@ -230,15 +228,15 @@ namespace DracoFunctions { return pointCloudObject; } - void setup_encoder_and_metadata(PointCloud *point_cloud_or_mesh, Encoder &encoder, int compression_level, int quantization_bits, float quantization_range, const float *quantization_origin, bool create_metadata) { + 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 GeometryMetadata()); + auto metadata = std::make_unique(); if (quantization_origin == NULL || quantization_range == -1) { - encoder.SetAttributeQuantization(GeometryAttribute::POSITION, quantization_bits); + encoder.SetAttributeQuantization(draco::GeometryAttribute::POSITION, quantization_bits); } else { - encoder.SetAttributeExplicitQuantization(GeometryAttribute::POSITION, quantization_bits, 3, quantization_origin, quantization_range); + 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; @@ -257,24 +255,27 @@ namespace DracoFunctions { 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) { - TriangleSoupMeshBuilder mb; + draco::TriangleSoupMeshBuilder mb; mb.Start(faces.size()); const int pos_att_id = - mb.AddAttribute(GeometryAttribute::POSITION, 3, 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, FaceIndex(i), Vector3f(points[point1Index], points[point1Index+1], points[point1Index+2]).data(), Vector3f(points[point2Index], points[point2Index+1], points[point2Index+2]).data(), 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(); - Mesh *mesh = ptr_mesh.get(); - Encoder encoder; + 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); - EncoderBuffer buffer; - const Status status = encoder.EncodeMeshToBuffer(*mesh, &buffer); + draco::EncoderBuffer buffer; + const draco::Status status = encoder.EncodeMeshToBuffer(*mesh, &buffer); EncodedObject encodedMeshObject; encodedMeshObject.buffer = *((std::vector *)buffer.buffer()); if (status.ok()) { @@ -289,21 +290,21 @@ namespace DracoFunctions { EncodedObject encode_point_cloud(const std::vector &points, int quantization_bits, int compression_level, float quantization_range, const float *quantization_origin, bool create_metadata) { int num_points = points.size() / 3; - PointCloudBuilder pcb; + draco::PointCloudBuilder pcb; pcb.Start(num_points); const int pos_att_id = - pcb.AddAttribute(GeometryAttribute::POSITION, 3, DataType::DT_FLOAT32); + pcb.AddAttribute(draco::GeometryAttribute::POSITION, 3, draco::DataType::DT_FLOAT32); - for (PointIndex i(0); i < num_points; i++) { + for (draco::PointIndex i(0); i < num_points; i++) { pcb.SetAttributeValueForPoint(pos_att_id, i, points.data() + 3 * i.value()); } - std::unique_ptr ptr_point_cloud = pcb.Finalize(true); - PointCloud *point_cloud = ptr_point_cloud.get(); - Encoder encoder; + 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); - EncoderBuffer buffer; - const Status status = encoder.EncodePointCloudToBuffer(*point_cloud, &buffer); + draco::EncoderBuffer buffer; + const draco::Status status = encoder.EncodePointCloudToBuffer(*point_cloud, &buffer); EncodedObject encodedPointCloudObject; encodedPointCloudObject.buffer = *((std::vector *)buffer.buffer()); if (status.ok()) { diff --git a/src/DracoPy.pxd b/src/DracoPy.pxd index 31d228b..5ab1f3b 100644 --- a/src/DracoPy.pxd +++ b/src/DracoPy.pxd @@ -4,6 +4,22 @@ 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": + cdef enum DataType: + DT_INVALID + DT_INT8 + DT_UINT8 + DT_INT16 + DT_UINT16 + DT_INT32 + DT_UINT32 + DT_INT64 + DT_UINT64 + DT_FLOAT32 + DT_FLOAT64 + DT_BOOL + DT_TYPES_COUNT + cdef extern from "DracoPy.h" namespace "DracoFunctions": @@ -27,7 +43,7 @@ cdef extern from "DracoPy.h" namespace "DracoFunctions": cdef struct PointAttributeObject: unordered_map[uint32_t, string] data - uint32_t element_size + DataType datatype uint32_t dimension uint32_t unique_id From 40ffd20a65ccfc31d55173d1049c0cf27bf5ed0f Mon Sep 17 00:00:00 2001 From: Andrey Romanov Date: Sat, 23 Oct 2021 02:40:22 +0300 Subject: [PATCH 07/21] support encoding too --- src/DracoPy.cpp | 13474 +++++++++++++++++++++++++++++++++------------- src/DracoPy.h | 203 +- src/DracoPy.pxd | 14 +- src/DracoPy.pyx | 12 +- 4 files changed, 9992 insertions(+), 3711 deletions(-) diff --git a/src/DracoPy.cpp b/src/DracoPy.cpp index 4616d47..f306baa 100644 --- a/src/DracoPy.cpp +++ b/src/DracoPy.cpp @@ -1209,6 +1209,63 @@ static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); #endif +/* IterFinish.proto */ +static CYTHON_INLINE int __Pyx_IterFinish(void); + +/* 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 + +/* 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 + /* ListCompAppend.proto */ #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { @@ -1391,6 +1448,7 @@ static void __Pyx_CppExn2PyErr() { 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_AttributeMetadataObject(struct DracoFunctions::AttributeMetadataObject 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_MetadataObject(struct DracoFunctions::MetadataObject 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 */ @@ -1399,9 +1457,18 @@ static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *); /* CIntFromPy.proto */ static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *); +/* CIntFromPy.proto */ +static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *); + /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); +/* CIntFromPy.proto */ +static CYTHON_INLINE enum DracoFunctions::decoding_status __Pyx_PyInt_As_enum__DracoFunctions_3a__3a_decoding_status(PyObject *); + +/* CIntFromPy.proto */ +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); @@ -1452,7 +1519,22 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'DracoPy' */ static std::vector __pyx_convert_vector_from_py_float(PyObject *); /*proto*/ static std::vector __pyx_convert_vector_from_py_uint32_t(PyObject *); /*proto*/ +static std::vector __pyx_convert_vector_from_py_unsigned_int(PyObject *); /*proto*/ +static std::vector __pyx_convert_vector_from_py_double(PyObject *); /*proto*/ +static std::string __pyx_convert_string_from_py_std__in_string(PyObject *); /*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::AttributeMetadataObject __pyx_convert__from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(PyObject *); /*proto*/ +static std::vector __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(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_struct__DracoFunctions_3a__3a_MetadataObject(PyObject *); /*proto*/ +static struct DracoFunctions::MeshObject __pyx_convert__from_py_struct__DracoFunctions_3a__3a_MeshObject(PyObject *); /*proto*/ static PyObject *__pyx_convert_vector_to_py_unsigned_char(const std::vector &); /*proto*/ +static struct DracoFunctions::PointCloudObject __pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointCloudObject(PyObject *); /*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*/ @@ -1463,9 +1545,10 @@ static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string 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_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 PyObject *__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(const std::vector &); /*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_AttributeMetadataObject(const std::vector &); /*proto*/ +static PyObject *__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_MetadataObject(const std::vector &); /*proto*/ #define __Pyx_MODULE_NAME "DracoPy" extern int __pyx_module_is_main_DracoPy; int __pyx_module_is_main_DracoPy = 0; @@ -1476,6 +1559,7 @@ static PyObject *__pyx_builtin_property; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_TypeError; +static PyObject *__pyx_builtin_KeyError; static const char __pyx_k_dim[] = "dim"; static const char __pyx_k_doc[] = "__doc__"; static const char __pyx_k_Dict[] = "Dict"; @@ -1504,7 +1588,7 @@ static const char __pyx_k_DracoPy[] = "DracoPy"; static const char __pyx_k_entries[] = "entries"; static const char __pyx_k_normals[] = "normals"; static const char __pyx_k_prepare[] = "__prepare__"; -static const char __pyx_k_tree_id[] = "tree_id"; +static const char __pyx_k_KeyError[] = "KeyError"; static const char __pyx_k_datatype[] = "datatype"; static const char __pyx_k_num_axes[] = "num_axes"; static const char __pyx_k_num_dims[] = "num_dims"; @@ -1513,13 +1597,17 @@ static const char __pyx_k_qualname[] = "__qualname__"; static const char __pyx_k_DracoMesh[] = "DracoMesh"; static const char __pyx_k_TypeError[] = "TypeError"; 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_unique_id[] = "unique_id"; static const char __pyx_k_ValueError[] = "ValueError"; static const char __pyx_k_attributes[] = "attributes"; static const char __pyx_k_difference[] = "difference"; static const char __pyx_k_data_struct[] = "data_struct"; +static const char __pyx_k_mesh_object[] = "mesh_object"; static const char __pyx_k_mesh_struct[] = "mesh_struct"; +static const char __pyx_k_metadata_id[] = "metadata_id"; static const char __pyx_k_Invalid_mesh[] = "Invalid mesh"; static const char __pyx_k_encoded_mesh[] = "encoded_mesh"; static const char __pyx_k_quant_origin[] = "quant_origin"; @@ -1527,6 +1615,7 @@ static const char __pyx_k_Input_invalid[] = "Input invalid"; static const char __pyx_k_decode_status[] = "decode_status"; static const char __pyx_k_encoded_point[] = "encoded_point"; static const char __pyx_k_inverse_alpha[] = "inverse_alpha"; +static const char __pyx_k_MetadataObject[] = "MetadataObject"; static const char __pyx_k_DracoMesh_faces[] = "DracoMesh.faces"; static const char __pyx_k_DracoPointCloud[] = "DracoPointCloud"; static const char __pyx_k_EncodingOptions[] = "EncodingOptions"; @@ -1543,6 +1632,7 @@ 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_cline_in_traceback[] = "cline_in_traceback"; +static const char __pyx_k_point_cloud_object[] = "point_cloud_object"; 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"; @@ -1562,6 +1652,7 @@ static const char __pyx_k_get_encoded_coordinate[] = "get_encoded_coordinate"; static const char __pyx_k_EncodingFailedException[] = "EncodingFailedException"; 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_DracoPointCloud_metadatas[] = "DracoPointCloud.metadatas"; static const char __pyx_k_decode_point_cloud_buffer[] = "decode_point_cloud_buffer"; static const char __pyx_k_DracoPointCloud_attributes[] = "DracoPointCloud.attributes"; static const char __pyx_k_encode_point_cloud_to_buffer[] = "encode_point_cloud_to_buffer"; @@ -1573,7 +1664,26 @@ static const char __pyx_k_DracoPy_only_supports_meshes_wit[] = "DracoPy only sup 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_No_value_specified_for_struct_at[] = "No value specified for struct attribute 'data'"; static const char __pyx_k_Specified_value_out_of_encoded_r[] = "Specified value out of encoded range"; +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 'unique_id'"; +static const char __pyx_k_No_value_specified_for_struct_at_5[] = "No value specified for struct attribute 'metadata_id'"; +static const char __pyx_k_No_value_specified_for_struct_at_6[] = "No value specified for struct attribute 'attribute_metadatas'"; +static const char __pyx_k_No_value_specified_for_struct_at_7[] = "No value specified for struct attribute 'entries'"; +static const char __pyx_k_No_value_specified_for_struct_at_8[] = "No value specified for struct attribute 'sub_metadata_ids'"; +static const char __pyx_k_No_value_specified_for_struct_at_9[] = "No value specified for struct attribute 'points'"; +static const char __pyx_k_No_value_specified_for_struct_at_10[] = "No value specified for struct attribute 'faces'"; +static const char __pyx_k_No_value_specified_for_struct_at_11[] = "No value specified for struct attribute 'normals'"; +static const char __pyx_k_No_value_specified_for_struct_at_12[] = "No value specified for struct attribute 'encoding_options_set'"; +static const char __pyx_k_No_value_specified_for_struct_at_13[] = "No value specified for struct attribute 'quantization_bits'"; +static const char __pyx_k_No_value_specified_for_struct_at_14[] = "No value specified for struct attribute 'quantization_range'"; +static const char __pyx_k_No_value_specified_for_struct_at_15[] = "No value specified for struct attribute 'quantization_origin'"; +static const char __pyx_k_No_value_specified_for_struct_at_16[] = "No value specified for struct attribute 'decode_status'"; +static const char __pyx_k_No_value_specified_for_struct_at_17[] = "No value specified for struct attribute 'attributes'"; +static const char __pyx_k_No_value_specified_for_struct_at_18[] = "No value specified for struct attribute 'geometry_metadata'"; +static const char __pyx_k_No_value_specified_for_struct_at_19[] = "No value specified for struct attribute 'metadatas'"; static PyObject *__pyx_n_s_Dict; static PyObject *__pyx_n_s_DracoMesh; static PyObject *__pyx_n_s_DracoMesh_faces; @@ -1584,6 +1694,7 @@ static PyObject *__pyx_n_s_DracoPointCloud_attributes; 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; @@ -1601,7 +1712,28 @@ 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_KeyError; static PyObject *__pyx_n_s_List; +static PyObject *__pyx_n_u_MetadataObject; +static PyObject *__pyx_kp_s_No_value_specified_for_struct_at; +static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_10; +static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_11; +static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_12; +static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_13; +static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_14; +static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_15; +static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_16; +static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_17; +static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_18; +static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_19; +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_kp_s_No_value_specified_for_struct_at_8; +static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_9; static PyObject *__pyx_n_u_PointAttributeObject; static PyObject *__pyx_kp_u_Specified_value_out_of_encoded_r; static PyObject *__pyx_n_s_TypeError; @@ -1644,10 +1776,15 @@ static PyObject *__pyx_n_s_get_encoded_point; static PyObject *__pyx_n_s_import; static PyObject *__pyx_n_s_init; static PyObject *__pyx_n_s_inverse_alpha; +static PyObject *__pyx_n_s_iteritems; static PyObject *__pyx_n_s_main; static PyObject *__pyx_n_s_math; +static PyObject *__pyx_n_s_mesh_object; static PyObject *__pyx_n_s_mesh_struct; static PyObject *__pyx_n_s_metaclass; +static PyObject *__pyx_n_s_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_normals; @@ -1656,6 +1793,7 @@ 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_point; +static PyObject *__pyx_n_s_point_cloud_object; static PyObject *__pyx_n_s_point_cloud_struct; static PyObject *__pyx_n_s_points; static PyObject *__pyx_n_u_points; @@ -1677,7 +1815,6 @@ static PyObject *__pyx_n_s_self; static PyObject *__pyx_kp_s_src_DracoPy_pyx; static PyObject *__pyx_n_s_sub_metadata_ids; static PyObject *__pyx_n_s_test; -static PyObject *__pyx_n_s_tree_id; static PyObject *__pyx_n_s_typing; static PyObject *__pyx_n_s_unique_id; static PyObject *__pyx_n_s_value; @@ -1688,14 +1825,15 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_6num_axes(CYTHON_UNUSED PyO 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_12attributes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_14metadatas(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_encode_mesh_to_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_points, PyObject *__pyx_v_faces, PyObject *__pyx_v_mesh_object, 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_point_cloud_object, 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 */ @@ -1711,14 +1849,23 @@ 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__17; static PyObject *__pyx_tuple__18; +static PyObject *__pyx_tuple__19; static PyObject *__pyx_tuple__20; +static PyObject *__pyx_tuple__21; static PyObject *__pyx_tuple__22; +static PyObject *__pyx_tuple__23; static PyObject *__pyx_tuple__24; static PyObject *__pyx_tuple__25; static PyObject *__pyx_tuple__27; @@ -1729,15 +1876,17 @@ static PyObject *__pyx_tuple__35; static PyObject *__pyx_tuple__37; static PyObject *__pyx_tuple__39; static PyObject *__pyx_tuple__41; -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_codeobj__21; -static PyObject *__pyx_codeobj__23; +static PyObject *__pyx_tuple__43; +static PyObject *__pyx_tuple__45; +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__62; static PyObject *__pyx_codeobj__26; static PyObject *__pyx_codeobj__28; static PyObject *__pyx_codeobj__30; @@ -1747,6 +1896,16 @@ static PyObject *__pyx_codeobj__36; static PyObject *__pyx_codeobj__38; static PyObject *__pyx_codeobj__40; static PyObject *__pyx_codeobj__42; +static PyObject *__pyx_codeobj__44; +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__61; +static PyObject *__pyx_codeobj__63; /* Late includes */ /* "DracoPy.pyx":10 @@ -2599,7 +2758,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_12attributes(CYTHON_UNUSED * def attributes(self) -> List['PointAttributeObject']: * return self.data_struct['attributes'] # <<<<<<<<<<<<<< * - * + * @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, 41, __pyx_L1_error) @@ -2631,7 +2790,76 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_12attributes(CYTHON_UNUSED return __pyx_r; } -/* "DracoPy.pyx":46 +/* "DracoPy.pyx":44 + * + * @property + * def metadatas(self) -> List['MetadataObject']: # <<<<<<<<<<<<<< + * return self.data_struct['metadatas'] + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_15metadatas(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_15DracoPointCloud_15metadatas = {"metadatas", (PyCFunction)__pyx_pw_7DracoPy_15DracoPointCloud_15metadatas, METH_O, 0}; +static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_15metadatas(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("metadatas (wrapper)", 0); + __pyx_r = __pyx_pf_7DracoPy_15DracoPointCloud_14metadatas(__pyx_self, ((PyObject *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_14metadatas(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":45 + * @property + * def metadatas(self) -> List['MetadataObject']: + * return self.data_struct['metadatas'] # <<<<<<<<<<<<<< + * + * + */ + __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, 45, __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, 45, __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":44 + * + * @property + * def metadatas(self) -> List['MetadataObject']: # <<<<<<<<<<<<<< + * return self.data_struct['metadatas'] + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("DracoPy.DracoPointCloud.metadatas", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "DracoPy.pyx":50 * class DracoMesh(DracoPointCloud): * @property * def faces(self): # <<<<<<<<<<<<<< @@ -2663,7 +2891,7 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_faces(CYTHON_UNUSED PyObject *__py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("faces", 0); - /* "DracoPy.pyx":47 + /* "DracoPy.pyx":51 * @property * def faces(self): * return self.data_struct['faces'] # <<<<<<<<<<<<<< @@ -2671,16 +2899,16 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_faces(CYTHON_UNUSED PyObject *__py * @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, 47, __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, 51, __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, 47, __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, 51, __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":46 + /* "DracoPy.pyx":50 * class DracoMesh(DracoPointCloud): * @property * def faces(self): # <<<<<<<<<<<<<< @@ -2700,7 +2928,7 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_faces(CYTHON_UNUSED PyObject *__py return __pyx_r; } -/* "DracoPy.pyx":50 +/* "DracoPy.pyx":54 * * @property * def normals(self): # <<<<<<<<<<<<<< @@ -2732,7 +2960,7 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_2normals(CYTHON_UNUSED PyObject *_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("normals", 0); - /* "DracoPy.pyx":51 + /* "DracoPy.pyx":55 * @property * def normals(self): * return self.data_struct['normals'] # <<<<<<<<<<<<<< @@ -2740,16 +2968,16 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_2normals(CYTHON_UNUSED PyObject *_ * 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, 51, __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, 55, __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, 51, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_normals); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __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":50 + /* "DracoPy.pyx":54 * * @property * def normals(self): # <<<<<<<<<<<<<< @@ -2769,7 +2997,7 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_2normals(CYTHON_UNUSED PyObject *_ return __pyx_r; } -/* "DracoPy.pyx":54 +/* "DracoPy.pyx":58 * * class EncodingOptions(object): * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< @@ -2818,23 +3046,23 @@ static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_1__init__(PyObject *__pyx_s 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, 54, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); __PYX_ERR(0, 58, __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, 54, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 2); __PYX_ERR(0, 58, __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("__init__", 1, 4, 4, 3); __PYX_ERR(0, 54, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 3); __PYX_ERR(0, 58, __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, 54, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 58, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; @@ -2851,7 +3079,7 @@ static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_1__init__(PyObject *__pyx_s } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 54, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 58, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("DracoPy.EncodingOptions.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -2874,52 +3102,52 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions___init__(CYTHON_UNUSED PyOb int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "DracoPy.pyx":55 + /* "DracoPy.pyx":59 * 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, 55, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_quantization_bits, __pyx_v_quantization_bits) < 0) __PYX_ERR(0, 59, __pyx_L1_error) - /* "DracoPy.pyx":56 + /* "DracoPy.pyx":60 * 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, 56, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_quantization_range, __pyx_v_quantization_range) < 0) __PYX_ERR(0, 60, __pyx_L1_error) - /* "DracoPy.pyx":57 + /* "DracoPy.pyx":61 * 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_origin, __pyx_v_quantization_origin) < 0) __PYX_ERR(0, 57, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin, __pyx_v_quantization_origin) < 0) __PYX_ERR(0, 61, __pyx_L1_error) - /* "DracoPy.pyx":58 + /* "DracoPy.pyx":62 * 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): */ - __pyx_t_1 = __Pyx_PyNumber_PowerOf2(__pyx_int_2, __pyx_v_quantization_bits, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 58, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyNumber_PowerOf2(__pyx_int_2, __pyx_v_quantization_bits, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __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, 58, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_SubtractObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __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, 58, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_quantization_range, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __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, 58, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_inverse_alpha, __pyx_t_1) < 0) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":54 + /* "DracoPy.pyx":58 * * class EncodingOptions(object): * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< @@ -2941,7 +3169,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions___init__(CYTHON_UNUSED PyOb return __pyx_r; } -/* "DracoPy.pyx":60 +/* "DracoPy.pyx":64 * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) * * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< @@ -2987,17 +3215,17 @@ static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_3get_encoded_coordinate(PyO 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, 60, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, 1); __PYX_ERR(0, 64, __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, 60, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, 2); __PYX_ERR(0, 64, __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, 60, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_encoded_coordinate") < 0)) __PYX_ERR(0, 64, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -3012,7 +3240,7 @@ static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_3get_encoded_coordinate(PyO } 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, 60, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 64, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("DracoPy.EncodingOptions.get_encoded_coordinate", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3041,60 +3269,60 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_2get_encoded_coordinate(CYT int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_encoded_coordinate", 0); - /* "DracoPy.pyx":61 + /* "DracoPy.pyx":65 * * 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_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __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, 61, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_axis); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __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, 61, __pyx_L1_error) + __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, 65, __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, 61, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 65, __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, 61, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __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, 61, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_axis); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __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, 61, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_range); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __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, 61, __pyx_L1_error) + __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 65, __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, 61, __pyx_L1_error) + __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, 65, __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, 61, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 65, __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":62 + /* "DracoPy.pyx":66 * 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, 62, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __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, 62, __pyx_L1_error) + __PYX_ERR(0, 66, __pyx_L1_error) - /* "DracoPy.pyx":61 + /* "DracoPy.pyx":65 * * def get_encoded_coordinate(self, value, axis): * if value < self.quantization_origin[axis] or value > (self.quantization_origin[axis] + self.quantization_range): # <<<<<<<<<<<<<< @@ -3103,39 +3331,39 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_2get_encoded_coordinate(CYT */ } - /* "DracoPy.pyx":63 + /* "DracoPy.pyx":67 * 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_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 63, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __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, 63, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_axis); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 67, __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, 63, __pyx_L1_error) + __pyx_t_2 = PyNumber_Subtract(__pyx_v_value, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __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":64 + /* "DracoPy.pyx":68 * 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_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_floor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_floor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 68, __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, 64, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_inverse_alpha); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 68, __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, 64, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_v_difference, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 68, __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, 64, __pyx_L1_error) + __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, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; @@ -3151,13 +3379,13 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_2get_encoded_coordinate(CYT __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, 64, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 68, __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":65 + /* "DracoPy.pyx":69 * 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) # <<<<<<<<<<<<<< @@ -3165,17 +3393,17 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_2get_encoded_coordinate(CYT * 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, 65, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __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, 65, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_axis); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 69, __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, 65, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_inverse_alpha); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __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, 65, __pyx_L1_error) + __pyx_t_3 = PyNumber_Multiply(__pyx_v_quantized_index, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __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, 65, __pyx_L1_error) + __pyx_t_2 = PyNumber_Add(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __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; @@ -3183,7 +3411,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_2get_encoded_coordinate(CYT __pyx_t_2 = 0; goto __pyx_L0; - /* "DracoPy.pyx":60 + /* "DracoPy.pyx":64 * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) * * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< @@ -3207,7 +3435,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_2get_encoded_coordinate(CYT return __pyx_r; } -/* "DracoPy.pyx":67 +/* "DracoPy.pyx":71 * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) * * def get_encoded_point(self, point): # <<<<<<<<<<<<<< @@ -3250,11 +3478,11 @@ static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_5get_encoded_point(PyObject 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, 67, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_point", 1, 2, 2, 1); __PYX_ERR(0, 71, __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, 67, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_encoded_point") < 0)) __PYX_ERR(0, 71, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -3267,7 +3495,7 @@ static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_5get_encoded_point(PyObject } 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, 67, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_point", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 71, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("DracoPy.EncodingOptions.get_encoded_point", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3300,37 +3528,37 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_encoded_point", 0); - /* "DracoPy.pyx":68 + /* "DracoPy.pyx":72 * * 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, 68, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_encoded_point = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":69 + /* "DracoPy.pyx":73 * 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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_num_axes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_num_axes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __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, 69, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __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, 69, __pyx_L1_error) + __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __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, 69, __pyx_L1_error) + __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 73, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; for (;;) { @@ -3338,17 +3566,17 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U 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, 69, __pyx_L1_error) + __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, 73, __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, 69, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __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, 69, __pyx_L1_error) + __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, 73, __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, 69, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif } @@ -3358,7 +3586,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 69, __pyx_L1_error) + else __PYX_ERR(0, 73, __pyx_L1_error) } break; } @@ -3367,16 +3595,16 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U __Pyx_XDECREF_SET(__pyx_v_axis, __pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":70 + /* "DracoPy.pyx":74 * 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, 70, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_encoded_coordinate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 74, __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, 70, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_point, __pyx_v_axis); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; __pyx_t_8 = 0; @@ -3393,7 +3621,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U #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, 70, __pyx_L1_error) + __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, 74, __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; @@ -3402,14 +3630,14 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U #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, 70, __pyx_L1_error) + __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, 74, __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, 70, __pyx_L1_error) + __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 74, __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; @@ -3420,15 +3648,15 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U __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, 70, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 74, __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, 70, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_encoded_point, __pyx_t_2); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":69 + /* "DracoPy.pyx":73 * def get_encoded_point(self, point): * encoded_point = [] * for axis in range(self.num_axes): # <<<<<<<<<<<<<< @@ -3438,7 +3666,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":71 + /* "DracoPy.pyx":75 * for axis in range(self.num_axes): * encoded_point.append(self.get_encoded_coordinate(point[axis], axis)) * return encoded_point # <<<<<<<<<<<<<< @@ -3450,7 +3678,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U __pyx_r = __pyx_v_encoded_point; goto __pyx_L0; - /* "DracoPy.pyx":67 + /* "DracoPy.pyx":71 * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) * * def get_encoded_point(self, point): # <<<<<<<<<<<<<< @@ -3476,7 +3704,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U return __pyx_r; } -/* "DracoPy.pyx":74 +/* "DracoPy.pyx":78 * * @property * def num_axes(self): # <<<<<<<<<<<<<< @@ -3503,7 +3731,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_6num_axes(CYTHON_UNUSED PyO __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("num_axes", 0); - /* "DracoPy.pyx":75 + /* "DracoPy.pyx":79 * @property * def num_axes(self): * return 3 # <<<<<<<<<<<<<< @@ -3515,7 +3743,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_6num_axes(CYTHON_UNUSED PyO __pyx_r = __pyx_int_3; goto __pyx_L0; - /* "DracoPy.pyx":74 + /* "DracoPy.pyx":78 * * @property * def num_axes(self): # <<<<<<<<<<<<<< @@ -3530,10 +3758,10 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_6num_axes(CYTHON_UNUSED PyO return __pyx_r; } -/* "DracoPy.pyx":83 +/* "DracoPy.pyx":87 * pass * - * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< + * def encode_mesh_to_buffer(points, faces, mesh_object, # <<<<<<<<<<<<<< * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, */ @@ -3545,6 +3773,7 @@ static PyMethodDef __pyx_mdef_7DracoPy_1encode_mesh_to_buffer = {"encode_mesh_to 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; + PyObject *__pyx_v_mesh_object = 0; PyObject *__pyx_v_quantization_bits = 0; PyObject *__pyx_v_compression_level = 0; PyObject *__pyx_v_quantization_range = 0; @@ -3557,33 +3786,35 @@ static PyObject *__pyx_pw_7DracoPy_1encode_mesh_to_buffer(PyObject *__pyx_self, __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); - - /* "DracoPy.pyx":85 - * def encode_mesh_to_buffer(points, faces, + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_points,&__pyx_n_s_faces,&__pyx_n_s_mesh_object,&__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[8] = {0,0,0,0,0,0,0,0}; + values[3] = ((PyObject *)__pyx_int_14); + values[4] = ((PyObject *)__pyx_int_1); + values[5] = ((PyObject *)__pyx_int_neg_1); + + /* "DracoPy.pyx":89 + * def encode_mesh_to_buffer(points, faces, mesh_object, * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, # <<<<<<<<<<<<<< * create_metadata=False): * """ */ - values[5] = ((PyObject *)Py_None); + values[6] = ((PyObject *)Py_None); - /* "DracoPy.pyx":86 + /* "DracoPy.pyx":90 * 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. */ - values[6] = ((PyObject *)Py_False); + values[7] = ((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 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + CYTHON_FALLTHROUGH; case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); @@ -3610,44 +3841,52 @@ static PyObject *__pyx_pw_7DracoPy_1encode_mesh_to_buffer(PyObject *__pyx_self, 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, 83, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 3, 8, 1); __PYX_ERR(0, 87, __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_mesh_object)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 3, 8, 2); __PYX_ERR(0, 87, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_compression_level); + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_bits); 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); + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_compression_level); 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); + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_range); 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); + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_origin); if (value) { values[6] = value; kw_args--; } } + CYTHON_FALLTHROUGH; + case 7: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_create_metadata); + if (value) { values[7] = 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, 83, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode_mesh_to_buffer") < 0)) __PYX_ERR(0, 87, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + CYTHON_FALLTHROUGH; case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); @@ -3657,8 +3896,7 @@ static PyObject *__pyx_pw_7DracoPy_1encode_mesh_to_buffer(PyObject *__pyx_self, 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[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; @@ -3666,26 +3904,27 @@ static PyObject *__pyx_pw_7DracoPy_1encode_mesh_to_buffer(PyObject *__pyx_self, } __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_mesh_object = values[2]; + __pyx_v_quantization_bits = values[3]; + __pyx_v_compression_level = values[4]; + __pyx_v_quantization_range = values[5]; + __pyx_v_quantization_origin = values[6]; + __pyx_v_create_metadata = values[7]; } 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, 83, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 3, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 87, __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_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_encode_mesh_to_buffer(__pyx_self, __pyx_v_points, __pyx_v_faces, __pyx_v_mesh_object, __pyx_v_quantization_bits, __pyx_v_compression_level, __pyx_v_quantization_range, __pyx_v_quantization_origin, __pyx_v_create_metadata); - /* "DracoPy.pyx":83 + /* "DracoPy.pyx":87 * pass * - * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< + * def encode_mesh_to_buffer(points, faces, mesh_object, # <<<<<<<<<<<<<< * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, */ @@ -3695,7 +3934,7 @@ static PyObject *__pyx_pw_7DracoPy_1encode_mesh_to_buffer(PyObject *__pyx_self, 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) { +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_mesh_object, 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; @@ -3716,20 +3955,21 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject Py_ssize_t __pyx_t_12; std::vector __pyx_t_13; std::vector __pyx_t_14; - int __pyx_t_15; + struct DracoFunctions::MeshObject __pyx_t_15; int __pyx_t_16; - bool __pyx_t_17; - struct DracoFunctions::EncodedObject __pyx_t_18; - PyObject *__pyx_t_19 = NULL; + int __pyx_t_17; + bool __pyx_t_18; + struct DracoFunctions::EncodedObject __pyx_t_19; PyObject *__pyx_t_20 = NULL; PyObject *__pyx_t_21 = NULL; PyObject *__pyx_t_22 = NULL; + PyObject *__pyx_t_23 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("encode_mesh_to_buffer", 0); - /* "DracoPy.pyx":96 + /* "DracoPy.pyx":100 * a point where each coordinate is the minimum of that coordinate among the input vertices. * """ * cdef float* quant_origin = NULL # <<<<<<<<<<<<<< @@ -3738,7 +3978,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ __pyx_v_quant_origin = NULL; - /* "DracoPy.pyx":97 + /* "DracoPy.pyx":101 * """ * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -3754,7 +3994,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { - /* "DracoPy.pyx":98 + /* "DracoPy.pyx":102 * cdef float* quant_origin = NULL * try: * num_dims = 3 # <<<<<<<<<<<<<< @@ -3764,7 +4004,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_INCREF(__pyx_int_3); __pyx_v_num_dims = __pyx_int_3; - /* "DracoPy.pyx":99 + /* "DracoPy.pyx":103 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -3775,38 +4015,38 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_5 = (__pyx_t_4 != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":100 + /* "DracoPy.pyx":104 * 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, 100, __pyx_L3_error) + __pyx_t_6 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 104, __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, 100, __pyx_L3_error) + __pyx_t_7 = PyNumber_Multiply(__pyx_t_6, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 104, __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, 100, __pyx_L3_error) + __pyx_t_8 = __Pyx_PyInt_As_size_t(__pyx_t_7); if (unlikely((__pyx_t_8 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L3_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_quant_origin = ((float *)PyMem_Malloc(__pyx_t_8)); - /* "DracoPy.pyx":101 + /* "DracoPy.pyx":105 * 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] * # binary_metadata = encode_metadata(metadata) */ - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 101, __pyx_L3_error) + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 105, __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, 101, __pyx_L3_error) + __pyx_t_9 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 105, __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, 101, __pyx_L3_error) + __pyx_t_10 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 105, __pyx_L3_error) } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; for (;;) { @@ -3814,17 +4054,17 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject 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, 101, __pyx_L3_error) + __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, 105, __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, 101, __pyx_L3_error) + __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 105, __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, 101, __pyx_L3_error) + __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, 105, __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, 101, __pyx_L3_error) + __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 105, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_7); #endif } @@ -3834,7 +4074,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 101, __pyx_L3_error) + else __PYX_ERR(0, 105, __pyx_L3_error) } break; } @@ -3843,21 +4083,21 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_7); __pyx_t_7 = 0; - /* "DracoPy.pyx":102 + /* "DracoPy.pyx":106 * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) * for dim in range(num_dims): * quant_origin[dim] = quantization_origin[dim] # <<<<<<<<<<<<<< * # binary_metadata = encode_metadata(metadata) - * encoded_mesh = DracoPy.encode_mesh(points, faces, + * encoded_mesh = DracoPy.encode_mesh(points, faces, mesh_object, */ - __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 102, __pyx_L3_error) + __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 106, __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, 102, __pyx_L3_error) + __pyx_t_11 = __pyx_PyFloat_AsFloat(__pyx_t_7); if (unlikely((__pyx_t_11 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 106, __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, 102, __pyx_L3_error) + __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 106, __pyx_L3_error) (__pyx_v_quant_origin[__pyx_t_12]) = __pyx_t_11; - /* "DracoPy.pyx":101 + /* "DracoPy.pyx":105 * if quantization_origin is not None: * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) * for dim in range(num_dims): # <<<<<<<<<<<<<< @@ -3867,7 +4107,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "DracoPy.pyx":99 + /* "DracoPy.pyx":103 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -3876,60 +4116,61 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":104 + /* "DracoPy.pyx":108 * quant_origin[dim] = quantization_origin[dim] * # binary_metadata = encode_metadata(metadata) - * encoded_mesh = DracoPy.encode_mesh(points, faces, # <<<<<<<<<<<<<< + * encoded_mesh = DracoPy.encode_mesh(points, faces, mesh_object, # <<<<<<<<<<<<<< * quantization_bits, compression_level, * quantization_range, quant_origin, */ - __pyx_t_13 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L3_error) - __pyx_t_14 = __pyx_convert_vector_from_py_uint32_t(__pyx_v_faces); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L3_error) + __pyx_t_13 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L3_error) + __pyx_t_14 = __pyx_convert_vector_from_py_uint32_t(__pyx_v_faces); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L3_error) + __pyx_t_15 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_MeshObject(__pyx_v_mesh_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L3_error) - /* "DracoPy.pyx":105 + /* "DracoPy.pyx":109 * # binary_metadata = encode_metadata(metadata) - * encoded_mesh = DracoPy.encode_mesh(points, faces, + * encoded_mesh = DracoPy.encode_mesh(points, faces, mesh_object, * quantization_bits, compression_level, # <<<<<<<<<<<<<< * quantization_range, quant_origin, * create_metadata) */ - __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 105, __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, 105, __pyx_L3_error) + __pyx_t_16 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 109, __pyx_L3_error) + __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 109, __pyx_L3_error) - /* "DracoPy.pyx":106 - * encoded_mesh = DracoPy.encode_mesh(points, faces, + /* "DracoPy.pyx":110 + * encoded_mesh = DracoPy.encode_mesh(points, faces, mesh_object, * quantization_bits, compression_level, * quantization_range, quant_origin, # <<<<<<<<<<<<<< * create_metadata) * if quant_origin != NULL: */ - __pyx_t_11 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_11 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 106, __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, 110, __pyx_L3_error) - /* "DracoPy.pyx":107 + /* "DracoPy.pyx":111 * quantization_bits, compression_level, * quantization_range, quant_origin, * create_metadata) # <<<<<<<<<<<<<< * if quant_origin != NULL: * PyMem_Free(quant_origin) */ - __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_17 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L3_error) + __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_18 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 111, __pyx_L3_error) - /* "DracoPy.pyx":104 + /* "DracoPy.pyx":108 * quant_origin[dim] = quantization_origin[dim] * # binary_metadata = encode_metadata(metadata) - * encoded_mesh = DracoPy.encode_mesh(points, faces, # <<<<<<<<<<<<<< + * encoded_mesh = DracoPy.encode_mesh(points, faces, mesh_object, # <<<<<<<<<<<<<< * quantization_bits, compression_level, * quantization_range, quant_origin, */ 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); + __pyx_t_19 = DracoFunctions::encode_mesh(__pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_11, __pyx_v_quant_origin, __pyx_t_18); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 104, __pyx_L3_error) + __PYX_ERR(0, 108, __pyx_L3_error) } - __pyx_v_encoded_mesh = __pyx_t_18; + __pyx_v_encoded_mesh = __pyx_t_19; - /* "DracoPy.pyx":108 + /* "DracoPy.pyx":112 * quantization_range, quant_origin, * create_metadata) * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -3939,7 +4180,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_5 = ((__pyx_v_quant_origin != NULL) != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":109 + /* "DracoPy.pyx":113 * create_metadata) * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -3948,7 +4189,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":108 + /* "DracoPy.pyx":112 * quantization_range, quant_origin, * create_metadata) * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -3957,7 +4198,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":110 + /* "DracoPy.pyx":114 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -3967,7 +4208,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject switch (__pyx_v_encoded_mesh.encode_status) { case DracoFunctions::successful_encoding: - /* "DracoPy.pyx":111 + /* "DracoPy.pyx":115 * PyMem_Free(quant_origin) * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: * return bytes(encoded_mesh.buffer) # <<<<<<<<<<<<<< @@ -3975,16 +4216,16 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject * 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, 111, __pyx_L3_error) + __pyx_t_6 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_encoded_mesh.buffer); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 115, __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, 111, __pyx_L3_error) + __pyx_t_7 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 115, __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":110 + /* "DracoPy.pyx":114 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -3994,35 +4235,35 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject break; case DracoFunctions::failed_during_encoding: - /* "DracoPy.pyx":113 + /* "DracoPy.pyx":117 * 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, 113, __pyx_L3_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 117, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_19 = NULL; + __pyx_t_20 = 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)) { + __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_20)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_19); + __Pyx_INCREF(__pyx_t_20); __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, 113, __pyx_L3_error) + __pyx_t_7 = (__pyx_t_20) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_20, __pyx_kp_u_Invalid_mesh) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_u_Invalid_mesh); + __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 117, __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, 113, __pyx_L3_error) + __PYX_ERR(0, 117, __pyx_L3_error) - /* "DracoPy.pyx":112 + /* "DracoPy.pyx":116 * 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: # <<<<<<<<<<<<<< @@ -4033,7 +4274,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject default: break; } - /* "DracoPy.pyx":97 + /* "DracoPy.pyx":101 * """ * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -4046,61 +4287,61 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __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_20); __pyx_t_20 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "DracoPy.pyx":114 + /* "DracoPy.pyx":118 * 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, 114, __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_ErrFetch(&__pyx_t_7, &__pyx_t_6, &__pyx_t_20); + __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 118, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_21); + __pyx_t_17 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_7, __pyx_t_21); + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __Pyx_ErrRestore(__pyx_t_7, __pyx_t_6, __pyx_t_20); + __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_20 = 0; + if (__pyx_t_17) { __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, 114, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_19); + if (__Pyx_GetException(&__pyx_t_20, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 118, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_20); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); - /* "DracoPy.pyx":115 + /* "DracoPy.pyx":119 * 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, 115, __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_GetModuleGlobalName(__pyx_t_22, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 119, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_22); + __pyx_t_23 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_22))) { + __pyx_t_23 = PyMethod_GET_SELF(__pyx_t_22); + if (likely(__pyx_t_23)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_22); + __Pyx_INCREF(__pyx_t_23); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_21, function); + __Pyx_DECREF_SET(__pyx_t_22, 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, 115, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_20); + __pyx_t_21 = (__pyx_t_23) ? __Pyx_PyObject_Call2Args(__pyx_t_22, __pyx_t_23, __pyx_kp_u_Invalid_mesh) : __Pyx_PyObject_CallOneArg(__pyx_t_22, __pyx_kp_u_Invalid_mesh); + __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0; + if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 119, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_21); + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + __Pyx_Raise(__pyx_t_21, 0, 0, 0); __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, 115, __pyx_L5_except_error) + __PYX_ERR(0, 119, __pyx_L5_except_error) } - /* "DracoPy.pyx":116 + /* "DracoPy.pyx":120 * except EncodingFailedException: * raise EncodingFailedException('Invalid mesh') * except: # <<<<<<<<<<<<<< @@ -4109,12 +4350,12 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ /*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, 116, __pyx_L5_except_error) + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_20) < 0) __PYX_ERR(0, 120, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_19); + __Pyx_GOTREF(__pyx_t_20); - /* "DracoPy.pyx":117 + /* "DracoPy.pyx":121 * raise EncodingFailedException('Invalid mesh') * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -4124,7 +4365,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_5 = ((__pyx_v_quant_origin != NULL) != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":118 + /* "DracoPy.pyx":122 * except: * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -4133,7 +4374,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":117 + /* "DracoPy.pyx":121 * raise EncodingFailedException('Invalid mesh') * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -4142,22 +4383,22 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":119 + /* "DracoPy.pyx":123 * if quant_origin != NULL: * PyMem_Free(quant_origin) * raise ValueError("Input invalid") # <<<<<<<<<<<<<< * - * def encode_point_cloud_to_buffer(points, + * def encode_point_cloud_to_buffer(points, point_cloud_object, */ - __pyx_t_20 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 119, __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, 119, __pyx_L5_except_error) + __pyx_t_21 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 123, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_21); + __Pyx_Raise(__pyx_t_21, 0, 0, 0); + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __PYX_ERR(0, 123, __pyx_L5_except_error) } __pyx_L5_except_error:; - /* "DracoPy.pyx":97 + /* "DracoPy.pyx":101 * """ * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -4178,10 +4419,10 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_L8_try_end:; } - /* "DracoPy.pyx":83 + /* "DracoPy.pyx":87 * pass * - * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< + * def encode_mesh_to_buffer(points, faces, mesh_object, # <<<<<<<<<<<<<< * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, */ @@ -4192,10 +4433,10 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __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_XDECREF(__pyx_t_23); __Pyx_AddTraceback("DracoPy.encode_mesh_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -4206,10 +4447,10 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject return __pyx_r; } -/* "DracoPy.pyx":121 +/* "DracoPy.pyx":125 * raise ValueError("Input invalid") * - * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< + * def encode_point_cloud_to_buffer(points, point_cloud_object, # <<<<<<<<<<<<<< * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, */ @@ -4220,6 +4461,7 @@ static char __pyx_doc_7DracoPy_2encode_point_cloud_to_buffer[] = "\n Encode a 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_point_cloud_object = 0; PyObject *__pyx_v_quantization_bits = 0; PyObject *__pyx_v_compression_level = 0; PyObject *__pyx_v_quantization_range = 0; @@ -4232,33 +4474,35 @@ static PyObject *__pyx_pw_7DracoPy_3encode_point_cloud_to_buffer(PyObject *__pyx __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":123 - * def encode_point_cloud_to_buffer(points, + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_points,&__pyx_n_s_point_cloud_object,&__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); + + /* "DracoPy.pyx":127 + * def encode_point_cloud_to_buffer(points, point_cloud_object, * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, # <<<<<<<<<<<<<< * create_metadata=False): * """ */ - values[4] = ((PyObject *)Py_None); + values[5] = ((PyObject *)Py_None); - /* "DracoPy.pyx":124 + /* "DracoPy.pyx":128 * 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. */ - values[5] = ((PyObject *)Py_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); @@ -4281,40 +4525,48 @@ static PyObject *__pyx_pw_7DracoPy_3encode_point_cloud_to_buffer(PyObject *__pyx 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_point_cloud_object)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("encode_point_cloud_to_buffer", 0, 2, 7, 1); __PYX_ERR(0, 125, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_compression_level); + 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_quantization_range); + 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_origin); + 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_create_metadata); + 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_point_cloud_to_buffer") < 0)) __PYX_ERR(0, 121, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode_point_cloud_to_buffer") < 0)) __PYX_ERR(0, 125, __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); @@ -4324,33 +4576,33 @@ static PyObject *__pyx_pw_7DracoPy_3encode_point_cloud_to_buffer(PyObject *__pyx 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); + 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]; + __pyx_v_point_cloud_object = 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]; } 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, 121, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode_point_cloud_to_buffer", 0, 2, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 125, __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_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_2encode_point_cloud_to_buffer(__pyx_self, __pyx_v_points, __pyx_v_point_cloud_object, __pyx_v_quantization_bits, __pyx_v_compression_level, __pyx_v_quantization_range, __pyx_v_quantization_origin, __pyx_v_create_metadata); - /* "DracoPy.pyx":121 + /* "DracoPy.pyx":125 * raise ValueError("Input invalid") * - * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< + * def encode_point_cloud_to_buffer(points, point_cloud_object, # <<<<<<<<<<<<<< * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, */ @@ -4360,7 +4612,7 @@ static PyObject *__pyx_pw_7DracoPy_3encode_point_cloud_to_buffer(PyObject *__pyx 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) { +static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_points, PyObject *__pyx_v_point_cloud_object, 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; @@ -4380,20 +4632,21 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P float __pyx_t_11; Py_ssize_t __pyx_t_12; std::vector __pyx_t_13; - int __pyx_t_14; + struct DracoFunctions::PointCloudObject __pyx_t_14; int __pyx_t_15; - bool __pyx_t_16; - struct DracoFunctions::EncodedObject __pyx_t_17; - PyObject *__pyx_t_18 = NULL; + 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_point_cloud_to_buffer", 0); - /* "DracoPy.pyx":134 + /* "DracoPy.pyx":138 * a point where each coordinate is the minimum of that coordinate among the input vertices. * """ * cdef float* quant_origin = NULL # <<<<<<<<<<<<<< @@ -4402,7 +4655,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ __pyx_v_quant_origin = NULL; - /* "DracoPy.pyx":135 + /* "DracoPy.pyx":139 * """ * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -4418,7 +4671,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { - /* "DracoPy.pyx":136 + /* "DracoPy.pyx":140 * cdef float* quant_origin = NULL * try: * num_dims = 3 # <<<<<<<<<<<<<< @@ -4428,7 +4681,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_INCREF(__pyx_int_3); __pyx_v_num_dims = __pyx_int_3; - /* "DracoPy.pyx":137 + /* "DracoPy.pyx":141 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -4439,38 +4692,38 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_5 = (__pyx_t_4 != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":138 + /* "DracoPy.pyx":142 * 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, 138, __pyx_L3_error) + __pyx_t_6 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 142, __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, 138, __pyx_L3_error) + __pyx_t_7 = PyNumber_Multiply(__pyx_t_6, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 142, __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, 138, __pyx_L3_error) + __pyx_t_8 = __Pyx_PyInt_As_size_t(__pyx_t_7); if (unlikely((__pyx_t_8 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 142, __pyx_L3_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_quant_origin = ((float *)PyMem_Malloc(__pyx_t_8)); - /* "DracoPy.pyx":139 + /* "DracoPy.pyx":143 * 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] * # binary_metadata = encode_metadata(metadata) */ - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 139, __pyx_L3_error) + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 143, __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, 139, __pyx_L3_error) + __pyx_t_9 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 143, __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, 139, __pyx_L3_error) + __pyx_t_10 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 143, __pyx_L3_error) } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; for (;;) { @@ -4478,17 +4731,17 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P 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, 139, __pyx_L3_error) + __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, 143, __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, 139, __pyx_L3_error) + __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 143, __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, 139, __pyx_L3_error) + __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, 143, __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, 139, __pyx_L3_error) + __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 143, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_7); #endif } @@ -4498,7 +4751,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 139, __pyx_L3_error) + else __PYX_ERR(0, 143, __pyx_L3_error) } break; } @@ -4507,21 +4760,21 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_7); __pyx_t_7 = 0; - /* "DracoPy.pyx":140 + /* "DracoPy.pyx":144 * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) * for dim in range(num_dims): * quant_origin[dim] = quantization_origin[dim] # <<<<<<<<<<<<<< * # binary_metadata = encode_metadata(metadata) * encoded_point_cloud = DracoPy.encode_point_cloud( */ - __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 140, __pyx_L3_error) + __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 144, __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, 140, __pyx_L3_error) + __pyx_t_11 = __pyx_PyFloat_AsFloat(__pyx_t_7); if (unlikely((__pyx_t_11 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 144, __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, 140, __pyx_L3_error) + __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 144, __pyx_L3_error) (__pyx_v_quant_origin[__pyx_t_12]) = __pyx_t_11; - /* "DracoPy.pyx":139 + /* "DracoPy.pyx":143 * if quantization_origin is not None: * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) * for dim in range(num_dims): # <<<<<<<<<<<<<< @@ -4531,7 +4784,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "DracoPy.pyx":137 + /* "DracoPy.pyx":141 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -4540,44 +4793,45 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ } - /* "DracoPy.pyx":143 + /* "DracoPy.pyx":147 * # binary_metadata = encode_metadata(metadata) * encoded_point_cloud = DracoPy.encode_point_cloud( - * points, quantization_bits, compression_level, # <<<<<<<<<<<<<< + * points, point_cloud_object, quantization_bits, compression_level, # <<<<<<<<<<<<<< * quantization_range, quant_origin, create_metadata) * if quant_origin != NULL: */ - __pyx_t_13 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 143, __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, 143, __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, 143, __pyx_L3_error) + __pyx_t_13 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 147, __pyx_L3_error) + __pyx_t_14 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointCloudObject(__pyx_v_point_cloud_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 147, __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, 147, __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, 147, __pyx_L3_error) - /* "DracoPy.pyx":144 + /* "DracoPy.pyx":148 * encoded_point_cloud = DracoPy.encode_point_cloud( - * points, quantization_bits, compression_level, + * points, point_cloud_object, quantization_bits, compression_level, * quantization_range, quant_origin, create_metadata) # <<<<<<<<<<<<<< * if quant_origin != NULL: * PyMem_Free(quant_origin) */ - __pyx_t_11 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_11 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 144, __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, 144, __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, 148, __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, 148, __pyx_L3_error) - /* "DracoPy.pyx":142 + /* "DracoPy.pyx":146 * quant_origin[dim] = quantization_origin[dim] * # binary_metadata = encode_metadata(metadata) * encoded_point_cloud = DracoPy.encode_point_cloud( # <<<<<<<<<<<<<< - * points, quantization_bits, compression_level, + * points, point_cloud_object, quantization_bits, compression_level, * quantization_range, quant_origin, create_metadata) */ 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); + __pyx_t_18 = DracoFunctions::encode_point_cloud(__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, 142, __pyx_L3_error) + __PYX_ERR(0, 146, __pyx_L3_error) } - __pyx_v_encoded_point_cloud = __pyx_t_17; + __pyx_v_encoded_point_cloud = __pyx_t_18; - /* "DracoPy.pyx":145 - * points, quantization_bits, compression_level, + /* "DracoPy.pyx":149 + * points, point_cloud_object, quantization_bits, compression_level, * quantization_range, quant_origin, create_metadata) * if quant_origin != NULL: # <<<<<<<<<<<<<< * PyMem_Free(quant_origin) @@ -4586,7 +4840,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_5 = ((__pyx_v_quant_origin != NULL) != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":146 + /* "DracoPy.pyx":150 * quantization_range, quant_origin, create_metadata) * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -4595,8 +4849,8 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":145 - * points, quantization_bits, compression_level, + /* "DracoPy.pyx":149 + * points, point_cloud_object, quantization_bits, compression_level, * quantization_range, quant_origin, create_metadata) * if quant_origin != NULL: # <<<<<<<<<<<<<< * PyMem_Free(quant_origin) @@ -4604,7 +4858,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ } - /* "DracoPy.pyx":147 + /* "DracoPy.pyx":151 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -4614,7 +4868,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P switch (__pyx_v_encoded_point_cloud.encode_status) { case DracoFunctions::successful_encoding: - /* "DracoPy.pyx":148 + /* "DracoPy.pyx":152 * PyMem_Free(quant_origin) * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: * return bytes(encoded_point_cloud.buffer) # <<<<<<<<<<<<<< @@ -4622,16 +4876,16 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P * raise EncodingFailedException('Invalid point cloud') */ __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, 148, __pyx_L3_error) + __pyx_t_6 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_encoded_point_cloud.buffer); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 152, __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, 148, __pyx_L3_error) + __pyx_t_7 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 152, __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":147 + /* "DracoPy.pyx":151 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -4641,35 +4895,35 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P break; case DracoFunctions::failed_during_encoding: - /* "DracoPy.pyx":150 + /* "DracoPy.pyx":154 * 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, 150, __pyx_L3_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 154, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_18 = NULL; + __pyx_t_19 = 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_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_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, 150, __pyx_L3_error) + __pyx_t_7 = (__pyx_t_19) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_19, __pyx_kp_u_Invalid_point_cloud) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_u_Invalid_point_cloud); + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 154, __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, 150, __pyx_L3_error) + __PYX_ERR(0, 154, __pyx_L3_error) - /* "DracoPy.pyx":149 + /* "DracoPy.pyx":153 * 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: # <<<<<<<<<<<<<< @@ -4680,7 +4934,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P default: break; } - /* "DracoPy.pyx":135 + /* "DracoPy.pyx":139 * """ * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -4693,61 +4947,61 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __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_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":151 + /* "DracoPy.pyx":155 * 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, 151, __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_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, 155, __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_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, 151, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_18); + if (__Pyx_GetException(&__pyx_t_19, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 155, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_19); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); - /* "DracoPy.pyx":152 + /* "DracoPy.pyx":156 * 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, 152, __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_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 156, __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_20, function); + __Pyx_DECREF_SET(__pyx_t_21, function); } } - __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, 152, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_19); + __pyx_t_20 = (__pyx_t_22) ? __Pyx_PyObject_Call2Args(__pyx_t_21, __pyx_t_22, __pyx_kp_u_Invalid_point_cloud) : __Pyx_PyObject_CallOneArg(__pyx_t_21, __pyx_kp_u_Invalid_point_cloud); + __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0; + if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 156, __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_Raise(__pyx_t_19, 0, 0, 0); - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __PYX_ERR(0, 152, __pyx_L5_except_error) + __PYX_ERR(0, 156, __pyx_L5_except_error) } - /* "DracoPy.pyx":153 + /* "DracoPy.pyx":157 * except EncodingFailedException: * raise EncodingFailedException('Invalid point cloud') * except: # <<<<<<<<<<<<<< @@ -4756,12 +5010,12 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ /*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, 153, __pyx_L5_except_error) + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_19) < 0) __PYX_ERR(0, 157, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_18); + __Pyx_GOTREF(__pyx_t_19); - /* "DracoPy.pyx":154 + /* "DracoPy.pyx":158 * raise EncodingFailedException('Invalid point cloud') * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -4771,7 +5025,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_5 = ((__pyx_v_quant_origin != NULL) != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":155 + /* "DracoPy.pyx":159 * except: * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -4780,7 +5034,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":154 + /* "DracoPy.pyx":158 * raise EncodingFailedException('Invalid point cloud') * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -4789,22 +5043,22 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ } - /* "DracoPy.pyx":156 + /* "DracoPy.pyx":160 * 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, 156, __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, 156, __pyx_L5_except_error) + __pyx_t_20 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 160, __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, 160, __pyx_L5_except_error) } __pyx_L5_except_error:; - /* "DracoPy.pyx":135 + /* "DracoPy.pyx":139 * """ * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -4825,10 +5079,10 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_L8_try_end:; } - /* "DracoPy.pyx":121 + /* "DracoPy.pyx":125 * raise ValueError("Input invalid") * - * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< + * def encode_point_cloud_to_buffer(points, point_cloud_object, # <<<<<<<<<<<<<< * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, */ @@ -4839,10 +5093,10 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __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_XDECREF(__pyx_t_22); __Pyx_AddTraceback("DracoPy.encode_point_cloud_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -4853,7 +5107,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P return __pyx_r; } -/* "DracoPy.pyx":158 +/* "DracoPy.pyx":162 * raise ValueError("Input invalid") * * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< @@ -4887,29 +5141,29 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject int __pyx_clineno = 0; __Pyx_RefNannySetupContext("raise_decoding_error", 0); - /* "DracoPy.pyx":159 + /* "DracoPy.pyx":163 * * 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, 159, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::not_draco_encoded); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 163, __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, 159, __pyx_L1_error) + __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, 163, __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, 159, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 163, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":160 + /* "DracoPy.pyx":164 * 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, 160, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FileTypeException); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 164, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { @@ -4923,14 +5177,14 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject } __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, 160, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 164, __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, 160, __pyx_L1_error) + __PYX_ERR(0, 164, __pyx_L1_error) - /* "DracoPy.pyx":159 + /* "DracoPy.pyx":163 * * def raise_decoding_error(decoding_status): * if decoding_status == DracoPy.decoding_status.not_draco_encoded: # <<<<<<<<<<<<<< @@ -4939,35 +5193,35 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":161 + /* "DracoPy.pyx":165 * 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, 161, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::failed_during_decoding); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 165, __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, 161, __pyx_L1_error) + __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, 165, __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, 161, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":162 + /* "DracoPy.pyx":166 * 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__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 162, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __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, 162, __pyx_L1_error) + __PYX_ERR(0, 166, __pyx_L1_error) - /* "DracoPy.pyx":161 + /* "DracoPy.pyx":165 * 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: # <<<<<<<<<<<<<< @@ -4976,35 +5230,35 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":163 + /* "DracoPy.pyx":167 * 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, 163, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::no_position_attribute); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 167, __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, 163, __pyx_L1_error) + __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, 167, __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, 163, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 167, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":164 + /* "DracoPy.pyx":168 * 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): */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 164, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 168, __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, 164, __pyx_L1_error) + __PYX_ERR(0, 168, __pyx_L1_error) - /* "DracoPy.pyx":163 + /* "DracoPy.pyx":167 * 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: # <<<<<<<<<<<<<< @@ -5013,7 +5267,7 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":158 + /* "DracoPy.pyx":162 * raise ValueError("Input invalid") * * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< @@ -5036,7 +5290,7 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject return __pyx_r; } -/* "DracoPy.pyx":166 +/* "DracoPy.pyx":170 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer): # <<<<<<<<<<<<<< @@ -5075,24 +5329,24 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject int __pyx_clineno = 0; __Pyx_RefNannySetupContext("decode_buffer_to_mesh", 0); - /* "DracoPy.pyx":167 + /* "DracoPy.pyx":171 * * 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) */ - __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 167, __pyx_L1_error) - __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 167, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 171, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 171, __pyx_L1_error) try { __pyx_t_3 = DracoFunctions::decode_buffer(__pyx_t_1, __pyx_t_2); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 167, __pyx_L1_error) + __PYX_ERR(0, 171, __pyx_L1_error) } __pyx_v_mesh_struct = __pyx_t_3; - /* "DracoPy.pyx":168 + /* "DracoPy.pyx":172 * def decode_buffer_to_mesh(buffer): * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< @@ -5102,7 +5356,7 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject __pyx_t_4 = ((__pyx_v_mesh_struct.decode_status == DracoFunctions::successful) != 0); if (__pyx_t_4) { - /* "DracoPy.pyx":169 + /* "DracoPy.pyx":173 * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: * return DracoMesh(mesh_struct) # <<<<<<<<<<<<<< @@ -5110,9 +5364,9 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject * 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, 169, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_DracoMesh); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 173, __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, 169, __pyx_L1_error) + __pyx_t_7 = __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(__pyx_v_mesh_struct); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -5127,14 +5381,14 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject __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, 169, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 173, __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":168 + /* "DracoPy.pyx":172 * def decode_buffer_to_mesh(buffer): * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< @@ -5143,7 +5397,7 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":171 + /* "DracoPy.pyx":175 * return DracoMesh(mesh_struct) * else: * raise_decoding_error(mesh_struct.decode_status) # <<<<<<<<<<<<<< @@ -5151,9 +5405,9 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject * 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, 171, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_raise_decoding_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 175, __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, 171, __pyx_L1_error) + __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, 175, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -5168,13 +5422,13 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject __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, 171, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 175, __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; } - /* "DracoPy.pyx":166 + /* "DracoPy.pyx":170 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer): # <<<<<<<<<<<<<< @@ -5198,7 +5452,7 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject return __pyx_r; } -/* "DracoPy.pyx":173 +/* "DracoPy.pyx":177 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer): # <<<<<<<<<<<<<< @@ -5237,24 +5491,24 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb int __pyx_clineno = 0; __Pyx_RefNannySetupContext("decode_point_cloud_buffer", 0); - /* "DracoPy.pyx":174 + /* "DracoPy.pyx":178 * * 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) */ - __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 174, __pyx_L1_error) - __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 174, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 178, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 178, __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, 174, __pyx_L1_error) + __PYX_ERR(0, 178, __pyx_L1_error) } __pyx_v_point_cloud_struct = __pyx_t_3; - /* "DracoPy.pyx":175 + /* "DracoPy.pyx":179 * 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: # <<<<<<<<<<<<<< @@ -5264,7 +5518,7 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb __pyx_t_4 = ((__pyx_v_point_cloud_struct.decode_status == DracoFunctions::successful) != 0); if (__pyx_t_4) { - /* "DracoPy.pyx":176 + /* "DracoPy.pyx":180 * 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) # <<<<<<<<<<<<<< @@ -5272,9 +5526,9 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb * raise_decoding_error(point_cloud_struct.decode_status) */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 176, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 180, __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, 176, __pyx_L1_error) + __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, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -5289,14 +5543,14 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb __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, 176, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 180, __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":175 + /* "DracoPy.pyx":179 * 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: # <<<<<<<<<<<<<< @@ -5305,15 +5559,15 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb */ } - /* "DracoPy.pyx":178 + /* "DracoPy.pyx":182 * return DracoPointCloud(point_cloud_struct) * 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, 178, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_raise_decoding_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 182, __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, 178, __pyx_L1_error) + __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, 182, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -5328,13 +5582,13 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb __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, 178, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 182, __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; } - /* "DracoPy.pyx":173 + /* "DracoPy.pyx":177 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer): # <<<<<<<<<<<<<< @@ -5594,2824 +5848,7772 @@ static std::vector __pyx_convert_vector_from_py_uint32_t(PyObject *__ 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; +static std::vector __pyx_convert_vector_from_py_unsigned_int(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; - size_t __pyx_t_2; - size_t __pyx_t_3; - size_t __pyx_t_4; - PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + unsigned int __pyx_t_5; 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("__pyx_convert_vector_from_py_unsigned_int", 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())] # <<<<<<<<<<<<<< - * - * + /* "vector.from_py":47 + * cdef vector[X] __pyx_convert_vector_from_py_unsigned_int(object o) except *: + * cdef vector[X] v + * for item in o: # <<<<<<<<<<<<<< + * v.push_back(item) + * return v */ - __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; + 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) } - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + 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.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())] + /* "vector.from_py":48 + * cdef vector[X] v + * for item in o: + * v.push_back(item) # <<<<<<<<<<<<<< + * return v * */ + __pyx_t_5 = __Pyx_PyInt_As_unsigned_int(__pyx_v_item); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 48, __pyx_L1_error) + __pyx_v_v.push_back(((unsigned int)__pyx_t_5)); - /* 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.from_py":47 + * cdef vector[X] __pyx_convert_vector_from_py_unsigned_int(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.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())] # <<<<<<<<<<<<<< + /* "vector.from_py":49 + * for item in o: + * v.push_back(item) + * return v # <<<<<<<<<<<<<< * * */ - __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; + __pyx_r = __pyx_v_v; 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())] + /* "vector.from_py":45 * + * @cname("__pyx_convert_vector_from_py_unsigned_int") + * cdef vector[X] __pyx_convert_vector_from_py_unsigned_int(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_5); - __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_float", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_unsigned_int", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_item); __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; +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; - size_t __pyx_t_2; - size_t __pyx_t_3; - size_t __pyx_t_4; - PyObject *__pyx_t_5 = 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_to_py_unsigned_int", 0); + __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_double", 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())] # <<<<<<<<<<<<<< - * - * + /* "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_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; + 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) } - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + 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.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())] + /* "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)); - /* 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; -} - -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.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.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())] # <<<<<<<<<<<<<< + /* "vector.from_py":49 + * for item in o: + * v.push_back(item) + * return v # <<<<<<<<<<<<<< * * */ - __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; + __pyx_r = __pyx_v_v; 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())] + /* "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_5); - __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_double", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __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_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_item); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "string.to_py":31 +/* "string.from_py":13 * - * @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 *: + * @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 CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &__pyx_v_s) { - PyObject *__pyx_r = NULL; +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 - PyObject *__pyx_t_1 = NULL; + char const *__pyx_t_1; 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); + __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.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) + /* "string.from_py":16 + * cdef Py_ssize_t length = 0 + * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) + * return string(data, length) # <<<<<<<<<<<<<< + * + * */ - __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; + __pyx_r = std::string(__pyx_v_data, __pyx_v_length); goto __pyx_L0; - /* "string.to_py":31 + /* "string.from_py":13 * - * @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 *: + * @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_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_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_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "string.to_py":37 +/* "map.from_py":174 * - * @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; + * @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_PyUnicode_string_to_py_std__in_string", 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; - /* "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) + /* "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_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; + __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; - /* "string.to_py":37 + /* "map.from_py":174 * - * @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 *: + * @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_AddTraceback("string.to_py.__pyx_convert_PyUnicode_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __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_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_d); + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XDECREF(__pyx_v_value); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "string.to_py":43 +/* "FromPyStructUtility":11 * - * @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 *: + * @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 CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &__pyx_v_s) { - PyObject *__pyx_r = NULL; +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 - PyObject *__pyx_t_1 = NULL; + 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_PyStr_string_to_py_std__in_string", 0); + __Pyx_RefNannySetupContext("__pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointAttributeObject", 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) + /* "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_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; + __pyx_t_1 = ((!(PyMapping_Check(__pyx_v_obj) != 0)) != 0); + if (__pyx_t_1) { - /* "string.to_py":43 + /* "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) # <<<<<<<<<<<<<< * - * @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 *: + * 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; - /* 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 + /* "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) * - * @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); + /* "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:*/ { - /* "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) + /* "FromPyStructUtility":17 + * + * try: + * value = obj['data'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'data'") */ - __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; + __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; - /* "string.to_py":49 + /* "FromPyStructUtility":16 + * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) * - * @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 *: + * 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; - /* 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; -} + /* "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); -/* "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()) + /* "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__5, 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:; + } -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); + /* "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; - /* "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()) # <<<<<<<<<<<<<< - * + /* "FromPyStructUtility":21 + * raise ValueError("No value specified for struct attribute 'data'") + * result.data = value + * try: # <<<<<<<<<<<<<< + * value = obj['datatype'] + * except KeyError: */ - __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; + { + __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:*/ { - /* "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()) - * + /* "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; - /* 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; -} + /* "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); -/* "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 + /* "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__6, 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:; -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); + /* "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:; + } - /* "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() + /* "FromPyStructUtility":25 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'datatype'") + * result.datatype = value # <<<<<<<<<<<<<< + * try: + * value = obj['dimension'] */ - __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; + __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; - /* "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) + /* "FromPyStructUtility":26 + * raise ValueError("No value specified for struct attribute 'datatype'") + * result.datatype = value + * try: # <<<<<<<<<<<<<< + * value = obj['dimension'] + * except KeyError: */ - __pyx_v_iter = __pyx_v_s.begin(); + { + __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:*/ { - /* "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 + /* "FromPyStructUtility":27 + * result.datatype = value + * try: + * value = obj['dimension'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'dimension'") */ - while (1) { - __pyx_t_2 = ((__pyx_v_iter != __pyx_v_s.end()) != 0); - if (!__pyx_t_2) break; + __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; - /* "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) + /* "FromPyStructUtility":26 + * raise ValueError("No value specified for struct attribute 'datatype'") + * result.datatype = value + * try: # <<<<<<<<<<<<<< + * value = obj['dimension'] + * except KeyError: */ - __pyx_v_key_value = (&(*__pyx_v_iter)); + } + __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; - /* "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 + /* "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_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; + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, 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:; - /* "map.to_py":208 - * key_value = &cython.operator.dereference(iter) - * o[key_value.first] = key_value.second - * cython.operator.preincrement(iter) # <<<<<<<<<<<<<< - * return o - * + /* "FromPyStructUtility":26 + * raise ValueError("No value specified for struct attribute 'datatype'") + * result.datatype = value + * try: # <<<<<<<<<<<<<< + * value = obj['dimension'] + * except KeyError: */ - (void)((++__pyx_v_iter)); + __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:; } - /* "map.to_py":209 - * o[key_value.first] = key_value.second - * cython.operator.preincrement(iter) - * return o # <<<<<<<<<<<<<< + /* "FromPyStructUtility":30 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'dimension'") + * result.dimension = value # <<<<<<<<<<<<<< + * try: + * value = obj['unique_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['unique_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['unique_id'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'unique_id'") + */ + __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_unique_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['unique_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['unique_id'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'unique_id'") + * result.unique_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['unique_id'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'unique_id'") # <<<<<<<<<<<<<< + * result.unique_id = value + * return result + */ + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, 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['unique_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 'unique_id'") + * result.unique_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.unique_id = __pyx_t_12; + + /* "FromPyStructUtility":36 + * raise ValueError("No value specified for struct attribute 'unique_id'") + * result.unique_id = value + * return result # <<<<<<<<<<<<<< * * */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_o); - __pyx_r = __pyx_v_o; + __pyx_r = __pyx_v_result; goto __pyx_L0; - /* "map.to_py":201 + /* "FromPyStructUtility":11 * - * @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 + * @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_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_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_o); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_value); __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())] +/* "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 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; +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; - size_t __pyx_t_2; - size_t __pyx_t_3; - size_t __pyx_t_4; - PyObject *__pyx_t_5 = 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_to_py_struct__DracoFunctions_3a__3a_PointAttributeObject", 0); + __Pyx_RefNannySetupContext("__pyx_convert_vector_from_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())] # <<<<<<<<<<<<<< - * + /* "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_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_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_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "vector.to_py":60 + /* "vector.from_py":49 + * for item in o: + * v.push_back(item) + * return v # <<<<<<<<<<<<<< * - * @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_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_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_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_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_item); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "map.to_py":201 +/* "FromPyStructUtility":11 * - * @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 + * @cname("__pyx_convert__from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject") + * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(obj) except *: # <<<<<<<<<<<<<< + * cdef struct_type result + * if not PyMapping_Check(obj): */ -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; +static struct DracoFunctions::AttributeMetadataObject __pyx_convert__from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(PyObject *__pyx_v_obj) { + struct DracoFunctions::AttributeMetadataObject __pyx_v_result; + PyObject *__pyx_v_value = NULL; + struct DracoFunctions::AttributeMetadataObject __pyx_r; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; + 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; 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); + __Pyx_RefNannySetupContext("__pyx_convert__from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject", 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() + /* "FromPyStructUtility":13 + * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(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 = __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; + __pyx_t_1 = ((!(PyMapping_Check(__pyx_v_obj) != 0)) != 0); + if (__pyx_t_1) { - /* "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) + /* "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_v_iter = __pyx_v_s.begin(); + __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; - /* "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 + /* "FromPyStructUtility":13 + * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(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) + * */ - 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) + /* "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_v_key_value = (&(*__pyx_v_iter)); + { + __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:*/ { - /* "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 + /* "FromPyStructUtility":17 + * + * try: + * value = obj['metadata_id'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'metadata_id'") */ - __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; + __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; - /* "map.to_py":208 - * key_value = &cython.operator.dereference(iter) - * o[key_value.first] = key_value.second - * cython.operator.preincrement(iter) # <<<<<<<<<<<<<< - * return o + /* "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: */ - (void)((++__pyx_v_iter)); - } + } + __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; - /* "map.to_py":209 - * o[key_value.first] = key_value.second - * cython.operator.preincrement(iter) - * return o # <<<<<<<<<<<<<< - * - * + /* "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_AttributeMetadataObject", __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_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_o); - __pyx_r = __pyx_v_o; - goto __pyx_L0; + __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:; - /* "map.to_py":201 + /* "FromPyStructUtility":16 + * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) * - * @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 + * 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:; + } - /* 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() + /* "FromPyStructUtility":20 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'metadata_id'") + * result.metadata_id = value # <<<<<<<<<<<<<< + * try: + * value = obj['unique_id'] */ - __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; + __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; - /* "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) + /* "FromPyStructUtility":21 + * raise ValueError("No value specified for struct attribute 'metadata_id'") + * result.metadata_id = value + * try: # <<<<<<<<<<<<<< + * value = obj['unique_id'] + * except KeyError: */ - __pyx_v_iter = __pyx_v_s.begin(); + { + __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:*/ { - /* "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 + /* "FromPyStructUtility":22 + * result.metadata_id = value + * try: + * value = obj['unique_id'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'unique_id'") + */ + __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_unique_id); 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['unique_id'] + * except KeyError: */ - while (1) { - __pyx_t_2 = ((__pyx_v_iter != __pyx_v_s.end()) != 0); - if (!__pyx_t_2) break; + } + __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; - /* "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) + /* "FromPyStructUtility":23 + * try: + * value = obj['unique_id'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'unique_id'") + * result.unique_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_AttributeMetadataObject", __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['unique_id'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'unique_id'") # <<<<<<<<<<<<<< + * result.unique_id = value + * return result */ - __pyx_v_key_value = (&(*__pyx_v_iter)); + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, 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:; - /* "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 + /* "FromPyStructUtility":21 + * raise ValueError("No value specified for struct attribute 'metadata_id'") + * result.metadata_id = value + * try: # <<<<<<<<<<<<<< + * value = obj['unique_id'] + * except KeyError: */ - __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; + __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:; + } - /* "map.to_py":208 - * key_value = &cython.operator.dereference(iter) - * o[key_value.first] = key_value.second - * cython.operator.preincrement(iter) # <<<<<<<<<<<<<< - * return o + /* "FromPyStructUtility":25 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'unique_id'") + * result.unique_id = value # <<<<<<<<<<<<<< + * return result * */ - (void)((++__pyx_v_iter)); - } + __pyx_t_10 = __Pyx_PyInt_As_uint32_t(__pyx_v_value); if (unlikely((__pyx_t_10 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 25, __pyx_L1_error) + __pyx_v_result.unique_id = __pyx_t_10; - /* "map.to_py":209 - * o[key_value.first] = key_value.second - * cython.operator.preincrement(iter) - * return o # <<<<<<<<<<<<<< + /* "FromPyStructUtility":26 + * raise ValueError("No value specified for struct attribute 'unique_id'") + * result.unique_id = value + * return result # <<<<<<<<<<<<<< * * */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_o); - __pyx_r = __pyx_v_o; + __pyx_r = __pyx_v_result; goto __pyx_L0; - /* "map.to_py":201 + /* "FromPyStructUtility":11 * - * @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 + * @cname("__pyx_convert__from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject") + * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(obj) except *: # <<<<<<<<<<<<<< + * cdef struct_type result + * if not PyMapping_Check(obj): */ /* 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_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_AttributeMetadataObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); __pyx_L0:; - __Pyx_XDECREF(__pyx_v_o); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_value); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "vector.to_py":60 - * - * @cname("__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject") - * cdef object __pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(vector[X]& v): # <<<<<<<<<<<<<< - * return [v[i] for i in range(v.size())] +/* "vector.from_py":45 * + * @cname("__pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject") + * cdef vector[X] __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(object o) except *: # <<<<<<<<<<<<<< + * cdef vector[X] v + * for item in o: */ -static PyObject *__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(const std::vector &__pyx_v_v) { - size_t __pyx_v_i; - PyObject *__pyx_r = NULL; +static std::vector __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(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; - size_t __pyx_t_2; - size_t __pyx_t_3; - size_t __pyx_t_4; - PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + struct DracoFunctions::AttributeMetadataObject __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject", 0); + __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject", 0); - /* "vector.to_py":61 - * @cname("__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject") - * cdef object __pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(vector[X]& v): - * return [v[i] for i in range(v.size())] # <<<<<<<<<<<<<< - * - * + /* "vector.from_py":47 + * cdef vector[X] __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(object o) except *: + * cdef vector[X] v + * for item in o: # <<<<<<<<<<<<<< + * v.push_back(item) + * return v */ - __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_AttributeMetadataObject((__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; + 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) } - __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_AttributeMetadataObject") - * cdef object __pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(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_AttributeMetadataObject", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __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_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_attributes, __pyx_k_DracoPointCloud_attributes, sizeof(__pyx_k_DracoPointCloud_attributes), 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_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_n_u_GeometryMetadataObject, __pyx_k_GeometryMetadataObject, sizeof(__pyx_k_GeometryMetadataObject), 0, 1, 0, 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_n_s_List, __pyx_k_List, sizeof(__pyx_k_List), 0, 0, 1, 1}, - {&__pyx_n_u_PointAttributeObject, __pyx_k_PointAttributeObject, sizeof(__pyx_k_PointAttributeObject), 0, 1, 0, 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_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_attribute_metadatas, __pyx_k_attribute_metadatas, sizeof(__pyx_k_attribute_metadatas), 0, 0, 1, 1}, - {&__pyx_n_s_attributes, __pyx_k_attributes, sizeof(__pyx_k_attributes), 0, 0, 1, 1}, - {&__pyx_n_u_attributes, __pyx_k_attributes, sizeof(__pyx_k_attributes), 0, 1, 0, 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, __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_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_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_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_entries, __pyx_k_entries, sizeof(__pyx_k_entries), 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_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_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_return, __pyx_k_return, sizeof(__pyx_k_return), 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_sub_metadata_ids, __pyx_k_sub_metadata_ids, sizeof(__pyx_k_sub_metadata_ids), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_tree_id, __pyx_k_tree_id, sizeof(__pyx_k_tree_id), 0, 0, 1, 1}, - {&__pyx_n_s_typing, __pyx_k_typing, sizeof(__pyx_k_typing), 0, 0, 1, 1}, - {&__pyx_n_s_unique_id, __pyx_k_unique_id, sizeof(__pyx_k_unique_id), 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, 27, __pyx_L1_error) - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 62, __pyx_L1_error) - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 69, __pyx_L1_error) - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 162, __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); - - /* "DracoPy.pyx":62 - * 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_ = PyTuple_Pack(1, __pyx_kp_u_Specified_value_out_of_encoded_r); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple_); - __Pyx_GIVEREF(__pyx_tuple_); + 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; - /* "DracoPy.pyx":119 - * if quant_origin != NULL: - * PyMem_Free(quant_origin) - * raise ValueError("Input invalid") # <<<<<<<<<<<<<< + /* "vector.from_py":48 + * cdef vector[X] v + * for item in o: + * v.push_back(item) # <<<<<<<<<<<<<< + * return v * - * def encode_point_cloud_to_buffer(points, */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_Input_invalid); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 119, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__2); - __Pyx_GIVEREF(__pyx_tuple__2); + __pyx_t_5 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(__pyx_v_item); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 48, __pyx_L1_error) + __pyx_v_v.push_back(__pyx_t_5); - /* "DracoPy.pyx":162 - * 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') + /* "vector.from_py":47 + * cdef vector[X] __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(object o) except *: + * cdef vector[X] v + * for item in o: # <<<<<<<<<<<<<< + * v.push_back(item) + * return v */ - __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_Failed_to_decode_input_mesh_Data); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 162, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__3); - __Pyx_GIVEREF(__pyx_tuple__3); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":164 - * 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') # <<<<<<<<<<<<<< + /* "vector.from_py":49 + * for item in o: + * v.push_back(item) + * return v # <<<<<<<<<<<<<< + * * - * def decode_buffer_to_mesh(buffer): */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_DracoPy_only_supports_meshes_wit); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 164, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__4); - __Pyx_GIVEREF(__pyx_tuple__4); + __pyx_r = __pyx_v_v; + goto __pyx_L0; - /* "DracoPy.pyx":9 - * + /* "vector.from_py":45 * - * class DracoPointCloud(object): # <<<<<<<<<<<<<< - * def __init__(self, data_struct): - * self.data_struct = data_struct + * @cname("__pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject") + * cdef vector[X] __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(object o) except *: # <<<<<<<<<<<<<< + * cdef vector[X] v + * for item in o: */ - __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); - /* "DracoPy.pyx":10 - * - * class DracoPointCloud(object): - * def __init__(self, data_struct): # <<<<<<<<<<<<<< - * self.data_struct = data_struct - * if data_struct['encoding_options_set']: - */ - __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) + /* 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_AttributeMetadataObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_item); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "DracoPy.pyx":19 - * # self.metadata = decode_metadata(data_struct["binary_metadata"]) +/* "FromPyStructUtility":11 * - * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< - * if self.encoding_options is not None: - * return self.encoding_options.get_encoded_coordinate(value, axis) + * @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): */ - __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, 19, __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, 19, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 19, __pyx_L1_error) - /* "DracoPy.pyx":23 - * return self.encoding_options.get_encoded_coordinate(value, axis) +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) * - * def get_encoded_point(self, point): # <<<<<<<<<<<<<< - * if self.encoding_options is not None: - * return self.encoding_options.get_encoded_point(point) */ - __pyx_tuple__10 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_point); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 23, __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, 23, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 23, __pyx_L1_error) + __pyx_t_1 = ((!(PyMapping_Check(__pyx_v_obj) != 0)) != 0); + if (__pyx_t_1) { - /* "DracoPy.pyx":28 - * - * @property - * def num_axes(self): # <<<<<<<<<<<<<< - * return 3 + /* "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_tuple__12 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 28, __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, 28, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 28, __pyx_L1_error) + __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; - /* "DracoPy.pyx":32 - * - * @property - * def points(self): # <<<<<<<<<<<<<< - * return self.data_struct['points'] + /* "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_tuple__14 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 32, __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, 32, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 32, __pyx_L1_error) + } - /* "DracoPy.pyx":36 - * - * @property - * def geometry_metadata(self) -> 'GeometryMetadataObject': # <<<<<<<<<<<<<< - * return self.data_struct['geometry_metadata'] + /* "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_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_geometry_metadata, 36, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 36, __pyx_L1_error) + { + __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:*/ { - /* "DracoPy.pyx":40 - * - * @property - * def attributes(self) -> List['PointAttributeObject']: # <<<<<<<<<<<<<< - * return self.data_struct['attributes'] + /* "FromPyStructUtility":17 * + * try: + * value = obj['metadata_id'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'metadata_id'") */ - __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_attributes, 40, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 40, __pyx_L1_error) + __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; - /* "DracoPy.pyx":46 - * class DracoMesh(DracoPointCloud): - * @property - * def faces(self): # <<<<<<<<<<<<<< - * return self.data_struct['faces'] + /* "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_tuple__20 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__20); - __Pyx_GIVEREF(__pyx_tuple__20); - __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_faces, 46, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 46, __pyx_L1_error) + } + __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; - /* "DracoPy.pyx":50 - * - * @property - * def normals(self): # <<<<<<<<<<<<<< - * return self.data_struct['normals'] - * + /* "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_tuple__22 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__22); - __Pyx_GIVEREF(__pyx_tuple__22); - __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_normals, 50, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 50, __pyx_L1_error) + __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:; - /* "DracoPy.pyx":53 - * return self.data_struct['normals'] + /* "FromPyStructUtility":16 + * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) * - * class EncodingOptions(object): # <<<<<<<<<<<<<< - * def __init__(self, quantization_bits, quantization_range, quantization_origin): - * self.quantization_bits = quantization_bits + * try: # <<<<<<<<<<<<<< + * value = obj['metadata_id'] + * except KeyError: */ - __pyx_tuple__24 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__24); - __Pyx_GIVEREF(__pyx_tuple__24); + __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:; + } - /* "DracoPy.pyx":54 - * - * class EncodingOptions(object): - * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< - * self.quantization_bits = quantization_bits - * self.quantization_range = quantization_range + /* "FromPyStructUtility":20 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'metadata_id'") + * result.metadata_id = value # <<<<<<<<<<<<<< + * try: + * value = obj['attribute_metadatas'] */ - __pyx_tuple__25 = 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__25)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__25); - __Pyx_GIVEREF(__pyx_tuple__25); - __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(4, 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_init, 54, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 54, __pyx_L1_error) + __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; - /* "DracoPy.pyx":60 - * 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') + /* "FromPyStructUtility":21 + * raise ValueError("No value specified for struct attribute 'metadata_id'") + * result.metadata_id = value + * try: # <<<<<<<<<<<<<< + * value = obj['attribute_metadatas'] + * except KeyError: */ - __pyx_tuple__27 = 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__27)) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__27); - __Pyx_GIVEREF(__pyx_tuple__27); - __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_get_encoded_coordinate, 60, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 60, __pyx_L1_error) + { + __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:*/ { - /* "DracoPy.pyx":67 - * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) + /* "FromPyStructUtility":22 + * result.metadata_id = value + * try: + * value = obj['attribute_metadatas'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'attribute_metadatas'") + */ + __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_attribute_metadatas); 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['attribute_metadatas'] + * 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['attribute_metadatas'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'attribute_metadatas'") + * result.attribute_metadatas = 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['attribute_metadatas'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'attribute_metadatas'") # <<<<<<<<<<<<<< + * result.attribute_metadatas = value + * return result + */ + __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 'metadata_id'") + * result.metadata_id = value + * try: # <<<<<<<<<<<<<< + * value = obj['attribute_metadatas'] + * 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 'attribute_metadatas'") + * result.attribute_metadatas = value # <<<<<<<<<<<<<< + * return result * - * def get_encoded_point(self, point): # <<<<<<<<<<<<<< - * encoded_point = [] - * for axis in range(self.num_axes): */ - __pyx_tuple__29 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_point, __pyx_n_s_encoded_point, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 67, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__29); - __Pyx_GIVEREF(__pyx_tuple__29); - __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 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_get_encoded_point, 67, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 67, __pyx_L1_error) + __pyx_t_11 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 25, __pyx_L1_error) + __pyx_v_result.attribute_metadatas = __pyx_t_11; - /* "DracoPy.pyx":74 + /* "FromPyStructUtility":26 + * raise ValueError("No value specified for struct attribute 'attribute_metadatas'") + * result.attribute_metadatas = value + * return result # <<<<<<<<<<<<<< * - * @property - * def num_axes(self): # <<<<<<<<<<<<<< - * return 3 * */ - __pyx_tuple__31 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 74, __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_num_axes, 74, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 74, __pyx_L1_error) + __pyx_r = __pyx_v_result; + goto __pyx_L0; - /* "DracoPy.pyx":83 - * pass + /* "FromPyStructUtility":11 * - * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< - * quantization_bits=14, compression_level=1, - * quantization_range=-1, quantization_origin=None, + * @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): */ - __pyx_tuple__33 = 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__33)) __PYX_ERR(0, 83, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__33); - __Pyx_GIVEREF(__pyx_tuple__33); - __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(7, 0, 11, 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_encode_mesh_to_buffer, 83, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 83, __pyx_L1_error) - /* "DracoPy.pyx":121 - * raise ValueError("Input invalid") + /* 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 * - * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< - * quantization_bits=14, compression_level=1, - * quantization_range=-1, quantization_origin=None, + * @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_tuple__35 = 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__35)) __PYX_ERR(0, 121, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__35); - __Pyx_GIVEREF(__pyx_tuple__35); - __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(6, 0, 10, 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_encode_point_cloud_to_buffer, 121, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 121, __pyx_L1_error) + __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; - /* "DracoPy.pyx":158 - * raise ValueError("Input invalid") + /* "map.from_py":178 + * cdef map[X,Y] m + * for key, value in d.iteritems(): + * m.insert(pair[X,Y](key, value)) # <<<<<<<<<<<<<< + * return m * - * 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__37 = PyTuple_Pack(1, __pyx_n_s_decoding_status); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 158, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__37); - __Pyx_GIVEREF(__pyx_tuple__37); - __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_raise_decoding_error, 158, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 158, __pyx_L1_error) + __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; - /* "DracoPy.pyx":166 - * raise ValueError('DracoPy only supports meshes with position attributes') + /* "map.from_py":179 + * for key, value in d.iteritems(): + * m.insert(pair[X,Y](key, value)) + * return m # <<<<<<<<<<<<<< + * * - * def decode_buffer_to_mesh(buffer): # <<<<<<<<<<<<<< - * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) - * if mesh_struct.decode_status == DracoPy.decoding_status.successful: */ - __pyx_tuple__39 = PyTuple_Pack(2, __pyx_n_s_buffer, __pyx_n_s_mesh_struct); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 166, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__39); - __Pyx_GIVEREF(__pyx_tuple__39); - __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_buffer_to_mesh, 166, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 166, __pyx_L1_error) + __pyx_r = __pyx_v_m; + goto __pyx_L0; - /* "DracoPy.pyx":173 - * raise_decoding_error(mesh_struct.decode_status) + /* "map.from_py":174 * - * 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: + * @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 */ - __pyx_tuple__41 = PyTuple_Pack(2, __pyx_n_s_buffer, __pyx_n_s_point_cloud_struct); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 173, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__41); - __Pyx_GIVEREF(__pyx_tuple__41); - __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_point_cloud_buffer, 173, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 173, __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_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; + /* function exit code */ __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_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 0; + return __pyx_r; } -static int __Pyx_modinit_variable_export_code(void) { +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 - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); - /*--- Variable export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} + 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; -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; -} + /* "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; -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; -} + /* "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; -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; -} + /* "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; -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; -} + /* "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 + */ -static int __Pyx_modinit_function_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); - /*--- Function import code ---*/ + /* 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 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; + 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 CYTHON_SMALL_CODE int __pyx_pymod_exec_DracoPy(PyObject *__pyx_pyinit_module) -#endif -#endif -{ - PyObject *__pyx_t_1 = NULL; +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_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("__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) + * + */ } - #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, __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(); - (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) - if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - /* "DracoPy.pyx":2 - * # distutils: language = c++ - * from typing import Dict, List # <<<<<<<<<<<<<< + /* "FromPyStructUtility":16 + * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) * - * from cpython.mem cimport PyMem_Malloc, PyMem_Free + * try: # <<<<<<<<<<<<<< + * value = obj['entries'] + * except KeyError: */ - __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __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_t_2 = __Pyx_Import(__pyx_n_s_typing, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __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, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_Dict, __pyx_t_1) < 0) __PYX_ERR(0, 2, __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, 2, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_List, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + { + __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:*/ { - /* "DracoPy.pyx":6 - * from cpython.mem cimport PyMem_Malloc, PyMem_Free - * cimport DracoPy - * from math import floor # <<<<<<<<<<<<<< - * + /* "FromPyStructUtility":17 * + * try: + * value = obj['entries'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'entries'") */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_n_s_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, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_floor); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_floor, __pyx_t_2) < 0) __PYX_ERR(0, 6, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __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; - /* "DracoPy.pyx":9 - * + /* "FromPyStructUtility":16 + * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) * - * class DracoPointCloud(object): # <<<<<<<<<<<<<< - * def __init__(self, data_struct): - * self.data_struct = data_struct + * try: # <<<<<<<<<<<<<< + * value = obj['entries'] + * except KeyError: */ - __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__5, __pyx_n_s_DracoPointCloud, __pyx_n_s_DracoPointCloud, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + } + __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; - /* "DracoPy.pyx":10 - * - * class DracoPointCloud(object): - * def __init__(self, data_struct): # <<<<<<<<<<<<<< - * self.data_struct = data_struct - * if data_struct['encoding_options_set']: + /* "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_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_2, __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_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, 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:; - /* "DracoPy.pyx":19 - * # self.metadata = decode_metadata(data_struct["binary_metadata"]) + /* "FromPyStructUtility":16 + * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) * - * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< - * if self.encoding_options is not None: - * return self.encoding_options.get_encoded_coordinate(value, axis) + * try: # <<<<<<<<<<<<<< + * value = obj['entries'] + * except KeyError: */ - __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, 19, __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, 19, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __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:; + } - /* "DracoPy.pyx":23 - * 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) + /* "FromPyStructUtility":20 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'entries'") + * result.entries = value # <<<<<<<<<<<<<< + * try: + * value = obj['sub_metadata_ids'] */ - __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, 23, __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, 23, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __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; - /* "DracoPy.pyx":28 - * - * @property - * def num_axes(self): # <<<<<<<<<<<<<< - * return 3 - * + /* "FromPyStructUtility":21 + * raise ValueError("No value specified for struct attribute 'entries'") + * result.entries = value + * try: # <<<<<<<<<<<<<< + * value = obj['sub_metadata_ids'] + * except KeyError: */ - __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, 28, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + { + __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:*/ { - /* "DracoPy.pyx":27 - * return self.encoding_options.get_encoded_point(point) - * - * @property # <<<<<<<<<<<<<< - * def num_axes(self): - * return 3 + /* "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_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 27, __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, 28, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __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; - /* "DracoPy.pyx":32 - * - * @property - * def points(self): # <<<<<<<<<<<<<< - * return self.data_struct['points'] - * + /* "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_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, 32, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, 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:; - /* "DracoPy.pyx":31 - * return 3 - * - * @property # <<<<<<<<<<<<<< - * def points(self): - * return self.data_struct['points'] + /* "FromPyStructUtility":21 + * raise ValueError("No value specified for struct attribute 'entries'") + * result.entries = value + * try: # <<<<<<<<<<<<<< + * value = obj['sub_metadata_ids'] + * except KeyError: */ - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 31, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_points, __pyx_t_3) < 0) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __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:; + } - /* "DracoPy.pyx":36 - * - * @property - * def geometry_metadata(self) -> 'GeometryMetadataObject': # <<<<<<<<<<<<<< - * return self.data_struct['geometry_metadata'] + /* "FromPyStructUtility":25 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'sub_metadata_ids'") + * result.sub_metadata_ids = value # <<<<<<<<<<<<<< + * return result * */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_u_GeometryMetadataObject) < 0) __PYX_ERR(0, 36, __pyx_L1_error) - __pyx_t_4 = __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__17)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __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; - /* "DracoPy.pyx":35 - * return self.data_struct['points'] + /* "FromPyStructUtility":26 + * raise ValueError("No value specified for struct attribute 'sub_metadata_ids'") + * result.sub_metadata_ids = value + * return result # <<<<<<<<<<<<<< + * * - * @property # <<<<<<<<<<<<<< - * def geometry_metadata(self) -> 'GeometryMetadataObject': - * return self.data_struct['geometry_metadata'] */ - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_geometry_metadata, __pyx_t_3) < 0) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_v_result; + goto __pyx_L0; - /* "DracoPy.pyx":40 - * - * @property - * def attributes(self) -> List['PointAttributeObject']: # <<<<<<<<<<<<<< - * return self.data_struct['attributes'] + /* "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): */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_List); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_t_4, __pyx_n_u_PointAttributeObject); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_t_5) < 0) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_13attributes, 0, __pyx_n_s_DracoPointCloud_attributes, 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); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":39 - * return self.data_struct['geometry_metadata'] - * - * @property # <<<<<<<<<<<<<< - * def attributes(self) -> List['PointAttributeObject']: - * return self.data_struct['attributes'] - */ - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_attributes, __pyx_t_3) < 0) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + /* 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; +} - /* "DracoPy.pyx":9 - * +/* "vector.from_py":45 * - * class DracoPointCloud(object): # <<<<<<<<<<<<<< - * def __init__(self, data_struct): - * self.data_struct = data_struct + * @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: */ - __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoPointCloud, __pyx_tuple__5, __pyx_t_2, 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_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":44 - * - * - * class DracoMesh(DracoPointCloud): # <<<<<<<<<<<<<< - * @property - * def faces(self): +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 */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __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, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __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_3)) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + 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; - /* "DracoPy.pyx":46 - * class DracoMesh(DracoPointCloud): - * @property - * def faces(self): # <<<<<<<<<<<<<< - * return self.data_struct['faces'] + /* "vector.from_py":48 + * cdef vector[X] v + * for item in o: + * v.push_back(item) # <<<<<<<<<<<<<< + * return v * */ - __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_9DracoMesh_1faces, 0, __pyx_n_s_DracoMesh_faces, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__21)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __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); - /* "DracoPy.pyx":45 - * - * class DracoMesh(DracoPointCloud): - * @property # <<<<<<<<<<<<<< - * def faces(self): - * return self.data_struct['faces'] + /* "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_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 45, __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_faces, __pyx_t_4) < 0) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":50 + /* "vector.from_py":49 + * for item in o: + * v.push_back(item) + * return v # <<<<<<<<<<<<<< * - * @property - * def normals(self): # <<<<<<<<<<<<<< - * return self.data_struct['normals'] * */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_9DracoMesh_3normals, 0, __pyx_n_s_DracoMesh_normals, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__23)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + __pyx_r = __pyx_v_v; + goto __pyx_L0; - /* "DracoPy.pyx":49 - * return self.data_struct['faces'] + /* "vector.from_py":45 * - * @property # <<<<<<<<<<<<<< - * def normals(self): - * return self.data_struct['normals'] + * @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: */ - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 49, __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_normals, __pyx_t_5) < 0) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "DracoPy.pyx":44 - * + /* 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; +} + +/* "FromPyStructUtility":11 * - * class DracoMesh(DracoPointCloud): # <<<<<<<<<<<<<< - * @property - * def faces(self): + * @cname("__pyx_convert__from_py_struct__DracoFunctions_3a__3a_MeshObject") + * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_MeshObject(obj) except *: # <<<<<<<<<<<<<< + * cdef struct_type result + * if not PyMapping_Check(obj): */ - __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoMesh, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoMesh, __pyx_t_5) < 0) __PYX_ERR(0, 44, __pyx_L1_error) - __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_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":53 - * return self.data_struct['normals'] +static struct DracoFunctions::MeshObject __pyx_convert__from_py_struct__DracoFunctions_3a__3a_MeshObject(PyObject *__pyx_v_obj) { + struct DracoFunctions::MeshObject __pyx_v_result; + PyObject *__pyx_v_value = NULL; + struct DracoFunctions::MeshObject __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::vector __pyx_t_10; + std::vector __pyx_t_11; + bool __pyx_t_12; + double __pyx_t_13; + std::vector __pyx_t_14; + enum DracoFunctions::decoding_status __pyx_t_15; + std::vector __pyx_t_16; + struct DracoFunctions::GeometryMetadataObject __pyx_t_17; + std::vector __pyx_t_18; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert__from_py_struct__DracoFunctions_3a__3a_MeshObject", 0); + + /* "FromPyStructUtility":13 + * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_MeshObject(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) * - * 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__24); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_tuple__24, __pyx_n_s_EncodingOptions, __pyx_n_s_EncodingOptions, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_1 = ((!(PyMapping_Check(__pyx_v_obj) != 0)) != 0); + if (__pyx_t_1) { - /* "DracoPy.pyx":54 + /* "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) # <<<<<<<<<<<<<< * - * class EncodingOptions(object): - * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< - * self.quantization_bits = quantization_bits - * self.quantization_range = quantization_range + * try: */ - __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__26)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __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, 54, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __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; - /* "DracoPy.pyx":60 - * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) + /* "FromPyStructUtility":13 + * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_MeshObject(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) * - * 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_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__28)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 60, __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, 60, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } - /* "DracoPy.pyx":67 - * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) + /* "FromPyStructUtility":16 + * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) * - * def get_encoded_point(self, point): # <<<<<<<<<<<<<< - * encoded_point = [] - * for axis in range(self.num_axes): + * try: # <<<<<<<<<<<<<< + * value = obj['points'] + * except KeyError: */ - __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__30)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 67, __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, 67, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + { + __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:*/ { - /* "DracoPy.pyx":74 - * - * @property - * def num_axes(self): # <<<<<<<<<<<<<< - * return 3 + /* "FromPyStructUtility":17 * + * try: + * value = obj['points'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'points'") */ - __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__32)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 74, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_points); 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; - /* "DracoPy.pyx":73 - * return encoded_point + /* "FromPyStructUtility":16 + * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) * - * @property # <<<<<<<<<<<<<< - * def num_axes(self): - * return 3 + * try: # <<<<<<<<<<<<<< + * value = obj['points'] + * except KeyError: */ - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_num_axes, __pyx_t_5) < 0) __PYX_ERR(0, 74, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - - /* "DracoPy.pyx":53 - * return self.data_struct['normals'] - * - * class EncodingOptions(object): # <<<<<<<<<<<<<< - * def __init__(self, quantization_bits, quantization_range, quantization_origin): - * self.quantization_bits = quantization_bits + } + __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['points'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'points'") + * result.points = 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_MeshObject", __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['points'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'points'") # <<<<<<<<<<<<<< + * result.points = value + * try: */ - __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_EncodingOptions, __pyx_tuple__24, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingOptions, __pyx_t_5) < 0) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, 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:; - /* "DracoPy.pyx":77 - * return 3 - * - * class FileTypeException(Exception): # <<<<<<<<<<<<<< - * pass + /* "FromPyStructUtility":16 + * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) * + * try: # <<<<<<<<<<<<<< + * value = obj['points'] + * except KeyError: */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __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, 77, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __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_5)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_FileTypeException, __pyx_t_2, __pyx_t_5, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_FileTypeException, __pyx_t_3) < 0) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __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:; + } - /* "DracoPy.pyx":80 - * pass - * - * class EncodingFailedException(Exception): # <<<<<<<<<<<<<< - * pass - * + /* "FromPyStructUtility":20 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'points'") + * result.points = value # <<<<<<<<<<<<<< + * try: + * value = obj['faces'] */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __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, 80, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __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_5)) __PYX_ERR(0, 80, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_EncodingFailedException, __pyx_t_2, __pyx_t_5, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 80, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingFailedException, __pyx_t_3) < 0) __PYX_ERR(0, 80, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_10 = __pyx_convert_vector_from_py_float(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 20, __pyx_L1_error) + __pyx_v_result.points = __pyx_t_10; - /* "DracoPy.pyx":83 - * pass - * - * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< - * quantization_bits=14, compression_level=1, - * quantization_range=-1, quantization_origin=None, + /* "FromPyStructUtility":21 + * raise ValueError("No value specified for struct attribute 'points'") + * result.points = value + * try: # <<<<<<<<<<<<<< + * value = obj['faces'] + * except KeyError: */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_1encode_mesh_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __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, 83, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + { + __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:*/ { - /* "DracoPy.pyx":121 - * raise ValueError("Input invalid") - * - * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< - * quantization_bits=14, compression_level=1, - * quantization_range=-1, quantization_origin=None, + /* "FromPyStructUtility":22 + * result.points = value + * try: + * value = obj['faces'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'faces'") + */ + __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_faces); 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 'points'") + * result.points = value + * try: # <<<<<<<<<<<<<< + * value = obj['faces'] + * except KeyError: */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_3encode_point_cloud_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __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, 121, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __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; - /* "DracoPy.pyx":158 - * 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') + /* "FromPyStructUtility":23 + * try: + * value = obj['faces'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'faces'") + * result.faces = 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_MeshObject", __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['faces'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'faces'") # <<<<<<<<<<<<<< + * result.faces = value + * try: */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_5raise_decoding_error, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 158, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_raise_decoding_error, __pyx_t_2) < 0) __PYX_ERR(0, 158, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__14, 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:; - /* "DracoPy.pyx":166 - * 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: + /* "FromPyStructUtility":21 + * raise ValueError("No value specified for struct attribute 'points'") + * result.points = value + * try: # <<<<<<<<<<<<<< + * value = obj['faces'] + * except KeyError: */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_7decode_buffer_to_mesh, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 166, __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, 166, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __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:; + } - /* "DracoPy.pyx":173 - * 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: + /* "FromPyStructUtility":25 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'faces'") + * result.faces = value # <<<<<<<<<<<<<< + * try: + * value = obj['normals'] */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_9decode_point_cloud_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __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, 173, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_11 = __pyx_convert_vector_from_py_unsigned_int(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 25, __pyx_L1_error) + __pyx_v_result.faces = __pyx_t_11; - /* "DracoPy.pyx":1 - * # distutils: language = c++ # <<<<<<<<<<<<<< - * from typing import Dict, List - * + /* "FromPyStructUtility":26 + * raise ValueError("No value specified for struct attribute 'faces'") + * result.faces = value + * try: # <<<<<<<<<<<<<< + * value = obj['normals'] + * except KeyError: */ - __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; + { + __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:*/ { - /* "vector.to_py":60 - * - * @cname("__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject") - * cdef object __pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(vector[X]& v): # <<<<<<<<<<<<<< - * return [v[i] for i in range(v.size())] - * + /* "FromPyStructUtility":27 + * result.faces = value + * try: + * value = obj['normals'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'normals'") */ + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_normals); 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; - /*--- Wrapped vars code ---*/ + /* "FromPyStructUtility":26 + * raise ValueError("No value specified for struct attribute 'faces'") + * result.faces = value + * try: # <<<<<<<<<<<<<< + * value = obj['normals'] + * 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; - 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_4); - __Pyx_XDECREF(__pyx_t_5); - if (__pyx_m) { - if (__pyx_d) { - __Pyx_AddTraceback("init DracoPy", __pyx_clineno, __pyx_lineno, __pyx_filename); + /* "FromPyStructUtility":28 + * try: + * value = obj['normals'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'normals'") + * result.normals = 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_MeshObject", __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['normals'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'normals'") # <<<<<<<<<<<<<< + * result.normals = value + * try: + */ + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, 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) } - Py_CLEAR(__pyx_m); - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init DracoPy"); + goto __pyx_L22_except_error; + __pyx_L22_except_error:; + + /* "FromPyStructUtility":26 + * raise ValueError("No value specified for struct attribute 'faces'") + * result.faces = value + * try: # <<<<<<<<<<<<<< + * value = obj['normals'] + * 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:; } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if CYTHON_PEP489_MULTI_PHASE_INIT - return (__pyx_m != NULL) ? 0 : -1; - #elif PY_MAJOR_VERSION >= 3 - return __pyx_m; - #else - return; - #endif -} -/* --- Runtime support code --- */ -/* Refnanny */ -#if CYTHON_REFNANNY -static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule(modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, "RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); -end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; -} -#endif + /* "FromPyStructUtility":30 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'normals'") + * result.normals = value # <<<<<<<<<<<<<< + * try: + * value = obj['encoding_options_set'] + */ + __pyx_t_10 = __pyx_convert_vector_from_py_float(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 30, __pyx_L1_error) + __pyx_v_result.normals = __pyx_t_10; -/* PyObjectGetAttrStr */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_getattro)) - return tp->tp_getattro(obj, attr_name); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_getattr)) - return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); -#endif - return PyObject_GetAttr(obj, attr_name); -} -#endif + /* "FromPyStructUtility":31 + * raise ValueError("No value specified for struct attribute 'normals'") + * result.normals = value + * try: # <<<<<<<<<<<<<< + * value = obj['encoding_options_set'] + * 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:*/ { -/* GetBuiltinName */ -static PyObject *__Pyx_GetBuiltinName(PyObject *name) { - PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); - if (unlikely(!result)) { - PyErr_Format(PyExc_NameError, -#if PY_MAJOR_VERSION >= 3 - "name '%U' is not defined", name); -#else - "name '%.200s' is not defined", PyString_AS_STRING(name)); -#endif + /* "FromPyStructUtility":32 + * result.normals = value + * try: + * value = obj['encoding_options_set'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'encoding_options_set'") + */ + __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_encoding_options_set); 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 'normals'") + * result.normals = value + * try: # <<<<<<<<<<<<<< + * value = obj['encoding_options_set'] + * except KeyError: + */ } - return result; -} + __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; -/* RaiseArgTupleInvalid */ -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) -{ - Py_ssize_t num_expected; - const char *more_or_less; - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; - } else { - num_expected = num_max; - more_or_less = "at most"; - } - if (exact) { - more_or_less = "exactly"; + /* "FromPyStructUtility":33 + * try: + * value = obj['encoding_options_set'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'encoding_options_set'") + * result.encoding_options_set = 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_MeshObject", __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['encoding_options_set'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'encoding_options_set'") # <<<<<<<<<<<<<< + * result.encoding_options_set = value + * try: + */ + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__16, 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) } - PyErr_Format(PyExc_TypeError, - "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", - func_name, more_or_less, num_expected, - (num_expected == 1) ? "" : "s", num_found); -} + goto __pyx_L30_except_error; + __pyx_L30_except_error:; -/* RaiseDoubleKeywords */ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AsString(kw_name)); - #endif -} + /* "FromPyStructUtility":31 + * raise ValueError("No value specified for struct attribute 'normals'") + * result.normals = value + * try: # <<<<<<<<<<<<<< + * value = obj['encoding_options_set'] + * 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:; + } -/* ParseKeywords */ -static int __Pyx_ParseOptionalKeywords( - PyObject *kwds, - PyObject **argnames[], - PyObject *kwds2, - PyObject *values[], - Py_ssize_t num_pos_args, - const char* function_name) -{ - PyObject *key = 0, *value = 0; - Py_ssize_t pos = 0; - PyObject*** name; - PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { - name = first_kw_arg; - while (*name && (**name != key)) name++; - if (*name) { - values[name-argnames] = value; - continue; - } - name = first_kw_arg; - #if PY_MAJOR_VERSION < 3 - if (likely(PyString_Check(key))) { - while (*name) { - if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) - && _PyString_Eq(**name, key)) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - if ((**argname == key) || ( - (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) - && _PyString_Eq(**argname, key))) { - goto arg_passed_twice; - } - argname++; - } - } - } else - #endif - if (likely(PyUnicode_Check(key))) { - while (*name) { - int cmp = (**name == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**name, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) { - values[name-argnames] = value; - break; - } - name++; - } - if (*name) continue; - else { - PyObject*** argname = argnames; - while (argname != first_kw_arg) { - int cmp = (**argname == key) ? 0 : - #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : - #endif - PyUnicode_Compare(**argname, key); - if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; - if (cmp == 0) goto arg_passed_twice; - argname++; - } - } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } + /* "FromPyStructUtility":35 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'encoding_options_set'") + * result.encoding_options_set = value # <<<<<<<<<<<<<< + * try: + * value = obj['quantization_bits'] + */ + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_12 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(1, 35, __pyx_L1_error) + __pyx_v_result.encoding_options_set = __pyx_t_12; + + /* "FromPyStructUtility":36 + * raise ValueError("No value specified for struct attribute 'encoding_options_set'") + * result.encoding_options_set = value + * try: # <<<<<<<<<<<<<< + * value = obj['quantization_bits'] + * 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":37 + * result.encoding_options_set = value + * try: + * value = obj['quantization_bits'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'quantization_bits'") + */ + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_quantization_bits); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 37, __pyx_L36_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2); + __pyx_t_2 = 0; + + /* "FromPyStructUtility":36 + * raise ValueError("No value specified for struct attribute 'encoding_options_set'") + * result.encoding_options_set = value + * try: # <<<<<<<<<<<<<< + * value = obj['quantization_bits'] + * except KeyError: + */ } - 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; -} + __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_L41_try_end; + __pyx_L36_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; -/* PyObjectSetAttrStr */ -#if CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { - PyTypeObject* tp = Py_TYPE(obj); - if (likely(tp->tp_setattro)) - return tp->tp_setattro(obj, attr_name, value); -#if PY_MAJOR_VERSION < 3 - if (likely(tp->tp_setattr)) - return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value); -#endif - return PyObject_SetAttr(obj, attr_name, value); -} -#endif + /* "FromPyStructUtility":38 + * try: + * value = obj['quantization_bits'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'quantization_bits'") + * result.quantization_bits = 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_MeshObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 38, __pyx_L38_except_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_8); -/* DictGetItem */ -#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY -static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { - PyObject *value; - value = PyDict_GetItemWithError(d, key); - if (unlikely(!value)) { - if (!PyErr_Occurred()) { - if (unlikely(PyTuple_Check(key))) { - PyObject* args = PyTuple_Pack(1, key); - if (likely(args)) { - PyErr_SetObject(PyExc_KeyError, args); - Py_DECREF(args); - } - } else { - PyErr_SetObject(PyExc_KeyError, key); - } - } - return NULL; + /* "FromPyStructUtility":39 + * value = obj['quantization_bits'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'quantization_bits'") # <<<<<<<<<<<<<< + * result.quantization_bits = value + * try: + */ + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 39, __pyx_L38_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, 39, __pyx_L38_except_error) } - Py_INCREF(value); - return value; -} -#endif + goto __pyx_L38_except_error; + __pyx_L38_except_error:; -/* PyDictVersioning */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { - PyObject **dictptr = NULL; - Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; - if (offset) { -#if CYTHON_COMPILING_IN_CPYTHON - dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); -#else - dictptr = _PyObject_GetDictPtr(obj); -#endif + /* "FromPyStructUtility":36 + * raise ValueError("No value specified for struct attribute 'encoding_options_set'") + * result.encoding_options_set = value + * try: # <<<<<<<<<<<<<< + * value = obj['quantization_bits'] + * 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_L41_try_end:; + } + + /* "FromPyStructUtility":40 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'quantization_bits'") + * result.quantization_bits = value # <<<<<<<<<<<<<< + * try: + * value = obj['quantization_range'] + */ + __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 40, __pyx_L1_error) + __pyx_v_result.quantization_bits = __pyx_t_6; + + /* "FromPyStructUtility":41 + * raise ValueError("No value specified for struct attribute 'quantization_bits'") + * result.quantization_bits = value + * try: # <<<<<<<<<<<<<< + * value = obj['quantization_range'] + * 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":42 + * result.quantization_bits = value + * try: + * value = obj['quantization_range'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'quantization_range'") + */ + __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_quantization_range); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 42, __pyx_L44_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_8); + __pyx_t_8 = 0; + + /* "FromPyStructUtility":41 + * raise ValueError("No value specified for struct attribute 'quantization_bits'") + * result.quantization_bits = value + * try: # <<<<<<<<<<<<<< + * value = obj['quantization_range'] + * except KeyError: + */ } - return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; -} -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) - return 0; - return obj_dict_version == __Pyx_get_object_dict_version(obj); -} -#endif + __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_L49_try_end; + __pyx_L44_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; -/* GetModuleGlobalName */ -#if CYTHON_USE_DICT_VERSIONS -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) -#else -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) -#endif -{ - PyObject *result; -#if !CYTHON_AVOID_BORROWED_REFS -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 - result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } else if (unlikely(PyErr_Occurred())) { - return NULL; - } -#else - result = PyDict_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); + /* "FromPyStructUtility":43 + * try: + * value = obj['quantization_range'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'quantization_range'") + * result.quantization_range = 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_MeshObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_2) < 0) __PYX_ERR(1, 43, __pyx_L46_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_2); + + /* "FromPyStructUtility":44 + * value = obj['quantization_range'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'quantization_range'") # <<<<<<<<<<<<<< + * result.quantization_range = value + * try: + */ + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 44, __pyx_L46_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, 44, __pyx_L46_except_error) } -#endif -#else - result = PyObject_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); + goto __pyx_L46_except_error; + __pyx_L46_except_error:; + + /* "FromPyStructUtility":41 + * raise ValueError("No value specified for struct attribute 'quantization_bits'") + * result.quantization_bits = value + * try: # <<<<<<<<<<<<<< + * value = obj['quantization_range'] + * 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_L49_try_end:; + } + + /* "FromPyStructUtility":45 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'quantization_range'") + * result.quantization_range = value # <<<<<<<<<<<<<< + * try: + * value = obj['quantization_origin'] + */ + __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 45, __pyx_L1_error) + __pyx_v_result.quantization_range = __pyx_t_13; + + /* "FromPyStructUtility":46 + * raise ValueError("No value specified for struct attribute 'quantization_range'") + * result.quantization_range = value + * try: # <<<<<<<<<<<<<< + * value = obj['quantization_origin'] + * 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":47 + * result.quantization_range = value + * try: + * value = obj['quantization_origin'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'quantization_origin'") + */ + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 47, __pyx_L52_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2); + __pyx_t_2 = 0; + + /* "FromPyStructUtility":46 + * raise ValueError("No value specified for struct attribute 'quantization_range'") + * result.quantization_range = value + * try: # <<<<<<<<<<<<<< + * value = obj['quantization_origin'] + * except KeyError: + */ } - PyErr_Clear(); -#endif - return __Pyx_GetBuiltinName(name); -} + __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_L57_try_end; + __pyx_L52_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; -/* PyFunctionFastCall */ -#if CYTHON_FAST_PYCALL -static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, - PyObject *globals) { - PyFrameObject *f; - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject **fastlocals; - Py_ssize_t i; - PyObject *result; - assert(globals != NULL); - /* XXX Perhaps we should create a specialized - PyFrame_New() that doesn't take locals, but does - take builtins without sanity checking them. - */ - assert(tstate != NULL); - f = PyFrame_New(tstate, co, globals, NULL); - if (f == NULL) { - return NULL; + /* "FromPyStructUtility":48 + * try: + * value = obj['quantization_origin'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'quantization_origin'") + * result.quantization_origin = 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_MeshObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 48, __pyx_L54_except_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_8); + + /* "FromPyStructUtility":49 + * value = obj['quantization_origin'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'quantization_origin'") # <<<<<<<<<<<<<< + * result.quantization_origin = value + * try: + */ + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 49, __pyx_L54_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, 49, __pyx_L54_except_error) } - fastlocals = __Pyx_PyFrame_GetLocalsplus(f); - for (i = 0; i < na; i++) { - Py_INCREF(*args); - fastlocals[i] = *args++; + goto __pyx_L54_except_error; + __pyx_L54_except_error:; + + /* "FromPyStructUtility":46 + * raise ValueError("No value specified for struct attribute 'quantization_range'") + * result.quantization_range = value + * try: # <<<<<<<<<<<<<< + * value = obj['quantization_origin'] + * 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_L57_try_end:; + } + + /* "FromPyStructUtility":50 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'quantization_origin'") + * result.quantization_origin = value # <<<<<<<<<<<<<< + * try: + * value = obj['decode_status'] + */ + __pyx_t_14 = __pyx_convert_vector_from_py_double(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 50, __pyx_L1_error) + __pyx_v_result.quantization_origin = __pyx_t_14; + + /* "FromPyStructUtility":51 + * raise ValueError("No value specified for struct attribute 'quantization_origin'") + * result.quantization_origin = value + * try: # <<<<<<<<<<<<<< + * value = obj['decode_status'] + * 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":52 + * result.quantization_origin = value + * try: + * value = obj['decode_status'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'decode_status'") + */ + __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_decode_status); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 52, __pyx_L60_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_8); + __pyx_t_8 = 0; + + /* "FromPyStructUtility":51 + * raise ValueError("No value specified for struct attribute 'quantization_origin'") + * result.quantization_origin = value + * try: # <<<<<<<<<<<<<< + * value = obj['decode_status'] + * except KeyError: + */ } - result = PyEval_EvalFrameEx(f,0); - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - return result; -} -#if 1 || PY_VERSION_HEX < 0x030600B1 -static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject *closure; -#if PY_MAJOR_VERSION >= 3 - PyObject *kwdefs; -#endif - PyObject *kwtuple, **k; - PyObject **d; - Py_ssize_t nd; - Py_ssize_t nk; - PyObject *result; - assert(kwargs == NULL || PyDict_Check(kwargs)); - nk = kwargs ? PyDict_Size(kwargs) : 0; - if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { - return NULL; + __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_L65_try_end; + __pyx_L60_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":53 + * try: + * value = obj['decode_status'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'decode_status'") + * result.decode_status = 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_MeshObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_2) < 0) __PYX_ERR(1, 53, __pyx_L62_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_2); + + /* "FromPyStructUtility":54 + * value = obj['decode_status'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'decode_status'") # <<<<<<<<<<<<<< + * result.decode_status = value + * try: + */ + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 54, __pyx_L62_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, 54, __pyx_L62_except_error) } - if ( -#if PY_MAJOR_VERSION >= 3 - co->co_kwonlyargcount == 0 && -#endif - likely(kwargs == NULL || nk == 0) && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { - if (argdefs == NULL && co->co_argcount == nargs) { - result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); - goto done; - } - else if (nargs == 0 && argdefs != NULL - && co->co_argcount == Py_SIZE(argdefs)) { - /* function called with no arguments, but all parameters have - a default value: use default values as arguments .*/ - args = &PyTuple_GET_ITEM(argdefs, 0); - result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); - goto done; - } + goto __pyx_L62_except_error; + __pyx_L62_except_error:; + + /* "FromPyStructUtility":51 + * raise ValueError("No value specified for struct attribute 'quantization_origin'") + * result.quantization_origin = value + * try: # <<<<<<<<<<<<<< + * value = obj['decode_status'] + * 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_L65_try_end:; + } + + /* "FromPyStructUtility":55 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'decode_status'") + * result.decode_status = value # <<<<<<<<<<<<<< + * try: + * value = obj['attributes'] + */ + __pyx_t_15 = ((enum DracoFunctions::decoding_status)__Pyx_PyInt_As_enum__DracoFunctions_3a__3a_decoding_status(__pyx_v_value)); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 55, __pyx_L1_error) + __pyx_v_result.decode_status = __pyx_t_15; + + /* "FromPyStructUtility":56 + * raise ValueError("No value specified for struct attribute 'decode_status'") + * result.decode_status = value + * try: # <<<<<<<<<<<<<< + * value = obj['attributes'] + * 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":57 + * result.decode_status = value + * try: + * value = obj['attributes'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'attributes'") + */ + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_attributes); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 57, __pyx_L68_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2); + __pyx_t_2 = 0; + + /* "FromPyStructUtility":56 + * raise ValueError("No value specified for struct attribute 'decode_status'") + * result.decode_status = value + * try: # <<<<<<<<<<<<<< + * value = obj['attributes'] + * except KeyError: + */ } - if (kwargs != NULL) { - Py_ssize_t pos, i; - kwtuple = PyTuple_New(2 * nk); - if (kwtuple == NULL) { - result = NULL; - goto done; - } - k = &PyTuple_GET_ITEM(kwtuple, 0); - pos = i = 0; - while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { - Py_INCREF(k[i]); - Py_INCREF(k[i+1]); - i += 2; - } - nk = i / 2; + __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_L73_try_end; + __pyx_L68_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":58 + * try: + * value = obj['attributes'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'attributes'") + * result.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_MeshObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 58, __pyx_L70_except_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_8); + + /* "FromPyStructUtility":59 + * value = obj['attributes'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'attributes'") # <<<<<<<<<<<<<< + * result.attributes = value + * try: + */ + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 59, __pyx_L70_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, 59, __pyx_L70_except_error) } - else { - kwtuple = NULL; - k = NULL; + goto __pyx_L70_except_error; + __pyx_L70_except_error:; + + /* "FromPyStructUtility":56 + * raise ValueError("No value specified for struct attribute 'decode_status'") + * result.decode_status = value + * try: # <<<<<<<<<<<<<< + * value = obj['attributes'] + * 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_L73_try_end:; + } + + /* "FromPyStructUtility":60 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'attributes'") + * result.attributes = value # <<<<<<<<<<<<<< + * try: + * value = obj['geometry_metadata'] + */ + __pyx_t_16 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_PointAttributeObject(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 60, __pyx_L1_error) + __pyx_v_result.attributes = __pyx_t_16; + + /* "FromPyStructUtility":61 + * raise ValueError("No value specified for struct attribute 'attributes'") + * result.attributes = value + * try: # <<<<<<<<<<<<<< + * value = obj['geometry_metadata'] + * 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":62 + * result.attributes = value + * try: + * value = obj['geometry_metadata'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'geometry_metadata'") + */ + __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_geometry_metadata); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 62, __pyx_L76_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_8); + __pyx_t_8 = 0; + + /* "FromPyStructUtility":61 + * raise ValueError("No value specified for struct attribute 'attributes'") + * result.attributes = value + * try: # <<<<<<<<<<<<<< + * value = obj['geometry_metadata'] + * except KeyError: + */ } - closure = PyFunction_GET_CLOSURE(func); -#if PY_MAJOR_VERSION >= 3 - kwdefs = PyFunction_GET_KW_DEFAULTS(func); -#endif - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); - } - else { - d = NULL; - nd = 0; - } -#if PY_MAJOR_VERSION >= 3 - result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, - args, (int)nargs, - k, (int)nk, - d, (int)nd, kwdefs, closure); -#else - result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, - args, (int)nargs, - k, (int)nk, - d, (int)nd, closure); -#endif - Py_XDECREF(kwtuple); -done: - Py_LeaveRecursiveCall(); - return result; -} -#endif -#endif + __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_L81_try_end; + __pyx_L76_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; -/* PyCFunctionFastCall */ -#if CYTHON_FAST_PYCCALL -static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { - PyCFunctionObject *func = (PyCFunctionObject*)func_obj; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - int flags = PyCFunction_GET_FLAGS(func); - assert(PyCFunction_Check(func)); - assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); - assert(nargs >= 0); - assert(nargs == 0 || args != NULL); - /* _PyCFunction_FastCallDict() must not be called with an exception set, - because it may clear it (directly or indirectly) and so the - caller loses its exception */ - assert(!PyErr_Occurred()); - if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { - return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); - } else { - return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); - } -} -#endif + /* "FromPyStructUtility":63 + * try: + * value = obj['geometry_metadata'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'geometry_metadata'") + * result.geometry_metadata = 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_MeshObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_2) < 0) __PYX_ERR(1, 63, __pyx_L78_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_2); -/* 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"); + /* "FromPyStructUtility":64 + * value = obj['geometry_metadata'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'geometry_metadata'") # <<<<<<<<<<<<<< + * result.geometry_metadata = value + * try: + */ + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 64, __pyx_L78_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, 64, __pyx_L78_except_error) } - return result; -} -#endif + goto __pyx_L78_except_error; + __pyx_L78_except_error:; -/* PyObjectCall2Args */ -static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { - PyObject *args, *result = NULL; - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyFunction_FastCall(function, args, 2); - } - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(function)) { - PyObject *args[2] = {arg1, arg2}; - return __Pyx_PyCFunction_FastCall(function, args, 2); - } - #endif - args = PyTuple_New(2); - if (unlikely(!args)) goto done; - Py_INCREF(arg1); - PyTuple_SET_ITEM(args, 0, arg1); - Py_INCREF(arg2); - PyTuple_SET_ITEM(args, 1, arg2); - Py_INCREF(function); - result = __Pyx_PyObject_Call(function, args, NULL); - Py_DECREF(args); - Py_DECREF(function); -done: - return result; -} + /* "FromPyStructUtility":61 + * raise ValueError("No value specified for struct attribute 'attributes'") + * result.attributes = value + * try: # <<<<<<<<<<<<<< + * value = obj['geometry_metadata'] + * 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_L81_try_end:; + } -/* PyObjectCallMethO */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { - PyObject *self, *result; - PyCFunction cfunc; - cfunc = PyCFunction_GET_FUNCTION(func); - self = PyCFunction_GET_SELF(func); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = cfunc(self, arg); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif + /* "FromPyStructUtility":65 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'geometry_metadata'") + * result.geometry_metadata = value # <<<<<<<<<<<<<< + * try: + * value = obj['metadatas'] + */ + __pyx_t_17 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 65, __pyx_L1_error) + __pyx_v_result.geometry_metadata = __pyx_t_17; -/* PyObjectCallOneArg */ -#if CYTHON_COMPILING_IN_CPYTHON -static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_New(1); - if (unlikely(!args)) return NULL; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, arg); - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; -} -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { -#if CYTHON_FAST_PYCALL - if (PyFunction_Check(func)) { - return __Pyx_PyFunction_FastCall(func, &arg, 1); + /* "FromPyStructUtility":66 + * raise ValueError("No value specified for struct attribute 'geometry_metadata'") + * result.geometry_metadata = value + * try: # <<<<<<<<<<<<<< + * value = obj['metadatas'] + * 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":67 + * result.geometry_metadata = value + * try: + * value = obj['metadatas'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'metadatas'") + */ + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_metadatas); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 67, __pyx_L84_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2); + __pyx_t_2 = 0; + + /* "FromPyStructUtility":66 + * raise ValueError("No value specified for struct attribute 'geometry_metadata'") + * result.geometry_metadata = value + * try: # <<<<<<<<<<<<<< + * value = obj['metadatas'] + * except KeyError: + */ } -#endif - if (likely(PyCFunction_Check(func))) { - if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { - return __Pyx_PyObject_CallMethO(func, arg); -#if CYTHON_FAST_PYCCALL - } else if (__Pyx_PyFastCFunction_Check(func)) { - return __Pyx_PyCFunction_FastCall(func, &arg, 1); -#endif - } + __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_L89_try_end; + __pyx_L84_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":68 + * try: + * value = obj['metadatas'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'metadatas'") + * result.metadatas = 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_MeshObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 68, __pyx_L86_except_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_8); + + /* "FromPyStructUtility":69 + * value = obj['metadatas'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'metadatas'") # <<<<<<<<<<<<<< + * result.metadatas = value + * return result + */ + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 69, __pyx_L86_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, 69, __pyx_L86_except_error) } - return __Pyx__PyObject_CallOneArg(func, arg); -} -#else -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *result; - PyObject *args = PyTuple_Pack(1, arg); - if (unlikely(!args)) return NULL; - result = __Pyx_PyObject_Call(func, args, NULL); - Py_DECREF(args); - return result; + goto __pyx_L86_except_error; + __pyx_L86_except_error:; + + /* "FromPyStructUtility":66 + * raise ValueError("No value specified for struct attribute 'geometry_metadata'") + * result.geometry_metadata = value + * try: # <<<<<<<<<<<<<< + * value = obj['metadatas'] + * 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_L89_try_end:; + } + + /* "FromPyStructUtility":70 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'metadatas'") + * result.metadatas = value # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_18 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 70, __pyx_L1_error) + __pyx_v_result.metadatas = __pyx_t_18; + + /* "FromPyStructUtility":71 + * raise ValueError("No value specified for struct attribute 'metadatas'") + * result.metadatas = value + * return result # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "FromPyStructUtility":11 + * + * @cname("__pyx_convert__from_py_struct__DracoFunctions_3a__3a_MeshObject") + * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_MeshObject(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_MeshObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_value); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } -#endif -/* PyIntBinop */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) { - (void)inplace; - (void)zerodivision_check; - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long x; - long a = PyInt_AS_LONG(op1); - x = (long)((unsigned long)a - b); - if (likely((x^a) >= 0 || (x^~b) >= 0)) - return PyInt_FromLong(x); - return PyLong_Type.tp_as_number->nb_subtract(op1, op2); - } - #endif - #if CYTHON_USE_PYLONG_INTERNALS - if (likely(PyLong_CheckExact(op1))) { - const long b = intval; - long a, x; -#ifdef HAVE_LONG_LONG - const PY_LONG_LONG llb = intval; - PY_LONG_LONG lla, llx; -#endif - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; - } else { - switch (size) { - case -2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); +/* "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; +} + +/* "FromPyStructUtility":11 + * + * @cname("__pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointCloudObject") + * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointCloudObject(obj) except *: # <<<<<<<<<<<<<< + * cdef struct_type result + * if not PyMapping_Check(obj): + */ + +static struct DracoFunctions::PointCloudObject __pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointCloudObject(PyObject *__pyx_v_obj) { + struct DracoFunctions::PointCloudObject __pyx_v_result; + PyObject *__pyx_v_value = NULL; + struct DracoFunctions::PointCloudObject __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::vector __pyx_t_10; + bool __pyx_t_11; + double __pyx_t_12; + std::vector __pyx_t_13; + enum DracoFunctions::decoding_status __pyx_t_14; + std::vector __pyx_t_15; + struct DracoFunctions::GeometryMetadataObject __pyx_t_16; + std::vector __pyx_t_17; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointCloudObject", 0); + + /* "FromPyStructUtility":13 + * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointCloudObject(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_PointCloudObject(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['points'] + * 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['points'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'points'") + */ + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_points); 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['points'] + * 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['points'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'points'") + * result.points = 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_PointCloudObject", __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['points'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'points'") # <<<<<<<<<<<<<< + * result.points = value + * try: + */ + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, 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['points'] + * 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 'points'") + * result.points = value # <<<<<<<<<<<<<< + * try: + * value = obj['encoding_options_set'] + */ + __pyx_t_10 = __pyx_convert_vector_from_py_float(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 20, __pyx_L1_error) + __pyx_v_result.points = __pyx_t_10; + + /* "FromPyStructUtility":21 + * raise ValueError("No value specified for struct attribute 'points'") + * result.points = value + * try: # <<<<<<<<<<<<<< + * value = obj['encoding_options_set'] + * 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.points = value + * try: + * value = obj['encoding_options_set'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'encoding_options_set'") + */ + __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_encoding_options_set); 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 'points'") + * result.points = value + * try: # <<<<<<<<<<<<<< + * value = obj['encoding_options_set'] + * 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['encoding_options_set'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'encoding_options_set'") + * result.encoding_options_set = 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_PointCloudObject", __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['encoding_options_set'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'encoding_options_set'") # <<<<<<<<<<<<<< + * result.encoding_options_set = value + * try: + */ + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__16, 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 'points'") + * result.points = value + * try: # <<<<<<<<<<<<<< + * value = obj['encoding_options_set'] + * 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 'encoding_options_set'") + * result.encoding_options_set = value # <<<<<<<<<<<<<< + * try: + * value = obj['quantization_bits'] + */ + __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_11 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(1, 25, __pyx_L1_error) + __pyx_v_result.encoding_options_set = __pyx_t_11; + + /* "FromPyStructUtility":26 + * raise ValueError("No value specified for struct attribute 'encoding_options_set'") + * result.encoding_options_set = value + * try: # <<<<<<<<<<<<<< + * value = obj['quantization_bits'] + * 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.encoding_options_set = value + * try: + * value = obj['quantization_bits'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'quantization_bits'") + */ + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_quantization_bits); 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 'encoding_options_set'") + * result.encoding_options_set = value + * try: # <<<<<<<<<<<<<< + * value = obj['quantization_bits'] + * 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['quantization_bits'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'quantization_bits'") + * result.quantization_bits = 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_PointCloudObject", __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['quantization_bits'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'quantization_bits'") # <<<<<<<<<<<<<< + * result.quantization_bits = value + * try: + */ + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__17, 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 'encoding_options_set'") + * result.encoding_options_set = value + * try: # <<<<<<<<<<<<<< + * value = obj['quantization_bits'] + * 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 'quantization_bits'") + * result.quantization_bits = value # <<<<<<<<<<<<<< + * try: + * value = obj['quantization_range'] + */ + __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 30, __pyx_L1_error) + __pyx_v_result.quantization_bits = __pyx_t_6; + + /* "FromPyStructUtility":31 + * raise ValueError("No value specified for struct attribute 'quantization_bits'") + * result.quantization_bits = value + * try: # <<<<<<<<<<<<<< + * value = obj['quantization_range'] + * 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.quantization_bits = value + * try: + * value = obj['quantization_range'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'quantization_range'") + */ + __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_quantization_range); 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 'quantization_bits'") + * result.quantization_bits = value + * try: # <<<<<<<<<<<<<< + * value = obj['quantization_range'] + * 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['quantization_range'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'quantization_range'") + * result.quantization_range = 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_PointCloudObject", __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['quantization_range'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'quantization_range'") # <<<<<<<<<<<<<< + * result.quantization_range = value + * try: + */ + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, 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 'quantization_bits'") + * result.quantization_bits = value + * try: # <<<<<<<<<<<<<< + * value = obj['quantization_range'] + * 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 'quantization_range'") + * result.quantization_range = value # <<<<<<<<<<<<<< + * try: + * value = obj['quantization_origin'] + */ + __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 35, __pyx_L1_error) + __pyx_v_result.quantization_range = __pyx_t_12; + + /* "FromPyStructUtility":36 + * raise ValueError("No value specified for struct attribute 'quantization_range'") + * result.quantization_range = value + * try: # <<<<<<<<<<<<<< + * value = obj['quantization_origin'] + * 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":37 + * result.quantization_range = value + * try: + * value = obj['quantization_origin'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'quantization_origin'") + */ + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 37, __pyx_L36_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2); + __pyx_t_2 = 0; + + /* "FromPyStructUtility":36 + * raise ValueError("No value specified for struct attribute 'quantization_range'") + * result.quantization_range = value + * try: # <<<<<<<<<<<<<< + * value = obj['quantization_origin'] + * 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_L41_try_end; + __pyx_L36_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":38 + * try: + * value = obj['quantization_origin'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'quantization_origin'") + * result.quantization_origin = 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_PointCloudObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 38, __pyx_L38_except_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_8); + + /* "FromPyStructUtility":39 + * value = obj['quantization_origin'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'quantization_origin'") # <<<<<<<<<<<<<< + * result.quantization_origin = value + * try: + */ + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 39, __pyx_L38_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, 39, __pyx_L38_except_error) + } + goto __pyx_L38_except_error; + __pyx_L38_except_error:; + + /* "FromPyStructUtility":36 + * raise ValueError("No value specified for struct attribute 'quantization_range'") + * result.quantization_range = value + * try: # <<<<<<<<<<<<<< + * value = obj['quantization_origin'] + * 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_L41_try_end:; + } + + /* "FromPyStructUtility":40 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'quantization_origin'") + * result.quantization_origin = value # <<<<<<<<<<<<<< + * try: + * value = obj['decode_status'] + */ + __pyx_t_13 = __pyx_convert_vector_from_py_double(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 40, __pyx_L1_error) + __pyx_v_result.quantization_origin = __pyx_t_13; + + /* "FromPyStructUtility":41 + * raise ValueError("No value specified for struct attribute 'quantization_origin'") + * result.quantization_origin = value + * try: # <<<<<<<<<<<<<< + * value = obj['decode_status'] + * 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":42 + * result.quantization_origin = value + * try: + * value = obj['decode_status'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'decode_status'") + */ + __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_decode_status); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 42, __pyx_L44_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_8); + __pyx_t_8 = 0; + + /* "FromPyStructUtility":41 + * raise ValueError("No value specified for struct attribute 'quantization_origin'") + * result.quantization_origin = value + * try: # <<<<<<<<<<<<<< + * value = obj['decode_status'] + * 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_L49_try_end; + __pyx_L44_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":43 + * try: + * value = obj['decode_status'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'decode_status'") + * result.decode_status = 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_PointCloudObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_2) < 0) __PYX_ERR(1, 43, __pyx_L46_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_2); + + /* "FromPyStructUtility":44 + * value = obj['decode_status'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'decode_status'") # <<<<<<<<<<<<<< + * result.decode_status = value + * try: + */ + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 44, __pyx_L46_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, 44, __pyx_L46_except_error) + } + goto __pyx_L46_except_error; + __pyx_L46_except_error:; + + /* "FromPyStructUtility":41 + * raise ValueError("No value specified for struct attribute 'quantization_origin'") + * result.quantization_origin = value + * try: # <<<<<<<<<<<<<< + * value = obj['decode_status'] + * 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_L49_try_end:; + } + + /* "FromPyStructUtility":45 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'decode_status'") + * result.decode_status = value # <<<<<<<<<<<<<< + * try: + * value = obj['attributes'] + */ + __pyx_t_14 = ((enum DracoFunctions::decoding_status)__Pyx_PyInt_As_enum__DracoFunctions_3a__3a_decoding_status(__pyx_v_value)); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 45, __pyx_L1_error) + __pyx_v_result.decode_status = __pyx_t_14; + + /* "FromPyStructUtility":46 + * raise ValueError("No value specified for struct attribute 'decode_status'") + * result.decode_status = value + * try: # <<<<<<<<<<<<<< + * value = obj['attributes'] + * 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":47 + * result.decode_status = value + * try: + * value = obj['attributes'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'attributes'") + */ + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_attributes); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 47, __pyx_L52_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2); + __pyx_t_2 = 0; + + /* "FromPyStructUtility":46 + * raise ValueError("No value specified for struct attribute 'decode_status'") + * result.decode_status = value + * try: # <<<<<<<<<<<<<< + * value = obj['attributes'] + * 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_L57_try_end; + __pyx_L52_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":48 + * try: + * value = obj['attributes'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'attributes'") + * result.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_PointCloudObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 48, __pyx_L54_except_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_8); + + /* "FromPyStructUtility":49 + * value = obj['attributes'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'attributes'") # <<<<<<<<<<<<<< + * result.attributes = value + * try: + */ + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 49, __pyx_L54_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, 49, __pyx_L54_except_error) + } + goto __pyx_L54_except_error; + __pyx_L54_except_error:; + + /* "FromPyStructUtility":46 + * raise ValueError("No value specified for struct attribute 'decode_status'") + * result.decode_status = value + * try: # <<<<<<<<<<<<<< + * value = obj['attributes'] + * 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_L57_try_end:; + } + + /* "FromPyStructUtility":50 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'attributes'") + * result.attributes = value # <<<<<<<<<<<<<< + * try: + * value = obj['geometry_metadata'] + */ + __pyx_t_15 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_PointAttributeObject(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 50, __pyx_L1_error) + __pyx_v_result.attributes = __pyx_t_15; + + /* "FromPyStructUtility":51 + * raise ValueError("No value specified for struct attribute 'attributes'") + * result.attributes = value + * try: # <<<<<<<<<<<<<< + * value = obj['geometry_metadata'] + * 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":52 + * result.attributes = value + * try: + * value = obj['geometry_metadata'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'geometry_metadata'") + */ + __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_geometry_metadata); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 52, __pyx_L60_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_8); + __pyx_t_8 = 0; + + /* "FromPyStructUtility":51 + * raise ValueError("No value specified for struct attribute 'attributes'") + * result.attributes = value + * try: # <<<<<<<<<<<<<< + * value = obj['geometry_metadata'] + * 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_L65_try_end; + __pyx_L60_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":53 + * try: + * value = obj['geometry_metadata'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'geometry_metadata'") + * result.geometry_metadata = 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_PointCloudObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_2) < 0) __PYX_ERR(1, 53, __pyx_L62_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_2); + + /* "FromPyStructUtility":54 + * value = obj['geometry_metadata'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'geometry_metadata'") # <<<<<<<<<<<<<< + * result.geometry_metadata = value + * try: + */ + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 54, __pyx_L62_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, 54, __pyx_L62_except_error) + } + goto __pyx_L62_except_error; + __pyx_L62_except_error:; + + /* "FromPyStructUtility":51 + * raise ValueError("No value specified for struct attribute 'attributes'") + * result.attributes = value + * try: # <<<<<<<<<<<<<< + * value = obj['geometry_metadata'] + * 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_L65_try_end:; + } + + /* "FromPyStructUtility":55 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'geometry_metadata'") + * result.geometry_metadata = value # <<<<<<<<<<<<<< + * try: + * value = obj['metadatas'] + */ + __pyx_t_16 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 55, __pyx_L1_error) + __pyx_v_result.geometry_metadata = __pyx_t_16; + + /* "FromPyStructUtility":56 + * raise ValueError("No value specified for struct attribute 'geometry_metadata'") + * result.geometry_metadata = value + * try: # <<<<<<<<<<<<<< + * value = obj['metadatas'] + * 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":57 + * result.geometry_metadata = value + * try: + * value = obj['metadatas'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'metadatas'") + */ + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_metadatas); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 57, __pyx_L68_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2); + __pyx_t_2 = 0; + + /* "FromPyStructUtility":56 + * raise ValueError("No value specified for struct attribute 'geometry_metadata'") + * result.geometry_metadata = value + * try: # <<<<<<<<<<<<<< + * value = obj['metadatas'] + * 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_L73_try_end; + __pyx_L68_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":58 + * try: + * value = obj['metadatas'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'metadatas'") + * result.metadatas = 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_PointCloudObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 58, __pyx_L70_except_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_8); + + /* "FromPyStructUtility":59 + * value = obj['metadatas'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'metadatas'") # <<<<<<<<<<<<<< + * result.metadatas = value + * return result + */ + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 59, __pyx_L70_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, 59, __pyx_L70_except_error) + } + goto __pyx_L70_except_error; + __pyx_L70_except_error:; + + /* "FromPyStructUtility":56 + * raise ValueError("No value specified for struct attribute 'geometry_metadata'") + * result.geometry_metadata = value + * try: # <<<<<<<<<<<<<< + * value = obj['metadatas'] + * 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_L73_try_end:; + } + + /* "FromPyStructUtility":60 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'metadatas'") + * result.metadatas = value # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_17 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 60, __pyx_L1_error) + __pyx_v_result.metadatas = __pyx_t_17; + + /* "FromPyStructUtility":61 + * raise ValueError("No value specified for struct attribute 'metadatas'") + * result.metadatas = value + * return result # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "FromPyStructUtility":11 + * + * @cname("__pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointCloudObject") + * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointCloudObject(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_PointCloudObject", __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.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())] + * + */ + +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; +} + +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; +} + +/* "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_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; +} + +static PyObject *__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(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_AttributeMetadataObject", 0); + + /* "vector.to_py":61 + * @cname("__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject") + * cdef object __pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(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_AttributeMetadataObject((__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_AttributeMetadataObject") + * cdef object __pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(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_AttributeMetadataObject", __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; +} + +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_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_attributes, __pyx_k_DracoPointCloud_attributes, sizeof(__pyx_k_DracoPointCloud_attributes), 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_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_n_u_GeometryMetadataObject, __pyx_k_GeometryMetadataObject, sizeof(__pyx_k_GeometryMetadataObject), 0, 1, 0, 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_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_u_MetadataObject, __pyx_k_MetadataObject, sizeof(__pyx_k_MetadataObject), 0, 1, 0, 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_10, __pyx_k_No_value_specified_for_struct_at_10, sizeof(__pyx_k_No_value_specified_for_struct_at_10), 0, 0, 1, 0}, + {&__pyx_kp_s_No_value_specified_for_struct_at_11, __pyx_k_No_value_specified_for_struct_at_11, sizeof(__pyx_k_No_value_specified_for_struct_at_11), 0, 0, 1, 0}, + {&__pyx_kp_s_No_value_specified_for_struct_at_12, __pyx_k_No_value_specified_for_struct_at_12, sizeof(__pyx_k_No_value_specified_for_struct_at_12), 0, 0, 1, 0}, + {&__pyx_kp_s_No_value_specified_for_struct_at_13, __pyx_k_No_value_specified_for_struct_at_13, sizeof(__pyx_k_No_value_specified_for_struct_at_13), 0, 0, 1, 0}, + {&__pyx_kp_s_No_value_specified_for_struct_at_14, __pyx_k_No_value_specified_for_struct_at_14, sizeof(__pyx_k_No_value_specified_for_struct_at_14), 0, 0, 1, 0}, + {&__pyx_kp_s_No_value_specified_for_struct_at_15, __pyx_k_No_value_specified_for_struct_at_15, sizeof(__pyx_k_No_value_specified_for_struct_at_15), 0, 0, 1, 0}, + {&__pyx_kp_s_No_value_specified_for_struct_at_16, __pyx_k_No_value_specified_for_struct_at_16, sizeof(__pyx_k_No_value_specified_for_struct_at_16), 0, 0, 1, 0}, + {&__pyx_kp_s_No_value_specified_for_struct_at_17, __pyx_k_No_value_specified_for_struct_at_17, sizeof(__pyx_k_No_value_specified_for_struct_at_17), 0, 0, 1, 0}, + {&__pyx_kp_s_No_value_specified_for_struct_at_18, __pyx_k_No_value_specified_for_struct_at_18, sizeof(__pyx_k_No_value_specified_for_struct_at_18), 0, 0, 1, 0}, + {&__pyx_kp_s_No_value_specified_for_struct_at_19, __pyx_k_No_value_specified_for_struct_at_19, sizeof(__pyx_k_No_value_specified_for_struct_at_19), 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_kp_s_No_value_specified_for_struct_at_8, __pyx_k_No_value_specified_for_struct_at_8, sizeof(__pyx_k_No_value_specified_for_struct_at_8), 0, 0, 1, 0}, + {&__pyx_kp_s_No_value_specified_for_struct_at_9, __pyx_k_No_value_specified_for_struct_at_9, sizeof(__pyx_k_No_value_specified_for_struct_at_9), 0, 0, 1, 0}, + {&__pyx_n_u_PointAttributeObject, __pyx_k_PointAttributeObject, sizeof(__pyx_k_PointAttributeObject), 0, 1, 0, 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_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_attribute_metadatas, __pyx_k_attribute_metadatas, sizeof(__pyx_k_attribute_metadatas), 0, 0, 1, 1}, + {&__pyx_n_s_attributes, __pyx_k_attributes, sizeof(__pyx_k_attributes), 0, 0, 1, 1}, + {&__pyx_n_u_attributes, __pyx_k_attributes, sizeof(__pyx_k_attributes), 0, 1, 0, 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, __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_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_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_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_entries, __pyx_k_entries, sizeof(__pyx_k_entries), 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_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_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_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_mesh_object, __pyx_k_mesh_object, sizeof(__pyx_k_mesh_object), 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_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_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_object, __pyx_k_point_cloud_object, sizeof(__pyx_k_point_cloud_object), 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_return, __pyx_k_return, sizeof(__pyx_k_return), 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_sub_metadata_ids, __pyx_k_sub_metadata_ids, sizeof(__pyx_k_sub_metadata_ids), 0, 0, 1, 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_unique_id, __pyx_k_unique_id, sizeof(__pyx_k_unique_id), 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, 27, __pyx_L1_error) + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 66, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 73, __pyx_L1_error) + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 166, __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); + + /* "DracoPy.pyx":66 + * 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_ = PyTuple_Pack(1, __pyx_kp_u_Specified_value_out_of_encoded_r); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple_); + __Pyx_GIVEREF(__pyx_tuple_); + + /* "DracoPy.pyx":123 + * if quant_origin != NULL: + * PyMem_Free(quant_origin) + * raise ValueError("Input invalid") # <<<<<<<<<<<<<< + * + * def encode_point_cloud_to_buffer(points, point_cloud_object, + */ + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_Input_invalid); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__2); + __Pyx_GIVEREF(__pyx_tuple__2); + + /* "DracoPy.pyx":166 + * 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, 166, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__3); + __Pyx_GIVEREF(__pyx_tuple__3); + + /* "DracoPy.pyx":168 + * 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): + */ + __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_DracoPy_only_supports_meshes_wit); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 168, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__4); + __Pyx_GIVEREF(__pyx_tuple__4); + + /* "FromPyStructUtility":19 + * value = obj['data'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'data'") # <<<<<<<<<<<<<< + * result.data = value + * try: + */ + __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__5); + __Pyx_GIVEREF(__pyx_tuple__5); + + /* "FromPyStructUtility":24 + * value = obj['datatype'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'datatype'") # <<<<<<<<<<<<<< + * result.datatype = value + * try: + */ + __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_2); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__6); + __Pyx_GIVEREF(__pyx_tuple__6); + + /* "FromPyStructUtility":29 + * value = obj['dimension'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'dimension'") # <<<<<<<<<<<<<< + * result.dimension = value + * try: + */ + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_3); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 29, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__7); + __Pyx_GIVEREF(__pyx_tuple__7); + + /* "FromPyStructUtility":34 + * value = obj['unique_id'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'unique_id'") # <<<<<<<<<<<<<< + * result.unique_id = value + * return result + */ + __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_4); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__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_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_5); 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['attribute_metadatas'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'attribute_metadatas'") # <<<<<<<<<<<<<< + * result.attribute_metadatas = value + * return result + */ + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_6); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__10); + __Pyx_GIVEREF(__pyx_tuple__10); + + /* "FromPyStructUtility":19 + * value = obj['entries'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'entries'") # <<<<<<<<<<<<<< + * result.entries = value + * try: + */ + __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_7); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__11); + __Pyx_GIVEREF(__pyx_tuple__11); + + /* "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__12 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_8); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__12); + __Pyx_GIVEREF(__pyx_tuple__12); + + /* "FromPyStructUtility":19 + * value = obj['points'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'points'") # <<<<<<<<<<<<<< + * result.points = value + * try: + */ + __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_9); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__13); + __Pyx_GIVEREF(__pyx_tuple__13); + + /* "FromPyStructUtility":24 + * value = obj['faces'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'faces'") # <<<<<<<<<<<<<< + * result.faces = value + * try: + */ + __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_10); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__14); + __Pyx_GIVEREF(__pyx_tuple__14); + + /* "FromPyStructUtility":29 + * value = obj['normals'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'normals'") # <<<<<<<<<<<<<< + * result.normals = value + * try: + */ + __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_11); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 29, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__15); + __Pyx_GIVEREF(__pyx_tuple__15); + + /* "FromPyStructUtility":34 + * value = obj['encoding_options_set'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'encoding_options_set'") # <<<<<<<<<<<<<< + * result.encoding_options_set = value + * try: + */ + __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_12); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__16); + __Pyx_GIVEREF(__pyx_tuple__16); + + /* "FromPyStructUtility":39 + * value = obj['quantization_bits'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'quantization_bits'") # <<<<<<<<<<<<<< + * result.quantization_bits = value + * try: + */ + __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_13); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__17); + __Pyx_GIVEREF(__pyx_tuple__17); + + /* "FromPyStructUtility":44 + * value = obj['quantization_range'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'quantization_range'") # <<<<<<<<<<<<<< + * result.quantization_range = value + * try: + */ + __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_14); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__18); + __Pyx_GIVEREF(__pyx_tuple__18); + + /* "FromPyStructUtility":49 + * value = obj['quantization_origin'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'quantization_origin'") # <<<<<<<<<<<<<< + * result.quantization_origin = value + * try: + */ + __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_15); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 49, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__19); + __Pyx_GIVEREF(__pyx_tuple__19); + + /* "FromPyStructUtility":54 + * value = obj['decode_status'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'decode_status'") # <<<<<<<<<<<<<< + * result.decode_status = value + * try: + */ + __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_16); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(1, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__20); + __Pyx_GIVEREF(__pyx_tuple__20); + + /* "FromPyStructUtility":59 + * value = obj['attributes'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'attributes'") # <<<<<<<<<<<<<< + * result.attributes = value + * try: + */ + __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_17); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 59, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__21); + __Pyx_GIVEREF(__pyx_tuple__21); + + /* "FromPyStructUtility":64 + * value = obj['geometry_metadata'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'geometry_metadata'") # <<<<<<<<<<<<<< + * result.geometry_metadata = value + * try: + */ + __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_18); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(1, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__22); + __Pyx_GIVEREF(__pyx_tuple__22); + + /* "FromPyStructUtility":69 + * value = obj['metadatas'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'metadatas'") # <<<<<<<<<<<<<< + * result.metadatas = value + * return result + */ + __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_19); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 69, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__23); + __Pyx_GIVEREF(__pyx_tuple__23); + + /* "DracoPy.pyx":9 + * + * + * class DracoPointCloud(object): # <<<<<<<<<<<<<< + * def __init__(self, data_struct): + * self.data_struct = data_struct + */ + __pyx_tuple__24 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__24); + __Pyx_GIVEREF(__pyx_tuple__24); + + /* "DracoPy.pyx":10 + * + * class DracoPointCloud(object): + * def __init__(self, data_struct): # <<<<<<<<<<<<<< + * self.data_struct = data_struct + * if data_struct['encoding_options_set']: + */ + __pyx_tuple__25 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_data_struct); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__25); + __Pyx_GIVEREF(__pyx_tuple__25); + __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 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_init, 10, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 10, __pyx_L1_error) + + /* "DracoPy.pyx":19 + * # self.metadata = decode_metadata(data_struct["binary_metadata"]) + * + * 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__27 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_value, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__27); + __Pyx_GIVEREF(__pyx_tuple__27); + __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 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_get_encoded_coordinate, 19, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 19, __pyx_L1_error) + + /* "DracoPy.pyx":23 + * 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__29 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_point); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__29); + __Pyx_GIVEREF(__pyx_tuple__29); + __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 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_get_encoded_point, 23, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 23, __pyx_L1_error) + + /* "DracoPy.pyx":28 + * + * @property + * def num_axes(self): # <<<<<<<<<<<<<< + * return 3 + * + */ + __pyx_tuple__31 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 28, __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_num_axes, 28, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 28, __pyx_L1_error) + + /* "DracoPy.pyx":32 + * + * @property + * def points(self): # <<<<<<<<<<<<<< + * return self.data_struct['points'] + * + */ + __pyx_tuple__33 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 32, __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_points, 32, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 32, __pyx_L1_error) + + /* "DracoPy.pyx":36 + * + * @property + * def geometry_metadata(self) -> 'GeometryMetadataObject': # <<<<<<<<<<<<<< + * return self.data_struct['geometry_metadata'] + * + */ + __pyx_tuple__35 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__35); + __Pyx_GIVEREF(__pyx_tuple__35); + __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_geometry_metadata, 36, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 36, __pyx_L1_error) + + /* "DracoPy.pyx":40 + * + * @property + * def attributes(self) -> List['PointAttributeObject']: # <<<<<<<<<<<<<< + * return self.data_struct['attributes'] + * + */ + __pyx_tuple__37 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__37); + __Pyx_GIVEREF(__pyx_tuple__37); + __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_attributes, 40, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 40, __pyx_L1_error) + + /* "DracoPy.pyx":44 + * + * @property + * def metadatas(self) -> List['MetadataObject']: # <<<<<<<<<<<<<< + * return self.data_struct['metadatas'] + * + */ + __pyx_tuple__39 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__39); + __Pyx_GIVEREF(__pyx_tuple__39); + __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_metadatas, 44, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 44, __pyx_L1_error) + + /* "DracoPy.pyx":50 + * class DracoMesh(DracoPointCloud): + * @property + * def faces(self): # <<<<<<<<<<<<<< + * return self.data_struct['faces'] + * + */ + __pyx_tuple__41 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__41); + __Pyx_GIVEREF(__pyx_tuple__41); + __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_faces, 50, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 50, __pyx_L1_error) + + /* "DracoPy.pyx":54 + * + * @property + * def normals(self): # <<<<<<<<<<<<<< + * return self.data_struct['normals'] + * + */ + __pyx_tuple__43 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__43); + __Pyx_GIVEREF(__pyx_tuple__43); + __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_normals, 54, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 54, __pyx_L1_error) + + /* "DracoPy.pyx":57 + * return self.data_struct['normals'] + * + * class EncodingOptions(object): # <<<<<<<<<<<<<< + * def __init__(self, quantization_bits, quantization_range, quantization_origin): + * self.quantization_bits = quantization_bits + */ + __pyx_tuple__45 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__45); + __Pyx_GIVEREF(__pyx_tuple__45); + + /* "DracoPy.pyx":58 + * + * class EncodingOptions(object): + * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< + * self.quantization_bits = quantization_bits + * self.quantization_range = quantization_range + */ + __pyx_tuple__46 = 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__46)) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__46); + __Pyx_GIVEREF(__pyx_tuple__46); + __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 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_init, 58, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 58, __pyx_L1_error) + + /* "DracoPy.pyx":64 + * 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__48 = 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__48)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__48); + __Pyx_GIVEREF(__pyx_tuple__48); + __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_get_encoded_coordinate, 64, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 64, __pyx_L1_error) + + /* "DracoPy.pyx":71 + * 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__50 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_point, __pyx_n_s_encoded_point, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 71, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__50); + __Pyx_GIVEREF(__pyx_tuple__50); + __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 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_get_encoded_point, 71, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 71, __pyx_L1_error) + + /* "DracoPy.pyx":78 + * + * @property + * def num_axes(self): # <<<<<<<<<<<<<< + * return 3 + * + */ + __pyx_tuple__52 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 78, __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_num_axes, 78, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 78, __pyx_L1_error) + + /* "DracoPy.pyx":87 + * pass + * + * def encode_mesh_to_buffer(points, faces, mesh_object, # <<<<<<<<<<<<<< + * quantization_bits=14, compression_level=1, + * quantization_range=-1, quantization_origin=None, + */ + __pyx_tuple__54 = PyTuple_Pack(12, __pyx_n_s_points, __pyx_n_s_faces, __pyx_n_s_mesh_object, __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__54)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__54); + __Pyx_GIVEREF(__pyx_tuple__54); + __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(8, 0, 12, 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_encode_mesh_to_buffer, 87, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 87, __pyx_L1_error) + + /* "DracoPy.pyx":125 + * raise ValueError("Input invalid") + * + * def encode_point_cloud_to_buffer(points, point_cloud_object, # <<<<<<<<<<<<<< + * quantization_bits=14, compression_level=1, + * quantization_range=-1, quantization_origin=None, + */ + __pyx_tuple__56 = PyTuple_Pack(11, __pyx_n_s_points, __pyx_n_s_point_cloud_object, __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__56)) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__56); + __Pyx_GIVEREF(__pyx_tuple__56); + __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(7, 0, 11, 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_encode_point_cloud_to_buffer, 125, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 125, __pyx_L1_error) + + /* "DracoPy.pyx":162 + * 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__58 = PyTuple_Pack(1, __pyx_n_s_decoding_status); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__58); + __Pyx_GIVEREF(__pyx_tuple__58); + __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_src_DracoPy_pyx, __pyx_n_s_raise_decoding_error, 162, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(0, 162, __pyx_L1_error) + + /* "DracoPy.pyx":170 + * 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: + */ + __pyx_tuple__60 = PyTuple_Pack(2, __pyx_n_s_buffer, __pyx_n_s_mesh_struct); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 170, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__60); + __Pyx_GIVEREF(__pyx_tuple__60); + __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_buffer_to_mesh, 170, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 170, __pyx_L1_error) + + /* "DracoPy.pyx":177 + * 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_tuple__62 = PyTuple_Pack(2, __pyx_n_s_buffer, __pyx_n_s_point_cloud_struct); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(0, 177, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__62); + __Pyx_GIVEREF(__pyx_tuple__62); + __pyx_codeobj__63 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__62, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_point_cloud_buffer, 177, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__63)) __PYX_ERR(0, 177, __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_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; +} + +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_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 + __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); + /*--- Type init code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +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; + 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, __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(); + (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) + if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + + /* "DracoPy.pyx":2 + * # distutils: language = c++ + * from typing import Dict, List # <<<<<<<<<<<<<< + * + * from cpython.mem cimport PyMem_Malloc, PyMem_Free + */ + __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __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_t_2 = __Pyx_Import(__pyx_n_s_typing, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __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, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Dict, __pyx_t_1) < 0) __PYX_ERR(0, 2, __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, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_List, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":6 + * 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, 6, __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, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_floor); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_floor, __pyx_t_2) < 0) __PYX_ERR(0, 6, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "DracoPy.pyx":9 + * + * + * class DracoPointCloud(object): # <<<<<<<<<<<<<< + * def __init__(self, data_struct): + * self.data_struct = data_struct + */ + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__24); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__24, __pyx_n_s_DracoPointCloud, __pyx_n_s_DracoPointCloud, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "DracoPy.pyx":10 + * + * 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__26)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 10, __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, 10, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "DracoPy.pyx":19 + * # self.metadata = decode_metadata(data_struct["binary_metadata"]) + * + * 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__28)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 19, __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, 19, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "DracoPy.pyx":23 + * 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__30)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 23, __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, 23, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "DracoPy.pyx":28 + * + * @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__32)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + + /* "DracoPy.pyx":27 + * 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, 27, __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, 28, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "DracoPy.pyx":32 + * + * @property + * def points(self): # <<<<<<<<<<<<<< + * return self.data_struct['points'] + * + */ + __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__34)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + + /* "DracoPy.pyx":31 + * return 3 + * + * @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, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_points, __pyx_t_3) < 0) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "DracoPy.pyx":36 + * + * @property + * def geometry_metadata(self) -> 'GeometryMetadataObject': # <<<<<<<<<<<<<< + * return self.data_struct['geometry_metadata'] + * + */ + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_u_GeometryMetadataObject) < 0) __PYX_ERR(0, 36, __pyx_L1_error) + __pyx_t_4 = __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__36)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "DracoPy.pyx":35 + * return self.data_struct['points'] + * + * @property # <<<<<<<<<<<<<< + * def geometry_metadata(self) -> 'GeometryMetadataObject': + * return self.data_struct['geometry_metadata'] + */ + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_geometry_metadata, __pyx_t_3) < 0) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "DracoPy.pyx":40 + * + * @property + * def attributes(self) -> List['PointAttributeObject']: # <<<<<<<<<<<<<< + * return self.data_struct['attributes'] + * + */ + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_List); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_t_4, __pyx_n_u_PointAttributeObject); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_t_5) < 0) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_13attributes, 0, __pyx_n_s_DracoPointCloud_attributes, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "DracoPy.pyx":39 + * return self.data_struct['geometry_metadata'] + * + * @property # <<<<<<<<<<<<<< + * def attributes(self) -> List['PointAttributeObject']: + * return self.data_struct['attributes'] + */ + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_attributes, __pyx_t_3) < 0) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "DracoPy.pyx":44 + * + * @property + * def metadatas(self) -> List['MetadataObject']: # <<<<<<<<<<<<<< + * return self.data_struct['metadatas'] + * + */ + __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_List); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_t_5, __pyx_n_u_MetadataObject); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_t_4) < 0) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_15metadatas, 0, __pyx_n_s_DracoPointCloud_metadatas, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__40)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "DracoPy.pyx":43 + * return self.data_struct['attributes'] + * + * @property # <<<<<<<<<<<<<< + * def metadatas(self) -> List['MetadataObject']: + * return self.data_struct['metadatas'] + */ + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_metadatas, __pyx_t_3) < 0) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "DracoPy.pyx":9 + * + * + * class DracoPointCloud(object): # <<<<<<<<<<<<<< + * def __init__(self, data_struct): + * self.data_struct = data_struct + */ + __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoPointCloud, __pyx_tuple__24, __pyx_t_2, 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_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "DracoPy.pyx":48 + * + * + * class DracoMesh(DracoPointCloud): # <<<<<<<<<<<<<< + * @property + * def faces(self): + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __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, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __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_3)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + + /* "DracoPy.pyx":50 + * class DracoMesh(DracoPointCloud): + * @property + * def faces(self): # <<<<<<<<<<<<<< + * return self.data_struct['faces'] + * + */ + __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__42)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + + /* "DracoPy.pyx":49 + * + * class DracoMesh(DracoPointCloud): + * @property # <<<<<<<<<<<<<< + * def faces(self): + * return self.data_struct['faces'] + */ + __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 49, __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, 50, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "DracoPy.pyx":54 + * + * @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__44)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + + /* "DracoPy.pyx":53 + * return self.data_struct['faces'] + * + * @property # <<<<<<<<<<<<<< + * def normals(self): + * return self.data_struct['normals'] + */ + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 53, __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, 54, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "DracoPy.pyx":48 + * + * + * class DracoMesh(DracoPointCloud): # <<<<<<<<<<<<<< + * @property + * def faces(self): + */ + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoMesh, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoMesh, __pyx_t_4) < 0) __PYX_ERR(0, 48, __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_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":57 + * return self.data_struct['normals'] + * + * 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__45); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_tuple__45, __pyx_n_s_EncodingOptions, __pyx_n_s_EncodingOptions, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + + /* "DracoPy.pyx":58 + * + * class EncodingOptions(object): + * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< + * self.quantization_bits = quantization_bits + * self.quantization_range = quantization_range + */ + __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__47)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 58, __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, 58, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "DracoPy.pyx":64 + * 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_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__49)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 64, __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, 64, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "DracoPy.pyx":71 + * 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_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__51)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __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, 71, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "DracoPy.pyx":78 + * + * @property + * def num_axes(self): # <<<<<<<<<<<<<< + * return 3 + * + */ + __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__53)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + + /* "DracoPy.pyx":77 + * return encoded_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, 77, __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, 78, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "DracoPy.pyx":57 + * return self.data_struct['normals'] + * + * class EncodingOptions(object): # <<<<<<<<<<<<<< + * def __init__(self, quantization_bits, quantization_range, quantization_origin): + * self.quantization_bits = quantization_bits + */ + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_EncodingOptions, __pyx_tuple__45, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingOptions, __pyx_t_4) < 0) __PYX_ERR(0, 57, __pyx_L1_error) + __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":81 + * return 3 + * + * class FileTypeException(Exception): # <<<<<<<<<<<<<< + * pass + * + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __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, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __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_4)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_FileTypeException, __pyx_t_2, __pyx_t_4, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_FileTypeException, __pyx_t_3) < 0) __PYX_ERR(0, 81, __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_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":84 + * pass + * + * class EncodingFailedException(Exception): # <<<<<<<<<<<<<< + * pass + * + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __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, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __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_4)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_EncodingFailedException, __pyx_t_2, __pyx_t_4, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingFailedException, __pyx_t_3) < 0) __PYX_ERR(0, 84, __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_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":87 + * pass + * + * def encode_mesh_to_buffer(points, faces, mesh_object, # <<<<<<<<<<<<<< + * quantization_bits=14, compression_level=1, + * quantization_range=-1, quantization_origin=None, + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_1encode_mesh_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __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, 87, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":125 + * raise ValueError("Input invalid") + * + * def encode_point_cloud_to_buffer(points, point_cloud_object, # <<<<<<<<<<<<<< + * quantization_bits=14, compression_level=1, + * quantization_range=-1, quantization_origin=None, + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_3encode_point_cloud_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 125, __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, 125, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":162 + * 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_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_5raise_decoding_error, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_raise_decoding_error, __pyx_t_2) < 0) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":170 + * 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: + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_7decode_buffer_to_mesh, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 170, __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, 170, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":177 + * 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_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_9decode_point_cloud_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __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, 177, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":1 + * # distutils: language = c++ # <<<<<<<<<<<<<< + * from typing import Dict, List + * + */ + __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; + + /* "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())] + * + */ + + /*--- Wrapped vars code ---*/ + + 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_4); + __Pyx_XDECREF(__pyx_t_5); + if (__pyx_m) { + if (__pyx_d) { + __Pyx_AddTraceback("init DracoPy", __pyx_clineno, __pyx_lineno, __pyx_filename); + } + Py_CLEAR(__pyx_m); + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init DracoPy"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if CYTHON_PEP489_MULTI_PHASE_INIT + return (__pyx_m != NULL) ? 0 : -1; + #elif PY_MAJOR_VERSION >= 3 + return __pyx_m; + #else + return; + #endif +} + +/* --- Runtime support code --- */ +/* Refnanny */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule(modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, "RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif + +/* PyObjectGetAttrStr */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#endif + +/* GetBuiltinName */ +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); + if (unlikely(!result)) { + PyErr_Format(PyExc_NameError, +#if PY_MAJOR_VERSION >= 3 + "name '%U' is not defined", name); +#else + "name '%.200s' is not defined", PyString_AS_STRING(name)); +#endif + } + return result; +} + +/* RaiseArgTupleInvalid */ +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) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +/* RaiseDoubleKeywords */ +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); + #endif +} + +/* ParseKeywords */ +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + 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 +bad: + return -1; +} + +/* PyObjectSetAttrStr */ +#if CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_setattro)) + return tp->tp_setattro(obj, attr_name, value); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_setattr)) + return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value); +#endif + return PyObject_SetAttr(obj, attr_name, value); +} +#endif + +/* DictGetItem */ +#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { + PyObject *value; + value = PyDict_GetItemWithError(d, key); + if (unlikely(!value)) { + if (!PyErr_Occurred()) { + if (unlikely(PyTuple_Check(key))) { + PyObject* args = PyTuple_Pack(1, key); + if (likely(args)) { + PyErr_SetObject(PyExc_KeyError, args); + Py_DECREF(args); + } + } else { + PyErr_SetObject(PyExc_KeyError, key); + } + } + return NULL; + } + Py_INCREF(value); + return value; +} +#endif + +/* PyDictVersioning */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { +#if CYTHON_COMPILING_IN_CPYTHON + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); +#endif + } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +} +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); +} +#endif + +/* GetModuleGlobalName */ +#if CYTHON_USE_DICT_VERSIONS +static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) +#else +static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) +#endif +{ + PyObject *result; +#if !CYTHON_AVOID_BORROWED_REFS +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 + result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } else if (unlikely(PyErr_Occurred())) { + return NULL; + } +#else + result = PyDict_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } +#endif +#else + result = PyObject_GetItem(__pyx_d, name); + __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) + if (likely(result)) { + return __Pyx_NewRef(result); + } + PyErr_Clear(); +#endif + return __Pyx_GetBuiltinName(name); +} + +/* PyFunctionFastCall */ +#if CYTHON_FAST_PYCALL +static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na, + PyObject *globals) { + PyFrameObject *f; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject **fastlocals; + Py_ssize_t i; + PyObject *result; + assert(globals != NULL); + /* XXX Perhaps we should create a specialized + PyFrame_New() that doesn't take locals, but does + take builtins without sanity checking them. + */ + assert(tstate != NULL); + f = PyFrame_New(tstate, co, globals, NULL); + if (f == NULL) { + return NULL; + } + fastlocals = __Pyx_PyFrame_GetLocalsplus(f); + for (i = 0; i < na; i++) { + Py_INCREF(*args); + fastlocals[i] = *args++; + } + result = PyEval_EvalFrameEx(f,0); + ++tstate->recursion_depth; + Py_DECREF(f); + --tstate->recursion_depth; + return result; +} +#if 1 || PY_VERSION_HEX < 0x030600B1 +static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs) { + PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); + PyObject *globals = PyFunction_GET_GLOBALS(func); + PyObject *argdefs = PyFunction_GET_DEFAULTS(func); + PyObject *closure; +#if PY_MAJOR_VERSION >= 3 + PyObject *kwdefs; +#endif + PyObject *kwtuple, **k; + PyObject **d; + Py_ssize_t nd; + Py_ssize_t nk; + PyObject *result; + assert(kwargs == NULL || PyDict_Check(kwargs)); + nk = kwargs ? PyDict_Size(kwargs) : 0; + if (Py_EnterRecursiveCall((char*)" while calling a Python object")) { + return NULL; + } + if ( +#if PY_MAJOR_VERSION >= 3 + co->co_kwonlyargcount == 0 && +#endif + likely(kwargs == NULL || nk == 0) && + co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { + if (argdefs == NULL && co->co_argcount == nargs) { + result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals); + goto done; + } + else if (nargs == 0 && argdefs != NULL + && co->co_argcount == Py_SIZE(argdefs)) { + /* function called with no arguments, but all parameters have + a default value: use default values as arguments .*/ + args = &PyTuple_GET_ITEM(argdefs, 0); + result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals); + goto done; + } + } + if (kwargs != NULL) { + Py_ssize_t pos, i; + kwtuple = PyTuple_New(2 * nk); + if (kwtuple == NULL) { + result = NULL; + goto done; + } + k = &PyTuple_GET_ITEM(kwtuple, 0); + pos = i = 0; + while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) { + Py_INCREF(k[i]); + Py_INCREF(k[i+1]); + i += 2; + } + nk = i / 2; + } + else { + kwtuple = NULL; + k = NULL; + } + closure = PyFunction_GET_CLOSURE(func); +#if PY_MAJOR_VERSION >= 3 + kwdefs = PyFunction_GET_KW_DEFAULTS(func); +#endif + if (argdefs != NULL) { + d = &PyTuple_GET_ITEM(argdefs, 0); + nd = Py_SIZE(argdefs); + } + else { + d = NULL; + nd = 0; + } +#if PY_MAJOR_VERSION >= 3 + result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL, + args, (int)nargs, + k, (int)nk, + d, (int)nd, kwdefs, closure); +#else + result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL, + args, (int)nargs, + k, (int)nk, + d, (int)nd, closure); +#endif + Py_XDECREF(kwtuple); +done: + Py_LeaveRecursiveCall(); + return result; +} +#endif +#endif + +/* PyCFunctionFastCall */ +#if CYTHON_FAST_PYCCALL +static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) { + PyCFunctionObject *func = (PyCFunctionObject*)func_obj; + PyCFunction meth = PyCFunction_GET_FUNCTION(func); + PyObject *self = PyCFunction_GET_SELF(func); + int flags = PyCFunction_GET_FLAGS(func); + assert(PyCFunction_Check(func)); + assert(METH_FASTCALL == (flags & ~(METH_CLASS | METH_STATIC | METH_COEXIST | METH_KEYWORDS | METH_STACKLESS))); + assert(nargs >= 0); + assert(nargs == 0 || args != NULL); + /* _PyCFunction_FastCallDict() must not be called with an exception set, + because it may clear it (directly or indirectly) and so the + caller loses its exception */ + assert(!PyErr_Occurred()); + if ((PY_VERSION_HEX < 0x030700A0) || unlikely(flags & METH_KEYWORDS)) { + return (*((__Pyx_PyCFunctionFastWithKeywords)(void*)meth)) (self, args, nargs, NULL); + } else { + return (*((__Pyx_PyCFunctionFast)(void*)meth)) (self, args, nargs); + } +} +#endif + +/* 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 + +/* PyObjectCall2Args */ +static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { + PyObject *args, *result = NULL; + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(function)) { + PyObject *args[2] = {arg1, arg2}; + return __Pyx_PyFunction_FastCall(function, args, 2); + } + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(function)) { + PyObject *args[2] = {arg1, arg2}; + return __Pyx_PyCFunction_FastCall(function, args, 2); + } + #endif + args = PyTuple_New(2); + if (unlikely(!args)) goto done; + Py_INCREF(arg1); + PyTuple_SET_ITEM(args, 0, arg1); + Py_INCREF(arg2); + PyTuple_SET_ITEM(args, 1, arg2); + Py_INCREF(function); + result = __Pyx_PyObject_Call(function, args, NULL); + Py_DECREF(args); + Py_DECREF(function); +done: + return result; +} + +/* PyObjectCallMethO */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = PyCFunction_GET_FUNCTION(func); + self = PyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyObjectCallOneArg */ +#if CYTHON_COMPILING_IN_CPYTHON +static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_New(1); + if (unlikely(!args)) return NULL; + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 0, arg); + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { +#if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCall(func, &arg, 1); + } +#endif + if (likely(PyCFunction_Check(func))) { + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, arg); +#if CYTHON_FAST_PYCCALL + } else if (__Pyx_PyFastCFunction_Check(func)) { + return __Pyx_PyCFunction_FastCall(func, &arg, 1); +#endif + } + } + return __Pyx__PyObject_CallOneArg(func, arg); +} +#else +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_Pack(1, arg); + if (unlikely(!args)) return NULL; + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; +} +#endif + +/* PyIntBinop */ +#if !CYTHON_COMPILING_IN_PYPY +static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) { + (void)inplace; + (void)zerodivision_check; + #if PY_MAJOR_VERSION < 3 + if (likely(PyInt_CheckExact(op1))) { + const long b = intval; + long x; + long a = PyInt_AS_LONG(op1); + x = (long)((unsigned long)a - b); + if (likely((x^a) >= 0 || (x^~b) >= 0)) + return PyInt_FromLong(x); + return PyLong_Type.tp_as_number->nb_subtract(op1, op2); + } + #endif + #if CYTHON_USE_PYLONG_INTERNALS + if (likely(PyLong_CheckExact(op1))) { + const long b = intval; + long a, x; +#ifdef HAVE_LONG_LONG + const PY_LONG_LONG llb = intval; + PY_LONG_LONG lla, llx; +#endif + const digit* digits = ((PyLongObject*)op1)->ob_digit; + const Py_ssize_t size = Py_SIZE(op1); + if (likely(__Pyx_sst_abs(size) <= 1)) { + a = likely(size) ? digits[0] : 0; + if (size == -1) a = -a; + } else { + switch (size) { + case -2: + if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { + a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); break; #ifdef HAVE_LONG_LONG } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { @@ -9134,30 +14336,430 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) exc_info->exc_value = local_value; exc_info->exc_traceback = local_tb; } - #else - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = local_type; - tstate->exc_value = local_value; - tstate->exc_traceback = local_tb; - #endif - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -#else - PyErr_SetExcInfo(local_type, local_value, local_tb); + #else + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = local_type; + tstate->exc_value = local_value; + tstate->exc_traceback = local_tb; + #endif + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_SetExcInfo(local_type, local_value, local_tb); +#endif + return 0; +bad: + *type = 0; + *value = 0; + *tb = 0; + Py_XDECREF(local_type); + Py_XDECREF(local_value); + Py_XDECREF(local_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 +} + +/* 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 + +/* 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 /* Import */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { @@ -9711,686 +15313,1284 @@ static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, for (i = 0; i < m->defaults_pyobjects; i++) Py_VISIT(pydefaults[i]); } - return 0; + return 0; +} +static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) +{ +#if PY_MAJOR_VERSION < 3 + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { + Py_INCREF(func); + return func; + } + if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { + if (type == NULL) + type = (PyObject *)(Py_TYPE(obj)); + return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type))); + } + if (obj == Py_None) + obj = NULL; +#endif + return __Pyx_PyMethod_New(func, obj, type); +} +static PyObject* +__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) +{ +#if PY_MAJOR_VERSION >= 3 + return PyUnicode_FromFormat("", + op->func_qualname, (void *)op); +#else + return PyString_FromFormat("", + PyString_AsString(op->func_qualname), (void *)op); +#endif +} +static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { + PyCFunctionObject* f = (PyCFunctionObject*)func; + PyCFunction meth = f->m_ml->ml_meth; + Py_ssize_t size; + switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { + case METH_VARARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) + return (*meth)(self, arg); + break; + case METH_VARARGS | METH_KEYWORDS: + return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw); + case METH_NOARGS: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { + size = PyTuple_GET_SIZE(arg); + if (likely(size == 0)) + return (*meth)(self, NULL); + PyErr_Format(PyExc_TypeError, + "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", + f->m_ml->ml_name, size); + return NULL; + } + break; + case METH_O: + if (likely(kw == NULL || PyDict_Size(kw) == 0)) { + size = PyTuple_GET_SIZE(arg); + if (likely(size == 1)) { + PyObject *result, *arg0; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + arg0 = PyTuple_GET_ITEM(arg, 0); + #else + arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; + #endif + result = (*meth)(self, arg0); + #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) + Py_DECREF(arg0); + #endif + return result; + } + PyErr_Format(PyExc_TypeError, + "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", + f->m_ml->ml_name, size); + return NULL; + } + break; + default: + PyErr_SetString(PyExc_SystemError, "Bad call flags in " + "__Pyx_CyFunction_Call. METH_OLDARGS is no " + "longer supported!"); + return NULL; + } + PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", + f->m_ml->ml_name); + return NULL; +} +static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { + return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw); +} +static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { + PyObject *result; + __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; + if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { + Py_ssize_t argc; + PyObject *new_args; + PyObject *self; + argc = PyTuple_GET_SIZE(args); + new_args = PyTuple_GetSlice(args, 1, argc); + if (unlikely(!new_args)) + return NULL; + self = PyTuple_GetItem(args, 0); + if (unlikely(!self)) { + Py_DECREF(new_args); + return NULL; + } + result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); + Py_DECREF(new_args); + } else { + result = __Pyx_CyFunction_Call(func, args, kw); + } + return result; +} +static PyTypeObject __pyx_CyFunctionType_type = { + PyVarObject_HEAD_INIT(0, 0) + "cython_function_or_method", + sizeof(__pyx_CyFunctionObject), + 0, + (destructor) __Pyx_CyFunction_dealloc, + 0, + 0, + 0, +#if PY_MAJOR_VERSION < 3 + 0, +#else + 0, +#endif + (reprfunc) __Pyx_CyFunction_repr, + 0, + 0, + 0, + 0, + __Pyx_CyFunction_CallAsMethod, + 0, + 0, + 0, + 0, + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, + 0, + (traverseproc) __Pyx_CyFunction_traverse, + (inquiry) __Pyx_CyFunction_clear, + 0, +#if PY_VERSION_HEX < 0x030500A0 + offsetof(__pyx_CyFunctionObject, func_weakreflist), +#else + offsetof(PyCFunctionObject, m_weakreflist), +#endif + 0, + 0, + __pyx_CyFunction_methods, + __pyx_CyFunction_members, + __pyx_CyFunction_getsets, + 0, + 0, + __Pyx_CyFunction_descr_get, + 0, + offsetof(__pyx_CyFunctionObject, func_dict), + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, +#if PY_VERSION_HEX >= 0x030400a1 + 0, +#endif +#if PY_VERSION_HEX >= 0x030800b1 + 0, +#endif +#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, +#endif +}; +static int __pyx_CyFunction_init(void) { + __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); + if (unlikely(__pyx_CyFunctionType == NULL)) { + return -1; + } + return 0; +} +static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults = PyObject_Malloc(size); + if (unlikely(!m->defaults)) + return PyErr_NoMemory(); + memset(m->defaults, 0, size); + m->defaults_pyobjects = pyobjects; + m->defaults_size = size; + return m->defaults; +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_tuple = tuple; + Py_INCREF(tuple); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->defaults_kwdict = dict; + Py_INCREF(dict); +} +static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { + __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; + m->func_annotations = dict; + Py_INCREF(dict); +} + +/* CythonFunction */ + static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, + PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { + PyObject *op = __Pyx_CyFunction_Init( + PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType), + ml, flags, qualname, closure, module, globals, code + ); + if (likely(op)) { + PyObject_GC_Track(op); + } + return op; +} + +/* Py3ClassCreate */ + static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, + PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) { + PyObject *ns; + if (metaclass) { + PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare); + if (prep) { + PyObject *pargs = PyTuple_Pack(2, name, bases); + if (unlikely(!pargs)) { + Py_DECREF(prep); + return NULL; + } + ns = PyObject_Call(prep, pargs, mkw); + Py_DECREF(prep); + Py_DECREF(pargs); + } else { + if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError))) + return NULL; + PyErr_Clear(); + ns = PyDict_New(); + } + } else { + ns = PyDict_New(); + } + if (unlikely(!ns)) + return NULL; + if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad; + if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad; + if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad; + return ns; +bad: + Py_DECREF(ns); + return NULL; } -static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type) -{ -#if PY_MAJOR_VERSION < 3 - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) { - Py_INCREF(func); - return func; +static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, + PyObject *dict, PyObject *mkw, + int calculate_metaclass, int allow_py2_metaclass) { + PyObject *result, *margs; + PyObject *owned_metaclass = NULL; + if (allow_py2_metaclass) { + owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass); + if (owned_metaclass) { + metaclass = owned_metaclass; + } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) { + PyErr_Clear(); + } else { + return NULL; + } } - if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) { - if (type == NULL) - type = (PyObject *)(Py_TYPE(obj)); - return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type))); + if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) { + metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases); + Py_XDECREF(owned_metaclass); + if (unlikely(!metaclass)) + return NULL; + owned_metaclass = metaclass; } - if (obj == Py_None) - obj = NULL; + margs = PyTuple_Pack(3, name, bases, dict); + if (unlikely(!margs)) { + result = NULL; + } else { + result = PyObject_Call(metaclass, margs, mkw); + Py_DECREF(margs); + } + Py_XDECREF(owned_metaclass); + return result; +} + +/* CLineInTraceback */ + #ifndef CYTHON_CLINE_IN_TRACEBACK +static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) { + PyObject *use_cline; + PyObject *ptype, *pvalue, *ptraceback; +#if CYTHON_COMPILING_IN_CPYTHON + PyObject **cython_runtime_dict; #endif - return __Pyx_PyMethod_New(func, obj, type); + if (unlikely(!__pyx_cython_runtime)) { + return c_line; + } + __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); +#if CYTHON_COMPILING_IN_CPYTHON + cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); + if (likely(cython_runtime_dict)) { + __PYX_PY_DICT_LOOKUP_IF_MODIFIED( + use_cline, *cython_runtime_dict, + __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) + } else +#endif + { + PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); + if (use_cline_obj) { + use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; + Py_DECREF(use_cline_obj); + } else { + PyErr_Clear(); + use_cline = NULL; + } + } + if (!use_cline) { + c_line = 0; + 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; + } + __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); + return c_line; } -static PyObject* -__Pyx_CyFunction_repr(__pyx_CyFunctionObject *op) -{ -#if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromFormat("", - op->func_qualname, (void *)op); -#else - return PyString_FromFormat("", - PyString_AsString(op->func_qualname), (void *)op); #endif + +/* CodeObjectCache */ + static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = start + (end - start) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } } -static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) { - PyCFunctionObject* f = (PyCFunctionObject*)func; - PyCFunction meth = f->m_ml->ml_meth; - Py_ssize_t size; - switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) { - case METH_VARARGS: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) - return (*meth)(self, arg); - break; - case METH_VARARGS | METH_KEYWORDS: - return (*(PyCFunctionWithKeywords)(void*)meth)(self, arg, kw); - case METH_NOARGS: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) { - size = PyTuple_GET_SIZE(arg); - if (likely(size == 0)) - return (*meth)(self, NULL); - PyErr_Format(PyExc_TypeError, - "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)", - f->m_ml->ml_name, size); - return NULL; +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); } - break; - case METH_O: - if (likely(kw == NULL || PyDict_Size(kw) == 0)) { - size = PyTuple_GET_SIZE(arg); - if (likely(size == 1)) { - PyObject *result, *arg0; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - arg0 = PyTuple_GET_ITEM(arg, 0); - #else - arg0 = PySequence_ITEM(arg, 0); if (unlikely(!arg0)) return NULL; - #endif - result = (*meth)(self, arg0); - #if !(CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS) - Py_DECREF(arg0); - #endif - return result; - } - PyErr_Format(PyExc_TypeError, - "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)", - f->m_ml->ml_name, size); - return NULL; + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; } - break; - default: - PyErr_SetString(PyExc_SystemError, "Bad call flags in " - "__Pyx_CyFunction_Call. METH_OLDARGS is no " - "longer supported!"); - return NULL; + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); +} + +/* AddTraceback */ + #include "compile.h" +#include "frameobject.h" +#include "traceback.h" +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; + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(filename); + #else + py_srcfile = PyUnicode_FromString(filename); + #endif + if (!py_srcfile) goto bad; + if (c_line) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #endif } - PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", - f->m_ml->ml_name); + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_code = __Pyx_PyCode_New( + 0, + 0, + 0, + 0, + 0, + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + py_line, + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); return NULL; } -static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) { - return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw); -} -static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) { - PyObject *result; - __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func; - if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) { - Py_ssize_t argc; - PyObject *new_args; - PyObject *self; - argc = PyTuple_GET_SIZE(args); - new_args = PyTuple_GetSlice(args, 1, argc); - if (unlikely(!new_args)) - return NULL; - self = PyTuple_GetItem(args, 0); - if (unlikely(!self)) { - Py_DECREF(new_args); - return NULL; - } - result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw); - Py_DECREF(new_args); - } else { - result = __Pyx_CyFunction_Call(func, args, kw); +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + PyThreadState *tstate = __Pyx_PyThreadState_Current; + if (c_line) { + c_line = __Pyx_CLineForTraceback(tstate, c_line); } - return result; + py_code = __pyx_find_code_object(c_line ? -c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); + } + py_frame = PyFrame_New( + tstate, /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + __pyx_d, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + __Pyx_PyFrame_SetLineNumber(py_frame, py_line); + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); } -static PyTypeObject __pyx_CyFunctionType_type = { - PyVarObject_HEAD_INIT(0, 0) - "cython_function_or_method", - sizeof(__pyx_CyFunctionObject), - 0, - (destructor) __Pyx_CyFunction_dealloc, - 0, - 0, - 0, + +/* CIntFromPyVerify */ + #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) +#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ + __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) +#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ + {\ + func_type value = func_value;\ + if (sizeof(target_type) < sizeof(func_type)) {\ + if (unlikely(value != (func_type) (target_type) value)) {\ + func_type zero = 0;\ + if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ + return (target_type) -1;\ + if (is_unsigned && unlikely(value < zero))\ + goto raise_neg_overflow;\ + else\ + goto raise_overflow;\ + }\ + }\ + return (target_type) value;\ + } + +static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttributeObject(struct DracoFunctions::PointAttributeObject s) { + PyObject* res; + PyObject* member; + 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.unique_id); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_unique_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_AttributeMetadataObject(struct DracoFunctions::AttributeMetadataObject 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_PyInt_From_uint32_t(s.unique_id); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_unique_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_AttributeMetadataObject(s.attribute_metadatas); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_attribute_metadatas, 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_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_MeshObject(struct DracoFunctions::MeshObject s) { + PyObject* res; + PyObject* member; + res = __Pyx_PyDict_NewPresized(11); 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); + member = __pyx_convert_vector_to_py_unsigned_int(s.faces); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_faces, member) < 0)) goto bad; + Py_DECREF(member); + member = __pyx_convert_vector_to_py_float(s.normals); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_normals, member) < 0)) goto bad; + Py_DECREF(member); + member = __Pyx_PyBool_FromLong(s.encoding_options_set); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_encoding_options_set, member) < 0)) goto bad; + Py_DECREF(member); + member = __Pyx_PyInt_From_int(s.quantization_bits); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_quantization_bits, member) < 0)) goto bad; + Py_DECREF(member); + member = PyFloat_FromDouble(s.quantization_range); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_quantization_range, member) < 0)) goto bad; + Py_DECREF(member); + member = __pyx_convert_vector_to_py_double(s.quantization_origin); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_quantization_origin, member) < 0)) goto bad; + Py_DECREF(member); + 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_vector_to_py_struct__DracoFunctions_3a__3a_PointAttributeObject(s.attributes); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_attributes, 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); + Py_DECREF(res); + return NULL; + } + static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointCloudObject(struct DracoFunctions::PointCloudObject s) { + PyObject* res; + PyObject* member; + res = __Pyx_PyDict_NewPresized(9); 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); + member = __Pyx_PyBool_FromLong(s.encoding_options_set); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_encoding_options_set, member) < 0)) goto bad; + Py_DECREF(member); + member = __Pyx_PyInt_From_int(s.quantization_bits); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_quantization_bits, member) < 0)) goto bad; + Py_DECREF(member); + member = PyFloat_FromDouble(s.quantization_range); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_quantization_range, member) < 0)) goto bad; + Py_DECREF(member); + member = __pyx_convert_vector_to_py_double(s.quantization_origin); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_quantization_origin, member) < 0)) goto bad; + Py_DECREF(member); + 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_vector_to_py_struct__DracoFunctions_3a__3a_PointAttributeObject(s.attributes); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_attributes, 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); + Py_DECREF(res); + return NULL; + } + /* 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 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 PY_MAJOR_VERSION < 3 - 0, -#else - 0, + 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 #endif - (reprfunc) __Pyx_CyFunction_repr, - 0, - 0, - 0, - 0, - __Pyx_CyFunction_CallAsMethod, - 0, - 0, - 0, - 0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, - 0, - (traverseproc) __Pyx_CyFunction_traverse, - (inquiry) __Pyx_CyFunction_clear, - 0, -#if PY_VERSION_HEX < 0x030500A0 - offsetof(__pyx_CyFunctionObject, func_weakreflist), -#else - offsetof(PyCFunctionObject, m_weakreflist), + 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 - 0, - 0, - __pyx_CyFunction_methods, - __pyx_CyFunction_members, - __pyx_CyFunction_getsets, - 0, - 0, - __Pyx_CyFunction_descr_get, - 0, - offsetof(__pyx_CyFunctionObject, func_dict), - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, -#if PY_VERSION_HEX >= 0x030400a1 - 0, +#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 -#if PY_VERSION_HEX >= 0x030800b1 - 0, + 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(size_t) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif -#if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 - 0, + } + } 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(size_t) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif -}; -static int __pyx_CyFunction_init(void) { - __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); - if (unlikely(__pyx_CyFunctionType == NULL)) { - return -1; - } - return 0; -} -static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults = PyObject_Malloc(size); - if (unlikely(!m->defaults)) - return PyErr_NoMemory(); - memset(m->defaults, 0, size); - m->defaults_pyobjects = pyobjects; - m->defaults_size = size; - return m->defaults; -} -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults_tuple = tuple; - Py_INCREF(tuple); -} -static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->defaults_kwdict = dict; - Py_INCREF(dict); -} -static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) { - __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func; - m->func_annotations = dict; - Py_INCREF(dict); -} - -/* CythonFunction */ - static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qualname, - PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) { - PyObject *op = __Pyx_CyFunction_Init( - PyObject_GC_New(__pyx_CyFunctionObject, __pyx_CyFunctionType), - ml, flags, qualname, closure, module, globals, code - ); - if (likely(op)) { - PyObject_GC_Track(op); - } - return op; -} - -/* Py3ClassCreate */ - static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, - PyObject *qualname, PyObject *mkw, PyObject *modname, PyObject *doc) { - PyObject *ns; - if (metaclass) { - PyObject *prep = __Pyx_PyObject_GetAttrStr(metaclass, __pyx_n_s_prepare); - if (prep) { - PyObject *pargs = PyTuple_Pack(2, name, bases); - if (unlikely(!pargs)) { - Py_DECREF(prep); - return NULL; } - ns = PyObject_Call(prep, pargs, mkw); - Py_DECREF(prep); - Py_DECREF(pargs); - } else { - if (unlikely(!PyErr_ExceptionMatches(PyExc_AttributeError))) - return NULL; - PyErr_Clear(); - ns = PyDict_New(); } - } else { - ns = PyDict_New(); - } - if (unlikely(!ns)) - return NULL; - if (unlikely(PyObject_SetItem(ns, __pyx_n_s_module, modname) < 0)) goto bad; - if (unlikely(PyObject_SetItem(ns, __pyx_n_s_qualname, qualname) < 0)) goto bad; - if (unlikely(doc && PyObject_SetItem(ns, __pyx_n_s_doc, doc) < 0)) goto bad; - return ns; -bad: - Py_DECREF(ns); - return NULL; -} -static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, - PyObject *dict, PyObject *mkw, - int calculate_metaclass, int allow_py2_metaclass) { - PyObject *result, *margs; - PyObject *owned_metaclass = NULL; - if (allow_py2_metaclass) { - owned_metaclass = PyObject_GetItem(dict, __pyx_n_s_metaclass); - if (owned_metaclass) { - metaclass = owned_metaclass; - } else if (likely(PyErr_ExceptionMatches(PyExc_KeyError))) { - PyErr_Clear(); - } else { - return NULL; + { +#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; } - } - if (calculate_metaclass && (!metaclass || PyType_Check(metaclass))) { - metaclass = __Pyx_CalculateMetaclass((PyTypeObject*) metaclass, bases); - Py_XDECREF(owned_metaclass); - if (unlikely(!metaclass)) - return NULL; - owned_metaclass = metaclass; - } - margs = PyTuple_Pack(3, name, bases, dict); - if (unlikely(!margs)) { - result = NULL; } else { - result = PyObject_Call(metaclass, margs, mkw); - Py_DECREF(margs); + 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; } - Py_XDECREF(owned_metaclass); - return result; +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; } -/* CLineInTraceback */ - #ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) { - PyObject *use_cline; - PyObject *ptype, *pvalue, *ptraceback; -#if CYTHON_COMPILING_IN_CPYTHON - PyObject **cython_runtime_dict; +/* CIntFromPy */ + static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" #endif - if (unlikely(!__pyx_cython_runtime)) { - return c_line; - } - __Pyx_ErrFetchInState(tstate, &ptype, &pvalue, &ptraceback); -#if CYTHON_COMPILING_IN_CPYTHON - cython_runtime_dict = _PyObject_GetDictPtr(__pyx_cython_runtime); - if (likely(cython_runtime_dict)) { - __PYX_PY_DICT_LOOKUP_IF_MODIFIED( - use_cline, *cython_runtime_dict, - __Pyx_PyDict_GetItemStr(*cython_runtime_dict, __pyx_n_s_cline_in_traceback)) + 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 PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(uint32_t) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(uint32_t, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (uint32_t) val; + } } else #endif - { - PyObject *use_cline_obj = __Pyx_PyObject_GetAttrStr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback); - if (use_cline_obj) { - use_cline = PyObject_Not(use_cline_obj) ? Py_False : Py_True; - Py_DECREF(use_cline_obj); - } else { - PyErr_Clear(); - use_cline = NULL; - } - } - if (!use_cline) { - c_line = 0; - 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; - } - __Pyx_ErrRestoreInState(tstate, ptype, pvalue, ptraceback); - return c_line; -} + 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 (uint32_t) 0; + case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, digits[0]) + case 2: + if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) >= 2 * PyLong_SHIFT) { + return (uint32_t) (((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); + } + } + break; + case 3: + if (8 * sizeof(uint32_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) >= 3 * PyLong_SHIFT) { + return (uint32_t) (((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); + } + } + break; + case 4: + if (8 * sizeof(uint32_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_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(uint32_t) >= 4 * PyLong_SHIFT) { + return (uint32_t) (((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)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 (uint32_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if (sizeof(uint32_t) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, 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 (uint32_t) 0; + case -1: __PYX_VERIFY_RETURN_INT(uint32_t, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, +digits[0]) + case -2: + if (8 * sizeof(uint32_t) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { + return (uint32_t) (((uint32_t)-1)*(((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + case 2: + if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { + return (uint32_t) ((((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + case -3: + if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { + return (uint32_t) (((uint32_t)-1)*(((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + case 3: + if (8 * sizeof(uint32_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { + return (uint32_t) ((((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + case -4: + if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_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(uint32_t) - 1 > 4 * PyLong_SHIFT) { + return (uint32_t) (((uint32_t)-1)*(((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + case 4: + if (8 * sizeof(uint32_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(uint32_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(uint32_t) - 1 > 4 * PyLong_SHIFT) { + return (uint32_t) ((((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + } + } + break; + } +#endif + if (sizeof(uint32_t) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_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 + uint32_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 - -/* CodeObjectCache */ - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { - int start = 0, mid = 0, end = count - 1; - if (end >= 0 && code_line > entries[end].code_line) { - return count; - } - while (start < end) { - mid = start + (end - start) / 2; - if (code_line < entries[mid].code_line) { - end = mid; - } else if (code_line > entries[mid].code_line) { - start = mid + 1; - } else { - return mid; + return (uint32_t) -1; } - } - if (code_line <= entries[mid].code_line) { - return mid; } else { - return mid + 1; - } -} -static PyCodeObject *__pyx_find_code_object(int code_line) { - PyCodeObject* code_object; - int pos; - if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { - return NULL; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { - return NULL; - } - code_object = __pyx_code_cache.entries[pos].code_object; - Py_INCREF(code_object); - return code_object; -} -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { - int pos, i; - __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; - if (unlikely(!code_line)) { - return; - } - if (unlikely(!entries)) { - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); - if (likely(entries)) { - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = 64; - __pyx_code_cache.count = 1; - entries[0].code_line = code_line; - entries[0].code_object = code_object; - Py_INCREF(code_object); - } - return; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { - PyCodeObject* tmp = entries[pos].code_object; - entries[pos].code_object = code_object; + uint32_t val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (uint32_t) -1; + val = __Pyx_PyInt_As_uint32_t(tmp); Py_DECREF(tmp); - return; - } - if (__pyx_code_cache.count == __pyx_code_cache.max_count) { - int new_max = __pyx_code_cache.max_count + 64; - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( - __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); - if (unlikely(!entries)) { - return; - } - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = new_max; - } - for (i=__pyx_code_cache.count; i>pos; i--) { - entries[i] = entries[i-1]; + return val; } - entries[pos].code_line = code_line; - entries[pos].code_object = code_object; - __pyx_code_cache.count++; - Py_INCREF(code_object); +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to uint32_t"); + return (uint32_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to uint32_t"); + return (uint32_t) -1; } -/* AddTraceback */ - #include "compile.h" -#include "frameobject.h" -#include "traceback.h" -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; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif - if (!py_srcfile) goto bad; - if (c_line) { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #endif - } - else { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); - #endif - } - if (!py_funcname) goto bad; - py_code = __Pyx_PyCode_New( - 0, - 0, - 0, - 0, - 0, - __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ - py_srcfile, /*PyObject *filename,*/ - py_funcname, /*PyObject *name,*/ - py_line, - __pyx_empty_bytes /*PyObject *lnotab*/ - ); - Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); - return py_code; -bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); - return NULL; -} -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - PyThreadState *tstate = __Pyx_PyThreadState_Current; - if (c_line) { - c_line = __Pyx_CLineForTraceback(tstate, c_line); - } - py_code = __pyx_find_code_object(c_line ? -c_line : py_line); - if (!py_code) { - py_code = __Pyx_CreateCodeObjectForTraceback( - funcname, c_line, py_line, filename); - if (!py_code) goto bad; - __pyx_insert_code_object(c_line ? -c_line : py_line, py_code); +/* CIntFromPy */ + static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned 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(unsigned int) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(unsigned int, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (unsigned 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 (unsigned int) 0; + case 1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, digits[0]) + case 2: + if (8 * sizeof(unsigned int) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(unsigned int) >= 2 * PyLong_SHIFT) { + return (unsigned int) (((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])); + } + } + break; + case 3: + if (8 * sizeof(unsigned int) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(unsigned int) >= 3 * PyLong_SHIFT) { + return (unsigned int) (((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0])); + } + } + break; + case 4: + if (8 * sizeof(unsigned int) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(unsigned 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(unsigned int) >= 4 * PyLong_SHIFT) { + return (unsigned int) (((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned 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 (unsigned int) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if (sizeof(unsigned int) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(unsigned int, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(unsigned 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 (unsigned int) 0; + case -1: __PYX_VERIFY_RETURN_INT(unsigned int, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(unsigned int, digit, +digits[0]) + case -2: + if (8 * sizeof(unsigned int) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) { + return (unsigned int) (((unsigned int)-1)*(((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); + } + } + break; + case 2: + if (8 * sizeof(unsigned int) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) { + return (unsigned int) ((((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); + } + } + break; + case -3: + if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(unsigned int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) { + return (unsigned int) (((unsigned int)-1)*(((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); + } + } + break; + case 3: + if (8 * sizeof(unsigned int) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) { + return (unsigned int) ((((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); + } + } + break; + case -4: + if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(unsigned 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(unsigned int) - 1 > 4 * PyLong_SHIFT) { + return (unsigned int) (((unsigned int)-1)*(((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); + } + } + break; + case 4: + if (8 * sizeof(unsigned int) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(unsigned 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(unsigned int) - 1 > 4 * PyLong_SHIFT) { + return (unsigned int) ((((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned int)digits[0]))); + } + } + break; + } +#endif + if (sizeof(unsigned int) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(unsigned int, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(unsigned int, 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 + unsigned int 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 (unsigned int) -1; + } + } else { + unsigned int val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (unsigned int) -1; + val = __Pyx_PyInt_As_unsigned_int(tmp); + Py_DECREF(tmp); + return val; } - py_frame = PyFrame_New( - tstate, /*PyThreadState *tstate,*/ - py_code, /*PyCodeObject *code,*/ - __pyx_d, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ - ); - if (!py_frame) goto bad; - __Pyx_PyFrame_SetLineNumber(py_frame, py_line); - PyTraceBack_Here(py_frame); -bad: - Py_XDECREF(py_code); - Py_XDECREF(py_frame); +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to unsigned int"); + return (unsigned int) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned int"); + return (unsigned int) -1; } -/* CIntFromPyVerify */ - #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) -#define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\ - __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1) -#define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\ - {\ - func_type value = func_value;\ - if (sizeof(target_type) < sizeof(func_type)) {\ - if (unlikely(value != (func_type) (target_type) value)) {\ - func_type zero = 0;\ - if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\ - return (target_type) -1;\ - if (is_unsigned && unlikely(value < zero))\ - goto raise_neg_overflow;\ - else\ - goto raise_overflow;\ - }\ - }\ - return (target_type) value;\ - } - -static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttributeObject(struct DracoFunctions::PointAttributeObject s) { - PyObject* res; - PyObject* member; - 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.unique_id); if (unlikely(!member)) goto bad; - if (unlikely(PyDict_SetItem(res, __pyx_n_s_unique_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_AttributeMetadataObject(struct DracoFunctions::AttributeMetadataObject s) { - PyObject* res; - PyObject* member; - res = __Pyx_PyDict_NewPresized(4); if (unlikely(!res)) return NULL; - member = __Pyx_PyInt_From_uint32_t(s.tree_id); if (unlikely(!member)) goto bad; - if (unlikely(PyDict_SetItem(res, __pyx_n_s_tree_id, member) < 0)) goto bad; - Py_DECREF(member); - 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); - member = __Pyx_PyInt_From_uint32_t(s.unique_id); if (unlikely(!member)) goto bad; - if (unlikely(PyDict_SetItem(res, __pyx_n_s_unique_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(4); if (unlikely(!res)) return NULL; - member = __Pyx_PyInt_From_uint32_t(s.tree_id); if (unlikely(!member)) goto bad; - if (unlikely(PyDict_SetItem(res, __pyx_n_s_tree_id, member) < 0)) goto bad; - Py_DECREF(member); - 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); - member = __pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(s.attribute_metadatas); if (unlikely(!member)) goto bad; - if (unlikely(PyDict_SetItem(res, __pyx_n_s_attribute_metadatas, 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); - member = __pyx_convert_vector_to_py_unsigned_int(s.faces); if (unlikely(!member)) goto bad; - if (unlikely(PyDict_SetItem(res, __pyx_n_s_faces, member) < 0)) goto bad; - Py_DECREF(member); - member = __pyx_convert_vector_to_py_float(s.normals); if (unlikely(!member)) goto bad; - if (unlikely(PyDict_SetItem(res, __pyx_n_s_normals, member) < 0)) goto bad; - Py_DECREF(member); - member = __Pyx_PyBool_FromLong(s.encoding_options_set); if (unlikely(!member)) goto bad; - if (unlikely(PyDict_SetItem(res, __pyx_n_s_encoding_options_set, member) < 0)) goto bad; - Py_DECREF(member); - member = __Pyx_PyInt_From_int(s.quantization_bits); if (unlikely(!member)) goto bad; - if (unlikely(PyDict_SetItem(res, __pyx_n_s_quantization_bits, member) < 0)) goto bad; - Py_DECREF(member); - member = PyFloat_FromDouble(s.quantization_range); if (unlikely(!member)) goto bad; - if (unlikely(PyDict_SetItem(res, __pyx_n_s_quantization_range, member) < 0)) goto bad; - Py_DECREF(member); - member = __pyx_convert_vector_to_py_double(s.quantization_origin); if (unlikely(!member)) goto bad; - if (unlikely(PyDict_SetItem(res, __pyx_n_s_quantization_origin, member) < 0)) goto bad; - Py_DECREF(member); - 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_vector_to_py_struct__DracoFunctions_3a__3a_PointAttributeObject(s.attributes); if (unlikely(!member)) goto bad; - if (unlikely(PyDict_SetItem(res, __pyx_n_s_attributes, 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); - return res; - bad: - Py_XDECREF(member); - Py_DECREF(res); - return NULL; - } - static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointCloudObject(struct DracoFunctions::PointCloudObject s) { - PyObject* res; - PyObject* member; - 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); - member = __Pyx_PyBool_FromLong(s.encoding_options_set); if (unlikely(!member)) goto bad; - if (unlikely(PyDict_SetItem(res, __pyx_n_s_encoding_options_set, member) < 0)) goto bad; - Py_DECREF(member); - member = __Pyx_PyInt_From_int(s.quantization_bits); if (unlikely(!member)) goto bad; - if (unlikely(PyDict_SetItem(res, __pyx_n_s_quantization_bits, member) < 0)) goto bad; - Py_DECREF(member); - member = PyFloat_FromDouble(s.quantization_range); if (unlikely(!member)) goto bad; - if (unlikely(PyDict_SetItem(res, __pyx_n_s_quantization_range, member) < 0)) goto bad; - Py_DECREF(member); - member = __pyx_convert_vector_to_py_double(s.quantization_origin); if (unlikely(!member)) goto bad; - if (unlikely(PyDict_SetItem(res, __pyx_n_s_quantization_origin, member) < 0)) goto bad; - Py_DECREF(member); - 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_vector_to_py_struct__DracoFunctions_3a__3a_PointAttributeObject(s.attributes); if (unlikely(!member)) goto bad; - if (unlikely(PyDict_SetItem(res, __pyx_n_s_attributes, 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); - return res; - bad: - Py_XDECREF(member); - Py_DECREF(res); - return NULL; - } - /* CIntFromPy */ - static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { +/* 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 size_t neg_one = (size_t) -1, const_zero = (size_t) 0; + 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(size_t) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(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 (size_t) val; + return (int) val; } } else #endif @@ -10399,32 +16599,32 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu #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 (int) 0; + case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) case 2: - if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(int) > 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(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(size_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(int) > 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(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(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) >= 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) >= 4 * PyLong_SHIFT) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); } } break; @@ -10438,86 +16638,86 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) - return (size_t) -1; + return (int) -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(int) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(int, 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(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 (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 (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(size_t) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(int) - 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(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(size_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(int) > 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(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(size_t) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(int) - 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(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(size_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(int) > 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(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(size_t) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(int) - 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(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 } } @@ -10526,7 +16726,7 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu 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)) { @@ -10546,47 +16746,47 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu 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; } /* CIntFromPy */ - static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) { + static CYTHON_INLINE enum DracoFunctions::decoding_status __Pyx_PyInt_As_enum__DracoFunctions_3a__3a_decoding_status(PyObject *x) { #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; + const enum DracoFunctions::decoding_status neg_one = (enum DracoFunctions::decoding_status) -1, const_zero = (enum DracoFunctions::decoding_status) 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(uint32_t) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(uint32_t, long, PyInt_AS_LONG(x)) + if (sizeof(enum DracoFunctions::decoding_status) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(enum DracoFunctions::decoding_status, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } - return (uint32_t) val; + return (enum DracoFunctions::decoding_status) val; } } else #endif @@ -10595,32 +16795,32 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return (uint32_t) 0; - case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, digits[0]) + case 0: return (enum DracoFunctions::decoding_status) 0; + case 1: __PYX_VERIFY_RETURN_INT(enum DracoFunctions::decoding_status, digit, digits[0]) case 2: - if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(enum DracoFunctions::decoding_status) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) >= 2 * PyLong_SHIFT) { - return (uint32_t) (((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); + __PYX_VERIFY_RETURN_INT(enum DracoFunctions::decoding_status, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(enum DracoFunctions::decoding_status) >= 2 * PyLong_SHIFT) { + return (enum DracoFunctions::decoding_status) (((((enum DracoFunctions::decoding_status)digits[1]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[0])); } } break; case 3: - if (8 * sizeof(uint32_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(enum DracoFunctions::decoding_status) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) >= 3 * PyLong_SHIFT) { - return (uint32_t) (((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); + __PYX_VERIFY_RETURN_INT(enum DracoFunctions::decoding_status, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(enum DracoFunctions::decoding_status) >= 3 * PyLong_SHIFT) { + return (enum DracoFunctions::decoding_status) (((((((enum DracoFunctions::decoding_status)digits[2]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[1]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[0])); } } break; case 4: - if (8 * sizeof(uint32_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(enum DracoFunctions::decoding_status) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_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(uint32_t) >= 4 * PyLong_SHIFT) { - return (uint32_t) (((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); + __PYX_VERIFY_RETURN_INT(enum DracoFunctions::decoding_status, 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 DracoFunctions::decoding_status) >= 4 * PyLong_SHIFT) { + return (enum DracoFunctions::decoding_status) (((((((((enum DracoFunctions::decoding_status)digits[3]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[2]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[1]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[0])); } } break; @@ -10634,86 +16834,86 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) - return (uint32_t) -1; + return (enum DracoFunctions::decoding_status) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif - if (sizeof(uint32_t) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned long, PyLong_AsUnsignedLong(x)) + if (sizeof(enum DracoFunctions::decoding_status) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(enum DracoFunctions::decoding_status, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } else if (sizeof(enum DracoFunctions::decoding_status) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(enum DracoFunctions::decoding_status, 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 (uint32_t) 0; - case -1: __PYX_VERIFY_RETURN_INT(uint32_t, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, +digits[0]) + case 0: return (enum DracoFunctions::decoding_status) 0; + case -1: __PYX_VERIFY_RETURN_INT(enum DracoFunctions::decoding_status, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(enum DracoFunctions::decoding_status, digit, +digits[0]) case -2: - if (8 * sizeof(uint32_t) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(enum DracoFunctions::decoding_status) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { - return (uint32_t) (((uint32_t)-1)*(((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + __PYX_VERIFY_RETURN_INT(enum DracoFunctions::decoding_status, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(enum DracoFunctions::decoding_status) - 1 > 2 * PyLong_SHIFT) { + return (enum DracoFunctions::decoding_status) (((enum DracoFunctions::decoding_status)-1)*(((((enum DracoFunctions::decoding_status)digits[1]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[0]))); } } break; case 2: - if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(enum DracoFunctions::decoding_status) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { - return (uint32_t) ((((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + __PYX_VERIFY_RETURN_INT(enum DracoFunctions::decoding_status, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(enum DracoFunctions::decoding_status) - 1 > 2 * PyLong_SHIFT) { + return (enum DracoFunctions::decoding_status) ((((((enum DracoFunctions::decoding_status)digits[1]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[0]))); } } break; case -3: - if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(enum DracoFunctions::decoding_status) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { - return (uint32_t) (((uint32_t)-1)*(((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + __PYX_VERIFY_RETURN_INT(enum DracoFunctions::decoding_status, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(enum DracoFunctions::decoding_status) - 1 > 3 * PyLong_SHIFT) { + return (enum DracoFunctions::decoding_status) (((enum DracoFunctions::decoding_status)-1)*(((((((enum DracoFunctions::decoding_status)digits[2]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[1]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[0]))); } } break; case 3: - if (8 * sizeof(uint32_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(enum DracoFunctions::decoding_status) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { - return (uint32_t) ((((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + __PYX_VERIFY_RETURN_INT(enum DracoFunctions::decoding_status, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(enum DracoFunctions::decoding_status) - 1 > 3 * PyLong_SHIFT) { + return (enum DracoFunctions::decoding_status) ((((((((enum DracoFunctions::decoding_status)digits[2]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[1]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[0]))); } } break; case -4: - if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(enum DracoFunctions::decoding_status) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_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(uint32_t) - 1 > 4 * PyLong_SHIFT) { - return (uint32_t) (((uint32_t)-1)*(((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + __PYX_VERIFY_RETURN_INT(enum DracoFunctions::decoding_status, 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 DracoFunctions::decoding_status) - 1 > 4 * PyLong_SHIFT) { + return (enum DracoFunctions::decoding_status) (((enum DracoFunctions::decoding_status)-1)*(((((((((enum DracoFunctions::decoding_status)digits[3]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[2]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[1]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[0]))); } } break; case 4: - if (8 * sizeof(uint32_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(enum DracoFunctions::decoding_status) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_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(uint32_t) - 1 > 4 * PyLong_SHIFT) { - return (uint32_t) ((((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + __PYX_VERIFY_RETURN_INT(enum DracoFunctions::decoding_status, 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 DracoFunctions::decoding_status) - 1 > 4 * PyLong_SHIFT) { + return (enum DracoFunctions::decoding_status) ((((((((((enum DracoFunctions::decoding_status)digits[3]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[2]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[1]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[0]))); } } break; } #endif - if (sizeof(uint32_t) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(uint32_t, long, PyLong_AsLong(x)) + if (sizeof(enum DracoFunctions::decoding_status) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(enum DracoFunctions::decoding_status, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(uint32_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } else if (sizeof(enum DracoFunctions::decoding_status) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(enum DracoFunctions::decoding_status, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } @@ -10722,7 +16922,7 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else - uint32_t val; + enum DracoFunctions::decoding_status val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { @@ -10742,47 +16942,47 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu return val; } #endif - return (uint32_t) -1; + return (enum DracoFunctions::decoding_status) -1; } } else { - uint32_t val; + enum DracoFunctions::decoding_status val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (uint32_t) -1; - val = __Pyx_PyInt_As_uint32_t(tmp); + if (!tmp) return (enum DracoFunctions::decoding_status) -1; + val = __Pyx_PyInt_As_enum__DracoFunctions_3a__3a_decoding_status(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, - "value too large to convert to uint32_t"); - return (uint32_t) -1; + "value too large to convert to enum DracoFunctions::decoding_status"); + return (enum DracoFunctions::decoding_status) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to uint32_t"); - return (uint32_t) -1; + "can't convert negative value to enum DracoFunctions::decoding_status"); + return (enum DracoFunctions::decoding_status) -1; } /* 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 @@ -10791,32 +16991,32 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu #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; @@ -10830,86 +17030,86 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu { 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 } } @@ -10918,7 +17118,7 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu 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)) { @@ -10938,24 +17138,24 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu 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; + "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 int"); - return (int) -1; + "can't convert negative value to enum draco::DataType"); + return (enum draco::DataType) -1; } /* CIntToPy */ diff --git a/src/DracoPy.h b/src/DracoPy.h index 31d86f1..a85e248 100644 --- a/src/DracoPy.h +++ b/src/DracoPy.h @@ -15,12 +15,12 @@ namespace DracoFunctions { enum encoding_status { successful_encoding, failed_during_encoding }; struct MetadataObject { - uint32_t tree_id; // id to help build tree structure std::unordered_map entries; std::unordered_map sub_metadata_ids; }; - struct AttributeMetadataObject: MetadataObject { + struct AttributeMetadataObject { + uint32_t metadata_id; // reference to metadata object uint32_t unique_id; }; @@ -31,7 +31,8 @@ namespace DracoFunctions { uint32_t unique_id; }; - struct GeometryMetadataObject: MetadataObject { + struct GeometryMetadataObject { + uint32_t metadata_id; // reference to metadata object std::vector attribute_metadatas; }; @@ -48,6 +49,7 @@ namespace DracoFunctions { std::vector attributes; GeometryMetadataObject geometry_metadata; + std::vector metadatas; }; struct MeshObject : PointCloudObject { @@ -60,67 +62,135 @@ namespace DracoFunctions { encoding_status encode_status; }; - std::vector decode_attributes(const draco::PointCloud& pc) { - const int32_t attributes_len = pc.num_attributes(); - std::vector attribute_objects(attributes_len); - for (int i = 0; i < attributes_len; ++i) - if (const auto* attribute = pc.attribute(i)) - { - attribute_objects[i].dimension = static_cast(attribute->num_components()); - attribute_objects[i].datatype = attribute->data_type(); - attribute_objects[i].unique_id = static_cast(attribute->unique_id()); - const auto value_size = attribute->num_components() * attribute->byte_stride(); - for (draco::PointIndex v(0); v < attribute->indices_map_size(); ++v) { - auto& value = attribute_objects[i].data[v.value()]; - value.resize(value_size); - attribute->GetMappedValue(v, value.data()); + namespace { + //////////////////////////////////////////////////// + ////// helpful decoding functions ////////////////// + //////////////////////////////////////////////////// + + std::vector decode_generic_attributes(const draco::PointCloud& pc) { + const int32_t attributes_len = pc.num_attributes(); + std::vector attribute_objects(attributes_len); + for (int i = 0; i < attributes_len; ++i) + if (const auto* attribute = pc.attribute(i)) + if (attribute->attribute_type() == draco::GeometryAttribute::GENERIC) { + attribute_objects[i].dimension = static_cast(attribute->num_components()); + attribute_objects[i].datatype = attribute->data_type(); + attribute_objects[i].unique_id = static_cast(attribute->unique_id()); + const auto value_size = attribute->num_components() * attribute->byte_stride(); + for (draco::PointIndex v(0); v < attribute->indices_map_size(); ++v) { + auto& value = attribute_objects[i].data[v.value()]; + value.resize(value_size); + attribute->GetMappedValue(v, value.data()); + } + } + return attribute_objects; + } + + uint32_t add_metadata_object(std::vector& metadata_objects) { + metadata_objects.push_back({}); + return static_cast(metadata_objects.size() - 1); + } + + void decode_metadata(const draco::Metadata& metadata, std::vector& all_metadata_objects) { + // main metadata object is a have just created object + MetadataObject& main_metadata_object = all_metadata_objects.back(); + + using MetadataPair = std::pair; + std::vector to_parse_metadata = { {&metadata, &main_metadata_object} }; + for (std::vector to_parse_metadatas_next; !to_parse_metadata.empty(); + to_parse_metadata = std::move(to_parse_metadatas_next)) { + for (auto [metadata, metadata_object]: to_parse_metadata) { + // consider entries + for (const auto& [name, vec_value]: metadata->entries()) { + 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); + metadata_object->entries[name] = std::move(str_value); + } + // consider sub metadatas + for (const auto& [name, sub_metadata]: metadata->sub_metadatas()) { + metadata_object->sub_metadata_ids[name] = add_metadata_object(all_metadata_objects);; + to_parse_metadatas_next.push_back({sub_metadata.get(), &all_metadata_objects.back()}); + } } } - return attribute_objects; - } + } + + GeometryMetadataObject decode_geometry_metadata(const draco::GeometryMetadata& geometry_metadata, + PointCloudObject& pco) { + GeometryMetadataObject geometry_metadata_object; + auto& all_metadata_objects = pco.metadatas; + geometry_metadata_object.metadata_id = add_metadata_object(all_metadata_objects); + decode_metadata(geometry_metadata, all_metadata_objects); + for (const auto& attribute_metadata: geometry_metadata.attribute_metadatas()) { + AttributeMetadataObject amo; + amo.unique_id = attribute_metadata->att_unique_id(); + amo.metadata_id = add_metadata_object(all_metadata_objects); + decode_metadata(*attribute_metadata, all_metadata_objects); + geometry_metadata_object.attribute_metadatas.push_back(std::move(amo)); + } + return geometry_metadata_object; + } - void decode_metadata(const draco::Metadata& metadata, MetadataObject& main_metadata_object) { - main_metadata_object.tree_id = 0; - using MetadataPair = std::pair; - std::vector to_parse_metadata = { {&metadata, &main_metadata_object} }; - std::vector metadata_objects; - uint32_t metadata_idx = 0; - for (std::vector to_parse_metadatas_next; !to_parse_metadata.empty(); - to_parse_metadata = std::move(to_parse_metadatas_next)) { - for (auto [metadata, metadata_object]: to_parse_metadata) { - // consider entries - for (const auto& [name, vec_value]: metadata->entries()) { - 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); - metadata_object->entries[name] = std::move(str_value); + //////////////////////////////////////////////////// + ////// helpful encoding functions ////////////////// + //////////////////////////////////////////////////// + + void encode_generic_attributes(const PointCloudObject& pco, draco::PointCloud& pc) { + for (const PointAttributeObject& pao: pco.attributes) { + auto attribute = std::make_unique(); + attribute->Init(draco::GeometryAttribute::GENERIC, nullptr, + pao.dimension, pao.datatype, false, + draco::DataTypeLength(pao.datatype) * pao.dimension, 0); + attribute->set_unique_id(pao.unique_id); + for (draco::PointIndex v(0); v < pao.data.size(); ++v) { + draco::AttributeValueIndex value_index(v.value()); + attribute->SetAttributeValue(value_index, pao.data.at(v.value()).data()); + attribute->SetPointMapEntry(v, value_index); } - // consider sub metadatas - for (const auto& [name, sub_metadata]: metadata->sub_metadatas()) { - MetadataObject sub_metadata_object; - sub_metadata_object.tree_id = ++metadata_idx; - metadata_object->sub_metadata_ids[name] = sub_metadata_object.tree_id; - metadata_objects.push_back(std::move(sub_metadata_object)); - to_parse_metadatas_next.push_back({sub_metadata.get(), &sub_metadata_object}); + pc.AddAttribute(std::move(attribute)); + } + } + + void encode_metadata(const PointCloudObject& pco, const MetadataObject& main_metadata_object, + draco::Metadata& metadata) { + using MetadataPair = std::pair; + std::vector to_parse_metadata = { {&metadata, &main_metadata_object} }; + for (std::vector to_parse_metadatas_next; !to_parse_metadata.empty(); + to_parse_metadata = std::move(to_parse_metadatas_next)) { + for (auto [metadata, metadata_object]: to_parse_metadata) { + // consider entries + for (const auto& [name, str_value]: metadata_object->entries) { + 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& [name, metadata_id]: metadata_object->sub_metadata_ids) { + auto sub_metadata = std::make_unique(); + to_parse_metadatas_next.push_back({sub_metadata.get(), &pco.metadatas[metadata_id]}); + metadata->AddSubMetadata(name, std::move(sub_metadata)); + } } } } - } - GeometryMetadataObject decode_geometry_metadata(const draco::GeometryMetadata& geometry_metadata) { - GeometryMetadataObject geometry_metadata_object; - decode_metadata(static_cast(geometry_metadata), - static_cast(geometry_metadata_object)); - for (const auto& attribute_metadata: geometry_metadata.attribute_metadatas()) { - AttributeMetadataObject attribute_metadata_object; - attribute_metadata_object.unique_id = attribute_metadata->att_unique_id(); - decode_metadata(static_cast(*attribute_metadata.get()), - static_cast(attribute_metadata_object)); - geometry_metadata_object.attribute_metadatas.push_back(std::move(attribute_metadata_object)); + std::unique_ptr encode_geometry_metadata(const PointCloudObject& pco) { + draco::GeometryMetadata geometry_metadata; + const GeometryMetadataObject& gmo = pco.geometry_metadata; + encode_metadata(pco, pco.metadatas[gmo.metadata_id], geometry_metadata); + + for (const auto& amo: pco.geometry_metadata.attribute_metadatas) { + auto attribute_metadata = std::make_unique(); + attribute_metadata->set_att_unique_id(amo.unique_id); + encode_metadata(pco, pco.metadatas[amo.metadata_id], *attribute_metadata); + geometry_metadata.AddAttributeMetadata(std::move(attribute_metadata)); + } + return std::make_unique(std::move(geometry_metadata)); } - return geometry_metadata_object; } + MeshObject decode_buffer(const char *buffer, std::size_t buffer_len) { MeshObject meshObject; draco::DecoderBuffer decoderBuffer; @@ -171,9 +241,9 @@ namespace DracoFunctions { metadata->GetEntryDoubleArray("quantization_origin", &(meshObject.quantization_origin))) { meshObject.encoding_options_set = true; } - meshObject.geometry_metadata = decode_geometry_metadata(*metadata); + meshObject.geometry_metadata = decode_geometry_metadata(*metadata, meshObject); } - meshObject.attributes = decode_attributes(*mesh); + meshObject.attributes = decode_generic_attributes(*mesh); meshObject.decode_status = successful; return meshObject; } @@ -221,9 +291,9 @@ namespace DracoFunctions { metadata->GetEntryDoubleArray("quantization_origin", &(pointCloudObject.quantization_origin))) { pointCloudObject.encoding_options_set = true; } - pointCloudObject.geometry_metadata = decode_geometry_metadata(*metadata); + pointCloudObject.geometry_metadata = decode_geometry_metadata(*metadata, pointCloudObject); } - pointCloudObject.attributes = decode_attributes(*point_cloud); + pointCloudObject.attributes = decode_generic_attributes(*point_cloud); pointCloudObject.decode_status = successful; return pointCloudObject; } @@ -252,9 +322,10 @@ namespace DracoFunctions { } } - 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, + MeshObject mesh_object, + int quantization_bits, int compression_level, float quantization_range, + const float *quantization_origin, bool create_metadata) { draco::TriangleSoupMeshBuilder mb; mb.Start(faces.size()); const int pos_att_id = @@ -272,6 +343,9 @@ namespace DracoFunctions { std::unique_ptr ptr_mesh = mb.Finalize(); draco::Mesh *mesh = ptr_mesh.get(); + mesh->AddMetadata(encode_geometry_metadata(mesh_object)); + encode_generic_attributes(mesh_object, *mesh); + draco::Encoder encoder; setup_encoder_and_metadata(mesh, encoder, compression_level, quantization_bits, quantization_range, quantization_origin, create_metadata); draco::EncoderBuffer buffer; @@ -287,8 +361,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, const PointCloudObject& pco, + int quantization_bits, int compression_level, + float quantization_range, const float *quantization_origin, + bool create_metadata) { int num_points = points.size() / 3; draco::PointCloudBuilder pcb; pcb.Start(num_points); @@ -301,6 +377,9 @@ namespace DracoFunctions { std::unique_ptr ptr_point_cloud = pcb.Finalize(true); draco::PointCloud *point_cloud = ptr_point_cloud.get(); + point_cloud->AddMetadata(encode_geometry_metadata(pco)); + encode_generic_attributes(pco, *point_cloud); + draco::Encoder encoder; setup_encoder_and_metadata(point_cloud, encoder, compression_level, quantization_bits, quantization_range, quantization_origin, create_metadata); draco::EncoderBuffer buffer; diff --git a/src/DracoPy.pxd b/src/DracoPy.pxd index 5ab1f3b..dfec117 100644 --- a/src/DracoPy.pxd +++ b/src/DracoPy.pxd @@ -31,14 +31,11 @@ cdef extern from "DracoPy.h" namespace "DracoFunctions": successful_encoding, failed_during_encoding cdef struct MetadataObject: - uint32_t tree_id unordered_map[string, string] entries unordered_map[string, uint32_t] sub_metadata_ids cdef struct AttributeMetadataObject: - uint32_t tree_id - unordered_map[string, string] entries - unordered_map[string, uint32_t] sub_metadata_ids + uint32_t metadata_id # reference to metadata object uint32_t unique_id cdef struct PointAttributeObject: @@ -48,9 +45,7 @@ cdef extern from "DracoPy.h" namespace "DracoFunctions": uint32_t unique_id cdef struct GeometryMetadataObject: - uint32_t tree_id - unordered_map[string, string] entries - unordered_map[string, uint32_t] sub_metadata_ids + uint32_t metadata_id # reference to metadata object vector[AttributeMetadataObject] attribute_metadatas cdef struct PointCloudObject: @@ -67,6 +62,7 @@ cdef extern from "DracoPy.h" namespace "DracoFunctions": vector[PointAttributeObject] attributes GeometryMetadataObject geometry_metadata + vector[MetadataObject] metadatas cdef struct MeshObject: vector[float] points @@ -86,6 +82,7 @@ cdef extern from "DracoPy.h" namespace "DracoFunctions": vector[PointAttributeObject] attributes GeometryMetadataObject geometry_metadata + vector[MetadataObject] metadatas cdef struct EncodedObject: vector[unsigned char] buffer @@ -109,12 +106,13 @@ cdef extern from "DracoPy.h" namespace "DracoFunctions": EncodedObject encode_mesh( vector[float] points, vector[uint32_t] faces, + MeshObject mesh_object, int quantization_bits, int compression_level, float quantization_range, const float *quantization_origin, bool create_metadata) except + EncodedObject encode_point_cloud( - vector[float] points, + vector[float] points, PointCloudObject pco, int quantization_bits, int compression_level, float quantization_range, const float *quantization_origin, bool create_metadata) except + diff --git a/src/DracoPy.pyx b/src/DracoPy.pyx index 764aaba..59b96ec 100644 --- a/src/DracoPy.pyx +++ b/src/DracoPy.pyx @@ -40,6 +40,10 @@ class DracoPointCloud(object): def attributes(self) -> List['PointAttributeObject']: return self.data_struct['attributes'] + @property + def metadatas(self) -> List['MetadataObject']: + return self.data_struct['metadatas'] + class DracoMesh(DracoPointCloud): @property @@ -80,7 +84,7 @@ class FileTypeException(Exception): class EncodingFailedException(Exception): pass -def encode_mesh_to_buffer(points, faces, +def encode_mesh_to_buffer(points, faces, mesh_object, quantization_bits=14, compression_level=1, quantization_range=-1, quantization_origin=None, create_metadata=False): @@ -101,7 +105,7 @@ def encode_mesh_to_buffer(points, faces, for dim in range(num_dims): quant_origin[dim] = quantization_origin[dim] # binary_metadata = encode_metadata(metadata) - encoded_mesh = DracoPy.encode_mesh(points, faces, + encoded_mesh = DracoPy.encode_mesh(points, faces, mesh_object, quantization_bits, compression_level, quantization_range, quant_origin, create_metadata) @@ -118,7 +122,7 @@ def encode_mesh_to_buffer(points, faces, PyMem_Free(quant_origin) raise ValueError("Input invalid") -def encode_point_cloud_to_buffer(points, +def encode_point_cloud_to_buffer(points, point_cloud_object, quantization_bits=14, compression_level=1, quantization_range=-1, quantization_origin=None, create_metadata=False): @@ -140,7 +144,7 @@ def encode_point_cloud_to_buffer(points, quant_origin[dim] = quantization_origin[dim] # binary_metadata = encode_metadata(metadata) encoded_point_cloud = DracoPy.encode_point_cloud( - points, quantization_bits, compression_level, + points, point_cloud_object, quantization_bits, compression_level, quantization_range, quant_origin, create_metadata) if quant_origin != NULL: PyMem_Free(quant_origin) From b96232d32b447204beb1832b7ca90cc3e020ec87 Mon Sep 17 00:00:00 2001 From: Andrey Romanov Date: Sat, 30 Oct 2021 03:51:08 +0300 Subject: [PATCH 08/21] test works, tasks: 1.points duplications 2.code cleaning 3.more tests --- src/DracoPy.cpp | 6034 +++++++++++++++-------------------------------- src/DracoPy.h | 373 ++- src/DracoPy.pxd | 16 +- src/DracoPy.pyx | 27 +- tests.py | 128 +- 5 files changed, 2322 insertions(+), 4256 deletions(-) diff --git a/src/DracoPy.cpp b/src/DracoPy.cpp index f306baa..eedde91 100644 --- a/src/DracoPy.cpp +++ b/src/DracoPy.cpp @@ -11,7 +11,7 @@ #else #define CYTHON_ABI "0_29_24" #define CYTHON_HEX_VERSION 0x001D18F0 -#define CYTHON_FUTURE_DIVISION 1 +#define CYTHON_FUTURE_DIVISION 0 #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) @@ -1209,8 +1209,16 @@ static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); #endif -/* IterFinish.proto */ -static CYTHON_INLINE int __Pyx_IterFinish(void); +/* 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 + +/* Import.proto */ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /* PyObjectCallNoArg.proto */ #if CYTHON_COMPILING_IN_CPYTHON @@ -1219,6 +1227,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); #define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) #endif +/* IterFinish.proto */ +static CYTHON_INLINE int __Pyx_IterFinish(void); + /* PyObjectGetMethod.proto */ static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); @@ -1258,14 +1269,6 @@ static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int 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 - /* ListCompAppend.proto */ #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { @@ -1283,9 +1286,6 @@ static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) #endif -/* Import.proto */ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); - /* ImportFrom.proto */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); @@ -1446,7 +1446,6 @@ static void __Pyx_CppExn2PyErr() { #endif 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_AttributeMetadataObject(struct DracoFunctions::AttributeMetadataObject 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_MetadataObject(struct DracoFunctions::MetadataObject s); static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(struct DracoFunctions::MeshObject s); @@ -1458,20 +1457,17 @@ static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *); static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *); /* CIntFromPy.proto */ -static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_int(PyObject *); +static CYTHON_INLINE enum draco::DataType __Pyx_PyInt_As_enum__draco_3a__3a_DataType(PyObject *); /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); -/* CIntFromPy.proto */ -static CYTHON_INLINE enum DracoFunctions::decoding_status __Pyx_PyInt_As_enum__DracoFunctions_3a__3a_decoding_status(PyObject *); - -/* CIntFromPy.proto */ -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); +/* CIntFromPy.proto */ +static CYTHON_INLINE enum DracoFunctions::decoding_status __Pyx_PyInt_As_enum__DracoFunctions_3a__3a_decoding_status(PyObject *); + /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(enum DracoFunctions::decoding_status value); @@ -1519,21 +1515,17 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'DracoPy' */ static std::vector __pyx_convert_vector_from_py_float(PyObject *); /*proto*/ static std::vector __pyx_convert_vector_from_py_uint32_t(PyObject *); /*proto*/ -static std::vector __pyx_convert_vector_from_py_unsigned_int(PyObject *); /*proto*/ -static std::vector __pyx_convert_vector_from_py_double(PyObject *); /*proto*/ static std::string __pyx_convert_string_from_py_std__in_string(PyObject *); /*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::AttributeMetadataObject __pyx_convert__from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(PyObject *); /*proto*/ -static std::vector __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(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_struct__DracoFunctions_3a__3a_MetadataObject(PyObject *); /*proto*/ -static struct DracoFunctions::MeshObject __pyx_convert__from_py_struct__DracoFunctions_3a__3a_MeshObject(PyObject *); /*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 PyObject *__pyx_convert_vector_to_py_unsigned_char(const std::vector &); /*proto*/ +static std::vector __pyx_convert_vector_from_py_double(PyObject *); /*proto*/ static struct DracoFunctions::PointCloudObject __pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointCloudObject(PyObject *); /*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*/ @@ -1545,7 +1537,6 @@ static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string 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_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 PyObject *__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(const std::vector &); /*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*/ @@ -1560,6 +1551,7 @@ static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_TypeError; static PyObject *__pyx_builtin_KeyError; +static const char __pyx_k_e[] = "e"; static const char __pyx_k_dim[] = "dim"; static const char __pyx_k_doc[] = "__doc__"; static const char __pyx_k_Dict[] = "Dict"; @@ -1600,12 +1592,11 @@ 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_unique_id[] = "unique_id"; +static const char __pyx_k_print_exc[] = "print_exc"; +static const char __pyx_k_traceback[] = "traceback"; static const char __pyx_k_ValueError[] = "ValueError"; -static const char __pyx_k_attributes[] = "attributes"; static const char __pyx_k_difference[] = "difference"; static const char __pyx_k_data_struct[] = "data_struct"; -static const char __pyx_k_mesh_object[] = "mesh_object"; static const char __pyx_k_mesh_struct[] = "mesh_struct"; static const char __pyx_k_metadata_id[] = "metadata_id"; static const char __pyx_k_Invalid_mesh[] = "Invalid mesh"; @@ -1615,7 +1606,6 @@ static const char __pyx_k_Input_invalid[] = "Input invalid"; static const char __pyx_k_decode_status[] = "decode_status"; static const char __pyx_k_encoded_point[] = "encoded_point"; static const char __pyx_k_inverse_alpha[] = "inverse_alpha"; -static const char __pyx_k_MetadataObject[] = "MetadataObject"; static const char __pyx_k_DracoMesh_faces[] = "DracoMesh.faces"; static const char __pyx_k_DracoPointCloud[] = "DracoPointCloud"; static const char __pyx_k_EncodingOptions[] = "EncodingOptions"; @@ -1632,14 +1622,13 @@ 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_cline_in_traceback[] = "cline_in_traceback"; +static const char __pyx_k_generic_attributes[] = "generic_attributes"; static const char __pyx_k_point_cloud_object[] = "point_cloud_object"; 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_attribute_metadatas[] = "attribute_metadatas"; static const char __pyx_k_encoded_point_cloud[] = "encoded_point_cloud"; static const char __pyx_k_quantization_origin[] = "quantization_origin"; -static const char __pyx_k_PointAttributeObject[] = "PointAttributeObject"; 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_decode_buffer_to_mesh[] = "decode_buffer_to_mesh"; @@ -1647,14 +1636,12 @@ 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_GeometryMetadataObject[] = "GeometryMetadataObject"; static const char __pyx_k_get_encoded_coordinate[] = "get_encoded_coordinate"; static const char __pyx_k_EncodingFailedException[] = "EncodingFailedException"; 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_DracoPointCloud_metadatas[] = "DracoPointCloud.metadatas"; static const char __pyx_k_decode_point_cloud_buffer[] = "decode_point_cloud_buffer"; -static const char __pyx_k_DracoPointCloud_attributes[] = "DracoPointCloud.attributes"; static const char __pyx_k_encode_point_cloud_to_buffer[] = "encode_point_cloud_to_buffer"; 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"; @@ -1664,33 +1651,28 @@ static const char __pyx_k_DracoPy_only_supports_meshes_wit[] = "DracoPy only sup 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_No_value_specified_for_struct_at[] = "No value specified for struct attribute 'data'"; +static const char __pyx_k_No_value_specified_for_struct_at[] = "No value specified for struct attribute 'entries'"; static const char __pyx_k_Specified_value_out_of_encoded_r[] = "Specified value out of encoded range"; -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 'unique_id'"; -static const char __pyx_k_No_value_specified_for_struct_at_5[] = "No value specified for struct attribute 'metadata_id'"; -static const char __pyx_k_No_value_specified_for_struct_at_6[] = "No value specified for struct attribute 'attribute_metadatas'"; -static const char __pyx_k_No_value_specified_for_struct_at_7[] = "No value specified for struct attribute 'entries'"; -static const char __pyx_k_No_value_specified_for_struct_at_8[] = "No value specified for struct attribute 'sub_metadata_ids'"; -static const char __pyx_k_No_value_specified_for_struct_at_9[] = "No value specified for struct attribute 'points'"; -static const char __pyx_k_No_value_specified_for_struct_at_10[] = "No value specified for struct attribute 'faces'"; -static const char __pyx_k_No_value_specified_for_struct_at_11[] = "No value specified for struct attribute 'normals'"; -static const char __pyx_k_No_value_specified_for_struct_at_12[] = "No value specified for struct attribute 'encoding_options_set'"; -static const char __pyx_k_No_value_specified_for_struct_at_13[] = "No value specified for struct attribute 'quantization_bits'"; -static const char __pyx_k_No_value_specified_for_struct_at_14[] = "No value specified for struct attribute 'quantization_range'"; -static const char __pyx_k_No_value_specified_for_struct_at_15[] = "No value specified for struct attribute 'quantization_origin'"; -static const char __pyx_k_No_value_specified_for_struct_at_16[] = "No value specified for struct attribute 'decode_status'"; -static const char __pyx_k_No_value_specified_for_struct_at_17[] = "No value specified for struct attribute 'attributes'"; -static const char __pyx_k_No_value_specified_for_struct_at_18[] = "No value specified for struct attribute 'geometry_metadata'"; -static const char __pyx_k_No_value_specified_for_struct_at_19[] = "No value specified for struct attribute 'metadatas'"; +static const char __pyx_k_No_value_specified_for_struct_at_2[] = "No value specified for struct attribute 'sub_metadata_ids'"; +static const char __pyx_k_No_value_specified_for_struct_at_3[] = "No value specified for struct attribute 'data'"; +static const char __pyx_k_No_value_specified_for_struct_at_4[] = "No value specified for struct attribute 'datatype'"; +static const char __pyx_k_No_value_specified_for_struct_at_5[] = "No value specified for struct attribute 'dimension'"; +static const char __pyx_k_No_value_specified_for_struct_at_6[] = "No value specified for struct attribute 'metadata_id'"; +static const char __pyx_k_No_value_specified_for_struct_at_7[] = "No value specified for struct attribute 'generic_attributes'"; +static const char __pyx_k_No_value_specified_for_struct_at_8[] = "No value specified for struct attribute 'points'"; +static const char __pyx_k_No_value_specified_for_struct_at_9[] = "No value specified for struct attribute 'encoding_options_set'"; +static const char __pyx_k_No_value_specified_for_struct_at_10[] = "No value specified for struct attribute 'quantization_bits'"; +static const char __pyx_k_No_value_specified_for_struct_at_11[] = "No value specified for struct attribute 'quantization_range'"; +static const char __pyx_k_No_value_specified_for_struct_at_12[] = "No value specified for struct attribute 'quantization_origin'"; +static const char __pyx_k_No_value_specified_for_struct_at_13[] = "No value specified for struct attribute 'decode_status'"; +static const char __pyx_k_No_value_specified_for_struct_at_14[] = "No value specified for struct attribute 'geometry_metadata'"; +static const char __pyx_k_No_value_specified_for_struct_at_15[] = "No value specified for struct attribute 'metadatas'"; 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_attributes; 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; @@ -1698,23 +1680,21 @@ 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_kp_s_DracoPy_only_supports_meshes_wit; 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_kp_u_Failed_to_decode_input_mesh_Data; +static PyObject *__pyx_kp_s_Failed_to_decode_input_mesh_Data; static PyObject *__pyx_n_s_FileTypeException; -static PyObject *__pyx_n_u_GeometryMetadataObject; -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_kp_s_Input_invalid; +static PyObject *__pyx_kp_s_Input_mesh_is_not_draco_encoded; +static PyObject *__pyx_kp_s_Invalid_mesh; +static PyObject *__pyx_kp_s_Invalid_point_cloud; static PyObject *__pyx_n_s_KeyError; static PyObject *__pyx_n_s_List; -static PyObject *__pyx_n_u_MetadataObject; static PyObject *__pyx_kp_s_No_value_specified_for_struct_at; static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_10; static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_11; @@ -1722,10 +1702,6 @@ static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_12; static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_13; static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_14; static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_15; -static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_16; -static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_17; -static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_18; -static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_19; 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; @@ -1734,13 +1710,9 @@ 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_kp_s_No_value_specified_for_struct_at_8; static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_9; -static PyObject *__pyx_n_u_PointAttributeObject; -static PyObject *__pyx_kp_u_Specified_value_out_of_encoded_r; +static PyObject *__pyx_kp_s_Specified_value_out_of_encoded_r; static PyObject *__pyx_n_s_TypeError; static PyObject *__pyx_n_s_ValueError; -static PyObject *__pyx_n_s_attribute_metadatas; -static PyObject *__pyx_n_s_attributes; -static PyObject *__pyx_n_u_attributes; static PyObject *__pyx_n_s_axis; static PyObject *__pyx_n_s_buffer; static PyObject *__pyx_n_s_cline_in_traceback; @@ -1757,6 +1729,7 @@ 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_e; 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; @@ -1764,13 +1737,11 @@ static PyObject *__pyx_n_s_encoded_point; static PyObject *__pyx_n_s_encoded_point_cloud; 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_entries; 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_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_import; @@ -1779,16 +1750,13 @@ static PyObject *__pyx_n_s_inverse_alpha; static PyObject *__pyx_n_s_iteritems; static PyObject *__pyx_n_s_main; static PyObject *__pyx_n_s_math; -static PyObject *__pyx_n_s_mesh_object; static PyObject *__pyx_n_s_mesh_struct; static PyObject *__pyx_n_s_metaclass; static PyObject *__pyx_n_s_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_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; @@ -1796,17 +1764,14 @@ static PyObject *__pyx_n_s_point; static PyObject *__pyx_n_s_point_cloud_object; 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_print_exc; static PyObject *__pyx_n_s_property; static PyObject *__pyx_n_s_qualname; static PyObject *__pyx_n_s_quant_origin; static PyObject *__pyx_n_s_quantization_bits; -static PyObject *__pyx_n_u_quantization_bits; static PyObject *__pyx_n_s_quantization_origin; -static PyObject *__pyx_n_u_quantization_origin; 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; @@ -1815,8 +1780,8 @@ static PyObject *__pyx_n_s_self; static PyObject *__pyx_kp_s_src_DracoPy_pyx; static PyObject *__pyx_n_s_sub_metadata_ids; static PyObject *__pyx_n_s_test; +static PyObject *__pyx_n_s_traceback; static PyObject *__pyx_n_s_typing; -static PyObject *__pyx_n_s_unique_id; static PyObject *__pyx_n_s_value; 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 */ @@ -1824,15 +1789,14 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_4get_encoded_point(CYTHON_U 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_12attributes(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_14metadatas(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_mesh_object, 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_encode_mesh_to_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_points, PyObject *__pyx_v_faces, PyObject *__pyx_v_metadatas, PyObject *__pyx_v_geometry_metadata, 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_point_cloud_object, 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 */ @@ -1864,9 +1828,7 @@ static PyObject *__pyx_tuple__18; static PyObject *__pyx_tuple__19; static PyObject *__pyx_tuple__20; static PyObject *__pyx_tuple__21; -static PyObject *__pyx_tuple__22; static PyObject *__pyx_tuple__23; -static PyObject *__pyx_tuple__24; static PyObject *__pyx_tuple__25; static PyObject *__pyx_tuple__27; static PyObject *__pyx_tuple__29; @@ -1875,18 +1837,17 @@ static PyObject *__pyx_tuple__33; static PyObject *__pyx_tuple__35; static PyObject *__pyx_tuple__37; static PyObject *__pyx_tuple__39; -static PyObject *__pyx_tuple__41; -static PyObject *__pyx_tuple__43; -static PyObject *__pyx_tuple__45; +static PyObject *__pyx_tuple__40; +static PyObject *__pyx_tuple__42; +static PyObject *__pyx_tuple__44; 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__62; +static PyObject *__pyx_codeobj__22; +static PyObject *__pyx_codeobj__24; static PyObject *__pyx_codeobj__26; static PyObject *__pyx_codeobj__28; static PyObject *__pyx_codeobj__30; @@ -1894,18 +1855,15 @@ static PyObject *__pyx_codeobj__32; static PyObject *__pyx_codeobj__34; static PyObject *__pyx_codeobj__36; static PyObject *__pyx_codeobj__38; -static PyObject *__pyx_codeobj__40; -static PyObject *__pyx_codeobj__42; -static PyObject *__pyx_codeobj__44; +static PyObject *__pyx_codeobj__41; +static PyObject *__pyx_codeobj__43; +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__61; -static PyObject *__pyx_codeobj__63; /* Late includes */ /* "DracoPy.pyx":10 @@ -2014,7 +1972,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyOb * self.encoding_options = EncodingOptions(data_struct['quantization_bits'], * data_struct['quantization_range'], data_struct['quantization_origin']) */ - __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_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data_struct, __pyx_n_s_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; @@ -2029,7 +1987,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyOb */ __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_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data_struct, __pyx_n_s_quantization_bits); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); /* "DracoPy.pyx":14 @@ -2039,9 +1997,9 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyOb * 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, 14, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data_struct, __pyx_n_s_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_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data_struct, __pyx_n_s_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; @@ -2586,7 +2544,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_6num_axes(CYTHON_UNUSED PyO /* "DracoPy.pyx":32 * * @property - * def points(self): # <<<<<<<<<<<<<< + * def points(self) -> List[float]: # <<<<<<<<<<<<<< * return self.data_struct['points'] * */ @@ -2617,7 +2575,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_8points(CYTHON_UNUSED PyObj /* "DracoPy.pyx":33 * @property - * def points(self): + * def points(self) -> List[float]: * return self.data_struct['points'] # <<<<<<<<<<<<<< * * @property @@ -2625,7 +2583,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_8points(CYTHON_UNUSED PyObj __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, 33, __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, 33, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_points); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 33, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; @@ -2635,7 +2593,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_8points(CYTHON_UNUSED PyObj /* "DracoPy.pyx":32 * * @property - * def points(self): # <<<<<<<<<<<<<< + * def points(self) -> List[float]: # <<<<<<<<<<<<<< * return self.data_struct['points'] * */ @@ -2655,9 +2613,9 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_8points(CYTHON_UNUSED PyObj /* "DracoPy.pyx":36 * * @property - * def geometry_metadata(self) -> 'GeometryMetadataObject': # <<<<<<<<<<<<<< + * def geometry_metadata(self) -> Dict: # <<<<<<<<<<<<<< * return self.data_struct['geometry_metadata'] - * + * # */ /* Python wrapper */ @@ -2686,15 +2644,15 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_10geometry_metadata(CYTHON_ /* "DracoPy.pyx":37 * @property - * def geometry_metadata(self) -> 'GeometryMetadataObject': + * def geometry_metadata(self) -> Dict: * return self.data_struct['geometry_metadata'] # <<<<<<<<<<<<<< - * - * @property + * # + * # @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_geometry_metadata); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_geometry_metadata); 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; @@ -2704,9 +2662,9 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_10geometry_metadata(CYTHON_ /* "DracoPy.pyx":36 * * @property - * def geometry_metadata(self) -> 'GeometryMetadataObject': # <<<<<<<<<<<<<< + * def geometry_metadata(self) -> Dict: # <<<<<<<<<<<<<< * return self.data_struct['geometry_metadata'] - * + * # */ /* function exit code */ @@ -2721,98 +2679,29 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_10geometry_metadata(CYTHON_ return __pyx_r; } -/* "DracoPy.pyx":40 - * - * @property - * def attributes(self) -> List['PointAttributeObject']: # <<<<<<<<<<<<<< - * return self.data_struct['attributes'] - * - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_13attributes(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_15DracoPointCloud_13attributes = {"attributes", (PyCFunction)__pyx_pw_7DracoPy_15DracoPointCloud_13attributes, METH_O, 0}; -static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_13attributes(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("attributes (wrapper)", 0); - __pyx_r = __pyx_pf_7DracoPy_15DracoPointCloud_12attributes(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_12attributes(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("attributes", 0); - - /* "DracoPy.pyx":41 - * @property - * def attributes(self) -> List['PointAttributeObject']: - * return self.data_struct['attributes'] # <<<<<<<<<<<<<< - * - * @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, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_attributes); 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; - goto __pyx_L0; - - /* "DracoPy.pyx":40 - * - * @property - * def attributes(self) -> List['PointAttributeObject']: # <<<<<<<<<<<<<< - * return self.data_struct['attributes'] - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("DracoPy.DracoPointCloud.attributes", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - /* "DracoPy.pyx":44 * * @property - * def metadatas(self) -> List['MetadataObject']: # <<<<<<<<<<<<<< + * def metadatas(self) -> List[Dict]: # <<<<<<<<<<<<<< * return self.data_struct['metadatas'] * */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_15metadatas(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_15DracoPointCloud_15metadatas = {"metadatas", (PyCFunction)__pyx_pw_7DracoPy_15DracoPointCloud_15metadatas, METH_O, 0}; -static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_15metadatas(PyObject *__pyx_self, PyObject *__pyx_v_self) { +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_14metadatas(__pyx_self, ((PyObject *)__pyx_v_self)); + __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_14metadatas(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { +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; @@ -2824,7 +2713,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_14metadatas(CYTHON_UNUSED P /* "DracoPy.pyx":45 * @property - * def metadatas(self) -> List['MetadataObject']: + * def metadatas(self) -> List[Dict]: * return self.data_struct['metadatas'] # <<<<<<<<<<<<<< * * @@ -2832,7 +2721,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_14metadatas(CYTHON_UNUSED P __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, 45, __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, 45, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_metadatas); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; @@ -2842,7 +2731,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_14metadatas(CYTHON_UNUSED P /* "DracoPy.pyx":44 * * @property - * def metadatas(self) -> List['MetadataObject']: # <<<<<<<<<<<<<< + * def metadatas(self) -> List[Dict]: # <<<<<<<<<<<<<< * return self.data_struct['metadatas'] * */ @@ -2862,7 +2751,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_14metadatas(CYTHON_UNUSED P /* "DracoPy.pyx":50 * class DracoMesh(DracoPointCloud): * @property - * def faces(self): # <<<<<<<<<<<<<< + * def faces(self) -> List[int]: # <<<<<<<<<<<<<< * return self.data_struct['faces'] * */ @@ -2893,7 +2782,7 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_faces(CYTHON_UNUSED PyObject *__py /* "DracoPy.pyx":51 * @property - * def faces(self): + * def faces(self) -> List[int]: * return self.data_struct['faces'] # <<<<<<<<<<<<<< * * @property @@ -2901,7 +2790,7 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_faces(CYTHON_UNUSED PyObject *__py __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, 51, __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, 51, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_faces); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; @@ -2911,7 +2800,7 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_faces(CYTHON_UNUSED PyObject *__py /* "DracoPy.pyx":50 * class DracoMesh(DracoPointCloud): * @property - * def faces(self): # <<<<<<<<<<<<<< + * def faces(self) -> List[int]: # <<<<<<<<<<<<<< * return self.data_struct['faces'] * */ @@ -2970,7 +2859,7 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_2normals(CYTHON_UNUSED PyObject *_ __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, 55, __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, 55, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_normals); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; @@ -3761,9 +3650,9 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_6num_axes(CYTHON_UNUSED PyO /* "DracoPy.pyx":87 * pass * - * def encode_mesh_to_buffer(points, faces, mesh_object, # <<<<<<<<<<<<<< + * def encode_mesh_to_buffer(points, faces, metadatas, # <<<<<<<<<<<<<< + * geometry_metadata, * quantization_bits=14, compression_level=1, - * quantization_range=-1, quantization_origin=None, */ /* Python wrapper */ @@ -3773,7 +3662,8 @@ static PyMethodDef __pyx_mdef_7DracoPy_1encode_mesh_to_buffer = {"encode_mesh_to 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; - PyObject *__pyx_v_mesh_object = 0; + PyObject *__pyx_v_metadatas = 0; + PyObject *__pyx_v_geometry_metadata = 0; PyObject *__pyx_v_quantization_bits = 0; PyObject *__pyx_v_compression_level = 0; PyObject *__pyx_v_quantization_range = 0; @@ -3786,33 +3676,35 @@ static PyObject *__pyx_pw_7DracoPy_1encode_mesh_to_buffer(PyObject *__pyx_self, __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_mesh_object,&__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[8] = {0,0,0,0,0,0,0,0}; - values[3] = ((PyObject *)__pyx_int_14); - values[4] = ((PyObject *)__pyx_int_1); - values[5] = ((PyObject *)__pyx_int_neg_1); - - /* "DracoPy.pyx":89 - * def encode_mesh_to_buffer(points, faces, mesh_object, + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_points,&__pyx_n_s_faces,&__pyx_n_s_metadatas,&__pyx_n_s_geometry_metadata,&__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[9] = {0,0,0,0,0,0,0,0,0}; + values[4] = ((PyObject *)__pyx_int_14); + values[5] = ((PyObject *)__pyx_int_1); + values[6] = ((PyObject *)__pyx_int_neg_1); + + /* "DracoPy.pyx":90 + * geometry_metadata, * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, # <<<<<<<<<<<<<< * create_metadata=False): * """ */ - values[6] = ((PyObject *)Py_None); + values[7] = ((PyObject *)Py_None); - /* "DracoPy.pyx":90 + /* "DracoPy.pyx":91 * 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. */ - values[7] = ((PyObject *)Py_False); + values[8] = ((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 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + CYTHON_FALLTHROUGH; case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); CYTHON_FALLTHROUGH; case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); @@ -3841,50 +3733,58 @@ static PyObject *__pyx_pw_7DracoPy_1encode_mesh_to_buffer(PyObject *__pyx_self, 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, 3, 8, 1); __PYX_ERR(0, 87, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 4, 9, 1); __PYX_ERR(0, 87, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mesh_object)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_metadatas)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 3, 8, 2); __PYX_ERR(0, 87, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 4, 9, 2); __PYX_ERR(0, 87, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_bits); - if (value) { values[3] = value; kw_args--; } + if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geometry_metadata)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 4, 9, 3); __PYX_ERR(0, 87, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_compression_level); + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_bits); 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_range); + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_compression_level); 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_quantization_origin); + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_range); if (value) { values[6] = value; kw_args--; } } CYTHON_FALLTHROUGH; case 7: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_create_metadata); + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_origin); if (value) { values[7] = value; kw_args--; } } + CYTHON_FALLTHROUGH; + case 8: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_create_metadata); + if (value) { values[8] = 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, 87, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { + case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + CYTHON_FALLTHROUGH; case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); CYTHON_FALLTHROUGH; case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); @@ -3894,8 +3794,7 @@ static PyObject *__pyx_pw_7DracoPy_1encode_mesh_to_buffer(PyObject *__pyx_self, 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); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; @@ -3904,29 +3803,30 @@ static PyObject *__pyx_pw_7DracoPy_1encode_mesh_to_buffer(PyObject *__pyx_self, } __pyx_v_points = values[0]; __pyx_v_faces = values[1]; - __pyx_v_mesh_object = values[2]; - __pyx_v_quantization_bits = values[3]; - __pyx_v_compression_level = values[4]; - __pyx_v_quantization_range = values[5]; - __pyx_v_quantization_origin = values[6]; - __pyx_v_create_metadata = values[7]; + __pyx_v_metadatas = values[2]; + __pyx_v_geometry_metadata = values[3]; + __pyx_v_quantization_bits = values[4]; + __pyx_v_compression_level = values[5]; + __pyx_v_quantization_range = values[6]; + __pyx_v_quantization_origin = values[7]; + __pyx_v_create_metadata = values[8]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 3, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 87, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 4, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 87, __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_encode_mesh_to_buffer(__pyx_self, __pyx_v_points, __pyx_v_faces, __pyx_v_mesh_object, __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_encode_mesh_to_buffer(__pyx_self, __pyx_v_points, __pyx_v_faces, __pyx_v_metadatas, __pyx_v_geometry_metadata, __pyx_v_quantization_bits, __pyx_v_compression_level, __pyx_v_quantization_range, __pyx_v_quantization_origin, __pyx_v_create_metadata); /* "DracoPy.pyx":87 * pass * - * def encode_mesh_to_buffer(points, faces, mesh_object, # <<<<<<<<<<<<<< + * def encode_mesh_to_buffer(points, faces, metadatas, # <<<<<<<<<<<<<< + * geometry_metadata, * quantization_bits=14, compression_level=1, - * quantization_range=-1, quantization_origin=None, */ /* function exit code */ @@ -3934,11 +3834,13 @@ static PyObject *__pyx_pw_7DracoPy_1encode_mesh_to_buffer(PyObject *__pyx_self, 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_mesh_object, 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) { +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_metadatas, PyObject *__pyx_v_geometry_metadata, 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; + CYTHON_UNUSED PyObject *__pyx_v_e = NULL; + PyObject *__pyx_v_traceback = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3955,21 +3857,22 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject Py_ssize_t __pyx_t_12; std::vector __pyx_t_13; std::vector __pyx_t_14; - struct DracoFunctions::MeshObject __pyx_t_15; - int __pyx_t_16; + std::vector __pyx_t_15; + struct DracoFunctions::GeometryMetadataObject __pyx_t_16; int __pyx_t_17; - bool __pyx_t_18; - struct DracoFunctions::EncodedObject __pyx_t_19; - PyObject *__pyx_t_20 = NULL; + int __pyx_t_18; + bool __pyx_t_19; + struct DracoFunctions::EncodedObject __pyx_t_20; PyObject *__pyx_t_21 = NULL; PyObject *__pyx_t_22 = NULL; PyObject *__pyx_t_23 = NULL; + PyObject *__pyx_t_24 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("encode_mesh_to_buffer", 0); - /* "DracoPy.pyx":100 + /* "DracoPy.pyx":101 * a point where each coordinate is the minimum of that coordinate among the input vertices. * """ * cdef float* quant_origin = NULL # <<<<<<<<<<<<<< @@ -3978,7 +3881,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ __pyx_v_quant_origin = NULL; - /* "DracoPy.pyx":101 + /* "DracoPy.pyx":102 * """ * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -3994,7 +3897,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { - /* "DracoPy.pyx":102 + /* "DracoPy.pyx":103 * cdef float* quant_origin = NULL * try: * num_dims = 3 # <<<<<<<<<<<<<< @@ -4004,7 +3907,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_INCREF(__pyx_int_3); __pyx_v_num_dims = __pyx_int_3; - /* "DracoPy.pyx":103 + /* "DracoPy.pyx":104 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -4015,38 +3918,38 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_5 = (__pyx_t_4 != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":104 + /* "DracoPy.pyx":105 * 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, 104, __pyx_L3_error) + __pyx_t_6 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 105, __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, 104, __pyx_L3_error) + __pyx_t_7 = PyNumber_Multiply(__pyx_t_6, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 105, __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, 104, __pyx_L3_error) + __pyx_t_8 = __Pyx_PyInt_As_size_t(__pyx_t_7); if (unlikely((__pyx_t_8 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 105, __pyx_L3_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_quant_origin = ((float *)PyMem_Malloc(__pyx_t_8)); - /* "DracoPy.pyx":105 + /* "DracoPy.pyx":106 * 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] - * # binary_metadata = encode_metadata(metadata) + * encoded_mesh = DracoPy.encode_mesh(points, faces, metadatas, */ - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 105, __pyx_L3_error) + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 106, __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, 105, __pyx_L3_error) + __pyx_t_9 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 106, __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, 105, __pyx_L3_error) + __pyx_t_10 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 106, __pyx_L3_error) } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; for (;;) { @@ -4054,17 +3957,17 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject 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, 105, __pyx_L3_error) + __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, 106, __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, 105, __pyx_L3_error) + __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 106, __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, 105, __pyx_L3_error) + __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, 106, __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, 105, __pyx_L3_error) + __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 106, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_7); #endif } @@ -4074,7 +3977,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 105, __pyx_L3_error) + else __PYX_ERR(0, 106, __pyx_L3_error) } break; } @@ -4083,31 +3986,31 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_7); __pyx_t_7 = 0; - /* "DracoPy.pyx":106 + /* "DracoPy.pyx":107 * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) * for dim in range(num_dims): * quant_origin[dim] = quantization_origin[dim] # <<<<<<<<<<<<<< - * # binary_metadata = encode_metadata(metadata) - * encoded_mesh = DracoPy.encode_mesh(points, faces, mesh_object, + * encoded_mesh = DracoPy.encode_mesh(points, faces, metadatas, + * geometry_metadata, */ - __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 106, __pyx_L3_error) + __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 107, __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, 106, __pyx_L3_error) + __pyx_t_11 = __pyx_PyFloat_AsFloat(__pyx_t_7); if (unlikely((__pyx_t_11 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __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, 106, __pyx_L3_error) + __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 107, __pyx_L3_error) (__pyx_v_quant_origin[__pyx_t_12]) = __pyx_t_11; - /* "DracoPy.pyx":105 + /* "DracoPy.pyx":106 * 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] - * # binary_metadata = encode_metadata(metadata) + * encoded_mesh = DracoPy.encode_mesh(points, faces, metadatas, */ } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "DracoPy.pyx":103 + /* "DracoPy.pyx":104 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -4117,60 +4020,69 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject } /* "DracoPy.pyx":108 + * for dim in range(num_dims): * quant_origin[dim] = quantization_origin[dim] - * # binary_metadata = encode_metadata(metadata) - * encoded_mesh = DracoPy.encode_mesh(points, faces, mesh_object, # <<<<<<<<<<<<<< + * encoded_mesh = DracoPy.encode_mesh(points, faces, metadatas, # <<<<<<<<<<<<<< + * geometry_metadata, * quantization_bits, compression_level, - * quantization_range, quant_origin, */ __pyx_t_13 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L3_error) __pyx_t_14 = __pyx_convert_vector_from_py_uint32_t(__pyx_v_faces); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L3_error) - __pyx_t_15 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_MeshObject(__pyx_v_mesh_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L3_error) + __pyx_t_15 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_metadatas); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L3_error) /* "DracoPy.pyx":109 - * # binary_metadata = encode_metadata(metadata) - * encoded_mesh = DracoPy.encode_mesh(points, faces, mesh_object, + * quant_origin[dim] = quantization_origin[dim] + * encoded_mesh = DracoPy.encode_mesh(points, faces, metadatas, + * geometry_metadata, # <<<<<<<<<<<<<< + * quantization_bits, compression_level, + * quantization_range, quant_origin, + */ + __pyx_t_16 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_geometry_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 109, __pyx_L3_error) + + /* "DracoPy.pyx":110 + * encoded_mesh = DracoPy.encode_mesh(points, faces, metadatas, + * geometry_metadata, * quantization_bits, compression_level, # <<<<<<<<<<<<<< * quantization_range, quant_origin, * create_metadata) */ - __pyx_t_16 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 109, __pyx_L3_error) - __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 109, __pyx_L3_error) + __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 110, __pyx_L3_error) + __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 110, __pyx_L3_error) - /* "DracoPy.pyx":110 - * encoded_mesh = DracoPy.encode_mesh(points, faces, mesh_object, + /* "DracoPy.pyx":111 + * geometry_metadata, * quantization_bits, compression_level, * quantization_range, quant_origin, # <<<<<<<<<<<<<< * create_metadata) * if quant_origin != NULL: */ - __pyx_t_11 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_11 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 110, __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, 111, __pyx_L3_error) - /* "DracoPy.pyx":111 + /* "DracoPy.pyx":112 * quantization_bits, compression_level, * quantization_range, quant_origin, * create_metadata) # <<<<<<<<<<<<<< * if quant_origin != NULL: * PyMem_Free(quant_origin) */ - __pyx_t_18 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_18 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 111, __pyx_L3_error) + __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_19 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 112, __pyx_L3_error) /* "DracoPy.pyx":108 + * for dim in range(num_dims): * quant_origin[dim] = quantization_origin[dim] - * # binary_metadata = encode_metadata(metadata) - * encoded_mesh = DracoPy.encode_mesh(points, faces, mesh_object, # <<<<<<<<<<<<<< + * encoded_mesh = DracoPy.encode_mesh(points, faces, metadatas, # <<<<<<<<<<<<<< + * geometry_metadata, * quantization_bits, compression_level, - * quantization_range, quant_origin, */ try { - __pyx_t_19 = DracoFunctions::encode_mesh(__pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_11, __pyx_v_quant_origin, __pyx_t_18); + __pyx_t_20 = DracoFunctions::encode_mesh(__pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_11, __pyx_v_quant_origin, __pyx_t_19); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 108, __pyx_L3_error) } - __pyx_v_encoded_mesh = __pyx_t_19; + __pyx_v_encoded_mesh = __pyx_t_20; - /* "DracoPy.pyx":112 + /* "DracoPy.pyx":113 * quantization_range, quant_origin, * create_metadata) * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -4180,7 +4092,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_5 = ((__pyx_v_quant_origin != NULL) != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":113 + /* "DracoPy.pyx":114 * create_metadata) * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -4189,7 +4101,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":112 + /* "DracoPy.pyx":113 * quantization_range, quant_origin, * create_metadata) * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -4198,7 +4110,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":114 + /* "DracoPy.pyx":115 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -4208,7 +4120,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject switch (__pyx_v_encoded_mesh.encode_status) { case DracoFunctions::successful_encoding: - /* "DracoPy.pyx":115 + /* "DracoPy.pyx":116 * PyMem_Free(quant_origin) * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: * return bytes(encoded_mesh.buffer) # <<<<<<<<<<<<<< @@ -4216,16 +4128,16 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject * 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, 115, __pyx_L3_error) + __pyx_t_6 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_encoded_mesh.buffer); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 116, __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, 115, __pyx_L3_error) + __pyx_t_7 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 116, __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":114 + /* "DracoPy.pyx":115 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -4235,35 +4147,35 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject break; case DracoFunctions::failed_during_encoding: - /* "DracoPy.pyx":117 + /* "DracoPy.pyx":118 * 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, 117, __pyx_L3_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 118, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_20 = NULL; + __pyx_t_21 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_20 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_20)) { + __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_21)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_20); + __Pyx_INCREF(__pyx_t_21); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_6, function); } } - __pyx_t_7 = (__pyx_t_20) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_20, __pyx_kp_u_Invalid_mesh) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_u_Invalid_mesh); - __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 117, __pyx_L3_error) + __pyx_t_7 = (__pyx_t_21) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_21, __pyx_kp_s_Invalid_mesh) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_s_Invalid_mesh); + __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0; + 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_Raise(__pyx_t_7, 0, 0, 0); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(0, 117, __pyx_L3_error) + __PYX_ERR(0, 118, __pyx_L3_error) - /* "DracoPy.pyx":116 + /* "DracoPy.pyx":117 * 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: # <<<<<<<<<<<<<< @@ -4274,7 +4186,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject default: break; } - /* "DracoPy.pyx":101 + /* "DracoPy.pyx":102 * """ * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -4287,77 +4199,118 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L8_try_end; __pyx_L3_error:; - __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "DracoPy.pyx":118 + /* "DracoPy.pyx":119 * 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_20); - __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 118, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_21); - __pyx_t_17 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_7, __pyx_t_21); - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - __Pyx_ErrRestore(__pyx_t_7, __pyx_t_6, __pyx_t_20); - __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_20 = 0; - if (__pyx_t_17) { + * except Exception as e: + */ + __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_6, &__pyx_t_21); + __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 119, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_22); + __pyx_t_18 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_7, __pyx_t_22); + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + __Pyx_ErrRestore(__pyx_t_7, __pyx_t_6, __pyx_t_21); + __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_21 = 0; + if (__pyx_t_18) { __Pyx_AddTraceback("DracoPy.encode_mesh_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_20, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 118, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_20); + if (__Pyx_GetException(&__pyx_t_21, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 119, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_21); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); - /* "DracoPy.pyx":119 + /* "DracoPy.pyx":120 * raise EncodingFailedException('Invalid mesh') * except EncodingFailedException: * raise EncodingFailedException('Invalid mesh') # <<<<<<<<<<<<<< - * except: - * if quant_origin != NULL: - */ - __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 119, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_22); - __pyx_t_23 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_22))) { - __pyx_t_23 = PyMethod_GET_SELF(__pyx_t_22); - if (likely(__pyx_t_23)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_22); - __Pyx_INCREF(__pyx_t_23); + * except Exception as e: + * import traceback + */ + __Pyx_GetModuleGlobalName(__pyx_t_23, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 120, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_23); + __pyx_t_24 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_23))) { + __pyx_t_24 = PyMethod_GET_SELF(__pyx_t_23); + if (likely(__pyx_t_24)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_23); + __Pyx_INCREF(__pyx_t_24); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_22, function); + __Pyx_DECREF_SET(__pyx_t_23, function); } } - __pyx_t_21 = (__pyx_t_23) ? __Pyx_PyObject_Call2Args(__pyx_t_22, __pyx_t_23, __pyx_kp_u_Invalid_mesh) : __Pyx_PyObject_CallOneArg(__pyx_t_22, __pyx_kp_u_Invalid_mesh); - __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0; - if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 119, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_21); + __pyx_t_22 = (__pyx_t_24) ? __Pyx_PyObject_Call2Args(__pyx_t_23, __pyx_t_24, __pyx_kp_s_Invalid_mesh) : __Pyx_PyObject_CallOneArg(__pyx_t_23, __pyx_kp_s_Invalid_mesh); + __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0; + if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 120, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_22); + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + __Pyx_Raise(__pyx_t_22, 0, 0, 0); __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; - __Pyx_Raise(__pyx_t_21, 0, 0, 0); - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - __PYX_ERR(0, 119, __pyx_L5_except_error) + __PYX_ERR(0, 120, __pyx_L5_except_error) } - /* "DracoPy.pyx":120 + /* "DracoPy.pyx":121 * except EncodingFailedException: * raise EncodingFailedException('Invalid mesh') - * except: # <<<<<<<<<<<<<< - * if quant_origin != NULL: - * PyMem_Free(quant_origin) + * except Exception as e: # <<<<<<<<<<<<<< + * import traceback + * traceback.print_exc() */ - /*except:*/ { + __pyx_t_18 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_18) { __Pyx_AddTraceback("DracoPy.encode_mesh_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_20) < 0) __PYX_ERR(0, 120, __pyx_L5_except_error) + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_21) < 0) __PYX_ERR(0, 121, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_20); + __Pyx_GOTREF(__pyx_t_21); + __Pyx_INCREF(__pyx_t_6); + __pyx_v_e = __pyx_t_6; - /* "DracoPy.pyx":121 + /* "DracoPy.pyx":122 * raise EncodingFailedException('Invalid mesh') - * except: + * except Exception as e: + * import traceback # <<<<<<<<<<<<<< + * traceback.print_exc() + * if quant_origin != NULL: + */ + __pyx_t_22 = __Pyx_Import(__pyx_n_s_traceback, 0, -1); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 122, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_22); + __pyx_v_traceback = __pyx_t_22; + __pyx_t_22 = 0; + + /* "DracoPy.pyx":123 + * except Exception as e: + * import traceback + * traceback.print_exc() # <<<<<<<<<<<<<< + * if quant_origin != NULL: + * PyMem_Free(quant_origin) + */ + __pyx_t_23 = __Pyx_PyObject_GetAttrStr(__pyx_v_traceback, __pyx_n_s_print_exc); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 123, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_23); + __pyx_t_24 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_23))) { + __pyx_t_24 = PyMethod_GET_SELF(__pyx_t_23); + if (likely(__pyx_t_24)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_23); + __Pyx_INCREF(__pyx_t_24); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_23, function); + } + } + __pyx_t_22 = (__pyx_t_24) ? __Pyx_PyObject_CallOneArg(__pyx_t_23, __pyx_t_24) : __Pyx_PyObject_CallNoArg(__pyx_t_23); + __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0; + if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 123, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_22); + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + + /* "DracoPy.pyx":124 + * import traceback + * traceback.print_exc() * if quant_origin != NULL: # <<<<<<<<<<<<<< * PyMem_Free(quant_origin) * raise ValueError("Input invalid") @@ -4365,8 +4318,8 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_5 = ((__pyx_v_quant_origin != NULL) != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":122 - * except: + /* "DracoPy.pyx":125 + * traceback.print_exc() * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< * raise ValueError("Input invalid") @@ -4374,31 +4327,32 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":121 - * raise EncodingFailedException('Invalid mesh') - * except: + /* "DracoPy.pyx":124 + * import traceback + * traceback.print_exc() * if quant_origin != NULL: # <<<<<<<<<<<<<< * PyMem_Free(quant_origin) * raise ValueError("Input invalid") */ } - /* "DracoPy.pyx":123 + /* "DracoPy.pyx":126 * if quant_origin != NULL: * PyMem_Free(quant_origin) * raise ValueError("Input invalid") # <<<<<<<<<<<<<< * * def encode_point_cloud_to_buffer(points, point_cloud_object, */ - __pyx_t_21 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 123, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_21); - __Pyx_Raise(__pyx_t_21, 0, 0, 0); - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - __PYX_ERR(0, 123, __pyx_L5_except_error) + __pyx_t_22 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 126, __pyx_L5_except_error) + __Pyx_GOTREF(__pyx_t_22); + __Pyx_Raise(__pyx_t_22, 0, 0, 0); + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + __PYX_ERR(0, 126, __pyx_L5_except_error) } + goto __pyx_L5_except_error; __pyx_L5_except_error:; - /* "DracoPy.pyx":101 + /* "DracoPy.pyx":102 * """ * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -4422,9 +4376,9 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject /* "DracoPy.pyx":87 * pass * - * def encode_mesh_to_buffer(points, faces, mesh_object, # <<<<<<<<<<<<<< + * def encode_mesh_to_buffer(points, faces, metadatas, # <<<<<<<<<<<<<< + * geometry_metadata, * quantization_bits=14, compression_level=1, - * quantization_range=-1, quantization_origin=None, */ /* function exit code */ @@ -4433,21 +4387,23 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_20); __Pyx_XDECREF(__pyx_t_21); __Pyx_XDECREF(__pyx_t_22); __Pyx_XDECREF(__pyx_t_23); + __Pyx_XDECREF(__pyx_t_24); __Pyx_AddTraceback("DracoPy.encode_mesh_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_XDECREF(__pyx_v_e); + __Pyx_XDECREF(__pyx_v_traceback); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "DracoPy.pyx":125 +/* "DracoPy.pyx":128 * raise ValueError("Input invalid") * * def encode_point_cloud_to_buffer(points, point_cloud_object, # <<<<<<<<<<<<<< @@ -4480,7 +4436,7 @@ static PyObject *__pyx_pw_7DracoPy_3encode_point_cloud_to_buffer(PyObject *__pyx values[3] = ((PyObject *)__pyx_int_1); values[4] = ((PyObject *)__pyx_int_neg_1); - /* "DracoPy.pyx":127 + /* "DracoPy.pyx":130 * def encode_point_cloud_to_buffer(points, point_cloud_object, * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, # <<<<<<<<<<<<<< @@ -4489,7 +4445,7 @@ static PyObject *__pyx_pw_7DracoPy_3encode_point_cloud_to_buffer(PyObject *__pyx */ values[5] = ((PyObject *)Py_None); - /* "DracoPy.pyx":128 + /* "DracoPy.pyx":131 * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, * create_metadata=False): # <<<<<<<<<<<<<< @@ -4527,7 +4483,7 @@ static PyObject *__pyx_pw_7DracoPy_3encode_point_cloud_to_buffer(PyObject *__pyx case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_point_cloud_object)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("encode_point_cloud_to_buffer", 0, 2, 7, 1); __PYX_ERR(0, 125, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode_point_cloud_to_buffer", 0, 2, 7, 1); __PYX_ERR(0, 128, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -4561,7 +4517,7 @@ static PyObject *__pyx_pw_7DracoPy_3encode_point_cloud_to_buffer(PyObject *__pyx } } 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, 125, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode_point_cloud_to_buffer") < 0)) __PYX_ERR(0, 128, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -4591,7 +4547,7 @@ static PyObject *__pyx_pw_7DracoPy_3encode_point_cloud_to_buffer(PyObject *__pyx } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("encode_point_cloud_to_buffer", 0, 2, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 125, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode_point_cloud_to_buffer", 0, 2, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 128, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("DracoPy.encode_point_cloud_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -4599,7 +4555,7 @@ static PyObject *__pyx_pw_7DracoPy_3encode_point_cloud_to_buffer(PyObject *__pyx __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(__pyx_self, __pyx_v_points, __pyx_v_point_cloud_object, __pyx_v_quantization_bits, __pyx_v_compression_level, __pyx_v_quantization_range, __pyx_v_quantization_origin, __pyx_v_create_metadata); - /* "DracoPy.pyx":125 + /* "DracoPy.pyx":128 * raise ValueError("Input invalid") * * def encode_point_cloud_to_buffer(points, point_cloud_object, # <<<<<<<<<<<<<< @@ -4646,7 +4602,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P int __pyx_clineno = 0; __Pyx_RefNannySetupContext("encode_point_cloud_to_buffer", 0); - /* "DracoPy.pyx":138 + /* "DracoPy.pyx":141 * a point where each coordinate is the minimum of that coordinate among the input vertices. * """ * cdef float* quant_origin = NULL # <<<<<<<<<<<<<< @@ -4655,7 +4611,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ __pyx_v_quant_origin = NULL; - /* "DracoPy.pyx":139 + /* "DracoPy.pyx":142 * """ * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -4671,7 +4627,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { - /* "DracoPy.pyx":140 + /* "DracoPy.pyx":143 * cdef float* quant_origin = NULL * try: * num_dims = 3 # <<<<<<<<<<<<<< @@ -4681,7 +4637,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_INCREF(__pyx_int_3); __pyx_v_num_dims = __pyx_int_3; - /* "DracoPy.pyx":141 + /* "DracoPy.pyx":144 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -4692,38 +4648,38 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_5 = (__pyx_t_4 != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":142 + /* "DracoPy.pyx":145 * 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, 142, __pyx_L3_error) + __pyx_t_6 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 145, __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, 142, __pyx_L3_error) + __pyx_t_7 = PyNumber_Multiply(__pyx_t_6, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 145, __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, 142, __pyx_L3_error) + __pyx_t_8 = __Pyx_PyInt_As_size_t(__pyx_t_7); if (unlikely((__pyx_t_8 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 145, __pyx_L3_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_v_quant_origin = ((float *)PyMem_Malloc(__pyx_t_8)); - /* "DracoPy.pyx":143 + /* "DracoPy.pyx":146 * 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] * # binary_metadata = encode_metadata(metadata) */ - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 143, __pyx_L3_error) + __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 146, __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, 143, __pyx_L3_error) + __pyx_t_9 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 146, __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, 143, __pyx_L3_error) + __pyx_t_10 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 146, __pyx_L3_error) } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; for (;;) { @@ -4731,17 +4687,17 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P 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, 143, __pyx_L3_error) + __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, 146, __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, 143, __pyx_L3_error) + __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 146, __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, 143, __pyx_L3_error) + __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, 146, __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, 143, __pyx_L3_error) + __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 146, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_7); #endif } @@ -4751,7 +4707,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 143, __pyx_L3_error) + else __PYX_ERR(0, 146, __pyx_L3_error) } break; } @@ -4760,21 +4716,21 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_7); __pyx_t_7 = 0; - /* "DracoPy.pyx":144 + /* "DracoPy.pyx":147 * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) * for dim in range(num_dims): * quant_origin[dim] = quantization_origin[dim] # <<<<<<<<<<<<<< * # binary_metadata = encode_metadata(metadata) * encoded_point_cloud = DracoPy.encode_point_cloud( */ - __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 144, __pyx_L3_error) + __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 147, __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, 144, __pyx_L3_error) + __pyx_t_11 = __pyx_PyFloat_AsFloat(__pyx_t_7); if (unlikely((__pyx_t_11 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 147, __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, 144, __pyx_L3_error) + __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 147, __pyx_L3_error) (__pyx_v_quant_origin[__pyx_t_12]) = __pyx_t_11; - /* "DracoPy.pyx":143 + /* "DracoPy.pyx":146 * if quantization_origin is not None: * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) * for dim in range(num_dims): # <<<<<<<<<<<<<< @@ -4784,7 +4740,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "DracoPy.pyx":141 + /* "DracoPy.pyx":144 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -4793,29 +4749,29 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ } - /* "DracoPy.pyx":147 + /* "DracoPy.pyx":150 * # binary_metadata = encode_metadata(metadata) * encoded_point_cloud = DracoPy.encode_point_cloud( * points, point_cloud_object, quantization_bits, compression_level, # <<<<<<<<<<<<<< * quantization_range, quant_origin, create_metadata) * if quant_origin != NULL: */ - __pyx_t_13 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 147, __pyx_L3_error) - __pyx_t_14 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointCloudObject(__pyx_v_point_cloud_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 147, __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, 147, __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, 147, __pyx_L3_error) + __pyx_t_13 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 150, __pyx_L3_error) + __pyx_t_14 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointCloudObject(__pyx_v_point_cloud_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 150, __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, 150, __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, 150, __pyx_L3_error) - /* "DracoPy.pyx":148 + /* "DracoPy.pyx":151 * encoded_point_cloud = DracoPy.encode_point_cloud( * points, point_cloud_object, quantization_bits, compression_level, * quantization_range, quant_origin, create_metadata) # <<<<<<<<<<<<<< * if quant_origin != NULL: * PyMem_Free(quant_origin) */ - __pyx_t_11 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_11 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 148, __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, 148, __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, 151, __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, 151, __pyx_L3_error) - /* "DracoPy.pyx":146 + /* "DracoPy.pyx":149 * quant_origin[dim] = quantization_origin[dim] * # binary_metadata = encode_metadata(metadata) * encoded_point_cloud = DracoPy.encode_point_cloud( # <<<<<<<<<<<<<< @@ -4826,11 +4782,11 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_18 = DracoFunctions::encode_point_cloud(__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, 146, __pyx_L3_error) + __PYX_ERR(0, 149, __pyx_L3_error) } __pyx_v_encoded_point_cloud = __pyx_t_18; - /* "DracoPy.pyx":149 + /* "DracoPy.pyx":152 * points, point_cloud_object, quantization_bits, compression_level, * quantization_range, quant_origin, create_metadata) * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -4840,7 +4796,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_5 = ((__pyx_v_quant_origin != NULL) != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":150 + /* "DracoPy.pyx":153 * quantization_range, quant_origin, create_metadata) * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -4849,7 +4805,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":149 + /* "DracoPy.pyx":152 * points, point_cloud_object, quantization_bits, compression_level, * quantization_range, quant_origin, create_metadata) * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -4858,7 +4814,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ } - /* "DracoPy.pyx":151 + /* "DracoPy.pyx":154 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -4868,7 +4824,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P switch (__pyx_v_encoded_point_cloud.encode_status) { case DracoFunctions::successful_encoding: - /* "DracoPy.pyx":152 + /* "DracoPy.pyx":155 * PyMem_Free(quant_origin) * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: * return bytes(encoded_point_cloud.buffer) # <<<<<<<<<<<<<< @@ -4876,16 +4832,16 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P * raise EncodingFailedException('Invalid point cloud') */ __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, 152, __pyx_L3_error) + __pyx_t_6 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_encoded_point_cloud.buffer); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 155, __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, 152, __pyx_L3_error) + __pyx_t_7 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 155, __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":151 + /* "DracoPy.pyx":154 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -4895,14 +4851,14 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P break; case DracoFunctions::failed_during_encoding: - /* "DracoPy.pyx":154 + /* "DracoPy.pyx":157 * 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, 154, __pyx_L3_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 157, __pyx_L3_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_19 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -4914,16 +4870,16 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __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_point_cloud) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_u_Invalid_point_cloud); + __pyx_t_7 = (__pyx_t_19) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_19, __pyx_kp_s_Invalid_point_cloud) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_s_Invalid_point_cloud); __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 154, __pyx_L3_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 157, __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, 154, __pyx_L3_error) + __PYX_ERR(0, 157, __pyx_L3_error) - /* "DracoPy.pyx":153 + /* "DracoPy.pyx":156 * 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: # <<<<<<<<<<<<<< @@ -4934,7 +4890,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P default: break; } - /* "DracoPy.pyx":139 + /* "DracoPy.pyx":142 * """ * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -4951,7 +4907,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "DracoPy.pyx":155 + /* "DracoPy.pyx":158 * elif encoded_point_cloud.encode_status == DracoPy.encoding_status.failed_during_encoding: * raise EncodingFailedException('Invalid point cloud') * except EncodingFailedException: # <<<<<<<<<<<<<< @@ -4959,7 +4915,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P * 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, 155, __pyx_L5_except_error) + __Pyx_GetModuleGlobalName(__pyx_t_20, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 158, __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; @@ -4967,19 +4923,19 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_19 = 0; if (__pyx_t_16) { __Pyx_AddTraceback("DracoPy.encode_point_cloud_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_19, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 155, __pyx_L5_except_error) + if (__Pyx_GetException(&__pyx_t_19, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 158, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_19); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_7); - /* "DracoPy.pyx":156 + /* "DracoPy.pyx":159 * raise EncodingFailedException('Invalid point cloud') * except EncodingFailedException: * raise EncodingFailedException('Invalid point cloud') # <<<<<<<<<<<<<< * except: * if quant_origin != NULL: */ - __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 156, __pyx_L5_except_error) + __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 159, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_21); __pyx_t_22 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_21))) { @@ -4991,17 +4947,17 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __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_point_cloud) : __Pyx_PyObject_CallOneArg(__pyx_t_21, __pyx_kp_u_Invalid_point_cloud); + __pyx_t_20 = (__pyx_t_22) ? __Pyx_PyObject_Call2Args(__pyx_t_21, __pyx_t_22, __pyx_kp_s_Invalid_point_cloud) : __Pyx_PyObject_CallOneArg(__pyx_t_21, __pyx_kp_s_Invalid_point_cloud); __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0; - if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 156, __pyx_L5_except_error) + if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 159, __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, 156, __pyx_L5_except_error) + __PYX_ERR(0, 159, __pyx_L5_except_error) } - /* "DracoPy.pyx":157 + /* "DracoPy.pyx":160 * except EncodingFailedException: * raise EncodingFailedException('Invalid point cloud') * except: # <<<<<<<<<<<<<< @@ -5010,12 +4966,12 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ /*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_19) < 0) __PYX_ERR(0, 157, __pyx_L5_except_error) + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_19) < 0) __PYX_ERR(0, 160, __pyx_L5_except_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_19); - /* "DracoPy.pyx":158 + /* "DracoPy.pyx":161 * raise EncodingFailedException('Invalid point cloud') * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -5025,7 +4981,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_5 = ((__pyx_v_quant_origin != NULL) != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":159 + /* "DracoPy.pyx":162 * except: * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -5034,7 +4990,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":158 + /* "DracoPy.pyx":161 * raise EncodingFailedException('Invalid point cloud') * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -5043,22 +4999,22 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ } - /* "DracoPy.pyx":160 + /* "DracoPy.pyx":163 * if quant_origin != NULL: * PyMem_Free(quant_origin) * raise ValueError("Input invalid") # <<<<<<<<<<<<<< * * def raise_decoding_error(decoding_status): */ - __pyx_t_20 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 160, __pyx_L5_except_error) + __pyx_t_20 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 163, __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, 160, __pyx_L5_except_error) + __PYX_ERR(0, 163, __pyx_L5_except_error) } __pyx_L5_except_error:; - /* "DracoPy.pyx":139 + /* "DracoPy.pyx":142 * """ * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -5079,7 +5035,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_L8_try_end:; } - /* "DracoPy.pyx":125 + /* "DracoPy.pyx":128 * raise ValueError("Input invalid") * * def encode_point_cloud_to_buffer(points, point_cloud_object, # <<<<<<<<<<<<<< @@ -5107,7 +5063,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P return __pyx_r; } -/* "DracoPy.pyx":162 +/* "DracoPy.pyx":165 * raise ValueError("Input invalid") * * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< @@ -5141,29 +5097,29 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject int __pyx_clineno = 0; __Pyx_RefNannySetupContext("raise_decoding_error", 0); - /* "DracoPy.pyx":163 + /* "DracoPy.pyx":166 * * 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, 163, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::not_draco_encoded); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __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, 163, __pyx_L1_error) + __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, 166, __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, 163, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 166, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":164 + /* "DracoPy.pyx":167 * 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, 164, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FileTypeException); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 167, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { @@ -5175,16 +5131,16 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject __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_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_kp_s_Input_mesh_is_not_draco_encoded) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_s_Input_mesh_is_not_draco_encoded); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 164, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 167, __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, 164, __pyx_L1_error) + __PYX_ERR(0, 167, __pyx_L1_error) - /* "DracoPy.pyx":163 + /* "DracoPy.pyx":166 * * def raise_decoding_error(decoding_status): * if decoding_status == DracoPy.decoding_status.not_draco_encoded: # <<<<<<<<<<<<<< @@ -5193,35 +5149,35 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":165 + /* "DracoPy.pyx":168 * 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, 165, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::failed_during_decoding); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 168, __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, 165, __pyx_L1_error) + __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, 168, __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, 165, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 168, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":166 + /* "DracoPy.pyx":169 * 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__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 166, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 169, __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, 166, __pyx_L1_error) + __PYX_ERR(0, 169, __pyx_L1_error) - /* "DracoPy.pyx":165 + /* "DracoPy.pyx":168 * 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: # <<<<<<<<<<<<<< @@ -5230,35 +5186,35 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":167 + /* "DracoPy.pyx":170 * 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, 167, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::no_position_attribute); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 170, __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, 167, __pyx_L1_error) + __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, 170, __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, 167, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 170, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":168 + /* "DracoPy.pyx":171 * 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): */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 168, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __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, 168, __pyx_L1_error) + __PYX_ERR(0, 171, __pyx_L1_error) - /* "DracoPy.pyx":167 + /* "DracoPy.pyx":170 * 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: # <<<<<<<<<<<<<< @@ -5267,7 +5223,7 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":162 + /* "DracoPy.pyx":165 * raise ValueError("Input invalid") * * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< @@ -5290,7 +5246,7 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject return __pyx_r; } -/* "DracoPy.pyx":170 +/* "DracoPy.pyx":173 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer): # <<<<<<<<<<<<<< @@ -5329,24 +5285,24 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject int __pyx_clineno = 0; __Pyx_RefNannySetupContext("decode_buffer_to_mesh", 0); - /* "DracoPy.pyx":171 + /* "DracoPy.pyx":174 * * 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) */ - __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 171, __pyx_L1_error) - __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 171, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 174, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 174, __pyx_L1_error) try { __pyx_t_3 = DracoFunctions::decode_buffer(__pyx_t_1, __pyx_t_2); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 171, __pyx_L1_error) + __PYX_ERR(0, 174, __pyx_L1_error) } __pyx_v_mesh_struct = __pyx_t_3; - /* "DracoPy.pyx":172 + /* "DracoPy.pyx":175 * def decode_buffer_to_mesh(buffer): * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< @@ -5356,7 +5312,7 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject __pyx_t_4 = ((__pyx_v_mesh_struct.decode_status == DracoFunctions::successful) != 0); if (__pyx_t_4) { - /* "DracoPy.pyx":173 + /* "DracoPy.pyx":176 * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: * return DracoMesh(mesh_struct) # <<<<<<<<<<<<<< @@ -5364,9 +5320,9 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject * 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, 173, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_DracoMesh); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 176, __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, 173, __pyx_L1_error) + __pyx_t_7 = __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(__pyx_v_mesh_struct); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 176, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -5381,14 +5337,14 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject __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, 173, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 176, __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":172 + /* "DracoPy.pyx":175 * def decode_buffer_to_mesh(buffer): * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< @@ -5397,7 +5353,7 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":175 + /* "DracoPy.pyx":178 * return DracoMesh(mesh_struct) * else: * raise_decoding_error(mesh_struct.decode_status) # <<<<<<<<<<<<<< @@ -5405,9 +5361,9 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject * 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, 175, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_raise_decoding_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 178, __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, 175, __pyx_L1_error) + __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, 178, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -5422,13 +5378,13 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject __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, 175, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 178, __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; } - /* "DracoPy.pyx":170 + /* "DracoPy.pyx":173 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer): # <<<<<<<<<<<<<< @@ -5452,7 +5408,7 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject return __pyx_r; } -/* "DracoPy.pyx":177 +/* "DracoPy.pyx":180 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer): # <<<<<<<<<<<<<< @@ -5491,24 +5447,24 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb int __pyx_clineno = 0; __Pyx_RefNannySetupContext("decode_point_cloud_buffer", 0); - /* "DracoPy.pyx":178 + /* "DracoPy.pyx":181 * * 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) */ - __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 178, __pyx_L1_error) - __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 178, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 181, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 181, __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, 178, __pyx_L1_error) + __PYX_ERR(0, 181, __pyx_L1_error) } __pyx_v_point_cloud_struct = __pyx_t_3; - /* "DracoPy.pyx":179 + /* "DracoPy.pyx":182 * 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: # <<<<<<<<<<<<<< @@ -5518,7 +5474,7 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb __pyx_t_4 = ((__pyx_v_point_cloud_struct.decode_status == DracoFunctions::successful) != 0); if (__pyx_t_4) { - /* "DracoPy.pyx":180 + /* "DracoPy.pyx":183 * 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) # <<<<<<<<<<<<<< @@ -5526,9 +5482,9 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb * raise_decoding_error(point_cloud_struct.decode_status) */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 180, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 183, __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, 180, __pyx_L1_error) + __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, 183, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -5543,14 +5499,14 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb __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, 180, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 183, __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":179 + /* "DracoPy.pyx":182 * 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: # <<<<<<<<<<<<<< @@ -5559,15 +5515,15 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb */ } - /* "DracoPy.pyx":182 + /* "DracoPy.pyx":185 * return DracoPointCloud(point_cloud_struct) * 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, 182, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_raise_decoding_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 185, __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, 182, __pyx_L1_error) + __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, 185, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -5582,13 +5538,13 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb __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, 182, __pyx_L1_error) + if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 185, __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; } - /* "DracoPy.pyx":177 + /* "DracoPy.pyx":180 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer): # <<<<<<<<<<<<<< @@ -5848,234 +5804,6 @@ static std::vector __pyx_convert_vector_from_py_uint32_t(PyObject *__ return __pyx_r; } -static std::vector __pyx_convert_vector_from_py_unsigned_int(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; - unsigned int __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_unsigned_int", 0); - - /* "vector.from_py":47 - * cdef vector[X] __pyx_convert_vector_from_py_unsigned_int(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_unsigned_int(__pyx_v_item); if (unlikely((__pyx_t_5 == (unsigned int)-1) && PyErr_Occurred())) __PYX_ERR(1, 48, __pyx_L1_error) - __pyx_v_v.push_back(((unsigned int)__pyx_t_5)); - - /* "vector.from_py":47 - * cdef vector[X] __pyx_convert_vector_from_py_unsigned_int(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_unsigned_int") - * cdef vector[X] __pyx_convert_vector_from_py_unsigned_int(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_unsigned_int", __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_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.from_py":13 * * @cname("__pyx_convert_string_from_py_std__in_string") @@ -6143,18 +5871,18 @@ static std::string __pyx_convert_string_from_py_std__in_string(PyObject *__pyx_v /* "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 *: # <<<<<<<<<<<<<< + * @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_uint32_t__and_std_3a__3a_string(PyObject *__pyx_v_o) { +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; + std::unordered_map __pyx_v_m; PyObject *__pyx_v_key = NULL; PyObject *__pyx_v_value = NULL; - std::unordered_map __pyx_r; + std::unordered_map __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; @@ -6163,16 +5891,16 @@ static std::unordered_map __pyx_convert_unordered_map_fro PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; int __pyx_t_7; - uint32_t __pyx_t_8; + 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_uint32_t__and_std_3a__3a_string", 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_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 *: + * @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(): @@ -6218,9 +5946,9 @@ static std::unordered_map __pyx_convert_unordered_map_fro * 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_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 (((uint32_t)__pyx_t_8), ((std::string)__pyx_t_9))); + __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; @@ -6236,8 +5964,8 @@ static std::unordered_map __pyx_convert_unordered_map_fro /* "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 *: # <<<<<<<<<<<<<< + * @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 */ @@ -6247,7 +5975,7 @@ static std::unordered_map __pyx_convert_unordered_map_fro __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_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); @@ -6257,38 +5985,145 @@ static std::unordered_map __pyx_convert_unordered_map_fro 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; +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; - struct DracoFunctions::PointAttributeObject __pyx_r; + std::unordered_map __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_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; - enum draco::DataType __pyx_t_11; - uint32_t __pyx_t_12; + 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_PointAttributeObject", 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_PointAttributeObject(obj) except *: + * 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) @@ -6309,7 +6144,7 @@ static struct DracoFunctions::PointAttributeObject __pyx_convert__from_py_struct __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 __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) @@ -6321,7 +6156,7 @@ static struct DracoFunctions::PointAttributeObject __pyx_convert__from_py_struct * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) * * try: # <<<<<<<<<<<<<< - * value = obj['data'] + * value = obj['entries'] * except KeyError: */ { @@ -6336,11 +6171,11 @@ static struct DracoFunctions::PointAttributeObject __pyx_convert__from_py_struct /* "FromPyStructUtility":17 * * try: - * value = obj['data'] # <<<<<<<<<<<<<< + * value = obj['entries'] # <<<<<<<<<<<<<< * except KeyError: - * raise ValueError("No value specified for struct attribute 'data'") + * raise ValueError("No value specified for struct attribute 'entries'") */ - __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_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; @@ -6349,7 +6184,7 @@ static struct DracoFunctions::PointAttributeObject __pyx_convert__from_py_struct * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) * * try: # <<<<<<<<<<<<<< - * value = obj['data'] + * value = obj['entries'] * except KeyError: */ } @@ -6362,24 +6197,24 @@ static struct DracoFunctions::PointAttributeObject __pyx_convert__from_py_struct /* "FromPyStructUtility":18 * try: - * value = obj['data'] + * value = obj['entries'] * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'data'") - * result.data = value + * 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_PointAttributeObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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['data'] + * value = obj['entries'] * except KeyError: - * raise ValueError("No value specified for struct attribute 'data'") # <<<<<<<<<<<<<< - * result.data = value + * raise ValueError("No value specified for struct attribute 'entries'") # <<<<<<<<<<<<<< + * result.entries = value * try: */ __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 19, __pyx_L6_except_error) @@ -6395,7 +6230,7 @@ static struct DracoFunctions::PointAttributeObject __pyx_convert__from_py_struct * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) * * try: # <<<<<<<<<<<<<< - * value = obj['data'] + * value = obj['entries'] * except KeyError: */ __Pyx_XGIVEREF(__pyx_t_3); @@ -6408,19 +6243,19 @@ static struct DracoFunctions::PointAttributeObject __pyx_convert__from_py_struct /* "FromPyStructUtility":20 * except KeyError: - * raise ValueError("No value specified for struct attribute 'data'") - * result.data = value # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'entries'") + * result.entries = value # <<<<<<<<<<<<<< * try: - * value = obj['datatype'] + * value = obj['sub_metadata_ids'] */ - __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; + __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 'data'") - * result.data = value + * raise ValueError("No value specified for struct attribute 'entries'") + * result.entries = value * try: # <<<<<<<<<<<<<< - * value = obj['datatype'] + * value = obj['sub_metadata_ids'] * except KeyError: */ { @@ -6433,22 +6268,22 @@ static struct DracoFunctions::PointAttributeObject __pyx_convert__from_py_struct /*try:*/ { /* "FromPyStructUtility":22 - * result.data = value + * result.entries = value * try: - * value = obj['datatype'] # <<<<<<<<<<<<<< + * value = obj['sub_metadata_ids'] # <<<<<<<<<<<<<< * except KeyError: - * raise ValueError("No value specified for struct attribute 'datatype'") + * raise ValueError("No value specified for struct attribute 'sub_metadata_ids'") */ - __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_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 'data'") - * result.data = value + * raise ValueError("No value specified for struct attribute 'entries'") + * result.entries = value * try: # <<<<<<<<<<<<<< - * value = obj['datatype'] + * value = obj['sub_metadata_ids'] * except KeyError: */ } @@ -6464,25 +6299,25 @@ static struct DracoFunctions::PointAttributeObject __pyx_convert__from_py_struct /* "FromPyStructUtility":23 * try: - * value = obj['datatype'] + * value = obj['sub_metadata_ids'] * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'datatype'") - * result.datatype = value + * 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_PointAttributeObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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['datatype'] + * value = obj['sub_metadata_ids'] * except KeyError: - * raise ValueError("No value specified for struct attribute 'datatype'") # <<<<<<<<<<<<<< - * result.datatype = value - * try: + * 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__6, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 24, __pyx_L14_except_error) __Pyx_GOTREF(__pyx_t_9); @@ -6494,10 +6329,10 @@ static struct DracoFunctions::PointAttributeObject __pyx_convert__from_py_struct __pyx_L14_except_error:; /* "FromPyStructUtility":21 - * raise ValueError("No value specified for struct attribute 'data'") - * result.data = value + * raise ValueError("No value specified for struct attribute 'entries'") + * result.entries = value * try: # <<<<<<<<<<<<<< - * value = obj['datatype'] + * value = obj['sub_metadata_ids'] * except KeyError: */ __Pyx_XGIVEREF(__pyx_t_5); @@ -6510,234 +6345,30 @@ static struct DracoFunctions::PointAttributeObject __pyx_convert__from_py_struct /* "FromPyStructUtility":25 * except KeyError: - * raise ValueError("No value specified for struct attribute 'datatype'") - * result.datatype = value # <<<<<<<<<<<<<< - * try: - * value = obj['dimension'] + * raise ValueError("No value specified for struct attribute 'sub_metadata_ids'") + * result.sub_metadata_ids = value # <<<<<<<<<<<<<< + * return result + * */ - __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; + __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 'datatype'") - * result.datatype = value - * try: # <<<<<<<<<<<<<< - * value = obj['dimension'] - * except KeyError: + * raise ValueError("No value specified for struct attribute 'sub_metadata_ids'") + * result.sub_metadata_ids = value + * return result # <<<<<<<<<<<<<< + * + * */ - { - __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:*/ { + __pyx_r = __pyx_v_result; + goto __pyx_L0; - /* "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__7, 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['unique_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['unique_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['unique_id'] # <<<<<<<<<<<<<< - * except KeyError: - * raise ValueError("No value specified for struct attribute 'unique_id'") - */ - __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_unique_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['unique_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['unique_id'] - * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'unique_id'") - * result.unique_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['unique_id'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'unique_id'") # <<<<<<<<<<<<<< - * result.unique_id = value - * return result - */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, 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['unique_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 'unique_id'") - * result.unique_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.unique_id = __pyx_t_12; - - /* "FromPyStructUtility":36 - * raise ValueError("No value specified for struct attribute 'unique_id'") - * result.unique_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): + /* "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 */ @@ -6746,7 +6377,7 @@ static struct DracoFunctions::PointAttributeObject __pyx_convert__from_py_struct __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_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); @@ -6756,29 +6387,29 @@ static struct DracoFunctions::PointAttributeObject __pyx_convert__from_py_struct /* "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 *: # <<<<<<<<<<<<<< + * @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: */ -static std::vector __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_PointAttributeObject(PyObject *__pyx_v_o) { - std::vector __pyx_v_v; +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; + 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; + 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_PointAttributeObject", 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_PointAttributeObject(object o) except *: + * 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) @@ -6833,11 +6464,11 @@ static std::vector __pyx_convert_v * 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_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_PointAttributeObject(object o) except *: + * 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) @@ -6858,8 +6489,8 @@ static std::vector __pyx_convert_v /* "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 *: # <<<<<<<<<<<<<< + * @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: */ @@ -6868,7 +6499,7 @@ static std::vector __pyx_convert_v __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_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); @@ -6876,47 +6507,165 @@ static std::vector __pyx_convert_v return __pyx_r; } -/* "FromPyStructUtility":11 +/* "map.from_py":174 * - * @cname("__pyx_convert__from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject") - * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(obj) except *: # <<<<<<<<<<<<<< - * cdef struct_type result - * if not PyMapping_Check(obj): + * @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 struct DracoFunctions::AttributeMetadataObject __pyx_convert__from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(PyObject *__pyx_v_obj) { - struct DracoFunctions::AttributeMetadataObject __pyx_v_result; +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; - struct DracoFunctions::AttributeMetadataObject __pyx_r; + std::unordered_map __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_1 = NULL; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; 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; + 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__from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject", 0); + __Pyx_RefNannySetupContext("__pyx_convert_unordered_map_from_py_uint32_t__and_std_3a__3a_string", 0); - /* "FromPyStructUtility":13 - * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(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) - * + /* "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(): */ - __pyx_t_1 = ((!(PyMapping_Check(__pyx_v_obj) != 0)) != 0); - if (__pyx_t_1) { + 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; - /* "FromPyStructUtility":14 - * cdef struct_type result - * if not PyMapping_Check(obj): + /* "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: @@ -6926,7 +6675,7 @@ static struct DracoFunctions::AttributeMetadataObject __pyx_convert__from_py_str __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "FromPyStructUtility":13 - * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(obj) except *: + * 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) @@ -6938,7 +6687,7 @@ static struct DracoFunctions::AttributeMetadataObject __pyx_convert__from_py_str * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) * * try: # <<<<<<<<<<<<<< - * value = obj['metadata_id'] + * value = obj['data'] * except KeyError: */ { @@ -6953,11 +6702,11 @@ static struct DracoFunctions::AttributeMetadataObject __pyx_convert__from_py_str /* "FromPyStructUtility":17 * * try: - * value = obj['metadata_id'] # <<<<<<<<<<<<<< + * value = obj['data'] # <<<<<<<<<<<<<< * except KeyError: - * raise ValueError("No value specified for struct attribute 'metadata_id'") + * raise ValueError("No value specified for struct attribute 'data'") */ - __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_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; @@ -6966,7 +6715,7 @@ static struct DracoFunctions::AttributeMetadataObject __pyx_convert__from_py_str * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) * * try: # <<<<<<<<<<<<<< - * value = obj['metadata_id'] + * value = obj['data'] * except KeyError: */ } @@ -6979,27 +6728,27 @@ static struct DracoFunctions::AttributeMetadataObject __pyx_convert__from_py_str /* "FromPyStructUtility":18 * try: - * value = obj['metadata_id'] + * value = obj['data'] * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'metadata_id'") - * result.metadata_id = value + * 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_AttributeMetadataObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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['metadata_id'] + * value = obj['data'] * except KeyError: - * raise ValueError("No value specified for struct attribute 'metadata_id'") # <<<<<<<<<<<<<< - * result.metadata_id = value + * 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_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, 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; @@ -7012,7 +6761,7 @@ static struct DracoFunctions::AttributeMetadataObject __pyx_convert__from_py_str * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) * * try: # <<<<<<<<<<<<<< - * value = obj['metadata_id'] + * value = obj['data'] * except KeyError: */ __Pyx_XGIVEREF(__pyx_t_3); @@ -7025,19 +6774,19 @@ static struct DracoFunctions::AttributeMetadataObject __pyx_convert__from_py_str /* "FromPyStructUtility":20 * except KeyError: - * raise ValueError("No value specified for struct attribute 'metadata_id'") - * result.metadata_id = value # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'data'") + * result.data = value # <<<<<<<<<<<<<< * try: - * value = obj['unique_id'] + * value = obj['datatype'] */ - __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; + __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 'metadata_id'") - * result.metadata_id = value + * raise ValueError("No value specified for struct attribute 'data'") + * result.data = value * try: # <<<<<<<<<<<<<< - * value = obj['unique_id'] + * value = obj['datatype'] * except KeyError: */ { @@ -7050,22 +6799,22 @@ static struct DracoFunctions::AttributeMetadataObject __pyx_convert__from_py_str /*try:*/ { /* "FromPyStructUtility":22 - * result.metadata_id = value + * result.data = value * try: - * value = obj['unique_id'] # <<<<<<<<<<<<<< + * value = obj['datatype'] # <<<<<<<<<<<<<< * except KeyError: - * raise ValueError("No value specified for struct attribute 'unique_id'") + * raise ValueError("No value specified for struct attribute 'datatype'") */ - __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_unique_id); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 22, __pyx_L12_error) + __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 'metadata_id'") - * result.metadata_id = value + * raise ValueError("No value specified for struct attribute 'data'") + * result.data = value * try: # <<<<<<<<<<<<<< - * value = obj['unique_id'] + * value = obj['datatype'] * except KeyError: */ } @@ -7081,25 +6830,25 @@ static struct DracoFunctions::AttributeMetadataObject __pyx_convert__from_py_str /* "FromPyStructUtility":23 * try: - * value = obj['unique_id'] + * value = obj['datatype'] * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'unique_id'") - * result.unique_id = value + * 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_AttributeMetadataObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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['unique_id'] + * value = obj['datatype'] * except KeyError: - * raise ValueError("No value specified for struct attribute 'unique_id'") # <<<<<<<<<<<<<< - * result.unique_id = value - * return result + * raise ValueError("No value specified for struct attribute 'datatype'") # <<<<<<<<<<<<<< + * result.datatype = value + * try: */ __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 24, __pyx_L14_except_error) __Pyx_GOTREF(__pyx_t_9); @@ -7111,10 +6860,10 @@ static struct DracoFunctions::AttributeMetadataObject __pyx_convert__from_py_str __pyx_L14_except_error:; /* "FromPyStructUtility":21 - * raise ValueError("No value specified for struct attribute 'metadata_id'") - * result.metadata_id = value + * raise ValueError("No value specified for struct attribute 'data'") + * result.data = value * try: # <<<<<<<<<<<<<< - * value = obj['unique_id'] + * value = obj['datatype'] * except KeyError: */ __Pyx_XGIVEREF(__pyx_t_5); @@ -7127,71 +6876,275 @@ static struct DracoFunctions::AttributeMetadataObject __pyx_convert__from_py_str /* "FromPyStructUtility":25 * except KeyError: - * raise ValueError("No value specified for struct attribute 'unique_id'") - * result.unique_id = value # <<<<<<<<<<<<<< - * return result - * + * raise ValueError("No value specified for struct attribute 'datatype'") + * result.datatype = value # <<<<<<<<<<<<<< + * try: + * value = obj['dimension'] */ - __pyx_t_10 = __Pyx_PyInt_As_uint32_t(__pyx_v_value); if (unlikely((__pyx_t_10 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 25, __pyx_L1_error) - __pyx_v_result.unique_id = __pyx_t_10; + __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 'unique_id'") - * result.unique_id = value - * return result # <<<<<<<<<<<<<< - * - * + * raise ValueError("No value specified for struct attribute 'datatype'") + * result.datatype = value + * try: # <<<<<<<<<<<<<< + * value = obj['dimension'] + * except KeyError: */ - __pyx_r = __pyx_v_result; - goto __pyx_L0; + { + __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":11 - * - * @cname("__pyx_convert__from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject") - * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(obj) except *: # <<<<<<<<<<<<<< - * cdef struct_type result - * if not PyMapping_Check(obj): + /* "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; - /* 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_AttributeMetadataObject", __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_AttributeMetadataObject") - * cdef vector[X] __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(object o) except *: # <<<<<<<<<<<<<< - * cdef vector[X] v - * for item in o: + /* "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; -static std::vector __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(PyObject *__pyx_v_o) { - std::vector __pyx_v_v; - PyObject *__pyx_v_item = NULL; - std::vector __pyx_r; - __Pyx_RefNannyDeclarations + /* "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__9, 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__10, 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::AttributeMetadataObject __pyx_t_5; + 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_AttributeMetadataObject", 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_AttributeMetadataObject(object o) except *: + * 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) @@ -7246,11 +7199,11 @@ static std::vector __pyx_conver * return v * */ - __pyx_t_5 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(__pyx_v_item); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 48, __pyx_L1_error) + __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_AttributeMetadataObject(object o) except *: + * 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) @@ -7271,8 +7224,8 @@ static std::vector __pyx_conver /* "vector.from_py":45 * - * @cname("__pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject") - * cdef vector[X] __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(object o) except *: # <<<<<<<<<<<<<< + * @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: */ @@ -7281,7 +7234,7 @@ static std::vector __pyx_conver __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_AttributeMetadataObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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); @@ -7312,7 +7265,7 @@ static struct DracoFunctions::GeometryMetadataObject __pyx_convert__from_py_stru PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; uint32_t __pyx_t_10; - std::vector __pyx_t_11; + std::vector __pyx_t_11; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -7413,7 +7366,7 @@ static struct DracoFunctions::GeometryMetadataObject __pyx_convert__from_py_stru * result.metadata_id = 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_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, 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; @@ -7442,7 +7395,7 @@ static struct DracoFunctions::GeometryMetadataObject __pyx_convert__from_py_stru * raise ValueError("No value specified for struct attribute 'metadata_id'") * result.metadata_id = value # <<<<<<<<<<<<<< * try: - * value = obj['attribute_metadatas'] + * 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; @@ -7451,7 +7404,7 @@ static struct DracoFunctions::GeometryMetadataObject __pyx_convert__from_py_stru * raise ValueError("No value specified for struct attribute 'metadata_id'") * result.metadata_id = value * try: # <<<<<<<<<<<<<< - * value = obj['attribute_metadatas'] + * value = obj['generic_attributes'] * except KeyError: */ { @@ -7466,11 +7419,11 @@ static struct DracoFunctions::GeometryMetadataObject __pyx_convert__from_py_stru /* "FromPyStructUtility":22 * result.metadata_id = value * try: - * value = obj['attribute_metadatas'] # <<<<<<<<<<<<<< + * value = obj['generic_attributes'] # <<<<<<<<<<<<<< * except KeyError: - * raise ValueError("No value specified for struct attribute 'attribute_metadatas'") + * raise ValueError("No value specified for struct attribute 'generic_attributes'") */ - __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_attribute_metadatas); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 22, __pyx_L12_error) + __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; @@ -7479,7 +7432,7 @@ static struct DracoFunctions::GeometryMetadataObject __pyx_convert__from_py_stru * raise ValueError("No value specified for struct attribute 'metadata_id'") * result.metadata_id = value * try: # <<<<<<<<<<<<<< - * value = obj['attribute_metadatas'] + * value = obj['generic_attributes'] * except KeyError: */ } @@ -7495,1918 +7448,63 @@ static struct DracoFunctions::GeometryMetadataObject __pyx_convert__from_py_stru /* "FromPyStructUtility":23 * try: - * value = obj['attribute_metadatas'] + * value = obj['generic_attributes'] * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'attribute_metadatas'") - * result.attribute_metadatas = value + * 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['attribute_metadatas'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'attribute_metadatas'") # <<<<<<<<<<<<<< - * result.attribute_metadatas = value - * return result - */ - __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 'metadata_id'") - * result.metadata_id = value - * try: # <<<<<<<<<<<<<< - * value = obj['attribute_metadatas'] - * 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 'attribute_metadatas'") - * result.attribute_metadatas = value # <<<<<<<<<<<<<< - * return result - * - */ - __pyx_t_11 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 25, __pyx_L1_error) - __pyx_v_result.attribute_metadatas = __pyx_t_11; - - /* "FromPyStructUtility":26 - * raise ValueError("No value specified for struct attribute 'attribute_metadatas'") - * result.attribute_metadatas = 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__11, 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__12, 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_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: - */ - -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; -} - -/* "FromPyStructUtility":11 - * - * @cname("__pyx_convert__from_py_struct__DracoFunctions_3a__3a_MeshObject") - * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_MeshObject(obj) except *: # <<<<<<<<<<<<<< - * cdef struct_type result - * if not PyMapping_Check(obj): - */ - -static struct DracoFunctions::MeshObject __pyx_convert__from_py_struct__DracoFunctions_3a__3a_MeshObject(PyObject *__pyx_v_obj) { - struct DracoFunctions::MeshObject __pyx_v_result; - PyObject *__pyx_v_value = NULL; - struct DracoFunctions::MeshObject __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::vector __pyx_t_10; - std::vector __pyx_t_11; - bool __pyx_t_12; - double __pyx_t_13; - std::vector __pyx_t_14; - enum DracoFunctions::decoding_status __pyx_t_15; - std::vector __pyx_t_16; - struct DracoFunctions::GeometryMetadataObject __pyx_t_17; - std::vector __pyx_t_18; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_convert__from_py_struct__DracoFunctions_3a__3a_MeshObject", 0); - - /* "FromPyStructUtility":13 - * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_MeshObject(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_MeshObject(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['points'] - * 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['points'] # <<<<<<<<<<<<<< - * except KeyError: - * raise ValueError("No value specified for struct attribute 'points'") - */ - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_points); 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['points'] - * 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['points'] - * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'points'") - * result.points = 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_MeshObject", __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['points'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'points'") # <<<<<<<<<<<<<< - * result.points = value - * try: - */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, 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['points'] - * 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 'points'") - * result.points = value # <<<<<<<<<<<<<< - * try: - * value = obj['faces'] - */ - __pyx_t_10 = __pyx_convert_vector_from_py_float(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 20, __pyx_L1_error) - __pyx_v_result.points = __pyx_t_10; - - /* "FromPyStructUtility":21 - * raise ValueError("No value specified for struct attribute 'points'") - * result.points = value - * try: # <<<<<<<<<<<<<< - * value = obj['faces'] - * 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.points = value - * try: - * value = obj['faces'] # <<<<<<<<<<<<<< - * except KeyError: - * raise ValueError("No value specified for struct attribute 'faces'") - */ - __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_faces); 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 'points'") - * result.points = value - * try: # <<<<<<<<<<<<<< - * value = obj['faces'] - * 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['faces'] - * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'faces'") - * result.faces = 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_MeshObject", __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['faces'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'faces'") # <<<<<<<<<<<<<< - * result.faces = value - * try: - */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__14, 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 'points'") - * result.points = value - * try: # <<<<<<<<<<<<<< - * value = obj['faces'] - * 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 'faces'") - * result.faces = value # <<<<<<<<<<<<<< - * try: - * value = obj['normals'] - */ - __pyx_t_11 = __pyx_convert_vector_from_py_unsigned_int(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 25, __pyx_L1_error) - __pyx_v_result.faces = __pyx_t_11; - - /* "FromPyStructUtility":26 - * raise ValueError("No value specified for struct attribute 'faces'") - * result.faces = value - * try: # <<<<<<<<<<<<<< - * value = obj['normals'] - * 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.faces = value - * try: - * value = obj['normals'] # <<<<<<<<<<<<<< - * except KeyError: - * raise ValueError("No value specified for struct attribute 'normals'") - */ - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_normals); 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 'faces'") - * result.faces = value - * try: # <<<<<<<<<<<<<< - * value = obj['normals'] - * 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['normals'] - * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'normals'") - * result.normals = 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_MeshObject", __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['normals'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'normals'") # <<<<<<<<<<<<<< - * result.normals = value - * try: - */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, 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 'faces'") - * result.faces = value - * try: # <<<<<<<<<<<<<< - * value = obj['normals'] - * 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 'normals'") - * result.normals = value # <<<<<<<<<<<<<< - * try: - * value = obj['encoding_options_set'] - */ - __pyx_t_10 = __pyx_convert_vector_from_py_float(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 30, __pyx_L1_error) - __pyx_v_result.normals = __pyx_t_10; - - /* "FromPyStructUtility":31 - * raise ValueError("No value specified for struct attribute 'normals'") - * result.normals = value - * try: # <<<<<<<<<<<<<< - * value = obj['encoding_options_set'] - * 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.normals = value - * try: - * value = obj['encoding_options_set'] # <<<<<<<<<<<<<< - * except KeyError: - * raise ValueError("No value specified for struct attribute 'encoding_options_set'") - */ - __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_encoding_options_set); 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 'normals'") - * result.normals = value - * try: # <<<<<<<<<<<<<< - * value = obj['encoding_options_set'] - * 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['encoding_options_set'] - * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'encoding_options_set'") - * result.encoding_options_set = 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_MeshObject", __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['encoding_options_set'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'encoding_options_set'") # <<<<<<<<<<<<<< - * result.encoding_options_set = value - * try: - */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__16, 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 'normals'") - * result.normals = value - * try: # <<<<<<<<<<<<<< - * value = obj['encoding_options_set'] - * 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 'encoding_options_set'") - * result.encoding_options_set = value # <<<<<<<<<<<<<< - * try: - * value = obj['quantization_bits'] - */ - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_12 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(1, 35, __pyx_L1_error) - __pyx_v_result.encoding_options_set = __pyx_t_12; - - /* "FromPyStructUtility":36 - * raise ValueError("No value specified for struct attribute 'encoding_options_set'") - * result.encoding_options_set = value - * try: # <<<<<<<<<<<<<< - * value = obj['quantization_bits'] - * 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":37 - * result.encoding_options_set = value - * try: - * value = obj['quantization_bits'] # <<<<<<<<<<<<<< - * except KeyError: - * raise ValueError("No value specified for struct attribute 'quantization_bits'") - */ - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_quantization_bits); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 37, __pyx_L36_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2); - __pyx_t_2 = 0; - - /* "FromPyStructUtility":36 - * raise ValueError("No value specified for struct attribute 'encoding_options_set'") - * result.encoding_options_set = value - * try: # <<<<<<<<<<<<<< - * value = obj['quantization_bits'] - * 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_L41_try_end; - __pyx_L36_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":38 - * try: - * value = obj['quantization_bits'] - * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'quantization_bits'") - * result.quantization_bits = 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_MeshObject", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 38, __pyx_L38_except_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_8); - - /* "FromPyStructUtility":39 - * value = obj['quantization_bits'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'quantization_bits'") # <<<<<<<<<<<<<< - * result.quantization_bits = value - * try: - */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 39, __pyx_L38_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, 39, __pyx_L38_except_error) - } - goto __pyx_L38_except_error; - __pyx_L38_except_error:; - - /* "FromPyStructUtility":36 - * raise ValueError("No value specified for struct attribute 'encoding_options_set'") - * result.encoding_options_set = value - * try: # <<<<<<<<<<<<<< - * value = obj['quantization_bits'] - * 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_L41_try_end:; - } - - /* "FromPyStructUtility":40 - * except KeyError: - * raise ValueError("No value specified for struct attribute 'quantization_bits'") - * result.quantization_bits = value # <<<<<<<<<<<<<< - * try: - * value = obj['quantization_range'] - */ - __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 40, __pyx_L1_error) - __pyx_v_result.quantization_bits = __pyx_t_6; - - /* "FromPyStructUtility":41 - * raise ValueError("No value specified for struct attribute 'quantization_bits'") - * result.quantization_bits = value - * try: # <<<<<<<<<<<<<< - * value = obj['quantization_range'] - * 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":42 - * result.quantization_bits = value - * try: - * value = obj['quantization_range'] # <<<<<<<<<<<<<< - * except KeyError: - * raise ValueError("No value specified for struct attribute 'quantization_range'") - */ - __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_quantization_range); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 42, __pyx_L44_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_8); - __pyx_t_8 = 0; - - /* "FromPyStructUtility":41 - * raise ValueError("No value specified for struct attribute 'quantization_bits'") - * result.quantization_bits = value - * try: # <<<<<<<<<<<<<< - * value = obj['quantization_range'] - * 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_L49_try_end; - __pyx_L44_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":43 - * try: - * value = obj['quantization_range'] - * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'quantization_range'") - * result.quantization_range = 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_MeshObject", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_2) < 0) __PYX_ERR(1, 43, __pyx_L46_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_2); - - /* "FromPyStructUtility":44 - * value = obj['quantization_range'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'quantization_range'") # <<<<<<<<<<<<<< - * result.quantization_range = value - * try: - */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 44, __pyx_L46_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, 44, __pyx_L46_except_error) - } - goto __pyx_L46_except_error; - __pyx_L46_except_error:; - - /* "FromPyStructUtility":41 - * raise ValueError("No value specified for struct attribute 'quantization_bits'") - * result.quantization_bits = value - * try: # <<<<<<<<<<<<<< - * value = obj['quantization_range'] - * 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_L49_try_end:; - } - - /* "FromPyStructUtility":45 - * except KeyError: - * raise ValueError("No value specified for struct attribute 'quantization_range'") - * result.quantization_range = value # <<<<<<<<<<<<<< - * try: - * value = obj['quantization_origin'] - */ - __pyx_t_13 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_13 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 45, __pyx_L1_error) - __pyx_v_result.quantization_range = __pyx_t_13; - - /* "FromPyStructUtility":46 - * raise ValueError("No value specified for struct attribute 'quantization_range'") - * result.quantization_range = value - * try: # <<<<<<<<<<<<<< - * value = obj['quantization_origin'] - * 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":47 - * result.quantization_range = value - * try: - * value = obj['quantization_origin'] # <<<<<<<<<<<<<< - * except KeyError: - * raise ValueError("No value specified for struct attribute 'quantization_origin'") - */ - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 47, __pyx_L52_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2); - __pyx_t_2 = 0; - - /* "FromPyStructUtility":46 - * raise ValueError("No value specified for struct attribute 'quantization_range'") - * result.quantization_range = value - * try: # <<<<<<<<<<<<<< - * value = obj['quantization_origin'] - * 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_L57_try_end; - __pyx_L52_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":48 - * try: - * value = obj['quantization_origin'] - * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'quantization_origin'") - * result.quantization_origin = 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_MeshObject", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 48, __pyx_L54_except_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_8); - - /* "FromPyStructUtility":49 - * value = obj['quantization_origin'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'quantization_origin'") # <<<<<<<<<<<<<< - * result.quantization_origin = value - * try: - */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 49, __pyx_L54_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, 49, __pyx_L54_except_error) - } - goto __pyx_L54_except_error; - __pyx_L54_except_error:; - - /* "FromPyStructUtility":46 - * raise ValueError("No value specified for struct attribute 'quantization_range'") - * result.quantization_range = value - * try: # <<<<<<<<<<<<<< - * value = obj['quantization_origin'] - * 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_L57_try_end:; - } - - /* "FromPyStructUtility":50 - * except KeyError: - * raise ValueError("No value specified for struct attribute 'quantization_origin'") - * result.quantization_origin = value # <<<<<<<<<<<<<< - * try: - * value = obj['decode_status'] - */ - __pyx_t_14 = __pyx_convert_vector_from_py_double(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 50, __pyx_L1_error) - __pyx_v_result.quantization_origin = __pyx_t_14; - - /* "FromPyStructUtility":51 - * raise ValueError("No value specified for struct attribute 'quantization_origin'") - * result.quantization_origin = value - * try: # <<<<<<<<<<<<<< - * value = obj['decode_status'] - * 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":52 - * result.quantization_origin = value - * try: - * value = obj['decode_status'] # <<<<<<<<<<<<<< - * except KeyError: - * raise ValueError("No value specified for struct attribute 'decode_status'") - */ - __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_decode_status); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 52, __pyx_L60_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_8); - __pyx_t_8 = 0; - - /* "FromPyStructUtility":51 - * raise ValueError("No value specified for struct attribute 'quantization_origin'") - * result.quantization_origin = value - * try: # <<<<<<<<<<<<<< - * value = obj['decode_status'] - * 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_L65_try_end; - __pyx_L60_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":53 - * try: - * value = obj['decode_status'] - * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'decode_status'") - * result.decode_status = 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_MeshObject", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_2) < 0) __PYX_ERR(1, 53, __pyx_L62_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_2); - - /* "FromPyStructUtility":54 - * value = obj['decode_status'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'decode_status'") # <<<<<<<<<<<<<< - * result.decode_status = value - * try: - */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 54, __pyx_L62_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, 54, __pyx_L62_except_error) - } - goto __pyx_L62_except_error; - __pyx_L62_except_error:; - - /* "FromPyStructUtility":51 - * raise ValueError("No value specified for struct attribute 'quantization_origin'") - * result.quantization_origin = value - * try: # <<<<<<<<<<<<<< - * value = obj['decode_status'] - * 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_L65_try_end:; - } - - /* "FromPyStructUtility":55 - * except KeyError: - * raise ValueError("No value specified for struct attribute 'decode_status'") - * result.decode_status = value # <<<<<<<<<<<<<< - * try: - * value = obj['attributes'] - */ - __pyx_t_15 = ((enum DracoFunctions::decoding_status)__Pyx_PyInt_As_enum__DracoFunctions_3a__3a_decoding_status(__pyx_v_value)); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 55, __pyx_L1_error) - __pyx_v_result.decode_status = __pyx_t_15; - - /* "FromPyStructUtility":56 - * raise ValueError("No value specified for struct attribute 'decode_status'") - * result.decode_status = value - * try: # <<<<<<<<<<<<<< - * value = obj['attributes'] - * 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":57 - * result.decode_status = value - * try: - * value = obj['attributes'] # <<<<<<<<<<<<<< - * except KeyError: - * raise ValueError("No value specified for struct attribute 'attributes'") - */ - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_attributes); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 57, __pyx_L68_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2); - __pyx_t_2 = 0; - - /* "FromPyStructUtility":56 - * raise ValueError("No value specified for struct attribute 'decode_status'") - * result.decode_status = value - * try: # <<<<<<<<<<<<<< - * value = obj['attributes'] - * 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_L73_try_end; - __pyx_L68_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":58 - * try: - * value = obj['attributes'] - * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'attributes'") - * result.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_MeshObject", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 58, __pyx_L70_except_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_8); - - /* "FromPyStructUtility":59 - * value = obj['attributes'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'attributes'") # <<<<<<<<<<<<<< - * result.attributes = value - * try: - */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 59, __pyx_L70_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, 59, __pyx_L70_except_error) - } - goto __pyx_L70_except_error; - __pyx_L70_except_error:; - - /* "FromPyStructUtility":56 - * raise ValueError("No value specified for struct attribute 'decode_status'") - * result.decode_status = value - * try: # <<<<<<<<<<<<<< - * value = obj['attributes'] - * 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_L73_try_end:; - } - - /* "FromPyStructUtility":60 - * except KeyError: - * raise ValueError("No value specified for struct attribute 'attributes'") - * result.attributes = value # <<<<<<<<<<<<<< - * try: - * value = obj['geometry_metadata'] - */ - __pyx_t_16 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_PointAttributeObject(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 60, __pyx_L1_error) - __pyx_v_result.attributes = __pyx_t_16; - - /* "FromPyStructUtility":61 - * raise ValueError("No value specified for struct attribute 'attributes'") - * result.attributes = value - * try: # <<<<<<<<<<<<<< - * value = obj['geometry_metadata'] - * 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":62 - * result.attributes = value - * try: - * value = obj['geometry_metadata'] # <<<<<<<<<<<<<< - * except KeyError: - * raise ValueError("No value specified for struct attribute 'geometry_metadata'") - */ - __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_geometry_metadata); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 62, __pyx_L76_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_8); - __pyx_t_8 = 0; - - /* "FromPyStructUtility":61 - * raise ValueError("No value specified for struct attribute 'attributes'") - * result.attributes = value - * try: # <<<<<<<<<<<<<< - * value = obj['geometry_metadata'] - * 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_L81_try_end; - __pyx_L76_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":63 - * try: - * value = obj['geometry_metadata'] - * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'geometry_metadata'") - * result.geometry_metadata = 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_MeshObject", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_2) < 0) __PYX_ERR(1, 63, __pyx_L78_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_2); - - /* "FromPyStructUtility":64 - * value = obj['geometry_metadata'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'geometry_metadata'") # <<<<<<<<<<<<<< - * result.geometry_metadata = value - * try: - */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 64, __pyx_L78_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, 64, __pyx_L78_except_error) - } - goto __pyx_L78_except_error; - __pyx_L78_except_error:; - - /* "FromPyStructUtility":61 - * raise ValueError("No value specified for struct attribute 'attributes'") - * result.attributes = value - * try: # <<<<<<<<<<<<<< - * value = obj['geometry_metadata'] - * 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_L81_try_end:; - } - - /* "FromPyStructUtility":65 - * except KeyError: - * raise ValueError("No value specified for struct attribute 'geometry_metadata'") - * result.geometry_metadata = value # <<<<<<<<<<<<<< - * try: - * value = obj['metadatas'] - */ - __pyx_t_17 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 65, __pyx_L1_error) - __pyx_v_result.geometry_metadata = __pyx_t_17; - - /* "FromPyStructUtility":66 - * raise ValueError("No value specified for struct attribute 'geometry_metadata'") - * result.geometry_metadata = value - * try: # <<<<<<<<<<<<<< - * value = obj['metadatas'] - * 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":67 - * result.geometry_metadata = value - * try: - * value = obj['metadatas'] # <<<<<<<<<<<<<< - * except KeyError: - * raise ValueError("No value specified for struct attribute 'metadatas'") - */ - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_metadatas); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 67, __pyx_L84_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2); - __pyx_t_2 = 0; - - /* "FromPyStructUtility":66 - * raise ValueError("No value specified for struct attribute 'geometry_metadata'") - * result.geometry_metadata = value - * try: # <<<<<<<<<<<<<< - * value = obj['metadatas'] - * 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_L89_try_end; - __pyx_L84_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":68 - * try: - * value = obj['metadatas'] - * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'metadatas'") - * result.metadatas = 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_MeshObject", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 68, __pyx_L86_except_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_8); + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_2); - /* "FromPyStructUtility":69 - * value = obj['metadatas'] + /* "FromPyStructUtility":24 + * value = obj['generic_attributes'] * except KeyError: - * raise ValueError("No value specified for struct attribute 'metadatas'") # <<<<<<<<<<<<<< - * result.metadatas = value + * 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__23, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 69, __pyx_L86_except_error) + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, 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, 69, __pyx_L86_except_error) + __PYX_ERR(1, 24, __pyx_L14_except_error) } - goto __pyx_L86_except_error; - __pyx_L86_except_error:; + goto __pyx_L14_except_error; + __pyx_L14_except_error:; - /* "FromPyStructUtility":66 - * raise ValueError("No value specified for struct attribute 'geometry_metadata'") - * result.geometry_metadata = value + /* "FromPyStructUtility":21 + * raise ValueError("No value specified for struct attribute 'metadata_id'") + * result.metadata_id = value * try: # <<<<<<<<<<<<<< - * value = obj['metadatas'] + * value = obj['generic_attributes'] * 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); + __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_L89_try_end:; + __pyx_L17_try_end:; } - /* "FromPyStructUtility":70 + /* "FromPyStructUtility":25 * except KeyError: - * raise ValueError("No value specified for struct attribute 'metadatas'") - * result.metadatas = value # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'generic_attributes'") + * result.generic_attributes = value # <<<<<<<<<<<<<< * return result * */ - __pyx_t_18 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 70, __pyx_L1_error) - __pyx_v_result.metadatas = __pyx_t_18; + __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":71 - * raise ValueError("No value specified for struct attribute 'metadatas'") - * result.metadatas = value + /* "FromPyStructUtility":26 + * raise ValueError("No value specified for struct attribute 'generic_attributes'") + * result.generic_attributes = value * return result # <<<<<<<<<<<<<< * * @@ -9416,8 +7514,8 @@ static struct DracoFunctions::MeshObject __pyx_convert__from_py_struct__DracoFun /* "FromPyStructUtility":11 * - * @cname("__pyx_convert__from_py_struct__DracoFunctions_3a__3a_MeshObject") - * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_MeshObject(obj) except *: # <<<<<<<<<<<<<< + * @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): */ @@ -9428,7 +7526,7 @@ static struct DracoFunctions::MeshObject __pyx_convert__from_py_struct__DracoFun __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_MeshObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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); @@ -9501,6 +7599,128 @@ static PyObject *__pyx_convert_vector_to_py_unsigned_char(const 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; +} + /* "FromPyStructUtility":11 * * @cname("__pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointCloudObject") @@ -9528,9 +7748,8 @@ static struct DracoFunctions::PointCloudObject __pyx_convert__from_py_struct__Dr double __pyx_t_12; std::vector __pyx_t_13; enum DracoFunctions::decoding_status __pyx_t_14; - std::vector __pyx_t_15; - struct DracoFunctions::GeometryMetadataObject __pyx_t_16; - std::vector __pyx_t_17; + struct DracoFunctions::GeometryMetadataObject __pyx_t_15; + std::vector __pyx_t_16; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -9631,7 +7850,7 @@ static struct DracoFunctions::PointCloudObject __pyx_convert__from_py_struct__Dr * result.points = value * try: */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 19, __pyx_L6_except_error) + __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; @@ -9733,7 +7952,7 @@ static struct DracoFunctions::PointCloudObject __pyx_convert__from_py_struct__Dr * result.encoding_options_set = value * try: */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 24, __pyx_L14_except_error) + __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; @@ -9835,7 +8054,7 @@ static struct DracoFunctions::PointCloudObject __pyx_convert__from_py_struct__Dr * result.quantization_bits = value * try: */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 29, __pyx_L22_except_error) + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__14, 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; @@ -9937,7 +8156,7 @@ static struct DracoFunctions::PointCloudObject __pyx_convert__from_py_struct__Dr * result.quantization_range = value * try: */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 34, __pyx_L30_except_error) + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, 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; @@ -10039,7 +8258,7 @@ static struct DracoFunctions::PointCloudObject __pyx_convert__from_py_struct__Dr * result.quantization_origin = value * try: */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 39, __pyx_L38_except_error) + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 39, __pyx_L38_except_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_Raise(__pyx_t_9, 0, 0, 0); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; @@ -10141,7 +8360,7 @@ static struct DracoFunctions::PointCloudObject __pyx_convert__from_py_struct__Dr * result.decode_status = value * try: */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 44, __pyx_L46_except_error) + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 44, __pyx_L46_except_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_Raise(__pyx_t_9, 0, 0, 0); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; @@ -10170,7 +8389,7 @@ static struct DracoFunctions::PointCloudObject __pyx_convert__from_py_struct__Dr * raise ValueError("No value specified for struct attribute 'decode_status'") * result.decode_status = value # <<<<<<<<<<<<<< * try: - * value = obj['attributes'] + * value = obj['geometry_metadata'] */ __pyx_t_14 = ((enum DracoFunctions::decoding_status)__Pyx_PyInt_As_enum__DracoFunctions_3a__3a_decoding_status(__pyx_v_value)); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 45, __pyx_L1_error) __pyx_v_result.decode_status = __pyx_t_14; @@ -10179,7 +8398,7 @@ static struct DracoFunctions::PointCloudObject __pyx_convert__from_py_struct__Dr * raise ValueError("No value specified for struct attribute 'decode_status'") * result.decode_status = value * try: # <<<<<<<<<<<<<< - * value = obj['attributes'] + * value = obj['geometry_metadata'] * except KeyError: */ { @@ -10194,11 +8413,11 @@ static struct DracoFunctions::PointCloudObject __pyx_convert__from_py_struct__Dr /* "FromPyStructUtility":47 * result.decode_status = value * try: - * value = obj['attributes'] # <<<<<<<<<<<<<< + * value = obj['geometry_metadata'] # <<<<<<<<<<<<<< * except KeyError: - * raise ValueError("No value specified for struct attribute 'attributes'") + * raise ValueError("No value specified for struct attribute 'geometry_metadata'") */ - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_attributes); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 47, __pyx_L52_error) + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_geometry_metadata); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 47, __pyx_L52_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2); __pyx_t_2 = 0; @@ -10207,7 +8426,7 @@ static struct DracoFunctions::PointCloudObject __pyx_convert__from_py_struct__Dr * raise ValueError("No value specified for struct attribute 'decode_status'") * result.decode_status = value * try: # <<<<<<<<<<<<<< - * value = obj['attributes'] + * value = obj['geometry_metadata'] * except KeyError: */ } @@ -10223,10 +8442,10 @@ static struct DracoFunctions::PointCloudObject __pyx_convert__from_py_struct__Dr /* "FromPyStructUtility":48 * try: - * value = obj['attributes'] + * value = obj['geometry_metadata'] * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'attributes'") - * result.attributes = value + * raise ValueError("No value specified for struct attribute 'geometry_metadata'") + * result.geometry_metadata = value */ __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError); if (__pyx_t_6) { @@ -10237,13 +8456,13 @@ static struct DracoFunctions::PointCloudObject __pyx_convert__from_py_struct__Dr __Pyx_GOTREF(__pyx_t_8); /* "FromPyStructUtility":49 - * value = obj['attributes'] + * value = obj['geometry_metadata'] * except KeyError: - * raise ValueError("No value specified for struct attribute 'attributes'") # <<<<<<<<<<<<<< - * result.attributes = value + * raise ValueError("No value specified for struct attribute 'geometry_metadata'") # <<<<<<<<<<<<<< + * result.geometry_metadata = value * try: */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 49, __pyx_L54_except_error) + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 49, __pyx_L54_except_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_Raise(__pyx_t_9, 0, 0, 0); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; @@ -10256,7 +8475,7 @@ static struct DracoFunctions::PointCloudObject __pyx_convert__from_py_struct__Dr * raise ValueError("No value specified for struct attribute 'decode_status'") * result.decode_status = value * try: # <<<<<<<<<<<<<< - * value = obj['attributes'] + * value = obj['geometry_metadata'] * except KeyError: */ __Pyx_XGIVEREF(__pyx_t_3); @@ -10269,117 +8488,15 @@ static struct DracoFunctions::PointCloudObject __pyx_convert__from_py_struct__Dr /* "FromPyStructUtility":50 * except KeyError: - * raise ValueError("No value specified for struct attribute 'attributes'") - * result.attributes = value # <<<<<<<<<<<<<< - * try: - * value = obj['geometry_metadata'] - */ - __pyx_t_15 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_PointAttributeObject(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 50, __pyx_L1_error) - __pyx_v_result.attributes = __pyx_t_15; - - /* "FromPyStructUtility":51 - * raise ValueError("No value specified for struct attribute 'attributes'") - * result.attributes = value - * try: # <<<<<<<<<<<<<< - * value = obj['geometry_metadata'] - * 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":52 - * result.attributes = value - * try: - * value = obj['geometry_metadata'] # <<<<<<<<<<<<<< - * except KeyError: - * raise ValueError("No value specified for struct attribute 'geometry_metadata'") - */ - __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_geometry_metadata); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 52, __pyx_L60_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_8); - __pyx_t_8 = 0; - - /* "FromPyStructUtility":51 - * raise ValueError("No value specified for struct attribute 'attributes'") - * result.attributes = value - * try: # <<<<<<<<<<<<<< - * value = obj['geometry_metadata'] - * 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_L65_try_end; - __pyx_L60_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":53 - * try: - * value = obj['geometry_metadata'] - * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'geometry_metadata'") - * result.geometry_metadata = 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_PointCloudObject", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_2) < 0) __PYX_ERR(1, 53, __pyx_L62_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_2); - - /* "FromPyStructUtility":54 - * value = obj['geometry_metadata'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'geometry_metadata'") # <<<<<<<<<<<<<< - * result.geometry_metadata = value - * try: - */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 54, __pyx_L62_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, 54, __pyx_L62_except_error) - } - goto __pyx_L62_except_error; - __pyx_L62_except_error:; - - /* "FromPyStructUtility":51 - * raise ValueError("No value specified for struct attribute 'attributes'") - * result.attributes = value - * try: # <<<<<<<<<<<<<< - * value = obj['geometry_metadata'] - * 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_L65_try_end:; - } - - /* "FromPyStructUtility":55 - * except KeyError: * raise ValueError("No value specified for struct attribute 'geometry_metadata'") * result.geometry_metadata = value # <<<<<<<<<<<<<< * try: * value = obj['metadatas'] */ - __pyx_t_16 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 55, __pyx_L1_error) - __pyx_v_result.geometry_metadata = __pyx_t_16; + __pyx_t_15 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 50, __pyx_L1_error) + __pyx_v_result.geometry_metadata = __pyx_t_15; - /* "FromPyStructUtility":56 + /* "FromPyStructUtility":51 * raise ValueError("No value specified for struct attribute 'geometry_metadata'") * result.geometry_metadata = value * try: # <<<<<<<<<<<<<< @@ -10389,25 +8506,25 @@ static struct DracoFunctions::PointCloudObject __pyx_convert__from_py_struct__Dr { __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_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":57 + /* "FromPyStructUtility":52 * result.geometry_metadata = value * try: * value = obj['metadatas'] # <<<<<<<<<<<<<< * except KeyError: * raise ValueError("No value specified for struct attribute 'metadatas'") */ - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_metadatas); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 57, __pyx_L68_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_metadatas); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 52, __pyx_L60_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_8); + __pyx_t_8 = 0; - /* "FromPyStructUtility":56 + /* "FromPyStructUtility":51 * raise ValueError("No value specified for struct attribute 'geometry_metadata'") * result.geometry_metadata = value * try: # <<<<<<<<<<<<<< @@ -10415,17 +8532,17 @@ static struct DracoFunctions::PointCloudObject __pyx_convert__from_py_struct__Dr * 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_L73_try_end; - __pyx_L68_error:; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L65_try_end; + __pyx_L60_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":58 + /* "FromPyStructUtility":53 * try: * value = obj['metadatas'] * except KeyError: # <<<<<<<<<<<<<< @@ -10435,53 +8552,53 @@ static struct DracoFunctions::PointCloudObject __pyx_convert__from_py_struct__Dr __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError); if (__pyx_t_6) { __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointCloudObject", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 58, __pyx_L70_except_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_2) < 0) __PYX_ERR(1, 53, __pyx_L62_except_error) __Pyx_GOTREF(__pyx_t_8); + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_2); - /* "FromPyStructUtility":59 + /* "FromPyStructUtility":54 * value = obj['metadatas'] * except KeyError: * raise ValueError("No value specified for struct attribute 'metadatas'") # <<<<<<<<<<<<<< * result.metadatas = value * return result */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 59, __pyx_L70_except_error) + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 54, __pyx_L62_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, 59, __pyx_L70_except_error) + __PYX_ERR(1, 54, __pyx_L62_except_error) } - goto __pyx_L70_except_error; - __pyx_L70_except_error:; + goto __pyx_L62_except_error; + __pyx_L62_except_error:; - /* "FromPyStructUtility":56 + /* "FromPyStructUtility":51 * raise ValueError("No value specified for struct attribute 'geometry_metadata'") * result.geometry_metadata = value * try: # <<<<<<<<<<<<<< * value = obj['metadatas'] * 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); + __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_L73_try_end:; + __pyx_L65_try_end:; } - /* "FromPyStructUtility":60 + /* "FromPyStructUtility":55 * except KeyError: * raise ValueError("No value specified for struct attribute 'metadatas'") * result.metadatas = value # <<<<<<<<<<<<<< * return result * */ - __pyx_t_17 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 60, __pyx_L1_error) - __pyx_v_result.metadatas = __pyx_t_17; + __pyx_t_16 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 55, __pyx_L1_error) + __pyx_v_result.metadatas = __pyx_t_16; - /* "FromPyStructUtility":61 + /* "FromPyStructUtility":56 * raise ValueError("No value specified for struct attribute 'metadatas'") * result.metadatas = value * return result # <<<<<<<<<<<<<< @@ -11127,63 +9244,6 @@ static PyObject *__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_PointA return __pyx_r; } -static PyObject *__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(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_AttributeMetadataObject", 0); - - /* "vector.to_py":61 - * @cname("__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject") - * cdef object __pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(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_AttributeMetadataObject((__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_AttributeMetadataObject") - * cdef object __pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_AttributeMetadataObject(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_AttributeMetadataObject", __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") @@ -11535,7 +9595,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_attributes, __pyx_k_DracoPointCloud_attributes, sizeof(__pyx_k_DracoPointCloud_attributes), 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}, @@ -11543,23 +9602,21 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_kp_s_DracoPy_only_supports_meshes_wit, __pyx_k_DracoPy_only_supports_meshes_wit, sizeof(__pyx_k_DracoPy_only_supports_meshes_wit), 0, 0, 1, 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_kp_s_Failed_to_decode_input_mesh_Data, __pyx_k_Failed_to_decode_input_mesh_Data, sizeof(__pyx_k_Failed_to_decode_input_mesh_Data), 0, 0, 1, 0}, {&__pyx_n_s_FileTypeException, __pyx_k_FileTypeException, sizeof(__pyx_k_FileTypeException), 0, 0, 1, 1}, - {&__pyx_n_u_GeometryMetadataObject, __pyx_k_GeometryMetadataObject, sizeof(__pyx_k_GeometryMetadataObject), 0, 1, 0, 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_s_Input_invalid, __pyx_k_Input_invalid, sizeof(__pyx_k_Input_invalid), 0, 0, 1, 0}, + {&__pyx_kp_s_Input_mesh_is_not_draco_encoded, __pyx_k_Input_mesh_is_not_draco_encoded, sizeof(__pyx_k_Input_mesh_is_not_draco_encoded), 0, 0, 1, 0}, + {&__pyx_kp_s_Invalid_mesh, __pyx_k_Invalid_mesh, sizeof(__pyx_k_Invalid_mesh), 0, 0, 1, 0}, + {&__pyx_kp_s_Invalid_point_cloud, __pyx_k_Invalid_point_cloud, sizeof(__pyx_k_Invalid_point_cloud), 0, 0, 1, 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_u_MetadataObject, __pyx_k_MetadataObject, sizeof(__pyx_k_MetadataObject), 0, 1, 0, 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_10, __pyx_k_No_value_specified_for_struct_at_10, sizeof(__pyx_k_No_value_specified_for_struct_at_10), 0, 0, 1, 0}, {&__pyx_kp_s_No_value_specified_for_struct_at_11, __pyx_k_No_value_specified_for_struct_at_11, sizeof(__pyx_k_No_value_specified_for_struct_at_11), 0, 0, 1, 0}, @@ -11567,10 +9624,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_No_value_specified_for_struct_at_13, __pyx_k_No_value_specified_for_struct_at_13, sizeof(__pyx_k_No_value_specified_for_struct_at_13), 0, 0, 1, 0}, {&__pyx_kp_s_No_value_specified_for_struct_at_14, __pyx_k_No_value_specified_for_struct_at_14, sizeof(__pyx_k_No_value_specified_for_struct_at_14), 0, 0, 1, 0}, {&__pyx_kp_s_No_value_specified_for_struct_at_15, __pyx_k_No_value_specified_for_struct_at_15, sizeof(__pyx_k_No_value_specified_for_struct_at_15), 0, 0, 1, 0}, - {&__pyx_kp_s_No_value_specified_for_struct_at_16, __pyx_k_No_value_specified_for_struct_at_16, sizeof(__pyx_k_No_value_specified_for_struct_at_16), 0, 0, 1, 0}, - {&__pyx_kp_s_No_value_specified_for_struct_at_17, __pyx_k_No_value_specified_for_struct_at_17, sizeof(__pyx_k_No_value_specified_for_struct_at_17), 0, 0, 1, 0}, - {&__pyx_kp_s_No_value_specified_for_struct_at_18, __pyx_k_No_value_specified_for_struct_at_18, sizeof(__pyx_k_No_value_specified_for_struct_at_18), 0, 0, 1, 0}, - {&__pyx_kp_s_No_value_specified_for_struct_at_19, __pyx_k_No_value_specified_for_struct_at_19, sizeof(__pyx_k_No_value_specified_for_struct_at_19), 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}, @@ -11579,13 +9632,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_kp_s_No_value_specified_for_struct_at_8, __pyx_k_No_value_specified_for_struct_at_8, sizeof(__pyx_k_No_value_specified_for_struct_at_8), 0, 0, 1, 0}, {&__pyx_kp_s_No_value_specified_for_struct_at_9, __pyx_k_No_value_specified_for_struct_at_9, sizeof(__pyx_k_No_value_specified_for_struct_at_9), 0, 0, 1, 0}, - {&__pyx_n_u_PointAttributeObject, __pyx_k_PointAttributeObject, sizeof(__pyx_k_PointAttributeObject), 0, 1, 0, 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_kp_s_Specified_value_out_of_encoded_r, __pyx_k_Specified_value_out_of_encoded_r, sizeof(__pyx_k_Specified_value_out_of_encoded_r), 0, 0, 1, 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_attribute_metadatas, __pyx_k_attribute_metadatas, sizeof(__pyx_k_attribute_metadatas), 0, 0, 1, 1}, - {&__pyx_n_s_attributes, __pyx_k_attributes, sizeof(__pyx_k_attributes), 0, 0, 1, 1}, - {&__pyx_n_u_attributes, __pyx_k_attributes, sizeof(__pyx_k_attributes), 0, 1, 0, 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}, @@ -11602,6 +9651,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_dim, __pyx_k_dim, sizeof(__pyx_k_dim), 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_e, __pyx_k_e, sizeof(__pyx_k_e), 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}, @@ -11609,13 +9659,11 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_entries, __pyx_k_entries, sizeof(__pyx_k_entries), 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_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_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, @@ -11624,16 +9672,13 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_mesh_object, __pyx_k_mesh_object, sizeof(__pyx_k_mesh_object), 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_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_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}, @@ -11641,17 +9686,14 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_point_cloud_object, __pyx_k_point_cloud_object, sizeof(__pyx_k_point_cloud_object), 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_print_exc, __pyx_k_print_exc, sizeof(__pyx_k_print_exc), 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}, @@ -11660,8 +9702,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_src_DracoPy_pyx, __pyx_k_src_DracoPy_pyx, sizeof(__pyx_k_src_DracoPy_pyx), 0, 0, 1, 0}, {&__pyx_n_s_sub_metadata_ids, __pyx_k_sub_metadata_ids, sizeof(__pyx_k_sub_metadata_ids), 0, 0, 1, 1}, {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_traceback, __pyx_k_traceback, sizeof(__pyx_k_traceback), 0, 0, 1, 1}, {&__pyx_n_s_typing, __pyx_k_typing, sizeof(__pyx_k_typing), 0, 0, 1, 1}, - {&__pyx_n_s_unique_id, __pyx_k_unique_id, sizeof(__pyx_k_unique_id), 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} }; @@ -11670,7 +9712,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) __PYX_ERR(0, 27, __pyx_L1_error) __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 66, __pyx_L1_error) __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 73, __pyx_L1_error) - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 166, __pyx_L1_error) + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 169, __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:; @@ -11688,48 +9730,48 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * difference = value - self.quantization_origin[axis] * quantized_index = floor((difference / self.inverse_alpha) + 0.5) */ - __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_Specified_value_out_of_encoded_r); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 66, __pyx_L1_error) + __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_Specified_value_out_of_encoded_r); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_); - /* "DracoPy.pyx":123 + /* "DracoPy.pyx":126 * if quant_origin != NULL: * PyMem_Free(quant_origin) * raise ValueError("Input invalid") # <<<<<<<<<<<<<< * * def encode_point_cloud_to_buffer(points, point_cloud_object, */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_Input_invalid); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 123, __pyx_L1_error) + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_Input_invalid); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 126, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); - /* "DracoPy.pyx":166 + /* "DracoPy.pyx":169 * 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, 166, __pyx_L1_error) + __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_Failed_to_decode_input_mesh_Data); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 169, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); - /* "DracoPy.pyx":168 + /* "DracoPy.pyx":171 * 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): */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_DracoPy_only_supports_meshes_wit); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 168, __pyx_L1_error) + __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_DracoPy_only_supports_meshes_wit); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4); /* "FromPyStructUtility":19 - * value = obj['data'] + * value = obj['entries'] * except KeyError: - * raise ValueError("No value specified for struct attribute 'data'") # <<<<<<<<<<<<<< - * result.data = value + * raise ValueError("No value specified for struct attribute 'entries'") # <<<<<<<<<<<<<< + * result.entries = value * try: */ __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 19, __pyx_L1_error) @@ -11737,81 +9779,70 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(__pyx_tuple__5); /* "FromPyStructUtility":24 - * value = obj['datatype'] + * value = obj['sub_metadata_ids'] * except KeyError: - * raise ValueError("No value specified for struct attribute 'datatype'") # <<<<<<<<<<<<<< - * result.datatype = value - * try: + * raise ValueError("No value specified for struct attribute 'sub_metadata_ids'") # <<<<<<<<<<<<<< + * result.sub_metadata_ids = value + * return result */ __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_2); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__6); __Pyx_GIVEREF(__pyx_tuple__6); - /* "FromPyStructUtility":29 - * value = obj['dimension'] + /* "FromPyStructUtility":19 + * value = obj['data'] * except KeyError: - * raise ValueError("No value specified for struct attribute 'dimension'") # <<<<<<<<<<<<<< - * result.dimension = value + * raise ValueError("No value specified for struct attribute 'data'") # <<<<<<<<<<<<<< + * result.data = value * try: */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_3); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 29, __pyx_L1_error) + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_3); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__7); __Pyx_GIVEREF(__pyx_tuple__7); - /* "FromPyStructUtility":34 - * value = obj['unique_id'] + /* "FromPyStructUtility":24 + * value = obj['datatype'] * except KeyError: - * raise ValueError("No value specified for struct attribute 'unique_id'") # <<<<<<<<<<<<<< - * result.unique_id = value - * return result + * raise ValueError("No value specified for struct attribute 'datatype'") # <<<<<<<<<<<<<< + * result.datatype = value + * try: */ - __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_4); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 34, __pyx_L1_error) + __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_4); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8); - /* "FromPyStructUtility":19 - * value = obj['metadata_id'] + /* "FromPyStructUtility":29 + * value = obj['dimension'] * except KeyError: - * raise ValueError("No value specified for struct attribute 'metadata_id'") # <<<<<<<<<<<<<< - * result.metadata_id = value + * raise ValueError("No value specified for struct attribute 'dimension'") # <<<<<<<<<<<<<< + * result.dimension = value * try: */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_5); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 19, __pyx_L1_error) + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_5); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 29, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9); - /* "FromPyStructUtility":24 - * value = obj['attribute_metadatas'] + /* "FromPyStructUtility":34 + * value = obj['metadata_id'] * except KeyError: - * raise ValueError("No value specified for struct attribute 'attribute_metadatas'") # <<<<<<<<<<<<<< - * result.attribute_metadatas = value + * raise ValueError("No value specified for struct attribute 'metadata_id'") # <<<<<<<<<<<<<< + * result.metadata_id = value * return result */ - __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_6); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 24, __pyx_L1_error) + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_6); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 34, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); - /* "FromPyStructUtility":19 - * value = obj['entries'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'entries'") # <<<<<<<<<<<<<< - * result.entries = value - * try: - */ - __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_7); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__11); - __Pyx_GIVEREF(__pyx_tuple__11); - /* "FromPyStructUtility":24 - * value = obj['sub_metadata_ids'] + * value = obj['generic_attributes'] * except KeyError: - * raise ValueError("No value specified for struct attribute 'sub_metadata_ids'") # <<<<<<<<<<<<<< - * result.sub_metadata_ids = value + * raise ValueError("No value specified for struct attribute 'generic_attributes'") # <<<<<<<<<<<<<< + * result.generic_attributes = value * return result */ - __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_8); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__12); - __Pyx_GIVEREF(__pyx_tuple__12); + __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_7); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__11); + __Pyx_GIVEREF(__pyx_tuple__11); /* "FromPyStructUtility":19 * value = obj['points'] @@ -11820,119 +9851,86 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * result.points = value * try: */ - __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_9); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__13); - __Pyx_GIVEREF(__pyx_tuple__13); + __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_8); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__12); + __Pyx_GIVEREF(__pyx_tuple__12); /* "FromPyStructUtility":24 - * value = obj['faces'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'faces'") # <<<<<<<<<<<<<< - * result.faces = value - * try: - */ - __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_10); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__14); - __Pyx_GIVEREF(__pyx_tuple__14); - - /* "FromPyStructUtility":29 - * value = obj['normals'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'normals'") # <<<<<<<<<<<<<< - * result.normals = value - * try: - */ - __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_11); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 29, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__15); - __Pyx_GIVEREF(__pyx_tuple__15); - - /* "FromPyStructUtility":34 * value = obj['encoding_options_set'] * except KeyError: * raise ValueError("No value specified for struct attribute 'encoding_options_set'") # <<<<<<<<<<<<<< * result.encoding_options_set = value * try: */ - __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_12); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__16); - __Pyx_GIVEREF(__pyx_tuple__16); + __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_9); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__13); + __Pyx_GIVEREF(__pyx_tuple__13); - /* "FromPyStructUtility":39 + /* "FromPyStructUtility":29 * value = obj['quantization_bits'] * except KeyError: * raise ValueError("No value specified for struct attribute 'quantization_bits'") # <<<<<<<<<<<<<< * result.quantization_bits = value * try: */ - __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_13); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__17); - __Pyx_GIVEREF(__pyx_tuple__17); + __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_10); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 29, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__14); + __Pyx_GIVEREF(__pyx_tuple__14); - /* "FromPyStructUtility":44 + /* "FromPyStructUtility":34 * value = obj['quantization_range'] * except KeyError: * raise ValueError("No value specified for struct attribute 'quantization_range'") # <<<<<<<<<<<<<< * result.quantization_range = value * try: */ - __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_14); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__18); - __Pyx_GIVEREF(__pyx_tuple__18); + __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_11); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__15); + __Pyx_GIVEREF(__pyx_tuple__15); - /* "FromPyStructUtility":49 + /* "FromPyStructUtility":39 * value = obj['quantization_origin'] * except KeyError: * raise ValueError("No value specified for struct attribute 'quantization_origin'") # <<<<<<<<<<<<<< * result.quantization_origin = value * try: */ - __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_15); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 49, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__19); - __Pyx_GIVEREF(__pyx_tuple__19); + __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_12); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__16); + __Pyx_GIVEREF(__pyx_tuple__16); - /* "FromPyStructUtility":54 + /* "FromPyStructUtility":44 * value = obj['decode_status'] * except KeyError: * raise ValueError("No value specified for struct attribute 'decode_status'") # <<<<<<<<<<<<<< * result.decode_status = value * try: */ - __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_16); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(1, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__20); - __Pyx_GIVEREF(__pyx_tuple__20); - - /* "FromPyStructUtility":59 - * value = obj['attributes'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'attributes'") # <<<<<<<<<<<<<< - * result.attributes = value - * try: - */ - __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_17); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__21); - __Pyx_GIVEREF(__pyx_tuple__21); + __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_13); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__17); + __Pyx_GIVEREF(__pyx_tuple__17); - /* "FromPyStructUtility":64 + /* "FromPyStructUtility":49 * value = obj['geometry_metadata'] * except KeyError: * raise ValueError("No value specified for struct attribute 'geometry_metadata'") # <<<<<<<<<<<<<< * result.geometry_metadata = value * try: */ - __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_18); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(1, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__22); - __Pyx_GIVEREF(__pyx_tuple__22); + __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_14); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 49, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__18); + __Pyx_GIVEREF(__pyx_tuple__18); - /* "FromPyStructUtility":69 + /* "FromPyStructUtility":54 * value = obj['metadatas'] * except KeyError: * raise ValueError("No value specified for struct attribute 'metadatas'") # <<<<<<<<<<<<<< * result.metadatas = value * return result */ - __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_19); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__23); - __Pyx_GIVEREF(__pyx_tuple__23); + __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_15); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__19); + __Pyx_GIVEREF(__pyx_tuple__19); /* "DracoPy.pyx":9 * @@ -11941,9 +9939,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * def __init__(self, data_struct): * self.data_struct = data_struct */ - __pyx_tuple__24 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__24); - __Pyx_GIVEREF(__pyx_tuple__24); + __pyx_tuple__20 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__20); + __Pyx_GIVEREF(__pyx_tuple__20); /* "DracoPy.pyx":10 * @@ -11952,10 +9950,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * self.data_struct = data_struct * if data_struct['encoding_options_set']: */ - __pyx_tuple__25 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_data_struct); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 10, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__25); - __Pyx_GIVEREF(__pyx_tuple__25); - __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 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_init, 10, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 10, __pyx_L1_error) + __pyx_tuple__21 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_data_struct); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 10, __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_init, 10, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 10, __pyx_L1_error) /* "DracoPy.pyx":19 * # self.metadata = decode_metadata(data_struct["binary_metadata"]) @@ -11964,10 +9962,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * if self.encoding_options is not None: * return self.encoding_options.get_encoded_coordinate(value, axis) */ - __pyx_tuple__27 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_value, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__27); - __Pyx_GIVEREF(__pyx_tuple__27); - __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 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_get_encoded_coordinate, 19, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 19, __pyx_L1_error) + __pyx_tuple__23 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_value, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__23); + __Pyx_GIVEREF(__pyx_tuple__23); + __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 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, 19, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 19, __pyx_L1_error) /* "DracoPy.pyx":23 * return self.encoding_options.get_encoded_coordinate(value, axis) @@ -11976,10 +9974,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * if self.encoding_options is not None: * return self.encoding_options.get_encoded_point(point) */ - __pyx_tuple__29 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_point); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 23, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__29); - __Pyx_GIVEREF(__pyx_tuple__29); - __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 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_get_encoded_point, 23, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 23, __pyx_L1_error) + __pyx_tuple__25 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_point); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__25); + __Pyx_GIVEREF(__pyx_tuple__25); + __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 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, 23, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 23, __pyx_L1_error) /* "DracoPy.pyx":28 * @@ -11988,70 +9986,58 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return 3 * */ - __pyx_tuple__31 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 28, __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_num_axes, 28, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 28, __pyx_L1_error) + __pyx_tuple__27 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 28, __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, 28, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 28, __pyx_L1_error) /* "DracoPy.pyx":32 * * @property - * def points(self): # <<<<<<<<<<<<<< + * def points(self) -> List[float]: # <<<<<<<<<<<<<< * return self.data_struct['points'] * */ - __pyx_tuple__33 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 32, __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_points, 32, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 32, __pyx_L1_error) + __pyx_tuple__29 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 32, __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_points, 32, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 32, __pyx_L1_error) /* "DracoPy.pyx":36 * * @property - * def geometry_metadata(self) -> 'GeometryMetadataObject': # <<<<<<<<<<<<<< + * def geometry_metadata(self) -> Dict: # <<<<<<<<<<<<<< * return self.data_struct['geometry_metadata'] - * - */ - __pyx_tuple__35 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__35); - __Pyx_GIVEREF(__pyx_tuple__35); - __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_geometry_metadata, 36, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 36, __pyx_L1_error) - - /* "DracoPy.pyx":40 - * - * @property - * def attributes(self) -> List['PointAttributeObject']: # <<<<<<<<<<<<<< - * return self.data_struct['attributes'] - * + * # */ - __pyx_tuple__37 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__37); - __Pyx_GIVEREF(__pyx_tuple__37); - __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_attributes, 40, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 40, __pyx_L1_error) + __pyx_tuple__31 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 36, __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_geometry_metadata, 36, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 36, __pyx_L1_error) /* "DracoPy.pyx":44 * * @property - * def metadatas(self) -> List['MetadataObject']: # <<<<<<<<<<<<<< + * def metadatas(self) -> List[Dict]: # <<<<<<<<<<<<<< * return self.data_struct['metadatas'] * */ - __pyx_tuple__39 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__39); - __Pyx_GIVEREF(__pyx_tuple__39); - __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_metadatas, 44, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_tuple__33 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 44, __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_metadatas, 44, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 44, __pyx_L1_error) /* "DracoPy.pyx":50 * class DracoMesh(DracoPointCloud): * @property - * def faces(self): # <<<<<<<<<<<<<< + * def faces(self) -> List[int]: # <<<<<<<<<<<<<< * return self.data_struct['faces'] * */ - __pyx_tuple__41 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__41); - __Pyx_GIVEREF(__pyx_tuple__41); - __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_faces, 50, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 50, __pyx_L1_error) + __pyx_tuple__35 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__35); + __Pyx_GIVEREF(__pyx_tuple__35); + __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_faces, 50, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 50, __pyx_L1_error) /* "DracoPy.pyx":54 * @@ -12060,10 +10046,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return self.data_struct['normals'] * */ - __pyx_tuple__43 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__43)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__43); - __Pyx_GIVEREF(__pyx_tuple__43); - __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_normals, 54, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 54, __pyx_L1_error) + __pyx_tuple__37 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__37); + __Pyx_GIVEREF(__pyx_tuple__37); + __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_normals, 54, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 54, __pyx_L1_error) /* "DracoPy.pyx":57 * return self.data_struct['normals'] @@ -12072,9 +10058,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * def __init__(self, quantization_bits, quantization_range, quantization_origin): * self.quantization_bits = quantization_bits */ - __pyx_tuple__45 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__45); - __Pyx_GIVEREF(__pyx_tuple__45); + __pyx_tuple__39 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__39); + __Pyx_GIVEREF(__pyx_tuple__39); /* "DracoPy.pyx":58 * @@ -12083,10 +10069,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * self.quantization_bits = quantization_bits * self.quantization_range = quantization_range */ - __pyx_tuple__46 = 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__46)) __PYX_ERR(0, 58, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__46); - __Pyx_GIVEREF(__pyx_tuple__46); - __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 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_init, 58, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 58, __pyx_L1_error) + __pyx_tuple__40 = 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__40)) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__40); + __Pyx_GIVEREF(__pyx_tuple__40); + __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(4, 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_init, 58, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 58, __pyx_L1_error) /* "DracoPy.pyx":64 * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) @@ -12095,10 +10081,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * 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__48 = 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__48)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__48); - __Pyx_GIVEREF(__pyx_tuple__48); - __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_get_encoded_coordinate, 64, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_tuple__42 = 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__42)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__42); + __Pyx_GIVEREF(__pyx_tuple__42); + __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_get_encoded_coordinate, 64, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 64, __pyx_L1_error) /* "DracoPy.pyx":71 * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) @@ -12107,10 +10093,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * encoded_point = [] * for axis in range(self.num_axes): */ - __pyx_tuple__50 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_point, __pyx_n_s_encoded_point, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 71, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__50); - __Pyx_GIVEREF(__pyx_tuple__50); - __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 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_get_encoded_point, 71, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 71, __pyx_L1_error) + __pyx_tuple__44 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_point, __pyx_n_s_encoded_point, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 71, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__44); + __Pyx_GIVEREF(__pyx_tuple__44); + __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_get_encoded_point, 71, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 71, __pyx_L1_error) /* "DracoPy.pyx":78 * @@ -12119,70 +10105,70 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return 3 * */ - __pyx_tuple__52 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 78, __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_num_axes, 78, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_tuple__46 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__46); + __Pyx_GIVEREF(__pyx_tuple__46); + __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_num_axes, 78, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 78, __pyx_L1_error) /* "DracoPy.pyx":87 * pass * - * def encode_mesh_to_buffer(points, faces, mesh_object, # <<<<<<<<<<<<<< + * def encode_mesh_to_buffer(points, faces, metadatas, # <<<<<<<<<<<<<< + * geometry_metadata, * quantization_bits=14, compression_level=1, - * quantization_range=-1, quantization_origin=None, */ - __pyx_tuple__54 = PyTuple_Pack(12, __pyx_n_s_points, __pyx_n_s_faces, __pyx_n_s_mesh_object, __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__54)) __PYX_ERR(0, 87, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__54); - __Pyx_GIVEREF(__pyx_tuple__54); - __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(8, 0, 12, 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_encode_mesh_to_buffer, 87, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_tuple__48 = PyTuple_Pack(15, __pyx_n_s_points, __pyx_n_s_faces, __pyx_n_s_metadatas, __pyx_n_s_geometry_metadata, __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, __pyx_n_s_e, __pyx_n_s_traceback); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__48); + __Pyx_GIVEREF(__pyx_tuple__48); + __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(9, 0, 15, 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_mesh_to_buffer, 87, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 87, __pyx_L1_error) - /* "DracoPy.pyx":125 + /* "DracoPy.pyx":128 * raise ValueError("Input invalid") * * def encode_point_cloud_to_buffer(points, point_cloud_object, # <<<<<<<<<<<<<< * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, */ - __pyx_tuple__56 = PyTuple_Pack(11, __pyx_n_s_points, __pyx_n_s_point_cloud_object, __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__56)) __PYX_ERR(0, 125, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__56); - __Pyx_GIVEREF(__pyx_tuple__56); - __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(7, 0, 11, 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_encode_point_cloud_to_buffer, 125, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 125, __pyx_L1_error) + __pyx_tuple__50 = PyTuple_Pack(11, __pyx_n_s_points, __pyx_n_s_point_cloud_object, __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__50)) __PYX_ERR(0, 128, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__50); + __Pyx_GIVEREF(__pyx_tuple__50); + __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(7, 0, 11, 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_point_cloud_to_buffer, 128, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 128, __pyx_L1_error) - /* "DracoPy.pyx":162 + /* "DracoPy.pyx":165 * 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__58 = PyTuple_Pack(1, __pyx_n_s_decoding_status); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(0, 162, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__58); - __Pyx_GIVEREF(__pyx_tuple__58); - __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_src_DracoPy_pyx, __pyx_n_s_raise_decoding_error, 162, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(0, 162, __pyx_L1_error) + __pyx_tuple__52 = PyTuple_Pack(1, __pyx_n_s_decoding_status); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 165, __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, 165, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 165, __pyx_L1_error) - /* "DracoPy.pyx":170 + /* "DracoPy.pyx":173 * 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: */ - __pyx_tuple__60 = PyTuple_Pack(2, __pyx_n_s_buffer, __pyx_n_s_mesh_struct); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(0, 170, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__60); - __Pyx_GIVEREF(__pyx_tuple__60); - __pyx_codeobj__61 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__60, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_buffer_to_mesh, 170, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__61)) __PYX_ERR(0, 170, __pyx_L1_error) + __pyx_tuple__54 = PyTuple_Pack(2, __pyx_n_s_buffer, __pyx_n_s_mesh_struct); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 173, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__54); + __Pyx_GIVEREF(__pyx_tuple__54); + __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 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, 173, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 173, __pyx_L1_error) - /* "DracoPy.pyx":177 + /* "DracoPy.pyx":180 * 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_tuple__62 = PyTuple_Pack(2, __pyx_n_s_buffer, __pyx_n_s_point_cloud_struct); if (unlikely(!__pyx_tuple__62)) __PYX_ERR(0, 177, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__62); - __Pyx_GIVEREF(__pyx_tuple__62); - __pyx_codeobj__63 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__62, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_point_cloud_buffer, 177, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__63)) __PYX_ERR(0, 177, __pyx_L1_error) + __pyx_tuple__56 = PyTuple_Pack(2, __pyx_n_s_buffer, __pyx_n_s_point_cloud_struct); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 180, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__56); + __Pyx_GIVEREF(__pyx_tuple__56); + __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 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, 180, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -12366,6 +10352,7 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec_DracoPy(PyObject *__pyx_pyinit_mod PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -12485,7 +10472,7 @@ if (!__Pyx_RefNanny) { __Pyx_INCREF(__pyx_n_s_List); __Pyx_GIVEREF(__pyx_n_s_List); PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_List); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_typing, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error) + __pyx_t_2 = __Pyx_Import(__pyx_n_s_typing, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __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, 2, __pyx_L1_error) @@ -12510,7 +10497,7 @@ if (!__Pyx_RefNanny) { __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, 6, __pyx_L1_error) + __pyx_t_1 = __Pyx_Import(__pyx_n_s_math, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_floor); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error) @@ -12526,9 +10513,9 @@ if (!__Pyx_RefNanny) { * def __init__(self, data_struct): * self.data_struct = data_struct */ - __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__24); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__20); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__24, __pyx_n_s_DracoPointCloud, __pyx_n_s_DracoPointCloud, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error) + __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__20, __pyx_n_s_DracoPointCloud, __pyx_n_s_DracoPointCloud, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); /* "DracoPy.pyx":10 @@ -12538,7 +10525,7 @@ if (!__Pyx_RefNanny) { * 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__26)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 10, __pyx_L1_error) + __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__22)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 10, __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, 10, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -12550,7 +10537,7 @@ if (!__Pyx_RefNanny) { * 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__28)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 19, __pyx_L1_error) + __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__24)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 19, __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, 19, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -12562,7 +10549,7 @@ if (!__Pyx_RefNanny) { * 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__30)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 23, __pyx_L1_error) + __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__26)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 23, __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, 23, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -12574,7 +10561,7 @@ if (!__Pyx_RefNanny) { * 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__32)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error) + __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__28)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); /* "DracoPy.pyx":27 @@ -12593,121 +10580,104 @@ if (!__Pyx_RefNanny) { /* "DracoPy.pyx":32 * * @property - * def points(self): # <<<<<<<<<<<<<< + * def points(self) -> List[float]: # <<<<<<<<<<<<<< * return self.data_struct['points'] * */ - __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__34)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 32, __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, 32, __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, 32, __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, 32, __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__30)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 32, __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":31 * return 3 * * @property # <<<<<<<<<<<<<< - * def points(self): + * def points(self) -> List[float]: * 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, 31, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 31, __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, 32, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_points, __pyx_t_3) < 0) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "DracoPy.pyx":36 * * @property - * def geometry_metadata(self) -> 'GeometryMetadataObject': # <<<<<<<<<<<<<< + * def geometry_metadata(self) -> Dict: # <<<<<<<<<<<<<< * return self.data_struct['geometry_metadata'] - * + * # */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_n_u_GeometryMetadataObject) < 0) __PYX_ERR(0, 36, __pyx_L1_error) - __pyx_t_4 = __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__36)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_t_5) < 0) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __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__32)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 36, __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":35 * return self.data_struct['points'] * * @property # <<<<<<<<<<<<<< - * def geometry_metadata(self) -> 'GeometryMetadataObject': + * def geometry_metadata(self) -> Dict: * return self.data_struct['geometry_metadata'] */ - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_geometry_metadata, __pyx_t_3) < 0) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "DracoPy.pyx":40 - * - * @property - * def attributes(self) -> List['PointAttributeObject']: # <<<<<<<<<<<<<< - * return self.data_struct['attributes'] - * - */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_List); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 40, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_t_4, __pyx_n_u_PointAttributeObject); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_t_5) < 0) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_13attributes, 0, __pyx_n_s_DracoPointCloud_attributes, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_3); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "DracoPy.pyx":39 - * return self.data_struct['geometry_metadata'] - * - * @property # <<<<<<<<<<<<<< - * def attributes(self) -> List['PointAttributeObject']: - * return self.data_struct['attributes'] - */ - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_attributes, __pyx_t_3) < 0) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_geometry_metadata, __pyx_t_4) < 0) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "DracoPy.pyx":44 * * @property - * def metadatas(self) -> List['MetadataObject']: # <<<<<<<<<<<<<< + * def metadatas(self) -> List[Dict]: # <<<<<<<<<<<<<< * return self.data_struct['metadatas'] * */ - __pyx_t_3 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_List); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_t_5, __pyx_n_u_MetadataObject); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Dict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __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, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_return, __pyx_t_4) < 0) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_15metadatas, 0, __pyx_n_s_DracoPointCloud_metadatas, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__40)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_4, __pyx_t_3); __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, 44, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_13metadatas, 0, __pyx_n_s_DracoPointCloud_metadatas, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 44, __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":43 - * return self.data_struct['attributes'] + * # return self.data_struct['attributes'] * * @property # <<<<<<<<<<<<<< - * def metadatas(self) -> List['MetadataObject']: + * def metadatas(self) -> List[Dict]: * return self.data_struct['metadatas'] */ - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 43, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 43, __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_metadatas, __pyx_t_4) < 0) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_metadatas, __pyx_t_3) < 0) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "DracoPy.pyx":9 * @@ -12716,10 +10686,10 @@ if (!__Pyx_RefNanny) { * def __init__(self, data_struct): * self.data_struct = data_struct */ - __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoPointCloud, __pyx_tuple__24, __pyx_t_2, 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_1, __pyx_n_s_DracoPointCloud, __pyx_tuple__20, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoPointCloud, __pyx_t_4) < 0) __PYX_ERR(0, 9, __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; @@ -12728,7 +10698,7 @@ if (!__Pyx_RefNanny) { * * class DracoMesh(DracoPointCloud): # <<<<<<<<<<<<<< * @property - * def faces(self): + * def faces(self) -> List[int]: */ __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); @@ -12739,31 +10709,42 @@ if (!__Pyx_RefNanny) { __pyx_t_1 = 0; __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __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_3)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __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, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); /* "DracoPy.pyx":50 * class DracoMesh(DracoPointCloud): * @property - * def faces(self): # <<<<<<<<<<<<<< + * def faces(self) -> List[int]: # <<<<<<<<<<<<<< * return self.data_struct['faces'] * */ - __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__42)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_List); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_3, ((PyObject *)(&PyInt_Type))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_return, __pyx_t_5) < 0) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_9DracoMesh_1faces, 0, __pyx_n_s_DracoMesh_faces, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_6); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; /* "DracoPy.pyx":49 * * class DracoMesh(DracoPointCloud): * @property # <<<<<<<<<<<<<< - * def faces(self): + * def faces(self) -> List[int]: * return self.data_struct['faces'] */ - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 49, __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, 50, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 49, __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_faces, __pyx_t_6) < 0) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; /* "DracoPy.pyx":54 * @@ -12772,8 +10753,8 @@ if (!__Pyx_RefNanny) { * 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__44)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_9DracoMesh_3normals, 0, __pyx_n_s_DracoMesh_normals, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); /* "DracoPy.pyx":53 * return self.data_struct['faces'] @@ -12782,24 +10763,24 @@ if (!__Pyx_RefNanny) { * def normals(self): * return self.data_struct['normals'] */ - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 53, __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_normals, __pyx_t_5) < 0) __PYX_ERR(0, 54, __pyx_L1_error) __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, 54, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "DracoPy.pyx":48 * * * class DracoMesh(DracoPointCloud): # <<<<<<<<<<<<<< * @property - * def faces(self): + * def faces(self) -> List[int]: */ - __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoMesh, __pyx_t_2, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoMesh, __pyx_t_4) < 0) __PYX_ERR(0, 48, __pyx_L1_error) + __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoMesh, __pyx_t_2, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoMesh, __pyx_t_5) < 0) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -12810,9 +10791,9 @@ if (!__Pyx_RefNanny) { * def __init__(self, quantization_bits, quantization_range, quantization_origin): * self.quantization_bits = quantization_bits */ - __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__45); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error) + __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__39); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_tuple__45, __pyx_n_s_EncodingOptions, __pyx_n_s_EncodingOptions, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error) + __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_tuple__39, __pyx_n_s_EncodingOptions, __pyx_n_s_EncodingOptions, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); /* "DracoPy.pyx":58 @@ -12822,10 +10803,10 @@ if (!__Pyx_RefNanny) { * self.quantization_bits = quantization_bits * self.quantization_range = quantization_range */ - __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__47)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 58, __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, 58, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __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__41)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __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, 58, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "DracoPy.pyx":64 * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) @@ -12834,10 +10815,10 @@ if (!__Pyx_RefNanny) { * 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_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__49)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 64, __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, 64, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __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__43)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 64, __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, 64, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "DracoPy.pyx":71 * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) @@ -12846,10 +10827,10 @@ if (!__Pyx_RefNanny) { * encoded_point = [] * for axis in range(self.num_axes): */ - __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__51)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 71, __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, 71, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __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__45)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __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, 71, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "DracoPy.pyx":78 * @@ -12858,8 +10839,8 @@ if (!__Pyx_RefNanny) { * return 3 * */ - __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__53)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_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__47)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); /* "DracoPy.pyx":77 * return encoded_point @@ -12868,11 +10849,11 @@ if (!__Pyx_RefNanny) { * 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, 77, __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, 78, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 77, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_num_axes, __pyx_t_5) < 0) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; /* "DracoPy.pyx":57 * return self.data_struct['normals'] @@ -12881,10 +10862,10 @@ if (!__Pyx_RefNanny) { * def __init__(self, quantization_bits, quantization_range, quantization_origin): * self.quantization_bits = quantization_bits */ - __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_EncodingOptions, __pyx_tuple__45, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingOptions, __pyx_t_4) < 0) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_EncodingOptions, __pyx_tuple__39, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingOptions, __pyx_t_5) < 0) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -12902,13 +10883,13 @@ if (!__Pyx_RefNanny) { 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, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __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_4)) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_t_5 = __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_5)) __PYX_ERR(0, 81, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_FileTypeException, __pyx_t_2, __pyx_t_5, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_FileTypeException, __pyx_t_2, __pyx_t_4, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_FileTypeException, __pyx_t_3) < 0) __PYX_ERR(0, 81, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_FileTypeException, __pyx_t_4) < 0) __PYX_ERR(0, 81, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -12926,74 +10907,74 @@ if (!__Pyx_RefNanny) { 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, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __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_4)) __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_t_5 = __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_5)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_EncodingFailedException, __pyx_t_2, __pyx_t_5, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_EncodingFailedException, __pyx_t_2, __pyx_t_4, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingFailedException, __pyx_t_3) < 0) __PYX_ERR(0, 84, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingFailedException, __pyx_t_4) < 0) __PYX_ERR(0, 84, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "DracoPy.pyx":87 * pass * - * def encode_mesh_to_buffer(points, faces, mesh_object, # <<<<<<<<<<<<<< + * def encode_mesh_to_buffer(points, faces, metadatas, # <<<<<<<<<<<<<< + * geometry_metadata, * quantization_bits=14, compression_level=1, - * quantization_range=-1, quantization_origin=None, */ __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_1encode_mesh_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __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, 87, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":125 + /* "DracoPy.pyx":128 * raise ValueError("Input invalid") * * def encode_point_cloud_to_buffer(points, point_cloud_object, # <<<<<<<<<<<<<< * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_3encode_point_cloud_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 125, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_3encode_point_cloud_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 128, __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, 125, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_point_cloud_to_buffer, __pyx_t_2) < 0) __PYX_ERR(0, 128, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":162 + /* "DracoPy.pyx":165 * 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_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_5raise_decoding_error, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 162, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_5raise_decoding_error, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_raise_decoding_error, __pyx_t_2) < 0) __PYX_ERR(0, 162, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_raise_decoding_error, __pyx_t_2) < 0) __PYX_ERR(0, 165, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":170 + /* "DracoPy.pyx":173 * 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: */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_7decode_buffer_to_mesh, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 170, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_7decode_buffer_to_mesh, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __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, 170, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode_buffer_to_mesh, __pyx_t_2) < 0) __PYX_ERR(0, 173, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":177 + /* "DracoPy.pyx":180 * 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_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_9decode_point_cloud_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 177, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_9decode_point_cloud_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __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, 177, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode_point_cloud_buffer, __pyx_t_2) < 0) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "DracoPy.pyx":1 @@ -13023,6 +11004,7 @@ if (!__Pyx_RefNanny) { __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); if (__pyx_m) { if (__pyx_d) { __Pyx_AddTraceback("init DracoPy", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -14350,16 +12332,128 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) #else PyErr_SetExcInfo(local_type, local_value, local_tb); #endif - return 0; -bad: - *type = 0; - *value = 0; - *tb = 0; - Py_XDECREF(local_type); - Py_XDECREF(local_value); - Py_XDECREF(local_tb); - return -1; + return 0; +bad: + *type = 0; + *value = 0; + *tb = 0; + Py_XDECREF(local_type); + Py_XDECREF(local_value); + Py_XDECREF(local_tb); + 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 + +/* Import */ + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + #if PY_MAJOR_VERSION < 3 + PyObject *py_import; + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); + if (!py_import) + goto bad; + #endif + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, 1); + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; + } + #endif + if (!module) { + #if PY_MAJOR_VERSION < 3 + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, (PyObject *)NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, level); + #endif + } + } +bad: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_import); + #endif + Py_XDECREF(empty_list); + Py_XDECREF(empty_dict); + return module; +} + +/* 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 /* IterFinish */ static CYTHON_INLINE int __Pyx_IterFinish(void) { @@ -14396,28 +12490,6 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) #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 - /* PyObjectGetMethod */ static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { PyObject *attr; @@ -14736,96 +12808,6 @@ static CYTHON_INLINE int __Pyx_dict_iter_next( 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 - -/* Import */ - static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *empty_list = 0; - PyObject *module = 0; - PyObject *global_dict = 0; - PyObject *empty_dict = 0; - PyObject *list; - #if PY_MAJOR_VERSION < 3 - PyObject *py_import; - py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (!py_import) - goto bad; - #endif - if (from_list) - list = from_list; - else { - empty_list = PyList_New(0); - if (!empty_list) - goto bad; - list = empty_list; - } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; - empty_dict = PyDict_New(); - if (!empty_dict) - goto bad; - { - #if PY_MAJOR_VERSION >= 3 - if (level == -1) { - if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, 1); - if (!module) { - if (!PyErr_ExceptionMatches(PyExc_ImportError)) - goto bad; - PyErr_Clear(); - } - } - level = 0; - } - #endif - if (!module) { - #if PY_MAJOR_VERSION < 3 - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, (PyObject *)NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, level); - #endif - } - } -bad: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(py_import); - #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); - return module; -} - /* ImportFrom */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); @@ -15845,25 +13827,9 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu 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.unique_id); if (unlikely(!member)) goto bad; - if (unlikely(PyDict_SetItem(res, __pyx_n_s_unique_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_AttributeMetadataObject(struct DracoFunctions::AttributeMetadataObject 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_PyInt_From_uint32_t(s.unique_id); if (unlikely(!member)) goto bad; - if (unlikely(PyDict_SetItem(res, __pyx_n_s_unique_id, member) < 0)) goto bad; - Py_DECREF(member); return res; bad: Py_XDECREF(member); @@ -15877,8 +13843,8 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu 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_AttributeMetadataObject(s.attribute_metadatas); if (unlikely(!member)) goto bad; - if (unlikely(PyDict_SetItem(res, __pyx_n_s_attribute_metadatas, member) < 0)) goto bad; + 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: @@ -15905,7 +13871,7 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(struct DracoFunctions::MeshObject s) { PyObject* res; PyObject* member; - res = __Pyx_PyDict_NewPresized(11); if (unlikely(!res)) return NULL; + 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); @@ -15930,9 +13896,6 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu 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_vector_to_py_struct__DracoFunctions_3a__3a_PointAttributeObject(s.attributes); if (unlikely(!member)) goto bad; - if (unlikely(PyDict_SetItem(res, __pyx_n_s_attributes, 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); @@ -15948,7 +13911,7 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointCloudObject(struct DracoFunctions::PointCloudObject s) { PyObject* res; PyObject* member; - res = __Pyx_PyDict_NewPresized(9); 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); @@ -15967,9 +13930,6 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu 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_vector_to_py_struct__DracoFunctions_3a__3a_PointAttributeObject(s.attributes); if (unlikely(!member)) goto bad; - if (unlikely(PyDict_SetItem(res, __pyx_n_s_attributes, 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); @@ -16375,26 +14335,26 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu } /* CIntFromPy */ - static CYTHON_INLINE unsigned int __Pyx_PyInt_As_unsigned_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 unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned 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(unsigned int) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(unsigned 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 (unsigned int) val; + return (enum draco::DataType) val; } } else #endif @@ -16403,32 +14363,32 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return (unsigned int) 0; - case 1: __PYX_VERIFY_RETURN_INT(unsigned 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(unsigned 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(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(unsigned int) >= 2 * PyLong_SHIFT) { - return (unsigned int) (((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned 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(unsigned 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(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(unsigned int) >= 3 * PyLong_SHIFT) { - return (unsigned int) (((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned 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(unsigned 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(unsigned 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(unsigned int) >= 4 * PyLong_SHIFT) { - return (unsigned int) (((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned 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; @@ -16442,86 +14402,86 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) - return (unsigned int) -1; + return (enum draco::DataType) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif - if (sizeof(unsigned int) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(unsigned 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(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(unsigned 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 (unsigned int) 0; - case -1: __PYX_VERIFY_RETURN_INT(unsigned int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(unsigned 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(unsigned 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(unsigned int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) { - return (unsigned int) (((unsigned int)-1)*(((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned 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(unsigned 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(unsigned int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(unsigned int) - 1 > 2 * PyLong_SHIFT) { - return (unsigned int) ((((((unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned 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(unsigned 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(unsigned int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) { - return (unsigned int) (((unsigned int)-1)*(((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned 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(unsigned 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(unsigned int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(unsigned int) - 1 > 3 * PyLong_SHIFT) { - return (unsigned int) ((((((((unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned 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(unsigned 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(unsigned 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(unsigned int) - 1 > 4 * PyLong_SHIFT) { - return (unsigned int) (((unsigned int)-1)*(((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned 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(unsigned 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(unsigned 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(unsigned int) - 1 > 4 * PyLong_SHIFT) { - return (unsigned int) ((((((((((unsigned int)digits[3]) << PyLong_SHIFT) | (unsigned int)digits[2]) << PyLong_SHIFT) | (unsigned int)digits[1]) << PyLong_SHIFT) | (unsigned 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(unsigned int) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(unsigned 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(unsigned int) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(unsigned 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 } } @@ -16530,7 +14490,7 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else - unsigned int val; + enum draco::DataType val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { @@ -16550,24 +14510,24 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu return val; } #endif - return (unsigned int) -1; + return (enum draco::DataType) -1; } } else { - unsigned int val; + enum draco::DataType val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (unsigned int) -1; - val = __Pyx_PyInt_As_unsigned_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 unsigned int"); - return (unsigned int) -1; + "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 unsigned int"); - return (unsigned int) -1; + "can't convert negative value to enum draco::DataType"); + return (enum draco::DataType) -1; } /* CIntFromPy */ @@ -16746,24 +14706,62 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu return val; } #endif - return (int) -1; + return (int) -1; + } + } else { + int val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + 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 int"); + return (int) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to int"); + return (int) -1; +} + +/* CIntToPy */ + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_char(unsigned char value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const unsigned char neg_one = (unsigned char) -1, const_zero = (unsigned char) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(unsigned char) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(unsigned char) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(unsigned char) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(unsigned char) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(unsigned char) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif } - } else { - int val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - 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 int"); - return (int) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to int"); - return (int) -1; + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(unsigned char), + little, !is_unsigned); + } } /* CIntFromPy */ @@ -16962,240 +14960,6 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu return (enum DracoFunctions::decoding_status) -1; } -/* CIntFromPy */ - 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 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(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 (enum draco::DataType) 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 (enum draco::DataType) 0; - case 1: __PYX_VERIFY_RETURN_INT(enum draco::DataType, digit, digits[0]) - case 2: - if (8 * sizeof(enum draco::DataType) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __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(enum draco::DataType) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __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(enum draco::DataType) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __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; - } -#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 (enum draco::DataType) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - 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(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 (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(enum draco::DataType) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __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(enum draco::DataType) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __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(enum draco::DataType) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __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(enum draco::DataType) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __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(enum draco::DataType) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __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(enum draco::DataType) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __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(enum draco::DataType) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(enum draco::DataType, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } 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 - } - } - { -#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::DataType 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::DataType) -1; - } - } else { - enum draco::DataType val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - 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 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_unsigned_char(unsigned char value) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const unsigned char neg_one = (unsigned char) -1, const_zero = (unsigned char) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop -#endif - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(unsigned char) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(unsigned char) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(unsigned char) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(unsigned char) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(unsigned char) <= 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(unsigned char), - little, !is_unsigned); - } -} - /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(enum DracoFunctions::decoding_status value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC diff --git a/src/DracoPy.h b/src/DracoPy.h index a85e248..94e43c9 100644 --- a/src/DracoPy.h +++ b/src/DracoPy.h @@ -17,23 +17,26 @@ namespace DracoFunctions { struct MetadataObject { std::unordered_map entries; std::unordered_map sub_metadata_ids; - }; - struct AttributeMetadataObject { - uint32_t metadata_id; // reference to metadata object - uint32_t unique_id; + // 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 unique_id; + uint32_t metadata_id; }; struct GeometryMetadataObject { uint32_t metadata_id; // reference to metadata object - std::vector attribute_metadatas; + std::vector generic_attributes; }; struct PointCloudObject { @@ -47,8 +50,9 @@ namespace DracoFunctions { decoding_status decode_status; - std::vector attributes; + // so far Geometry GeometryMetadataObject geometry_metadata; + // contains std::vector metadatas; }; @@ -67,126 +71,299 @@ namespace DracoFunctions { ////// helpful decoding functions ////////////////// //////////////////////////////////////////////////// - std::vector decode_generic_attributes(const draco::PointCloud& pc) { - const int32_t attributes_len = pc.num_attributes(); - std::vector attribute_objects(attributes_len); - for (int i = 0; i < attributes_len; ++i) - if (const auto* attribute = pc.attribute(i)) - if (attribute->attribute_type() == draco::GeometryAttribute::GENERIC) { - attribute_objects[i].dimension = static_cast(attribute->num_components()); - attribute_objects[i].datatype = attribute->data_type(); - attribute_objects[i].unique_id = static_cast(attribute->unique_id()); - const auto value_size = attribute->num_components() * attribute->byte_stride(); - for (draco::PointIndex v(0); v < attribute->indices_map_size(); ++v) { - auto& value = attribute_objects[i].data[v.value()]; - value.resize(value_size); - attribute->GetMappedValue(v, value.data()); - } - } - return attribute_objects; - } - uint32_t add_metadata_object(std::vector& metadata_objects) { metadata_objects.push_back({}); - return static_cast(metadata_objects.size() - 1); + const auto metadata_id = static_cast(metadata_objects.size() - 1); + return metadata_id; } - - void decode_metadata(const draco::Metadata& metadata, std::vector& all_metadata_objects) { + + uint32_t decode_metadata(const draco::Metadata& in_metadata, std::vector& all_metadata_objects) { + std::cout << 'a' << std::endl; // main metadata object is a have just created object + uint32_t metadata_id = add_metadata_object(all_metadata_objects); MetadataObject& main_metadata_object = all_metadata_objects.back(); + std::cout << 'b' << std::endl; using MetadataPair = std::pair; - std::vector to_parse_metadata = { {&metadata, &main_metadata_object} }; + std::cout << 'c' << std::endl; + std::vector to_parse_metadata = { {&in_metadata, &main_metadata_object} }; + std::cout << 'd' << std::endl; for (std::vector to_parse_metadatas_next; !to_parse_metadata.empty(); - to_parse_metadata = std::move(to_parse_metadatas_next)) { - for (auto [metadata, metadata_object]: to_parse_metadata) { + ) { + std::cout << 'e' << std::endl; + for (auto& [metadata, metadata_object]: to_parse_metadata) { + std::cout << 'f' << std::endl; + std::cout << "metadata " << metadata << std::endl; + std::cout << "metadata_object " << metadata_object << std::endl; // consider entries for (const auto& [name, vec_value]: metadata->entries()) { + std::cout << 'e' << std::endl; auto raw_value = reinterpret_cast(vec_value.data().data()); + std::cout << 'h' << std::endl; auto value_size = vec_value.data().size(); + std::cout << 'i' << std::endl; std::string str_value(raw_value, raw_value + value_size); + std::cout << 'j' << std::endl; metadata_object->entries[name] = std::move(str_value); } // consider sub metadatas for (const auto& [name, sub_metadata]: metadata->sub_metadatas()) { - metadata_object->sub_metadata_ids[name] = add_metadata_object(all_metadata_objects);; + std::cout << 'k' << std::endl; + std::cout << name << std::endl; + std::cout << metadata_object->entries.size() << std::endl; + std::cout << metadata_object->sub_metadata_ids.size() << std::endl; + const uint32_t sub_metadata_id = add_metadata_object(all_metadata_objects); + std::cout << "sub metadata id " << sub_metadata_id << std::endl; + metadata_object->sub_metadata_ids.reserve(30); + std::cout << "reserved " << sub_metadata_id << std::endl; + metadata_object->sub_metadata_ids[name] = sub_metadata_id; + std::cout << metadata_object->sub_metadata_ids.size() << std::endl; + std::cout << 'l' << std::endl; to_parse_metadatas_next.push_back({sub_metadata.get(), &all_metadata_objects.back()}); + std::cout << 'm' << std::endl; } } + to_parse_metadata = std::move(to_parse_metadatas_next); } + return metadata_id; } - GeometryMetadataObject decode_geometry_metadata(const draco::GeometryMetadata& geometry_metadata, - PointCloudObject& pco) { - GeometryMetadataObject geometry_metadata_object; - auto& all_metadata_objects = pco.metadatas; - geometry_metadata_object.metadata_id = add_metadata_object(all_metadata_objects); - decode_metadata(geometry_metadata, all_metadata_objects); - for (const auto& attribute_metadata: geometry_metadata.attribute_metadatas()) { - AttributeMetadataObject amo; - amo.unique_id = attribute_metadata->att_unique_id(); - amo.metadata_id = add_metadata_object(all_metadata_objects); - decode_metadata(*attribute_metadata, all_metadata_objects); - geometry_metadata_object.attribute_metadatas.push_back(std::move(amo)); - } - return geometry_metadata_object; + 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) { + std::cout << "GetAttributeIdByUniqueId" << std::endl; + const uint32_t attribute_id = pc.GetAttributeIdByUniqueId(attribute->unique_id()); + // pc.metadata()->) + std::cout << "attribute_id " << attribute_id << std::endl; + std::cout << "attribute->unique_id() " << attribute->unique_id() << std::endl; + std::cout << "GetAttributeMetadataByAttributeId" << std::endl; + const auto* attribute_metadata = pc.GetAttributeMetadataByAttributeId(attribute_id); + std::cout << "attribute_metadata " << attribute_metadata << std::endl; + attribute_metadata = pc.GetAttributeMetadataByAttributeId(attribute->unique_id()); + std::cout << "attribute_metadata " << attribute_metadata << std::endl; + // decode fields + PointAttributeObject pao; + pao.dimension = static_cast(attribute->num_components()); + pao.datatype = attribute->data_type(); + std::cout << "decode_metadata" << std::endl; + if (attribute_metadata) + pao.metadata_id = decode_metadata(*attribute_metadata, all_metadata_objects); + else + pao.metadata_id = -1; + std::cout << "attribute->num_components()" << std::endl; + // decode geometry data + const auto value_size = attribute->num_components() * attribute->byte_stride(); + std::cout << "for" << std::endl; + for (draco::PointIndex v(0); v < attribute->indices_map_size(); ++v) { + std::cout << "value = attribute_objects[i].data" << std::endl; + auto& value = pao.data[v.value()]; + value.resize(value_size); + std::cout << "get mapped value" << std::endl; + attribute->GetMappedValue(v, value.data()); + } + attribute_objects.push_back(std::move(pao)); + } + std::cout << "return from decode_generic_attributes" << std::endl; + return attribute_objects; + } + + void decode_geometry_metadata(draco::PointCloud& pc, + const draco::GeometryMetadata& geometry_metadata, + PointCloudObject& pco) { + std::cout << "decode_metadata" << std::endl; + pco.geometry_metadata.metadata_id = decode_metadata(geometry_metadata, pco.metadatas); + std::cout << "decode_generic_attributes" << std::endl; + pco.geometry_metadata.generic_attributes = decode_generic_attributes(pc, pco.metadatas); + + // // geometry_metadata + // for (const auto& attriute_metadata: geometry_metadata.attribute_metadatas()) { + // auto metadata_id = decode_metadata(*attriute_metadata, pco.metadatas); + // std::cout << "not found att_unique_id = " << attriute_metadata->att_unique_id(); + // std::cout << "metadata_id = " << metadata_id << std::endl; + // } } //////////////////////////////////////////////////// ////// helpful encoding functions ////////////////// //////////////////////////////////////////////////// - void encode_generic_attributes(const PointCloudObject& pco, draco::PointCloud& pc) { - for (const PointAttributeObject& pao: pco.attributes) { - auto attribute = std::make_unique(); - attribute->Init(draco::GeometryAttribute::GENERIC, nullptr, - pao.dimension, pao.datatype, false, - draco::DataTypeLength(pao.datatype) * pao.dimension, 0); - attribute->set_unique_id(pao.unique_id); - for (draco::PointIndex v(0); v < pao.data.size(); ++v) { - draco::AttributeValueIndex value_index(v.value()); - attribute->SetAttributeValue(value_index, pao.data.at(v.value()).data()); - attribute->SetPointMapEntry(v, value_index); + 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); + // attribute->SetExplicitMapping(pao.data.size()); + for (draco::PointIndex v(0); v < pao.data.size(); ++v) { + // std::cout << 5 << std::endl; + draco::AttributeValueIndex value_index(v.value()); + // std::cout << 6 << std::endl; + attribute->SetPointMapEntry(v, value_index); + // std::cout << 7 << std::endl; + // std::cout << value_index << std::endl; + // std::cout << pao.data.size() << std::endl; + // for (const auto item: pao.data) { + // std::cout << '(' << item.first << ','; + // std::cout << *reinterpret_cast(item.second.data()) << ") "; + // } + std::cout << std::endl; + try { + const auto& point_value = pao.data.at(v.value()); + std::cout << "point_value " << point_value.size() << std::endl; + attribute->SetAttributeValue(value_index, point_value.data()); + } catch (std::out_of_range& e ) { + std::cout << e.what() << std::endl; } - pc.AddAttribute(std::move(attribute)); + std::cout << 8 << std::endl; } + return attribute_id; } - void encode_metadata(const PointCloudObject& pco, const MetadataObject& main_metadata_object, - draco::Metadata& metadata) { + // void encode_generic_attributes(const std::vector& attributes, + // draco::PointCloud& pc) { + // std::cout << "start" << std::endl; + // for (const PointAttributeObject& pao: attributes) { + // std::cout << 1 << std::endl; + // draco::GeometryAttribute base_attribute; + // base_attribute.Init(draco::GeometryAttribute::GENERIC, nullptr, + // pao.dimension, pao.datatype, false, + // draco::DataTypeLength(pao.datatype) * pao.dimension, 0); + // auto attribute = pc.CreateAttribute(base_attribute, false, pao.data.size()); + // std::cout << 2 << std::endl; + // attribute->set_unique_id(pao.unique_id); + // std::cout << 3 << std::endl; + // attribute->SetExplicitMapping(pao.data.size()); + // std::cout << 4 << std::endl; + // for (draco::PointIndex v(0); v < pao.data.size(); ++v) { + // std::cout << 5 << std::endl; + // draco::AttributeValueIndex value_index(v.value()); + // std::cout << 6 << std::endl; + // attribute->SetPointMapEntry(v, value_index); + // std::cout << 7 << std::endl; + // std::cout << value_index << std::endl; + // std::cout << pao.data.size() << std::endl; + // for (const auto item: pao.data) { + // std::cout << '(' << item.first << ','; + // std::cout << *reinterpret_cast(item.second.data()) << ") "; + // } + // std::cout << std::endl; + // try { + // const auto& point_value = pao.data.at(v.value()); + // std::cout << "point_value " << point_value.size() << std::endl; + // attribute->SetAttributeValue(value_index, point_value.data()); + // } catch (std::out_of_range& e ) { + // std::cout << e.what() << std::endl; + // } + // std::cout << 8 << std::endl; + // } + // std::cout << 10 << std::endl; + // pc.AddAttribute(std::move(attribute)); + // std::cout << 9 << std::endl; + // } + // std::cout << "finish" << std::endl; + // } + + void encode_metadata(const std::vector& metadatas, + const MetadataObject& main_metadata_object, + draco::Metadata& out_metadata) { + // it should not encode geometry metadata as it doesn't exist + if (metadatas.empty()) + return; using MetadataPair = std::pair; - std::vector to_parse_metadata = { {&metadata, &main_metadata_object} }; + std::vector to_parse_metadata = { {&out_metadata, &main_metadata_object} }; for (std::vector to_parse_metadatas_next; !to_parse_metadata.empty(); - to_parse_metadata = std::move(to_parse_metadatas_next)) { - for (auto [metadata, metadata_object]: to_parse_metadata) { + ) { + // std::cout << "to_parse_metadata begin" << std::endl; + // for (auto& pair: to_parse_metadata) + // std::cout << pair.first << ' ' << pair.second << std::endl; + for (auto& [metadata, metadata_object]: to_parse_metadata) { + // std::cout << "4" << std::endl; + // std::cout << metadata << std::endl; + // std::cout << metadata_object << std::endl; // consider entries for (const auto& [name, str_value]: metadata_object->entries) { + // std::cout << "5 " << name << ' ' << str_value << std::endl; std::vector vec_value(str_value.size()); + // std::cout << "6" << std::endl; memcpy(vec_value.data(), str_value.data(), str_value.size()); + // std::cout << "7" << std::endl; metadata->AddEntryBinary(name, vec_value); + // std::cout << "8" << std::endl; } + // std::cout << "9" << std::endl; // consider sub metadatas for (const auto& [name, metadata_id]: metadata_object->sub_metadata_ids) { + // std::cout << "10" << std::endl; auto sub_metadata = std::make_unique(); - to_parse_metadatas_next.push_back({sub_metadata.get(), &pco.metadatas[metadata_id]}); + // std::cout << "11 " << sub_metadata.get() << ' ' << &metadatas[metadata_id] << std::endl; + to_parse_metadatas_next.push_back({sub_metadata.get(), &metadatas[metadata_id]}); + // std::cout << "12" << std::endl; metadata->AddSubMetadata(name, std::move(sub_metadata)); + // std::cout << "13" << std::endl; } } + // std::cout << "finish cycle iteration" << std::endl; + // std::cout << "to_parse_metadata_next before" << std::endl; + // for (auto& pair: to_parse_metadatas_next) + // std::cout << pair.first << ' ' << pair.second << std::endl; + // std::cout << "to_parse_metadata before" << std::endl; + // for (auto& pair: to_parse_metadata) + // std::cout << pair.first << ' ' << pair.second << std::endl; + to_parse_metadata = std::move(to_parse_metadatas_next); + // std::cout << "to_parse_metadata_next after" << std::endl; + // for (auto& pair: to_parse_metadatas_next) + // std::cout << pair.first << ' ' << pair.second << std::endl; + // std::cout << "to_parse_metadata after" << std::endl; + // for (auto& pair: to_parse_metadata) + // std::cout << pair.first << ' ' << pair.second << std::endl; } } - - std::unique_ptr encode_geometry_metadata(const PointCloudObject& pco) { - draco::GeometryMetadata geometry_metadata; - const GeometryMetadataObject& gmo = pco.geometry_metadata; - encode_metadata(pco, pco.metadatas[gmo.metadata_id], geometry_metadata); - - for (const auto& amo: pco.geometry_metadata.attribute_metadatas) { + + + bool encode_geometry_metadata( + draco::PointCloud& pc, + const std::vector& metadatas, + const GeometryMetadataObject& geometry_metadata_object) { + // it should not encode geometry metadata if actually no metadata was passed + if (metadatas.empty()) + return false; + const auto& gmo = geometry_metadata_object; + auto geometry_metadata_ptr = std::make_unique(); + auto& geometry_metadata = *geometry_metadata_ptr; + pc.AddMetadata(std::move(geometry_metadata_ptr)); + std::cout << "encode_metadata geometry_metadata" << std::endl; + encode_metadata(metadatas, metadatas[gmo.metadata_id], geometry_metadata); + + for (const auto& attribute_object: gmo.generic_attributes) { + std::cout << "encode_generic_attribute" << std::endl; + int32_t attribute_id = encode_generic_attribute(attribute_object, pc); + if (attribute_id < 0) + continue; auto attribute_metadata = std::make_unique(); - attribute_metadata->set_att_unique_id(amo.unique_id); - encode_metadata(pco, pco.metadatas[amo.metadata_id], *attribute_metadata); - geometry_metadata.AddAttributeMetadata(std::move(attribute_metadata)); + std::cout << "encode_metadata" << std::endl; + encode_metadata(metadatas, metadatas[attribute_object.metadata_id], *attribute_metadata); + std::cout << "AddAttributeMetadata " << attribute_id << std::endl; + + + auto& attribute_metadata_ref = *attribute_metadata; + std::string attr_name; + attribute_metadata->GetEntryString("name", &attr_name); + std::cout << "put attribute metadata with name " << attr_name << std::endl; + pc.AddAttributeMetadata(attribute_id, std::move(attribute_metadata)); + std::cout << attribute_metadata_ref.att_unique_id(); } - return std::make_unique(std::move(geometry_metadata)); + std::cout << "encode_geometry_metadata finish" << std::endl; + + return true; } } @@ -209,6 +386,8 @@ namespace DracoFunctions { } std::unique_ptr in_mesh = std::move(statusor).value(); draco::Mesh *mesh = in_mesh.get(); + std::cout << "decode_buffer" << std::endl; + std::cout << "mesh points " << mesh->num_points() << std::endl; const int pos_att_id = mesh->GetNamedAttributeId(draco::GeometryAttribute::POSITION); if (pos_att_id < 0) { meshObject.decode_status = no_position_attribute; @@ -223,15 +402,22 @@ namespace DracoFunctions { meshObject.decode_status = no_position_attribute; return meshObject; } + std::cout << '[' << v.value() << "] "; + std::cout << pos_val[0] << ' ' << pos_val[1] << ' ' << pos_val[2] << std::endl; meshObject.points.push_back(pos_val[0]); meshObject.points.push_back(pos_val[1]); meshObject.points.push_back(pos_val[2]); } for (draco::FaceIndex i(0); i < mesh->num_faces(); ++i) { + std::cout << '[' << i.value() << "] "; const auto &f = mesh->face(i); meshObject.faces.push_back(*(reinterpret_cast(&(f[0])))); + std::cout << meshObject.faces.back() << ' '; meshObject.faces.push_back(*(reinterpret_cast(&(f[1])))); + std::cout << meshObject.faces.back() << ' '; meshObject.faces.push_back(*(reinterpret_cast(&(f[2])))); + std::cout << meshObject.faces.back() << ' '; + std::cout << std::endl; } const draco::GeometryMetadata *metadata = mesh->GetMetadata(); meshObject.encoding_options_set = false; @@ -241,10 +427,14 @@ namespace DracoFunctions { metadata->GetEntryDoubleArray("quantization_origin", &(meshObject.quantization_origin))) { meshObject.encoding_options_set = true; } - meshObject.geometry_metadata = decode_geometry_metadata(*metadata, meshObject); + decode_geometry_metadata(*mesh, *metadata, meshObject); + std::cout << "result metadatas BEGIN" << std::endl; + for (auto& m : meshObject.metadatas) + std::cout << &m << std::endl; + std::cout << "result metadatas END" << std::endl; } - meshObject.attributes = decode_generic_attributes(*mesh); meshObject.decode_status = successful; + std::cout << " meshObject " << meshObject.points.size() << std::endl; return meshObject; } @@ -291,9 +481,8 @@ namespace DracoFunctions { metadata->GetEntryDoubleArray("quantization_origin", &(pointCloudObject.quantization_origin))) { pointCloudObject.encoding_options_set = true; } - pointCloudObject.geometry_metadata = decode_geometry_metadata(*metadata, pointCloudObject); + decode_geometry_metadata(*point_cloud, *metadata, pointCloudObject); } - pointCloudObject.attributes = decode_generic_attributes(*point_cloud); pointCloudObject.decode_status = successful; return pointCloudObject; } @@ -322,19 +511,26 @@ namespace DracoFunctions { } } - EncodedObject encode_mesh(const std::vector &points, const std::vector &faces, - MeshObject mesh_object, + EncodedObject encode_mesh(const std::vector &points, + const std::vector &faces, + const std::vector& metadatas, + const GeometryMetadataObject& geometry_metadata_object, + int quantization_bits, int compression_level, float quantization_range, const float *quantization_origin, bool create_metadata) { 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); + std::cout << "encode_mesh" << std::endl; + std::cout << " meshObject points " << points.size() << std::endl; 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; + std::cout << '[' << i << "] " << point1Index << ' ' << point2Index << ' ' << point3Index << ' '; + std::cout << points[point1Index] << ' ' << points[point2Index] << ' '; + std::cout << points[point3Index] << std::endl; 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(), @@ -343,8 +539,10 @@ namespace DracoFunctions { std::unique_ptr ptr_mesh = mb.Finalize(); draco::Mesh *mesh = ptr_mesh.get(); - mesh->AddMetadata(encode_geometry_metadata(mesh_object)); - encode_generic_attributes(mesh_object, *mesh); + std::cout << " mesh points " << mesh->num_points() << std::endl; + + encode_geometry_metadata(*mesh, metadatas, geometry_metadata_object); + draco::Encoder encoder; setup_encoder_and_metadata(mesh, encoder, compression_level, quantization_bits, quantization_range, quantization_origin, create_metadata); @@ -377,8 +575,7 @@ namespace DracoFunctions { std::unique_ptr ptr_point_cloud = pcb.Finalize(true); draco::PointCloud *point_cloud = ptr_point_cloud.get(); - point_cloud->AddMetadata(encode_geometry_metadata(pco)); - encode_generic_attributes(pco, *point_cloud); + encode_geometry_metadata(*point_cloud, pco.metadatas, pco.geometry_metadata); draco::Encoder encoder; setup_encoder_and_metadata(point_cloud, encoder, compression_level, quantization_bits, quantization_range, quantization_origin, create_metadata); diff --git a/src/DracoPy.pxd b/src/DracoPy.pxd index dfec117..a608d65 100644 --- a/src/DracoPy.pxd +++ b/src/DracoPy.pxd @@ -33,20 +33,16 @@ cdef extern from "DracoPy.h" namespace "DracoFunctions": cdef struct MetadataObject: unordered_map[string, string] entries unordered_map[string, uint32_t] sub_metadata_ids - - cdef struct AttributeMetadataObject: - uint32_t metadata_id # reference to metadata object - uint32_t unique_id cdef struct PointAttributeObject: unordered_map[uint32_t, string] data DataType datatype uint32_t dimension - uint32_t unique_id + uint32_t metadata_id cdef struct GeometryMetadataObject: uint32_t metadata_id # reference to metadata object - vector[AttributeMetadataObject] attribute_metadatas + vector[PointAttributeObject] generic_attributes cdef struct PointCloudObject: vector[float] points @@ -60,7 +56,6 @@ cdef extern from "DracoPy.h" namespace "DracoFunctions": # Represents the decoding success or error message decoding_status decode_status - vector[PointAttributeObject] attributes GeometryMetadataObject geometry_metadata vector[MetadataObject] metadatas @@ -80,7 +75,6 @@ cdef extern from "DracoPy.h" namespace "DracoFunctions": # Represents the decoding success or error message decoding_status decode_status - vector[PointAttributeObject] attributes GeometryMetadataObject geometry_metadata vector[MetadataObject] metadatas @@ -105,8 +99,10 @@ cdef extern from "DracoPy.h" namespace "DracoFunctions": PointCloudObject decode_buffer_to_point_cloud(const char *buffer, size_t buffer_len) except + EncodedObject encode_mesh( - vector[float] points, vector[uint32_t] faces, - MeshObject mesh_object, + vector[float] points, + vector[uint32_t] faces, + vector[MetadataObject] metadatas, + GeometryMetadataObject geometry_metadata, int quantization_bits, int compression_level, float quantization_range, const float *quantization_origin, bool create_metadata) except + diff --git a/src/DracoPy.pyx b/src/DracoPy.pyx index 59b96ec..aded0a7 100644 --- a/src/DracoPy.pyx +++ b/src/DracoPy.pyx @@ -29,25 +29,25 @@ class DracoPointCloud(object): return 3 @property - def points(self): + def points(self) -> List[float]: return self.data_struct['points'] @property - def geometry_metadata(self) -> 'GeometryMetadataObject': + def geometry_metadata(self) -> Dict: return self.data_struct['geometry_metadata'] + # + # @property + # def attributes(self) -> List[Dict]: + # return self.data_struct['attributes'] @property - def attributes(self) -> List['PointAttributeObject']: - return self.data_struct['attributes'] - - @property - def metadatas(self) -> List['MetadataObject']: + 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 @@ -84,7 +84,8 @@ class FileTypeException(Exception): class EncodingFailedException(Exception): pass -def encode_mesh_to_buffer(points, faces, mesh_object, +def encode_mesh_to_buffer(points, faces, metadatas, + geometry_metadata, quantization_bits=14, compression_level=1, quantization_range=-1, quantization_origin=None, create_metadata=False): @@ -104,8 +105,8 @@ def encode_mesh_to_buffer(points, faces, mesh_object, quant_origin = PyMem_Malloc(sizeof(float) * num_dims) for dim in range(num_dims): quant_origin[dim] = quantization_origin[dim] - # binary_metadata = encode_metadata(metadata) - encoded_mesh = DracoPy.encode_mesh(points, faces, mesh_object, + encoded_mesh = DracoPy.encode_mesh(points, faces, metadatas, + geometry_metadata, quantization_bits, compression_level, quantization_range, quant_origin, create_metadata) @@ -117,7 +118,9 @@ def encode_mesh_to_buffer(points, faces, mesh_object, raise EncodingFailedException('Invalid mesh') except EncodingFailedException: raise EncodingFailedException('Invalid mesh') - except: + except Exception as e: + import traceback + traceback.print_exc() if quant_origin != NULL: PyMem_Free(quant_origin) raise ValueError("Input invalid") diff --git a/tests.py b/tests.py index 1e7d5c7..0d89b1f 100644 --- a/tests.py +++ b/tests.py @@ -1,9 +1,54 @@ import os +from typing import Tuple, List + import DracoPy import pytest testdata_directory = "testdata_files" +############################################### +############## Utils For Tests ################ +############################################### + +def create_tetrahedron() -> Tuple[List[float], List[int]]: + """ + Tetrader + (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_empty_geometry_metadata() -> dict: + return { + "metadata_id": 0, + "attribute_metadatas": [], + } + + +############################################### +################ Tests itselves ############### +############################################### + def test_decoding_and_encoding_mesh_file(): expected_points = 104502 @@ -14,12 +59,14 @@ def test_decoding_and_encoding_mesh_file(): assert len(mesh_object.points) == expected_points assert len(mesh_object.faces) == expected_faces encoding_test = DracoPy.encode_mesh_to_buffer( - mesh_object.points, mesh_object.faces + mesh_object.points, mesh_object.faces, mesh_object.data_struct, ) - with open(os.path.join(testdata_directory, "bunny_test.drc"), "wb") as test_file: + with open(os.path.join(testdata_directory, "bunny_test.drc"), + "wb") as test_file: test_file.write(encoding_test) - with open(os.path.join(testdata_directory, "bunny_test.drc"), "rb") as test_file: + with open(os.path.join(testdata_directory, "bunny_test.drc"), + "rb") as test_file: file_content = test_file.read() mesh_object = DracoPy.decode_buffer_to_mesh(file_content) assert (mesh_object.encoding_options) is None @@ -28,17 +75,20 @@ def test_decoding_and_encoding_mesh_file(): def test_decoding_improper_file(): - with open(os.path.join(testdata_directory, "bunny.obj"), "rb") as improper_file: + with open(os.path.join(testdata_directory, "bunny.obj"), + "rb") as improper_file: file_content = improper_file.read() with pytest.raises(DracoPy.FileTypeException): DracoPy.decode_buffer_to_mesh(file_content) def test_metadata(): - with open(os.path.join(testdata_directory, "bunny.drc"), "rb") as draco_file: + with open(os.path.join(testdata_directory, "bunny.drc"), + "rb") as draco_file: file_content = draco_file.read() mesh_object = DracoPy.decode_buffer_to_mesh(file_content) encoding_options = { + "mesh_object": mesh_object.data_struct, "quantization_bits": 12, "compression_level": 3, "quantization_range": 1000, @@ -49,11 +99,12 @@ def test_metadata(): mesh_object.points, mesh_object.faces, **encoding_options ) with open( - os.path.join(testdata_directory, "bunny_test.drc"), "wb" + os.path.join(testdata_directory, "bunny_test.drc"), "wb" ) as test_file: test_file.write(encoding_test) - with open(os.path.join(testdata_directory, "bunny_test.drc"), "rb") as test_file: + with open(os.path.join(testdata_directory, "bunny_test.drc"), + "rb") as test_file: file_content = test_file.read() mesh_object = DracoPy.decode_buffer_to_mesh(file_content) eo = mesh_object.encoding_options @@ -66,21 +117,76 @@ def test_metadata(): def test_decoding_and_encoding_point_cloud_file(): expected_points = 107841 with open( - os.path.join(testdata_directory, "point_cloud_bunny.drc"), "rb" + os.path.join(testdata_directory, "point_cloud_bunny.drc"), "rb" ) as draco_file: file_content = draco_file.read() point_cloud_object = DracoPy.decode_point_cloud_buffer(file_content) assert len(point_cloud_object.points) == expected_points - encoding_test = DracoPy.encode_point_cloud_to_buffer(point_cloud_object.points) + encoding_test = DracoPy.encode_point_cloud_to_buffer( + point_cloud_object.points) with open( - os.path.join(testdata_directory, "point_cloud_bunny_test.drc"), "wb" + os.path.join(testdata_directory, "point_cloud_bunny_test.drc"), + "wb" ) as test_file: test_file.write(encoding_test) with open( - os.path.join(testdata_directory, "point_cloud_bunny_test.drc"), "rb" + os.path.join(testdata_directory, "point_cloud_bunny_test.drc"), "rb" ) as test_file: file_content = test_file.read() 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(): + points, faces = create_tetrahedron() + buffer = DracoPy.encode_mesh_to_buffer(points, faces, [], + create_empty_geometry_metadata(), + []) + mesh = DracoPy.decode_buffer_to_mesh(buffer) + print(mesh) + + +def test_encode_decode_tetrahedron_attributes(): + points, faces = create_tetrahedron() + attributes = [ + + ] + metadatas = [ + { + "entries": { + b"name": b"global_geometry_metadata_name", + }, + "sub_metadata_ids": { + }, + }, + { + "entries": { + b"name": b"custom_attribute_name" + }, + "sub_metadata_ids": {}, + }, + ] + geometry_metadata = { + "metadata_id": 0, + "generic_attributes": [ + { + "data": { + i: int.to_bytes(i, 4, "little", signed=False) + for i in range(4) + }, + "datatype": 6, + "dimension": 1, + "metadata_id": 1, + } + ], + } + buffer = DracoPy.encode_mesh_to_buffer(points, faces, metadatas, + geometry_metadata) + mesh = DracoPy.decode_buffer_to_mesh(buffer) + print(mesh) + + +# test_encode_decode_tetrahedron() +test_encode_decode_tetrahedron_attributes() \ No newline at end of file From 2829ed78b72648bd741792f07e3a39ed6cb6d297 Mon Sep 17 00:00:00 2001 From: Andrey Romanov Date: Wed, 10 Nov 2021 20:57:59 +0300 Subject: [PATCH 09/21] clear code from debug prints; fix crash in decode_metadata --- src/DracoPy.cpp | 375 +++++++++++++++++++++++++++++++----------------- src/DracoPy.h | 211 ++++----------------------- src/DracoPy.pxd | 4 +- src/DracoPy.pyx | 8 +- tests.py | 130 ++++++++++++----- 5 files changed, 372 insertions(+), 356 deletions(-) diff --git a/src/DracoPy.cpp b/src/DracoPy.cpp index eedde91..7574615 100644 --- a/src/DracoPy.cpp +++ b/src/DracoPy.cpp @@ -1597,6 +1597,7 @@ static const char __pyx_k_traceback[] = "traceback"; static const char __pyx_k_ValueError[] = "ValueError"; static const char __pyx_k_difference[] = "difference"; 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_metadata_id[] = "metadata_id"; static const char __pyx_k_Invalid_mesh[] = "Invalid mesh"; @@ -1725,6 +1726,7 @@ 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_status; +static PyObject *__pyx_n_s_deduplicate; static PyObject *__pyx_n_s_difference; static PyObject *__pyx_n_s_dim; static PyObject *__pyx_n_s_dimension; @@ -1799,8 +1801,8 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_6num_axes(CYTHON_UNUSED PyO 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_metadatas, PyObject *__pyx_v_geometry_metadata, 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_point_cloud_object, 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_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer, PyObject *__pyx_v_deduplicate); /* proto */ +static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer, PyObject *__pyx_v_deduplicate); /* proto */ static PyObject *__pyx_float_0_5; static PyObject *__pyx_int_1; static PyObject *__pyx_int_2; @@ -5206,7 +5208,7 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject * elif decoding_status == DracoPy.decoding_status.no_position_attribute: * raise ValueError('DracoPy only supports meshes with position attributes') # <<<<<<<<<<<<<< * - * def decode_buffer_to_mesh(buffer): + * def decode_buffer_to_mesh(buffer, deduplicate=False): */ __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); @@ -5249,37 +5251,93 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject /* "DracoPy.pyx":173 * 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): # <<<<<<<<<<<<<< + * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: */ /* 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_7decode_buffer_to_mesh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_7decode_buffer_to_mesh = {"decode_buffer_to_mesh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_7decode_buffer_to_mesh, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_7DracoPy_7decode_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); - __pyx_r = __pyx_pf_7DracoPy_6decode_buffer_to_mesh(__pyx_self, ((PyObject *)__pyx_v_buffer)); + { + 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, 173, __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_buffer_to_mesh", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 173, __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_6decode_buffer_to_mesh(__pyx_self, __pyx_v_buffer, __pyx_v_deduplicate); /* 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) { +static PyObject *__pyx_pf_7DracoPy_6decode_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; - struct DracoFunctions::MeshObject __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; + 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; @@ -5287,66 +5345,67 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject /* "DracoPy.pyx":174 * - * def decode_buffer_to_mesh(buffer): - * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) # <<<<<<<<<<<<<< + * def decode_buffer_to_mesh(buffer, deduplicate=False): + * 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, 174, __pyx_L1_error) __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 174, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_deduplicate); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 174, __pyx_L1_error) try { - __pyx_t_3 = DracoFunctions::decode_buffer(__pyx_t_1, __pyx_t_2); + __pyx_t_4 = DracoFunctions::decode_buffer(__pyx_t_1, __pyx_t_2, __pyx_t_3); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 174, __pyx_L1_error) } - __pyx_v_mesh_struct = __pyx_t_3; + __pyx_v_mesh_struct = __pyx_t_4; /* "DracoPy.pyx":175 - * def decode_buffer_to_mesh(buffer): - * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) + * def decode_buffer_to_mesh(buffer, deduplicate=False): + * 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_4 = ((__pyx_v_mesh_struct.decode_status == DracoFunctions::successful) != 0); - if (__pyx_t_4) { + __pyx_t_5 = ((__pyx_v_mesh_struct.decode_status == DracoFunctions::successful) != 0); + if (__pyx_t_5) { /* "DracoPy.pyx":176 - * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) + * 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_6, __pyx_n_s_DracoMesh); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 176, __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, 176, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_DracoMesh); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 176, __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_t_8 = __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(__pyx_v_mesh_struct); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 176, __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_6, function); + __Pyx_DECREF_SET(__pyx_t_7, 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_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, 176, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 176, __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; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; goto __pyx_L0; /* "DracoPy.pyx":175 - * def decode_buffer_to_mesh(buffer): - * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) + * def decode_buffer_to_mesh(buffer, deduplicate=False): + * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< * return DracoMesh(mesh_struct) * else: @@ -5358,37 +5417,37 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject * else: * raise_decoding_error(mesh_struct.decode_status) # <<<<<<<<<<<<<< * - * def decode_point_cloud_buffer(buffer): + * def decode_point_cloud_buffer(buffer, deduplicate=False): */ /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_raise_decoding_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 178, __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, 178, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_raise_decoding_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 178, __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_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, 178, __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_6, function); + __Pyx_DECREF_SET(__pyx_t_7, 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_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, 178, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 178, __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; } /* "DracoPy.pyx":173 * 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): # <<<<<<<<<<<<<< + * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: */ @@ -5396,10 +5455,10 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject __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_XDECREF(__pyx_t_9); __Pyx_AddTraceback("DracoPy.decode_buffer_to_mesh", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -5411,37 +5470,93 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject /* "DracoPy.pyx":180 * 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): # <<<<<<<<<<<<<< + * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer), deduplicate) * if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: */ /* 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) { +static PyObject *__pyx_pw_7DracoPy_9decode_point_cloud_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_9decode_point_cloud_buffer = {"decode_point_cloud_buffer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_9decode_point_cloud_buffer, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_7DracoPy_9decode_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); - __pyx_r = __pyx_pf_7DracoPy_8decode_point_cloud_buffer(__pyx_self, ((PyObject *)__pyx_v_buffer)); + { + 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, 180, __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, 180, __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_8decode_point_cloud_buffer(__pyx_self, __pyx_v_buffer, __pyx_v_deduplicate); /* 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) { +static PyObject *__pyx_pf_7DracoPy_8decode_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; - struct DracoFunctions::PointCloudObject __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; + 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; @@ -5449,66 +5564,67 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb /* "DracoPy.pyx":181 * - * 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): + * 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, 181, __pyx_L1_error) __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 181, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_deduplicate); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 181, __pyx_L1_error) try { - __pyx_t_3 = DracoFunctions::decode_buffer_to_point_cloud(__pyx_t_1, __pyx_t_2); + __pyx_t_4 = DracoFunctions::decode_buffer_to_point_cloud(__pyx_t_1, __pyx_t_2, __pyx_t_3); } catch(...) { __Pyx_CppExn2PyErr(); __PYX_ERR(0, 181, __pyx_L1_error) } - __pyx_v_point_cloud_struct = __pyx_t_3; + __pyx_v_point_cloud_struct = __pyx_t_4; /* "DracoPy.pyx":182 - * 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): + * 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_4 = ((__pyx_v_point_cloud_struct.decode_status == DracoFunctions::successful) != 0); - if (__pyx_t_4) { + __pyx_t_5 = ((__pyx_v_point_cloud_struct.decode_status == DracoFunctions::successful) != 0); + if (__pyx_t_5) { /* "DracoPy.pyx":183 - * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer)) + * 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_6, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 183, __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, 183, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 183, __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_t_8 = __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointCloudObject(__pyx_v_point_cloud_struct); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 183, __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_6, function); + __Pyx_DECREF_SET(__pyx_t_7, 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_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, 183, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 183, __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; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; goto __pyx_L0; /* "DracoPy.pyx":182 - * 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): + * 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: @@ -5521,34 +5637,34 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb * 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, 185, __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, 185, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_raise_decoding_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 185, __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_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, 185, __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_6, function); + __Pyx_DECREF_SET(__pyx_t_7, 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_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, 185, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 185, __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; } /* "DracoPy.pyx":180 * 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): # <<<<<<<<<<<<<< + * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer), deduplicate) * if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: */ @@ -5556,10 +5672,10 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb __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_XDECREF(__pyx_t_9); __Pyx_AddTraceback("DracoPy.decode_point_cloud_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -9647,6 +9763,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_deduplicate, __pyx_k_deduplicate, sizeof(__pyx_k_deduplicate), 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_dimension, __pyx_k_dimension, sizeof(__pyx_k_dimension), 0, 0, 1, 1}, @@ -9761,7 +9878,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * elif decoding_status == DracoPy.decoding_status.no_position_attribute: * raise ValueError('DracoPy only supports meshes with position attributes') # <<<<<<<<<<<<<< * - * def decode_buffer_to_mesh(buffer): + * def decode_buffer_to_mesh(buffer, deduplicate=False): */ __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_DracoPy_only_supports_meshes_wit); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 171, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); @@ -10149,26 +10266,26 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { /* "DracoPy.pyx":173 * 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): # <<<<<<<<<<<<<< + * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: */ - __pyx_tuple__54 = PyTuple_Pack(2, __pyx_n_s_buffer, __pyx_n_s_mesh_struct); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 173, __pyx_L1_error) + __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, 173, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__54); __Pyx_GIVEREF(__pyx_tuple__54); - __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 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, 173, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 173, __pyx_L1_error) + __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, 173, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 173, __pyx_L1_error) /* "DracoPy.pyx":180 * 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): # <<<<<<<<<<<<<< + * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer), deduplicate) * if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: */ - __pyx_tuple__56 = PyTuple_Pack(2, __pyx_n_s_buffer, __pyx_n_s_point_cloud_struct); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 180, __pyx_L1_error) + __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, 180, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__56); __Pyx_GIVEREF(__pyx_tuple__56); - __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 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, 180, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 180, __pyx_L1_error) + __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, 180, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 180, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -10956,8 +11073,8 @@ if (!__Pyx_RefNanny) { /* "DracoPy.pyx":173 * 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): # <<<<<<<<<<<<<< + * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: */ __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_7decode_buffer_to_mesh, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error) @@ -10968,8 +11085,8 @@ if (!__Pyx_RefNanny) { /* "DracoPy.pyx":180 * 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): # <<<<<<<<<<<<<< + * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer), deduplicate) * if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: */ __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_9decode_point_cloud_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error) diff --git a/src/DracoPy.h b/src/DracoPy.h index 94e43c9..cc0fa98 100644 --- a/src/DracoPy.h +++ b/src/DracoPy.h @@ -78,52 +78,29 @@ namespace DracoFunctions { } uint32_t decode_metadata(const draco::Metadata& in_metadata, std::vector& all_metadata_objects) { - std::cout << 'a' << std::endl; // main metadata object is a have just created object uint32_t metadata_id = add_metadata_object(all_metadata_objects); - MetadataObject& main_metadata_object = all_metadata_objects.back(); - - std::cout << 'b' << std::endl; - using MetadataPair = std::pair; - std::cout << 'c' << std::endl; - std::vector to_parse_metadata = { {&in_metadata, &main_metadata_object} }; - std::cout << 'd' << std::endl; - for (std::vector to_parse_metadatas_next; !to_parse_metadata.empty(); - ) { - std::cout << 'e' << std::endl; - for (auto& [metadata, metadata_object]: to_parse_metadata) { - std::cout << 'f' << std::endl; - std::cout << "metadata " << metadata << std::endl; - std::cout << "metadata_object " << metadata_object << std::endl; + 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& [metadata, metadata_object_idx]: to_parse_metadata) { // consider entries for (const auto& [name, vec_value]: metadata->entries()) { - std::cout << 'e' << std::endl; auto raw_value = reinterpret_cast(vec_value.data().data()); - std::cout << 'h' << std::endl; auto value_size = vec_value.data().size(); - std::cout << 'i' << std::endl; std::string str_value(raw_value, raw_value + value_size); - std::cout << 'j' << std::endl; - metadata_object->entries[name] = std::move(str_value); + all_metadata_objects[metadata_object_idx].entries[name] = std::move(str_value); } // consider sub metadatas for (const auto& [name, sub_metadata]: metadata->sub_metadatas()) { - std::cout << 'k' << std::endl; - std::cout << name << std::endl; - std::cout << metadata_object->entries.size() << std::endl; - std::cout << metadata_object->sub_metadata_ids.size() << std::endl; const uint32_t sub_metadata_id = add_metadata_object(all_metadata_objects); - std::cout << "sub metadata id " << sub_metadata_id << std::endl; - metadata_object->sub_metadata_ids.reserve(30); - std::cout << "reserved " << sub_metadata_id << std::endl; - metadata_object->sub_metadata_ids[name] = sub_metadata_id; - std::cout << metadata_object->sub_metadata_ids.size() << std::endl; - std::cout << 'l' << std::endl; - to_parse_metadatas_next.push_back({sub_metadata.get(), &all_metadata_objects.back()}); - std::cout << 'm' << std::endl; + 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}); } } - to_parse_metadata = std::move(to_parse_metadatas_next); + } return metadata_id; } @@ -134,56 +111,34 @@ namespace DracoFunctions { for (int i = 0; i < pc.num_attributes(); ++i) if (const auto* attribute = pc.attribute(i)) if (attribute->attribute_type() == draco::GeometryAttribute::GENERIC) { - std::cout << "GetAttributeIdByUniqueId" << std::endl; const uint32_t attribute_id = pc.GetAttributeIdByUniqueId(attribute->unique_id()); - // pc.metadata()->) - std::cout << "attribute_id " << attribute_id << std::endl; - std::cout << "attribute->unique_id() " << attribute->unique_id() << std::endl; - std::cout << "GetAttributeMetadataByAttributeId" << std::endl; const auto* attribute_metadata = pc.GetAttributeMetadataByAttributeId(attribute_id); - std::cout << "attribute_metadata " << attribute_metadata << std::endl; attribute_metadata = pc.GetAttributeMetadataByAttributeId(attribute->unique_id()); - std::cout << "attribute_metadata " << attribute_metadata << std::endl; // decode fields PointAttributeObject pao; pao.dimension = static_cast(attribute->num_components()); pao.datatype = attribute->data_type(); - std::cout << "decode_metadata" << std::endl; if (attribute_metadata) pao.metadata_id = decode_metadata(*attribute_metadata, all_metadata_objects); else pao.metadata_id = -1; - std::cout << "attribute->num_components()" << std::endl; // decode geometry data const auto value_size = attribute->num_components() * attribute->byte_stride(); - std::cout << "for" << std::endl; for (draco::PointIndex v(0); v < attribute->indices_map_size(); ++v) { - std::cout << "value = attribute_objects[i].data" << std::endl; auto& value = pao.data[v.value()]; value.resize(value_size); - std::cout << "get mapped value" << std::endl; attribute->GetMappedValue(v, value.data()); } attribute_objects.push_back(std::move(pao)); } - std::cout << "return from decode_generic_attributes" << std::endl; return attribute_objects; } void decode_geometry_metadata(draco::PointCloud& pc, const draco::GeometryMetadata& geometry_metadata, PointCloudObject& pco) { - std::cout << "decode_metadata" << std::endl; pco.geometry_metadata.metadata_id = decode_metadata(geometry_metadata, pco.metadatas); - std::cout << "decode_generic_attributes" << std::endl; pco.geometry_metadata.generic_attributes = decode_generic_attributes(pc, pco.metadatas); - - // // geometry_metadata - // for (const auto& attriute_metadata: geometry_metadata.attribute_metadatas()) { - // auto metadata_id = decode_metadata(*attriute_metadata, pco.metadatas); - // std::cout << "not found att_unique_id = " << attriute_metadata->att_unique_id(); - // std::cout << "metadata_id = " << metadata_id << std::endl; - // } } //////////////////////////////////////////////////// @@ -202,133 +157,48 @@ namespace DracoFunctions { if (attribute_id < 0) return attribute_id; draco::PointAttribute* attribute = pc.attribute(attribute_id); - // attribute->SetExplicitMapping(pao.data.size()); for (draco::PointIndex v(0); v < pao.data.size(); ++v) { - // std::cout << 5 << std::endl; draco::AttributeValueIndex value_index(v.value()); - // std::cout << 6 << std::endl; attribute->SetPointMapEntry(v, value_index); - // std::cout << 7 << std::endl; - // std::cout << value_index << std::endl; - // std::cout << pao.data.size() << std::endl; - // for (const auto item: pao.data) { - // std::cout << '(' << item.first << ','; - // std::cout << *reinterpret_cast(item.second.data()) << ") "; - // } - std::cout << std::endl; try { const auto& point_value = pao.data.at(v.value()); - std::cout << "point_value " << point_value.size() << std::endl; attribute->SetAttributeValue(value_index, point_value.data()); } catch (std::out_of_range& e ) { - std::cout << e.what() << std::endl; + std::cout << e.what() << std::endl; } - std::cout << 8 << std::endl; } return attribute_id; } - // void encode_generic_attributes(const std::vector& attributes, - // draco::PointCloud& pc) { - // std::cout << "start" << std::endl; - // for (const PointAttributeObject& pao: attributes) { - // std::cout << 1 << std::endl; - // draco::GeometryAttribute base_attribute; - // base_attribute.Init(draco::GeometryAttribute::GENERIC, nullptr, - // pao.dimension, pao.datatype, false, - // draco::DataTypeLength(pao.datatype) * pao.dimension, 0); - // auto attribute = pc.CreateAttribute(base_attribute, false, pao.data.size()); - // std::cout << 2 << std::endl; - // attribute->set_unique_id(pao.unique_id); - // std::cout << 3 << std::endl; - // attribute->SetExplicitMapping(pao.data.size()); - // std::cout << 4 << std::endl; - // for (draco::PointIndex v(0); v < pao.data.size(); ++v) { - // std::cout << 5 << std::endl; - // draco::AttributeValueIndex value_index(v.value()); - // std::cout << 6 << std::endl; - // attribute->SetPointMapEntry(v, value_index); - // std::cout << 7 << std::endl; - // std::cout << value_index << std::endl; - // std::cout << pao.data.size() << std::endl; - // for (const auto item: pao.data) { - // std::cout << '(' << item.first << ','; - // std::cout << *reinterpret_cast(item.second.data()) << ") "; - // } - // std::cout << std::endl; - // try { - // const auto& point_value = pao.data.at(v.value()); - // std::cout << "point_value " << point_value.size() << std::endl; - // attribute->SetAttributeValue(value_index, point_value.data()); - // } catch (std::out_of_range& e ) { - // std::cout << e.what() << std::endl; - // } - // std::cout << 8 << std::endl; - // } - // std::cout << 10 << std::endl; - // pc.AddAttribute(std::move(attribute)); - // std::cout << 9 << std::endl; - // } - // std::cout << "finish" << std::endl; - // } - void encode_metadata(const std::vector& metadatas, const MetadataObject& main_metadata_object, draco::Metadata& out_metadata) { - // it should not encode geometry metadata as it doesn't exist + // it should not encode metadata as it doesn't exist if (metadatas.empty()) return; using MetadataPair = std::pair; - std::vector to_parse_metadata = { {&out_metadata, &main_metadata_object} }; - for (std::vector to_parse_metadatas_next; !to_parse_metadata.empty(); - ) { - // std::cout << "to_parse_metadata begin" << std::endl; - // for (auto& pair: to_parse_metadata) - // std::cout << pair.first << ' ' << pair.second << std::endl; + 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& [metadata, metadata_object]: to_parse_metadata) { - // std::cout << "4" << std::endl; - // std::cout << metadata << std::endl; - // std::cout << metadata_object << std::endl; // consider entries for (const auto& [name, str_value]: metadata_object->entries) { - // std::cout << "5 " << name << ' ' << str_value << std::endl; std::vector vec_value(str_value.size()); - // std::cout << "6" << std::endl; memcpy(vec_value.data(), str_value.data(), str_value.size()); - // std::cout << "7" << std::endl; metadata->AddEntryBinary(name, vec_value); - // std::cout << "8" << std::endl; } - // std::cout << "9" << std::endl; // consider sub metadatas for (const auto& [name, metadata_id]: metadata_object->sub_metadata_ids) { - // std::cout << "10" << std::endl; auto sub_metadata = std::make_unique(); - // std::cout << "11 " << sub_metadata.get() << ' ' << &metadatas[metadata_id] << std::endl; to_parse_metadatas_next.push_back({sub_metadata.get(), &metadatas[metadata_id]}); - // std::cout << "12" << std::endl; metadata->AddSubMetadata(name, std::move(sub_metadata)); - // std::cout << "13" << std::endl; } } - // std::cout << "finish cycle iteration" << std::endl; - // std::cout << "to_parse_metadata_next before" << std::endl; - // for (auto& pair: to_parse_metadatas_next) - // std::cout << pair.first << ' ' << pair.second << std::endl; - // std::cout << "to_parse_metadata before" << std::endl; - // for (auto& pair: to_parse_metadata) - // std::cout << pair.first << ' ' << pair.second << std::endl; - to_parse_metadata = std::move(to_parse_metadatas_next); - // std::cout << "to_parse_metadata_next after" << std::endl; - // for (auto& pair: to_parse_metadatas_next) - // std::cout << pair.first << ' ' << pair.second << std::endl; - // std::cout << "to_parse_metadata after" << std::endl; - // for (auto& pair: to_parse_metadata) - // std::cout << pair.first << ' ' << pair.second << std::endl; + } } - bool encode_geometry_metadata( draco::PointCloud& pc, const std::vector& metadatas, @@ -340,35 +210,23 @@ namespace DracoFunctions { auto geometry_metadata_ptr = std::make_unique(); auto& geometry_metadata = *geometry_metadata_ptr; pc.AddMetadata(std::move(geometry_metadata_ptr)); - std::cout << "encode_metadata geometry_metadata" << std::endl; encode_metadata(metadatas, metadatas[gmo.metadata_id], geometry_metadata); - for (const auto& attribute_object: gmo.generic_attributes) { - std::cout << "encode_generic_attribute" << std::endl; int32_t attribute_id = encode_generic_attribute(attribute_object, pc); if (attribute_id < 0) continue; auto attribute_metadata = std::make_unique(); - std::cout << "encode_metadata" << std::endl; encode_metadata(metadatas, metadatas[attribute_object.metadata_id], *attribute_metadata); - std::cout << "AddAttributeMetadata " << attribute_id << std::endl; - auto& attribute_metadata_ref = *attribute_metadata; - std::string attr_name; - attribute_metadata->GetEntryString("name", &attr_name); - std::cout << "put attribute metadata with name " << attr_name << std::endl; pc.AddAttributeMetadata(attribute_id, std::move(attribute_metadata)); - std::cout << attribute_metadata_ref.att_unique_id(); } - std::cout << "encode_geometry_metadata finish" << std::endl; - return true; } } - - MeshObject decode_buffer(const char *buffer, std::size_t buffer_len) { + MeshObject decode_buffer(const char *buffer, std::size_t buffer_len, bool + deduplicate) { MeshObject meshObject; draco::DecoderBuffer decoderBuffer; decoderBuffer.Init(buffer, buffer_len); @@ -386,8 +244,10 @@ namespace DracoFunctions { } std::unique_ptr in_mesh = std::move(statusor).value(); draco::Mesh *mesh = in_mesh.get(); - std::cout << "decode_buffer" << std::endl; - std::cout << "mesh points " << mesh->num_points() << std::endl; + 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; @@ -402,22 +262,15 @@ namespace DracoFunctions { meshObject.decode_status = no_position_attribute; return meshObject; } - std::cout << '[' << v.value() << "] "; - std::cout << pos_val[0] << ' ' << pos_val[1] << ' ' << pos_val[2] << std::endl; meshObject.points.push_back(pos_val[0]); meshObject.points.push_back(pos_val[1]); meshObject.points.push_back(pos_val[2]); } for (draco::FaceIndex i(0); i < mesh->num_faces(); ++i) { - std::cout << '[' << i.value() << "] "; const auto &f = mesh->face(i); meshObject.faces.push_back(*(reinterpret_cast(&(f[0])))); - std::cout << meshObject.faces.back() << ' '; meshObject.faces.push_back(*(reinterpret_cast(&(f[1])))); - std::cout << meshObject.faces.back() << ' '; meshObject.faces.push_back(*(reinterpret_cast(&(f[2])))); - std::cout << meshObject.faces.back() << ' '; - std::cout << std::endl; } const draco::GeometryMetadata *metadata = mesh->GetMetadata(); meshObject.encoding_options_set = false; @@ -428,17 +281,13 @@ namespace DracoFunctions { meshObject.encoding_options_set = true; } decode_geometry_metadata(*mesh, *metadata, meshObject); - std::cout << "result metadatas BEGIN" << std::endl; - for (auto& m : meshObject.metadatas) - std::cout << &m << std::endl; - std::cout << "result metadatas END" << std::endl; } meshObject.decode_status = successful; - std::cout << " meshObject " << meshObject.points.size() << std::endl; 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); @@ -456,6 +305,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; @@ -522,15 +375,10 @@ namespace DracoFunctions { mb.Start(faces.size()); const int pos_att_id = mb.AddAttribute(draco::GeometryAttribute::POSITION, 3, draco::DataType::DT_FLOAT32); - std::cout << "encode_mesh" << std::endl; - std::cout << " meshObject points " << points.size() << std::endl; 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; - std::cout << '[' << i << "] " << point1Index << ' ' << point2Index << ' ' << point3Index << ' '; - std::cout << points[point1Index] << ' ' << points[point2Index] << ' '; - std::cout << points[point3Index] << std::endl; 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(), @@ -539,7 +387,6 @@ namespace DracoFunctions { std::unique_ptr ptr_mesh = mb.Finalize(); draco::Mesh *mesh = ptr_mesh.get(); - std::cout << " mesh points " << mesh->num_points() << std::endl; encode_geometry_metadata(*mesh, metadatas, geometry_metadata_object); diff --git a/src/DracoPy.pxd b/src/DracoPy.pxd index a608d65..2b1053d 100644 --- a/src/DracoPy.pxd +++ b/src/DracoPy.pxd @@ -94,9 +94,9 @@ cdef extern from "DracoPy.h" namespace "DracoFunctions": void write_bytes_from_vec(const vector[uint8_t]& value) except + string get() except + - 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, diff --git a/src/DracoPy.pyx b/src/DracoPy.pyx index aded0a7..8c93f81 100644 --- a/src/DracoPy.pyx +++ b/src/DracoPy.pyx @@ -170,15 +170,15 @@ 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): + 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): + 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 0d89b1f..6292cc8 100644 --- a/tests.py +++ b/tests.py @@ -1,11 +1,12 @@ import os -from typing import Tuple, List +from typing import Tuple, List, Dict import DracoPy import pytest testdata_directory = "testdata_files" + ############################################### ############## Utils For Tests ################ ############################################### @@ -17,13 +18,15 @@ def create_tetrahedron() -> Tuple[List[float], List[int]]: | | | + | (0)--------(1) / / - (2) + / + (2) """ points = [ - # X, Y, Z + # X, Y, Z 0., 0., 0., # 0 1., 0., 0., # 1 0., 1., 0., # 2 @@ -45,11 +48,27 @@ def create_empty_geometry_metadata() -> dict: } +def create_points_map(in_points: List[int], + out_points: List[int]) -> Dict[int, int]: + index_map = { + tuple(out_points[i * 3:(i + 1) * 3]): i + 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]) + out_index = index_map.pop(in_vertex) + in_index = i + index_map[in_index] = out_index + for key in index_map: + assert isinstance(key, int), f"input point {key} is not in output" + return index_map + + ############################################### ################ Tests itselves ############### ############################################### - +@pytest.mark.skip def test_decoding_and_encoding_mesh_file(): expected_points = 104502 expected_faces = 208353 @@ -81,7 +100,7 @@ def test_decoding_improper_file(): with pytest.raises(DracoPy.FileTypeException): DracoPy.decode_buffer_to_mesh(file_content) - +@pytest.mark.skip def test_metadata(): with open(os.path.join(testdata_directory, "bunny.drc"), "rb") as draco_file: @@ -113,7 +132,7 @@ def test_metadata(): assert (eo.quantization_range) == 1000 assert (eo.quantization_origin) == [-100, -100, -100] - +@pytest.mark.skip def test_decoding_and_encoding_point_cloud_file(): expected_points = 107841 with open( @@ -147,46 +166,79 @@ def test_encode_decode_tetrahedron(): mesh = DracoPy.decode_buffer_to_mesh(buffer) print(mesh) - -def test_encode_decode_tetrahedron_attributes(): +def test_encode_decode_geometry_attributes(): + # prepare input data points, faces = create_tetrahedron() - attributes = [ - - ] metadatas = [ { - "entries": { - b"name": b"global_geometry_metadata_name", - }, - "sub_metadata_ids": { - }, - }, - { - "entries": { - b"name": b"custom_attribute_name" - }, + "entries": {}, "sub_metadata_ids": {}, - }, + } + for _ in range(2) ] + attribute = { + "data": { + i: int.to_bytes(4 - i, 4, "little", signed=False) + for i in range(4) + }, + "datatype": 6, + "dimension": 1, + "metadata_id": 1, + } + geometry_metadata = { + "metadata_id": 0, + "generic_attributes": [attribute], + } + # encode - decode + buffer = DracoPy.encode_mesh_to_buffer( + points, faces, metadatas, 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 in_index, point_value in attribute["data"].items(): + out_index = points_map[in_index] + assert out_attribute["data"][out_index] == point_value + + +def test_encode_decode_metadata_entries(): + # 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": [ - { - "data": { - i: int.to_bytes(i, 4, "little", signed=False) - for i in range(4) - }, - "datatype": 6, - "dimension": 1, - "metadata_id": 1, - } - ], + "generic_attributes": [], } + # encode - decode buffer = DracoPy.encode_mesh_to_buffer(points, faces, metadatas, - geometry_metadata) + geometry_metadata_specific) mesh = DracoPy.decode_buffer_to_mesh(buffer) - print(mesh) - - -# test_encode_decode_tetrahedron() -test_encode_decode_tetrahedron_attributes() \ No newline at end of file + # 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] + +# test_encode_decode_metadata_entries() \ No newline at end of file From 209283e2b3c0886500ab81331dab7aec4f9bd368 Mon Sep 17 00:00:00 2001 From: Andrey Romanov Date: Thu, 11 Nov 2021 15:18:07 +0300 Subject: [PATCH 10/21] make metadatas and geometry metadata optional and fix tests --- src/DracoPy.cpp | 3475 +++++++++++++++++------------------------------ src/DracoPy.h | 16 +- src/DracoPy.pxd | 22 +- src/DracoPy.pyx | 53 +- tests.py | 29 +- 5 files changed, 1313 insertions(+), 2282 deletions(-) diff --git a/src/DracoPy.cpp b/src/DracoPy.cpp index 7574615..8e6721b 100644 --- a/src/DracoPy.cpp +++ b/src/DracoPy.cpp @@ -1172,6 +1172,13 @@ 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 + /* GetTopmostException.proto */ #if CYTHON_USE_EXC_INFO_STACK static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); @@ -1220,13 +1227,6 @@ static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tsta /* Import.proto */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); -/* 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 - /* IterFinish.proto */ static CYTHON_INLINE int __Pyx_IterFinish(void); @@ -1465,9 +1465,6 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_char(unsigned char value); -/* CIntFromPy.proto */ -static CYTHON_INLINE enum DracoFunctions::decoding_status __Pyx_PyInt_As_enum__DracoFunctions_3a__3a_decoding_status(PyObject *); - /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(enum DracoFunctions::decoding_status value); @@ -1525,8 +1522,6 @@ static struct DracoFunctions::PointAttributeObject __pyx_convert__from_py_struct 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 PyObject *__pyx_convert_vector_to_py_unsigned_char(const std::vector &); /*proto*/ -static std::vector __pyx_convert_vector_from_py_double(PyObject *); /*proto*/ -static struct DracoFunctions::PointCloudObject __pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointCloudObject(PyObject *); /*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*/ @@ -1624,7 +1619,6 @@ 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_cline_in_traceback[] = "cline_in_traceback"; static const char __pyx_k_generic_attributes[] = "generic_attributes"; -static const char __pyx_k_point_cloud_object[] = "point_cloud_object"; 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"; @@ -1644,6 +1638,7 @@ static const char __pyx_k_EncodingOptions_num_axes[] = "EncodingOptions.num_axes 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_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"; @@ -1660,14 +1655,6 @@ static const char __pyx_k_No_value_specified_for_struct_at_4[] = "No value speci static const char __pyx_k_No_value_specified_for_struct_at_5[] = "No value specified for struct attribute 'dimension'"; static const char __pyx_k_No_value_specified_for_struct_at_6[] = "No value specified for struct attribute 'metadata_id'"; static const char __pyx_k_No_value_specified_for_struct_at_7[] = "No value specified for struct attribute 'generic_attributes'"; -static const char __pyx_k_No_value_specified_for_struct_at_8[] = "No value specified for struct attribute 'points'"; -static const char __pyx_k_No_value_specified_for_struct_at_9[] = "No value specified for struct attribute 'encoding_options_set'"; -static const char __pyx_k_No_value_specified_for_struct_at_10[] = "No value specified for struct attribute 'quantization_bits'"; -static const char __pyx_k_No_value_specified_for_struct_at_11[] = "No value specified for struct attribute 'quantization_range'"; -static const char __pyx_k_No_value_specified_for_struct_at_12[] = "No value specified for struct attribute 'quantization_origin'"; -static const char __pyx_k_No_value_specified_for_struct_at_13[] = "No value specified for struct attribute 'decode_status'"; -static const char __pyx_k_No_value_specified_for_struct_at_14[] = "No value specified for struct attribute 'geometry_metadata'"; -static const char __pyx_k_No_value_specified_for_struct_at_15[] = "No value specified for struct attribute 'metadatas'"; static PyObject *__pyx_n_s_Dict; static PyObject *__pyx_n_s_DracoMesh; static PyObject *__pyx_n_s_DracoMesh_faces; @@ -1697,20 +1684,12 @@ static PyObject *__pyx_kp_s_Invalid_point_cloud; static PyObject *__pyx_n_s_KeyError; static PyObject *__pyx_n_s_List; static PyObject *__pyx_kp_s_No_value_specified_for_struct_at; -static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_10; -static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_11; -static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_12; -static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_13; -static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_14; -static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_15; 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_kp_s_No_value_specified_for_struct_at_8; -static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_9; static PyObject *__pyx_kp_s_Specified_value_out_of_encoded_r; static PyObject *__pyx_n_s_TypeError; static PyObject *__pyx_n_s_ValueError; @@ -1718,6 +1697,7 @@ static PyObject *__pyx_n_s_axis; static PyObject *__pyx_n_s_buffer; static PyObject *__pyx_n_s_cline_in_traceback; static PyObject *__pyx_n_s_compression_level; +static PyObject *__pyx_n_s_create_empty_geometry_metadata; static PyObject *__pyx_n_s_create_metadata; static PyObject *__pyx_n_s_data; static PyObject *__pyx_n_s_data_struct; @@ -1763,7 +1743,6 @@ 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_point; -static PyObject *__pyx_n_s_point_cloud_object; static PyObject *__pyx_n_s_point_cloud_struct; static PyObject *__pyx_n_s_points; static PyObject *__pyx_n_s_prepare; @@ -1798,12 +1777,14 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions___init__(CYTHON_UNUSED PyOb 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_metadatas, PyObject *__pyx_v_geometry_metadata, 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_point_cloud_object, 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, PyObject *__pyx_v_deduplicate); /* proto */ -static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer, PyObject *__pyx_v_deduplicate); /* proto */ +static PyObject *__pyx_pf_7DracoPy_create_empty_geometry_metadata(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_7DracoPy_2encode_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, PyObject *__pyx_v_metadatas, PyObject *__pyx_v_geometry_metadata); /* proto */ +static PyObject *__pyx_pf_7DracoPy_4encode_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, PyObject *__pyx_v_metadatas, PyObject *__pyx_v_geometry_metadata); /* proto */ +static PyObject *__pyx_pf_7DracoPy_6raise_decoding_error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_decoding_status); /* proto */ +static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer, PyObject *__pyx_v_deduplicate); /* proto */ +static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer, PyObject *__pyx_v_deduplicate); /* 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; @@ -1822,50 +1803,43 @@ 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__17; -static PyObject *__pyx_tuple__18; static PyObject *__pyx_tuple__19; -static PyObject *__pyx_tuple__20; static PyObject *__pyx_tuple__21; static PyObject *__pyx_tuple__23; static PyObject *__pyx_tuple__25; static PyObject *__pyx_tuple__27; 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_tuple__39; -static PyObject *__pyx_tuple__40; -static PyObject *__pyx_tuple__42; -static PyObject *__pyx_tuple__44; -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__32; +static PyObject *__pyx_tuple__34; +static PyObject *__pyx_tuple__36; +static PyObject *__pyx_tuple__38; +static PyObject *__pyx_tuple__41; +static PyObject *__pyx_tuple__43; +static PyObject *__pyx_tuple__45; +static PyObject *__pyx_tuple__47; +static PyObject *__pyx_tuple__49; +static PyObject *__pyx_codeobj__14; +static PyObject *__pyx_codeobj__16; +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; 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__41; -static PyObject *__pyx_codeobj__43; -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__33; +static PyObject *__pyx_codeobj__35; +static PyObject *__pyx_codeobj__37; +static PyObject *__pyx_codeobj__39; +static PyObject *__pyx_codeobj__40; +static PyObject *__pyx_codeobj__42; +static PyObject *__pyx_codeobj__44; +static PyObject *__pyx_codeobj__46; +static PyObject *__pyx_codeobj__48; +static PyObject *__pyx_codeobj__50; /* Late includes */ /* "DracoPy.pyx":10 @@ -3652,25 +3626,112 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_6num_axes(CYTHON_UNUSED PyO /* "DracoPy.pyx":87 * pass * - * def encode_mesh_to_buffer(points, faces, metadatas, # <<<<<<<<<<<<<< - * geometry_metadata, + * def create_empty_geometry_metadata() -> dict: # <<<<<<<<<<<<<< + * return { + * "metadata_id": 0, + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7DracoPy_1create_empty_geometry_metadata(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_1create_empty_geometry_metadata = {"create_empty_geometry_metadata", (PyCFunction)__pyx_pw_7DracoPy_1create_empty_geometry_metadata, METH_NOARGS, 0}; +static PyObject *__pyx_pw_7DracoPy_1create_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_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":88 + * + * def create_empty_geometry_metadata() -> dict: + * return { # <<<<<<<<<<<<<< + * "metadata_id": 0, + * "generic_attributes": [], + */ + __Pyx_XDECREF(__pyx_r); + + /* "DracoPy.pyx":89 + * def create_empty_geometry_metadata() -> dict: + * return { + * "metadata_id": 0, # <<<<<<<<<<<<<< + * "generic_attributes": [], + * } + */ + __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_metadata_id, __pyx_int_0) < 0) __PYX_ERR(0, 89, __pyx_L1_error) + + /* "DracoPy.pyx":90 + * return { + * "metadata_id": 0, + * "generic_attributes": [], # <<<<<<<<<<<<<< + * } + * + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_generic_attributes, __pyx_t_2) < 0) __PYX_ERR(0, 89, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "DracoPy.pyx":87 + * pass + * + * def create_empty_geometry_metadata() -> dict: # <<<<<<<<<<<<<< + * return { + * "metadata_id": 0, + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("DracoPy.create_empty_geometry_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "DracoPy.pyx":94 + * + * + * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< * quantization_bits=14, compression_level=1, + * quantization_range=-1, quantization_origin=None, */ /* 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) { +static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7DracoPy_2encode_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_3encode_mesh_to_buffer = {"encode_mesh_to_buffer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_3encode_mesh_to_buffer, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7DracoPy_2encode_mesh_to_buffer}; +static PyObject *__pyx_pw_7DracoPy_3encode_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_metadatas = 0; - PyObject *__pyx_v_geometry_metadata = 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; + PyObject *__pyx_v_metadatas = 0; + PyObject *__pyx_v_geometry_metadata = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -3678,29 +3739,47 @@ static PyObject *__pyx_pw_7DracoPy_1encode_mesh_to_buffer(PyObject *__pyx_self, __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_metadatas,&__pyx_n_s_geometry_metadata,&__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}; + 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,&__pyx_n_s_metadatas,&__pyx_n_s_geometry_metadata,0}; PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; - values[4] = ((PyObject *)__pyx_int_14); - values[5] = ((PyObject *)__pyx_int_1); - values[6] = ((PyObject *)__pyx_int_neg_1); + values[2] = ((PyObject *)__pyx_int_14); + values[3] = ((PyObject *)__pyx_int_1); + values[4] = ((PyObject *)__pyx_int_neg_1); - /* "DracoPy.pyx":90 - * geometry_metadata, + /* "DracoPy.pyx":96 + * def encode_mesh_to_buffer(points, faces, * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, # <<<<<<<<<<<<<< - * create_metadata=False): - * """ + * create_metadata=False, + * metadatas = None, */ - values[7] = ((PyObject *)Py_None); + values[5] = ((PyObject *)Py_None); - /* "DracoPy.pyx":91 + /* "DracoPy.pyx":97 * quantization_bits=14, compression_level=1, * quantization_range=-1, quantization_origin=None, - * create_metadata=False): # <<<<<<<<<<<<<< + * create_metadata=False, # <<<<<<<<<<<<<< + * metadatas = None, + * geometry_metadata = None, + */ + values[6] = ((PyObject *)Py_False); + + /* "DracoPy.pyx":98 + * quantization_range=-1, quantization_origin=None, + * create_metadata=False, + * metadatas = None, # <<<<<<<<<<<<<< + * geometry_metadata = None, + * ): + */ + values[7] = ((PyObject *)Py_None); + + /* "DracoPy.pyx":99 + * create_metadata=False, + * metadatas = None, + * geometry_metadata = None, # <<<<<<<<<<<<<< + * ): * """ - * Encode a list or numpy array of points/vertices (float) and faces (unsigned int) to a draco buffer. */ - values[8] = ((PyObject *)Py_False); + values[8] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); @@ -3735,53 +3814,53 @@ static PyObject *__pyx_pw_7DracoPy_1encode_mesh_to_buffer(PyObject *__pyx_self, 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, 4, 9, 1); __PYX_ERR(0, 87, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 2, 9, 1); __PYX_ERR(0, 94, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_metadatas)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 4, 9, 2); __PYX_ERR(0, 87, __pyx_L3_error) + 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 (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geometry_metadata)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 4, 9, 3); __PYX_ERR(0, 87, __pyx_L3_error) + 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_bits); + 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_compression_level); + 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_quantization_range); + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_create_metadata); if (value) { values[6] = value; kw_args--; } } CYTHON_FALLTHROUGH; case 7: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_origin); + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_metadatas); if (value) { values[7] = value; kw_args--; } } CYTHON_FALLTHROUGH; case 8: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_create_metadata); + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geometry_metadata); if (value) { values[8] = 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, 87, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode_mesh_to_buffer") < 0)) __PYX_ERR(0, 94, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3796,8 +3875,10 @@ static PyObject *__pyx_pw_7DracoPy_1encode_mesh_to_buffer(PyObject *__pyx_self, case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + 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; @@ -3805,30 +3886,30 @@ static PyObject *__pyx_pw_7DracoPy_1encode_mesh_to_buffer(PyObject *__pyx_self, } __pyx_v_points = values[0]; __pyx_v_faces = values[1]; - __pyx_v_metadatas = values[2]; - __pyx_v_geometry_metadata = values[3]; - __pyx_v_quantization_bits = values[4]; - __pyx_v_compression_level = values[5]; - __pyx_v_quantization_range = values[6]; - __pyx_v_quantization_origin = values[7]; - __pyx_v_create_metadata = values[8]; + __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_metadatas = values[7]; + __pyx_v_geometry_metadata = values[8]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 4, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 87, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 2, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 94, __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_encode_mesh_to_buffer(__pyx_self, __pyx_v_points, __pyx_v_faces, __pyx_v_metadatas, __pyx_v_geometry_metadata, __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_2encode_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_v_metadatas, __pyx_v_geometry_metadata); - /* "DracoPy.pyx":87 - * pass + /* "DracoPy.pyx":94 * - * def encode_mesh_to_buffer(points, faces, metadatas, # <<<<<<<<<<<<<< - * geometry_metadata, + * + * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< * quantization_bits=14, compression_level=1, + * quantization_range=-1, quantization_origin=None, */ /* function exit code */ @@ -3836,7 +3917,7 @@ static PyObject *__pyx_pw_7DracoPy_1encode_mesh_to_buffer(PyObject *__pyx_self, 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_metadatas, PyObject *__pyx_v_geometry_metadata, 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) { +static PyObject *__pyx_pf_7DracoPy_2encode_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, PyObject *__pyx_v_metadatas, PyObject *__pyx_v_geometry_metadata) { float *__pyx_v_quant_origin; PyObject *__pyx_v_num_dims = NULL; PyObject *__pyx_v_dim = NULL; @@ -3845,27 +3926,27 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject PyObject *__pyx_v_traceback = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + int __pyx_t_1; + int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; + PyObject *__pyx_t_4 = NULL; + 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; - std::vector __pyx_t_14; - std::vector __pyx_t_15; - struct DracoFunctions::GeometryMetadataObject __pyx_t_16; - int __pyx_t_17; + PyObject *__pyx_t_8 = NULL; + size_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + PyObject *(*__pyx_t_11)(PyObject *); + float __pyx_t_12; + Py_ssize_t __pyx_t_13; + std::vector __pyx_t_14; + std::vector __pyx_t_15; + std::vector __pyx_t_16; + struct DracoFunctions::GeometryMetadataObject __pyx_t_17; int __pyx_t_18; - bool __pyx_t_19; - struct DracoFunctions::EncodedObject __pyx_t_20; - PyObject *__pyx_t_21 = NULL; + int __pyx_t_19; + bool __pyx_t_20; + struct DracoFunctions::EncodedObject __pyx_t_21; PyObject *__pyx_t_22 = NULL; PyObject *__pyx_t_23 = NULL; PyObject *__pyx_t_24 = NULL; @@ -3873,18 +3954,99 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("encode_mesh_to_buffer", 0); + __Pyx_INCREF(__pyx_v_metadatas); + __Pyx_INCREF(__pyx_v_geometry_metadata); + + /* "DracoPy.pyx":110 + * a point where each coordinate is the minimum of that coordinate among the input vertices. + * """ + * if metadatas is None: # <<<<<<<<<<<<<< + * metadatas = [] + * if geometry_metadata is None: + */ + __pyx_t_1 = (__pyx_v_metadatas == Py_None); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { + + /* "DracoPy.pyx":111 + * """ + * if metadatas is None: + * metadatas = [] # <<<<<<<<<<<<<< + * if geometry_metadata is None: + * geometry_metadata = create_empty_geometry_metadata() + */ + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 111, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF_SET(__pyx_v_metadatas, __pyx_t_3); + __pyx_t_3 = 0; - /* "DracoPy.pyx":101 + /* "DracoPy.pyx":110 * a point where each coordinate is the minimum of that coordinate among the input vertices. * """ + * if metadatas is None: # <<<<<<<<<<<<<< + * metadatas = [] + * if geometry_metadata is None: + */ + } + + /* "DracoPy.pyx":112 + * if metadatas is None: + * metadatas = [] + * if geometry_metadata is None: # <<<<<<<<<<<<<< + * geometry_metadata = create_empty_geometry_metadata() + * cdef float* quant_origin = NULL + */ + __pyx_t_2 = (__pyx_v_geometry_metadata == Py_None); + __pyx_t_1 = (__pyx_t_2 != 0); + if (__pyx_t_1) { + + /* "DracoPy.pyx":113 + * metadatas = [] + * if geometry_metadata is None: + * geometry_metadata = create_empty_geometry_metadata() # <<<<<<<<<<<<<< + * cdef float* quant_origin = NULL + * try: + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_create_empty_geometry_metadata); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 113, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 113, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF_SET(__pyx_v_geometry_metadata, __pyx_t_3); + __pyx_t_3 = 0; + + /* "DracoPy.pyx":112 + * if metadatas is None: + * metadatas = [] + * if geometry_metadata is None: # <<<<<<<<<<<<<< + * geometry_metadata = create_empty_geometry_metadata() + * cdef float* quant_origin = NULL + */ + } + + /* "DracoPy.pyx":114 + * if geometry_metadata is None: + * geometry_metadata = create_empty_geometry_metadata() * cdef float* quant_origin = NULL # <<<<<<<<<<<<<< * try: * num_dims = 3 */ __pyx_v_quant_origin = NULL; - /* "DracoPy.pyx":102 - * """ + /* "DracoPy.pyx":115 + * geometry_metadata = create_empty_geometry_metadata() * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< * num_dims = 3 @@ -3893,13 +4055,13 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject { __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); + __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); /*try:*/ { - /* "DracoPy.pyx":103 + /* "DracoPy.pyx":116 * cdef float* quant_origin = NULL * try: * num_dims = 3 # <<<<<<<<<<<<<< @@ -3909,110 +4071,110 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_INCREF(__pyx_int_3); __pyx_v_num_dims = __pyx_int_3; - /* "DracoPy.pyx":104 + /* "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) { + __pyx_t_1 = (__pyx_v_quantization_origin != Py_None); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { - /* "DracoPy.pyx":105 + /* "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, 105, __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, 105, __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, 105, __pyx_L3_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_v_quant_origin = ((float *)PyMem_Malloc(__pyx_t_8)); + __pyx_t_3 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 118, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 118, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_PyInt_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 118, __pyx_L5_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_quant_origin = ((float *)PyMem_Malloc(__pyx_t_9)); - /* "DracoPy.pyx":106 + /* "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_mesh = DracoPy.encode_mesh(points, faces, metadatas, + * encoded_mesh = DracoPy.encode_mesh(points, */ - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 106, __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; + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 119, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_4); + if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { + __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_10 = 0; + __pyx_t_11 = NULL; } else { - __pyx_t_9 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 106, __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, 106, __pyx_L3_error) + __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 119, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 119, __pyx_L5_error) } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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 (likely(!__pyx_t_11)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_3)) 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, 106, __pyx_L3_error) + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 119, __pyx_L5_error) #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 106, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 119, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_4); #endif } else { - if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_6)) break; + if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_3)) 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, 106, __pyx_L3_error) + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 119, __pyx_L5_error) #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 106, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 119, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_4); #endif } } else { - __pyx_t_7 = __pyx_t_10(__pyx_t_6); - if (unlikely(!__pyx_t_7)) { + __pyx_t_4 = __pyx_t_11(__pyx_t_3); + 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(0, 106, __pyx_L3_error) + else __PYX_ERR(0, 119, __pyx_L5_error) } break; } - __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_4); } - __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_7); - __pyx_t_7 = 0; + __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_4); + __pyx_t_4 = 0; - /* "DracoPy.pyx":107 + /* "DracoPy.pyx":120 * 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, metadatas, - * geometry_metadata, + * encoded_mesh = DracoPy.encode_mesh(points, + * faces, */ - __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 107, __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, 107, __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, 107, __pyx_L3_error) - (__pyx_v_quant_origin[__pyx_t_12]) = __pyx_t_11; + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 120, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 120, __pyx_L5_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 120, __pyx_L5_error) + (__pyx_v_quant_origin[__pyx_t_13]) = __pyx_t_12; - /* "DracoPy.pyx":106 + /* "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_mesh = DracoPy.encode_mesh(points, faces, metadatas, + * encoded_mesh = DracoPy.encode_mesh(points, */ } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":104 + /* "DracoPy.pyx":117 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -4021,80 +4183,104 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":108 + /* "DracoPy.pyx":121 * for dim in range(num_dims): * quant_origin[dim] = quantization_origin[dim] - * encoded_mesh = DracoPy.encode_mesh(points, faces, metadatas, # <<<<<<<<<<<<<< - * geometry_metadata, - * quantization_bits, compression_level, + * encoded_mesh = DracoPy.encode_mesh(points, # <<<<<<<<<<<<<< + * faces, + * metadatas, */ - __pyx_t_13 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L3_error) - __pyx_t_14 = __pyx_convert_vector_from_py_uint32_t(__pyx_v_faces); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L3_error) - __pyx_t_15 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_metadatas); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 108, __pyx_L3_error) + __pyx_t_14 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 121, __pyx_L5_error) - /* "DracoPy.pyx":109 + /* "DracoPy.pyx":122 * quant_origin[dim] = quantization_origin[dim] - * encoded_mesh = DracoPy.encode_mesh(points, faces, metadatas, + * encoded_mesh = DracoPy.encode_mesh(points, + * faces, # <<<<<<<<<<<<<< + * metadatas, + * geometry_metadata, + */ + __pyx_t_15 = __pyx_convert_vector_from_py_uint32_t(__pyx_v_faces); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 122, __pyx_L5_error) + + /* "DracoPy.pyx":123 + * encoded_mesh = DracoPy.encode_mesh(points, + * faces, + * metadatas, # <<<<<<<<<<<<<< + * geometry_metadata, + * quantization_bits, + */ + __pyx_t_16 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_metadatas); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 123, __pyx_L5_error) + + /* "DracoPy.pyx":124 + * faces, + * metadatas, * geometry_metadata, # <<<<<<<<<<<<<< - * quantization_bits, compression_level, - * quantization_range, quant_origin, + * quantization_bits, + * compression_level, */ - __pyx_t_16 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_geometry_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 109, __pyx_L3_error) + __pyx_t_17 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_geometry_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 124, __pyx_L5_error) - /* "DracoPy.pyx":110 - * encoded_mesh = DracoPy.encode_mesh(points, faces, metadatas, + /* "DracoPy.pyx":125 + * metadatas, * geometry_metadata, - * quantization_bits, compression_level, # <<<<<<<<<<<<<< - * quantization_range, quant_origin, - * create_metadata) + * quantization_bits, # <<<<<<<<<<<<<< + * compression_level, + * quantization_range, */ - __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 110, __pyx_L3_error) - __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 110, __pyx_L3_error) + __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L5_error) - /* "DracoPy.pyx":111 + /* "DracoPy.pyx":126 * geometry_metadata, - * quantization_bits, compression_level, - * quantization_range, quant_origin, # <<<<<<<<<<<<<< + * quantization_bits, + * compression_level, # <<<<<<<<<<<<<< + * quantization_range, + * quant_origin, + */ + __pyx_t_19 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_19 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 126, __pyx_L5_error) + + /* "DracoPy.pyx":127 + * quantization_bits, + * compression_level, + * quantization_range, # <<<<<<<<<<<<<< + * quant_origin, * create_metadata) - * if quant_origin != NULL: */ - __pyx_t_11 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_11 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 111, __pyx_L3_error) + __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 127, __pyx_L5_error) - /* "DracoPy.pyx":112 - * quantization_bits, compression_level, - * quantization_range, quant_origin, + /* "DracoPy.pyx":129 + * quantization_range, + * quant_origin, * create_metadata) # <<<<<<<<<<<<<< * if quant_origin != NULL: * PyMem_Free(quant_origin) */ - __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_19 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 112, __pyx_L3_error) + __pyx_t_20 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_20 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 129, __pyx_L5_error) - /* "DracoPy.pyx":108 + /* "DracoPy.pyx":121 * for dim in range(num_dims): * quant_origin[dim] = quantization_origin[dim] - * encoded_mesh = DracoPy.encode_mesh(points, faces, metadatas, # <<<<<<<<<<<<<< - * geometry_metadata, - * quantization_bits, compression_level, + * encoded_mesh = DracoPy.encode_mesh(points, # <<<<<<<<<<<<<< + * faces, + * metadatas, */ try { - __pyx_t_20 = DracoFunctions::encode_mesh(__pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_11, __pyx_v_quant_origin, __pyx_t_19); + __pyx_t_21 = DracoFunctions::encode_mesh(__pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_12, __pyx_v_quant_origin, __pyx_t_20); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 108, __pyx_L3_error) + __PYX_ERR(0, 121, __pyx_L5_error) } - __pyx_v_encoded_mesh = __pyx_t_20; + __pyx_v_encoded_mesh = __pyx_t_21; - /* "DracoPy.pyx":113 - * quantization_range, quant_origin, + /* "DracoPy.pyx":130 + * 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) { + __pyx_t_2 = ((__pyx_v_quant_origin != NULL) != 0); + if (__pyx_t_2) { - /* "DracoPy.pyx":114 + /* "DracoPy.pyx":131 * create_metadata) * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -4103,8 +4289,8 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":113 - * quantization_range, quant_origin, + /* "DracoPy.pyx":130 + * quant_origin, * create_metadata) * if quant_origin != NULL: # <<<<<<<<<<<<<< * PyMem_Free(quant_origin) @@ -4112,7 +4298,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":115 + /* "DracoPy.pyx":132 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -4122,7 +4308,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject switch (__pyx_v_encoded_mesh.encode_status) { case DracoFunctions::successful_encoding: - /* "DracoPy.pyx":116 + /* "DracoPy.pyx":133 * PyMem_Free(quant_origin) * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: * return bytes(encoded_mesh.buffer) # <<<<<<<<<<<<<< @@ -4130,16 +4316,16 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject * 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, 116, __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, 116, __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":115 + __pyx_t_3 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_encoded_mesh.buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 133, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 133, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L9_try_return; + + /* "DracoPy.pyx":132 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -4149,35 +4335,35 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject break; case DracoFunctions::failed_during_encoding: - /* "DracoPy.pyx":118 + /* "DracoPy.pyx":135 * 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, 118, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_21 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_21)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_21); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 135, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_7 = (__pyx_t_21) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_21, __pyx_kp_s_Invalid_mesh) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_s_Invalid_mesh); - __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0; - 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_Raise(__pyx_t_7, 0, 0, 0); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(0, 118, __pyx_L3_error) + __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s_Invalid_mesh) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_Invalid_mesh); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 135, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 135, __pyx_L5_error) - /* "DracoPy.pyx":117 + /* "DracoPy.pyx":134 * 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: # <<<<<<<<<<<<<< @@ -4188,52 +4374,52 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject default: break; } - /* "DracoPy.pyx":102 - * """ + /* "DracoPy.pyx":115 + * geometry_metadata = create_empty_geometry_metadata() * 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_21); __pyx_t_21 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L10_try_end; + __pyx_L5_error:; + __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; - /* "DracoPy.pyx":119 + /* "DracoPy.pyx":136 * elif encoded_mesh.encode_status == DracoPy.encoding_status.failed_during_encoding: * raise EncodingFailedException('Invalid mesh') * except EncodingFailedException: # <<<<<<<<<<<<<< * raise EncodingFailedException('Invalid mesh') * except Exception as e: */ - __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_6, &__pyx_t_21); - __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 119, __pyx_L5_except_error) + __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 136, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_22); - __pyx_t_18 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_7, __pyx_t_22); + __pyx_t_19 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_4, __pyx_t_22); __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; - __Pyx_ErrRestore(__pyx_t_7, __pyx_t_6, __pyx_t_21); - __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_21 = 0; - if (__pyx_t_18) { + __Pyx_ErrRestore(__pyx_t_4, __pyx_t_3, __pyx_t_5); + __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_5 = 0; + if (__pyx_t_19) { __Pyx_AddTraceback("DracoPy.encode_mesh_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_21, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 119, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_21); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 136, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_4); - /* "DracoPy.pyx":120 + /* "DracoPy.pyx":137 * raise EncodingFailedException('Invalid mesh') * except EncodingFailedException: * raise EncodingFailedException('Invalid mesh') # <<<<<<<<<<<<<< * except Exception as e: * import traceback */ - __Pyx_GetModuleGlobalName(__pyx_t_23, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 120, __pyx_L5_except_error) + __Pyx_GetModuleGlobalName(__pyx_t_23, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 137, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_23); __pyx_t_24 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_23))) { @@ -4247,51 +4433,51 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject } __pyx_t_22 = (__pyx_t_24) ? __Pyx_PyObject_Call2Args(__pyx_t_23, __pyx_t_24, __pyx_kp_s_Invalid_mesh) : __Pyx_PyObject_CallOneArg(__pyx_t_23, __pyx_kp_s_Invalid_mesh); __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0; - if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 120, __pyx_L5_except_error) + if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 137, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_22); __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; __Pyx_Raise(__pyx_t_22, 0, 0, 0); __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; - __PYX_ERR(0, 120, __pyx_L5_except_error) + __PYX_ERR(0, 137, __pyx_L7_except_error) } - /* "DracoPy.pyx":121 + /* "DracoPy.pyx":138 * except EncodingFailedException: * raise EncodingFailedException('Invalid mesh') * except Exception as e: # <<<<<<<<<<<<<< * import traceback * traceback.print_exc() */ - __pyx_t_18 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_18) { + __pyx_t_19 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + if (__pyx_t_19) { __Pyx_AddTraceback("DracoPy.encode_mesh_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_21) < 0) __PYX_ERR(0, 121, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_21); - __Pyx_INCREF(__pyx_t_6); - __pyx_v_e = __pyx_t_6; + if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5) < 0) __PYX_ERR(0, 138, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_t_3); + __pyx_v_e = __pyx_t_3; - /* "DracoPy.pyx":122 + /* "DracoPy.pyx":139 * raise EncodingFailedException('Invalid mesh') * except Exception as e: * import traceback # <<<<<<<<<<<<<< * traceback.print_exc() * if quant_origin != NULL: */ - __pyx_t_22 = __Pyx_Import(__pyx_n_s_traceback, 0, -1); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 122, __pyx_L5_except_error) + __pyx_t_22 = __Pyx_Import(__pyx_n_s_traceback, 0, -1); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 139, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_22); __pyx_v_traceback = __pyx_t_22; __pyx_t_22 = 0; - /* "DracoPy.pyx":123 + /* "DracoPy.pyx":140 * except Exception as e: * import traceback * traceback.print_exc() # <<<<<<<<<<<<<< * if quant_origin != NULL: * PyMem_Free(quant_origin) */ - __pyx_t_23 = __Pyx_PyObject_GetAttrStr(__pyx_v_traceback, __pyx_n_s_print_exc); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 123, __pyx_L5_except_error) + __pyx_t_23 = __Pyx_PyObject_GetAttrStr(__pyx_v_traceback, __pyx_n_s_print_exc); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 140, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_23); __pyx_t_24 = NULL; if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_23))) { @@ -4305,22 +4491,22 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject } __pyx_t_22 = (__pyx_t_24) ? __Pyx_PyObject_CallOneArg(__pyx_t_23, __pyx_t_24) : __Pyx_PyObject_CallNoArg(__pyx_t_23); __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0; - if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 123, __pyx_L5_except_error) + if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 140, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_22); __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; - /* "DracoPy.pyx":124 + /* "DracoPy.pyx":141 * import traceback * traceback.print_exc() * 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) { + __pyx_t_2 = ((__pyx_v_quant_origin != NULL) != 0); + if (__pyx_t_2) { - /* "DracoPy.pyx":125 + /* "DracoPy.pyx":142 * traceback.print_exc() * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -4329,7 +4515,7 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":124 + /* "DracoPy.pyx":141 * import traceback * traceback.print_exc() * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -4338,58 +4524,58 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":126 + /* "DracoPy.pyx":143 * if quant_origin != NULL: * PyMem_Free(quant_origin) * raise ValueError("Input invalid") # <<<<<<<<<<<<<< * - * def encode_point_cloud_to_buffer(points, point_cloud_object, + * def encode_point_cloud_to_buffer(points, */ - __pyx_t_22 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 126, __pyx_L5_except_error) + __pyx_t_22 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 143, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_22); __Pyx_Raise(__pyx_t_22, 0, 0, 0); __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; - __PYX_ERR(0, 126, __pyx_L5_except_error) + __PYX_ERR(0, 143, __pyx_L7_except_error) } - goto __pyx_L5_except_error; - __pyx_L5_except_error:; + goto __pyx_L7_except_error; + __pyx_L7_except_error:; - /* "DracoPy.pyx":102 - * """ + /* "DracoPy.pyx":115 + * geometry_metadata = create_empty_geometry_metadata() * 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); + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); 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); + __pyx_L9_try_return:; + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); goto __pyx_L0; - __pyx_L8_try_end:; + __pyx_L10_try_end:; } - /* "DracoPy.pyx":87 - * pass + /* "DracoPy.pyx":94 * - * def encode_mesh_to_buffer(points, faces, metadatas, # <<<<<<<<<<<<<< - * geometry_metadata, + * + * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< * quantization_bits=14, compression_level=1, + * quantization_range=-1, quantization_origin=None, */ /* 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_21); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_22); __Pyx_XDECREF(__pyx_t_23); __Pyx_XDECREF(__pyx_t_24); @@ -4400,31 +4586,34 @@ static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_XDECREF(__pyx_v_dim); __Pyx_XDECREF(__pyx_v_e); __Pyx_XDECREF(__pyx_v_traceback); + __Pyx_XDECREF(__pyx_v_metadatas); + __Pyx_XDECREF(__pyx_v_geometry_metadata); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "DracoPy.pyx":128 +/* "DracoPy.pyx":145 * raise ValueError("Input invalid") * - * def encode_point_cloud_to_buffer(points, point_cloud_object, # <<<<<<<<<<<<<< - * quantization_bits=14, compression_level=1, - * quantization_range=-1, quantization_origin=None, + * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< + * quantization_bits=14, + * compression_level=1, */ /* 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) { +static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7DracoPy_4encode_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_5encode_point_cloud_to_buffer = {"encode_point_cloud_to_buffer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7DracoPy_4encode_point_cloud_to_buffer}; +static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_points = 0; - PyObject *__pyx_v_point_cloud_object = 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; + PyObject *__pyx_v_metadatas = 0; + PyObject *__pyx_v_geometry_metadata = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -4432,33 +4621,53 @@ static PyObject *__pyx_pw_7DracoPy_3encode_point_cloud_to_buffer(PyObject *__pyx __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("encode_point_cloud_to_buffer (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_points,&__pyx_n_s_point_cloud_object,&__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); - - /* "DracoPy.pyx":130 - * def encode_point_cloud_to_buffer(points, point_cloud_object, - * quantization_bits=14, compression_level=1, - * quantization_range=-1, quantization_origin=None, # <<<<<<<<<<<<<< - * create_metadata=False): - * """ - */ - values[5] = ((PyObject *)Py_None); - - /* "DracoPy.pyx":131 - * quantization_bits=14, compression_level=1, - * quantization_range=-1, quantization_origin=None, - * create_metadata=False): # <<<<<<<<<<<<<< + 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,&__pyx_n_s_metadatas,&__pyx_n_s_geometry_metadata,0}; + PyObject* values[8] = {0,0,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":149 + * compression_level=1, + * quantization_range=-1, + * quantization_origin=None, # <<<<<<<<<<<<<< + * create_metadata=False, + * metadatas = None, + */ + values[4] = ((PyObject *)Py_None); + + /* "DracoPy.pyx":150 + * quantization_range=-1, + * quantization_origin=None, + * create_metadata=False, # <<<<<<<<<<<<<< + * metadatas = None, + * geometry_metadata = None, + */ + values[5] = ((PyObject *)Py_False); + + /* "DracoPy.pyx":151 + * quantization_origin=None, + * create_metadata=False, + * metadatas = None, # <<<<<<<<<<<<<< + * geometry_metadata = None, + * ): + */ + values[6] = ((PyObject *)Py_None); + + /* "DracoPy.pyx":152 + * create_metadata=False, + * metadatas = None, + * geometry_metadata = None, # <<<<<<<<<<<<<< + * ): * """ - * Encode a list or numpy array of points/vertices (float) to a draco buffer. */ - values[6] = ((PyObject *)Py_False); + values[7] = ((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 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + CYTHON_FALLTHROUGH; case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); @@ -4483,46 +4692,54 @@ static PyObject *__pyx_pw_7DracoPy_3encode_point_cloud_to_buffer(PyObject *__pyx else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_point_cloud_object)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("encode_point_cloud_to_buffer", 0, 2, 7, 1); __PYX_ERR(0, 128, __pyx_L3_error) + 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_quantization_bits); + 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_compression_level); + 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_range); + 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_quantization_origin); + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_create_metadata); 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); + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_metadatas); if (value) { values[6] = value; kw_args--; } } + CYTHON_FALLTHROUGH; + case 7: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geometry_metadata); + if (value) { values[7] = 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, 128, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode_point_cloud_to_buffer") < 0)) __PYX_ERR(0, 145, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + CYTHON_FALLTHROUGH; case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); @@ -4534,35 +4751,37 @@ static PyObject *__pyx_pw_7DracoPy_3encode_point_cloud_to_buffer(PyObject *__pyx 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); + 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_point_cloud_object = 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_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_metadatas = values[6]; + __pyx_v_geometry_metadata = values[7]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("encode_point_cloud_to_buffer", 0, 2, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 128, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode_point_cloud_to_buffer", 0, 1, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 145, __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_2encode_point_cloud_to_buffer(__pyx_self, __pyx_v_points, __pyx_v_point_cloud_object, __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_4encode_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_v_metadatas, __pyx_v_geometry_metadata); - /* "DracoPy.pyx":128 + /* "DracoPy.pyx":145 * raise ValueError("Input invalid") * - * def encode_point_cloud_to_buffer(points, point_cloud_object, # <<<<<<<<<<<<<< - * quantization_bits=14, compression_level=1, - * quantization_range=-1, quantization_origin=None, + * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< + * quantization_bits=14, + * compression_level=1, */ /* function exit code */ @@ -4570,51 +4789,133 @@ static PyObject *__pyx_pw_7DracoPy_3encode_point_cloud_to_buffer(PyObject *__pyx 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_point_cloud_object, 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) { +static PyObject *__pyx_pf_7DracoPy_4encode_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, PyObject *__pyx_v_metadatas, PyObject *__pyx_v_geometry_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; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + int __pyx_t_1; + int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; + PyObject *__pyx_t_4 = NULL; + 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; - struct DracoFunctions::PointCloudObject __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_8 = NULL; + size_t __pyx_t_9; + Py_ssize_t __pyx_t_10; + PyObject *(*__pyx_t_11)(PyObject *); + float __pyx_t_12; + Py_ssize_t __pyx_t_13; + std::vector __pyx_t_14; + std::vector __pyx_t_15; + struct DracoFunctions::GeometryMetadataObject __pyx_t_16; + int __pyx_t_17; + int __pyx_t_18; + bool __pyx_t_19; + struct DracoFunctions::EncodedObject __pyx_t_20; PyObject *__pyx_t_21 = NULL; PyObject *__pyx_t_22 = NULL; + PyObject *__pyx_t_23 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("encode_point_cloud_to_buffer", 0); + __Pyx_INCREF(__pyx_v_metadatas); + __Pyx_INCREF(__pyx_v_geometry_metadata); + + /* "DracoPy.pyx":163 + * a point where each coordinate is the minimum of that coordinate among the input vertices. + * """ + * if metadatas is None: # <<<<<<<<<<<<<< + * metadatas = [] + * if geometry_metadata is None: + */ + __pyx_t_1 = (__pyx_v_metadatas == Py_None); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { + + /* "DracoPy.pyx":164 + * """ + * if metadatas is None: + * metadatas = [] # <<<<<<<<<<<<<< + * if geometry_metadata is None: + * geometry_metadata = create_empty_geometry_metadata() + */ + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 164, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF_SET(__pyx_v_metadatas, __pyx_t_3); + __pyx_t_3 = 0; - /* "DracoPy.pyx":141 + /* "DracoPy.pyx":163 * a point where each coordinate is the minimum of that coordinate among the input vertices. * """ + * if metadatas is None: # <<<<<<<<<<<<<< + * metadatas = [] + * if geometry_metadata is None: + */ + } + + /* "DracoPy.pyx":165 + * if metadatas is None: + * metadatas = [] + * if geometry_metadata is None: # <<<<<<<<<<<<<< + * geometry_metadata = create_empty_geometry_metadata() + * cdef float* quant_origin = NULL + */ + __pyx_t_2 = (__pyx_v_geometry_metadata == Py_None); + __pyx_t_1 = (__pyx_t_2 != 0); + if (__pyx_t_1) { + + /* "DracoPy.pyx":166 + * metadatas = [] + * if geometry_metadata is None: + * geometry_metadata = create_empty_geometry_metadata() # <<<<<<<<<<<<<< + * cdef float* quant_origin = NULL + * try: + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_create_empty_geometry_metadata); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 166, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 166, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF_SET(__pyx_v_geometry_metadata, __pyx_t_3); + __pyx_t_3 = 0; + + /* "DracoPy.pyx":165 + * if metadatas is None: + * metadatas = [] + * if geometry_metadata is None: # <<<<<<<<<<<<<< + * geometry_metadata = create_empty_geometry_metadata() + * cdef float* quant_origin = NULL + */ + } + + /* "DracoPy.pyx":167 + * if geometry_metadata is None: + * geometry_metadata = create_empty_geometry_metadata() * cdef float* quant_origin = NULL # <<<<<<<<<<<<<< * try: * num_dims = 3 */ __pyx_v_quant_origin = NULL; - /* "DracoPy.pyx":142 - * """ + /* "DracoPy.pyx":168 + * geometry_metadata = create_empty_geometry_metadata() * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< * num_dims = 3 @@ -4623,13 +4924,13 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P { __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); + __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_6); + __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); /*try:*/ { - /* "DracoPy.pyx":143 + /* "DracoPy.pyx":169 * cdef float* quant_origin = NULL * try: * num_dims = 3 # <<<<<<<<<<<<<< @@ -4639,110 +4940,110 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_INCREF(__pyx_int_3); __pyx_v_num_dims = __pyx_int_3; - /* "DracoPy.pyx":144 + /* "DracoPy.pyx":170 * 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) { + __pyx_t_1 = (__pyx_v_quantization_origin != Py_None); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { - /* "DracoPy.pyx":145 + /* "DracoPy.pyx":171 * 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, 145, __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, 145, __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, 145, __pyx_L3_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_v_quant_origin = ((float *)PyMem_Malloc(__pyx_t_8)); + __pyx_t_3 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 171, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 171, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_9 = __Pyx_PyInt_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 171, __pyx_L5_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_quant_origin = ((float *)PyMem_Malloc(__pyx_t_9)); - /* "DracoPy.pyx":146 + /* "DracoPy.pyx":172 * 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] - * # binary_metadata = encode_metadata(metadata) + * encoded_point_cloud = DracoPy.encode_point_cloud( */ - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 146, __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; + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 172, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_4); + if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { + __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_10 = 0; + __pyx_t_11 = NULL; } else { - __pyx_t_9 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 146, __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, 146, __pyx_L3_error) + __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 172, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 172, __pyx_L5_error) } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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 (likely(!__pyx_t_11)) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_3)) 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, 146, __pyx_L3_error) + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 172, __pyx_L5_error) #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 146, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 172, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_4); #endif } else { - if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_6)) break; + if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_3)) 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, 146, __pyx_L3_error) + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 172, __pyx_L5_error) #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 146, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 172, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_4); #endif } } else { - __pyx_t_7 = __pyx_t_10(__pyx_t_6); - if (unlikely(!__pyx_t_7)) { + __pyx_t_4 = __pyx_t_11(__pyx_t_3); + 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(0, 146, __pyx_L3_error) + else __PYX_ERR(0, 172, __pyx_L5_error) } break; } - __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_4); } - __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_7); - __pyx_t_7 = 0; + __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_4); + __pyx_t_4 = 0; - /* "DracoPy.pyx":147 + /* "DracoPy.pyx":173 * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) * for dim in range(num_dims): * quant_origin[dim] = quantization_origin[dim] # <<<<<<<<<<<<<< - * # binary_metadata = encode_metadata(metadata) * encoded_point_cloud = DracoPy.encode_point_cloud( + * points, metadatas, geometry_metadata, */ - __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 147, __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, 147, __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, 147, __pyx_L3_error) - (__pyx_v_quant_origin[__pyx_t_12]) = __pyx_t_11; + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 173, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 173, __pyx_L5_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 173, __pyx_L5_error) + (__pyx_v_quant_origin[__pyx_t_13]) = __pyx_t_12; - /* "DracoPy.pyx":146 + /* "DracoPy.pyx":172 * 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] - * # binary_metadata = encode_metadata(metadata) + * encoded_point_cloud = DracoPy.encode_point_cloud( */ } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":144 + /* "DracoPy.pyx":170 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -4751,55 +5052,64 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ } - /* "DracoPy.pyx":150 - * # binary_metadata = encode_metadata(metadata) + /* "DracoPy.pyx":175 + * quant_origin[dim] = quantization_origin[dim] * encoded_point_cloud = DracoPy.encode_point_cloud( - * points, point_cloud_object, quantization_bits, compression_level, # <<<<<<<<<<<<<< - * quantization_range, quant_origin, create_metadata) - * if quant_origin != NULL: + * points, metadatas, geometry_metadata, # <<<<<<<<<<<<<< + * quantization_bits, compression_level, + * quantization_range, quant_origin, create_metadata, */ - __pyx_t_13 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 150, __pyx_L3_error) - __pyx_t_14 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointCloudObject(__pyx_v_point_cloud_object); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 150, __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, 150, __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, 150, __pyx_L3_error) + __pyx_t_14 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 175, __pyx_L5_error) + __pyx_t_15 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_metadatas); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 175, __pyx_L5_error) + __pyx_t_16 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_geometry_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 175, __pyx_L5_error) - /* "DracoPy.pyx":151 + /* "DracoPy.pyx":176 * encoded_point_cloud = DracoPy.encode_point_cloud( - * points, point_cloud_object, quantization_bits, compression_level, - * quantization_range, quant_origin, create_metadata) # <<<<<<<<<<<<<< + * points, metadatas, geometry_metadata, + * quantization_bits, compression_level, # <<<<<<<<<<<<<< + * quantization_range, quant_origin, create_metadata, + * ) + */ + __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 176, __pyx_L5_error) + __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 176, __pyx_L5_error) + + /* "DracoPy.pyx":177 + * points, metadatas, geometry_metadata, + * quantization_bits, compression_level, + * quantization_range, quant_origin, create_metadata, # <<<<<<<<<<<<<< + * ) * if quant_origin != NULL: - * PyMem_Free(quant_origin) */ - __pyx_t_11 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_11 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 151, __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, 151, __pyx_L3_error) + __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 177, __pyx_L5_error) + __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_19 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 177, __pyx_L5_error) - /* "DracoPy.pyx":149 + /* "DracoPy.pyx":174 + * for dim in range(num_dims): * quant_origin[dim] = quantization_origin[dim] - * # binary_metadata = encode_metadata(metadata) * encoded_point_cloud = DracoPy.encode_point_cloud( # <<<<<<<<<<<<<< - * points, point_cloud_object, quantization_bits, compression_level, - * quantization_range, quant_origin, create_metadata) + * points, metadatas, geometry_metadata, + * quantization_bits, compression_level, */ try { - __pyx_t_18 = DracoFunctions::encode_point_cloud(__pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_11, __pyx_v_quant_origin, __pyx_t_17); + __pyx_t_20 = DracoFunctions::encode_point_cloud(__pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_12, __pyx_v_quant_origin, __pyx_t_19); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 149, __pyx_L3_error) + __PYX_ERR(0, 174, __pyx_L5_error) } - __pyx_v_encoded_point_cloud = __pyx_t_18; + __pyx_v_encoded_point_cloud = __pyx_t_20; - /* "DracoPy.pyx":152 - * points, point_cloud_object, quantization_bits, compression_level, - * quantization_range, quant_origin, create_metadata) + /* "DracoPy.pyx":179 + * 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: */ - __pyx_t_5 = ((__pyx_v_quant_origin != NULL) != 0); - if (__pyx_t_5) { + __pyx_t_2 = ((__pyx_v_quant_origin != NULL) != 0); + if (__pyx_t_2) { - /* "DracoPy.pyx":153 - * quantization_range, quant_origin, create_metadata) + /* "DracoPy.pyx":180 + * ) * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: @@ -4807,16 +5117,16 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":152 - * points, point_cloud_object, quantization_bits, compression_level, - * quantization_range, quant_origin, create_metadata) + /* "DracoPy.pyx":179 + * 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":154 + /* "DracoPy.pyx":181 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -4826,7 +5136,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P switch (__pyx_v_encoded_point_cloud.encode_status) { case DracoFunctions::successful_encoding: - /* "DracoPy.pyx":155 + /* "DracoPy.pyx":182 * PyMem_Free(quant_origin) * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: * return bytes(encoded_point_cloud.buffer) # <<<<<<<<<<<<<< @@ -4834,16 +5144,16 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P * raise EncodingFailedException('Invalid point cloud') */ __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, 155, __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, 155, __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":154 + __pyx_t_3 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_encoded_point_cloud.buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 182, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 182, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L9_try_return; + + /* "DracoPy.pyx":181 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -4853,35 +5163,35 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P break; case DracoFunctions::failed_during_encoding: - /* "DracoPy.pyx":157 + /* "DracoPy.pyx":184 * 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, 157, __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_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __Pyx_DECREF_SET(__pyx_t_3, function); } } - __pyx_t_7 = (__pyx_t_19) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_19, __pyx_kp_s_Invalid_point_cloud) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_s_Invalid_point_cloud); - __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 157, __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, 157, __pyx_L3_error) + __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s_Invalid_point_cloud) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_Invalid_point_cloud); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 184, __pyx_L5_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 184, __pyx_L5_error) - /* "DracoPy.pyx":156 + /* "DracoPy.pyx":183 * 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: # <<<<<<<<<<<<<< @@ -4892,74 +5202,74 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P default: break; } - /* "DracoPy.pyx":142 - * """ + /* "DracoPy.pyx":168 + * geometry_metadata = create_empty_geometry_metadata() * 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; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L10_try_end; + __pyx_L5_error:; + __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; - /* "DracoPy.pyx":158 + /* "DracoPy.pyx":185 * 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_19); - __Pyx_GetModuleGlobalName(__pyx_t_20, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 158, __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_ErrFetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 185, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_21); + __pyx_t_18 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_4, __pyx_t_21); + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __Pyx_ErrRestore(__pyx_t_4, __pyx_t_3, __pyx_t_5); + __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_5 = 0; + if (__pyx_t_18) { __Pyx_AddTraceback("DracoPy.encode_point_cloud_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_19, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 158, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_19); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 185, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_4); - /* "DracoPy.pyx":159 + /* "DracoPy.pyx":186 * raise EncodingFailedException('Invalid point cloud') * except EncodingFailedException: * raise EncodingFailedException('Invalid point cloud') # <<<<<<<<<<<<<< * except: * if quant_origin != NULL: */ - __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 159, __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_GetModuleGlobalName(__pyx_t_22, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 186, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_22); + __pyx_t_23 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_22))) { + __pyx_t_23 = PyMethod_GET_SELF(__pyx_t_22); + if (likely(__pyx_t_23)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_22); + __Pyx_INCREF(__pyx_t_23); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_21, function); + __Pyx_DECREF_SET(__pyx_t_22, function); } } - __pyx_t_20 = (__pyx_t_22) ? __Pyx_PyObject_Call2Args(__pyx_t_21, __pyx_t_22, __pyx_kp_s_Invalid_point_cloud) : __Pyx_PyObject_CallOneArg(__pyx_t_21, __pyx_kp_s_Invalid_point_cloud); - __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0; - if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 159, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_20); + __pyx_t_21 = (__pyx_t_23) ? __Pyx_PyObject_Call2Args(__pyx_t_22, __pyx_t_23, __pyx_kp_s_Invalid_point_cloud) : __Pyx_PyObject_CallOneArg(__pyx_t_22, __pyx_kp_s_Invalid_point_cloud); + __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0; + if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 186, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_21); + __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; + __Pyx_Raise(__pyx_t_21, 0, 0, 0); __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, 159, __pyx_L5_except_error) + __PYX_ERR(0, 186, __pyx_L7_except_error) } - /* "DracoPy.pyx":160 + /* "DracoPy.pyx":187 * except EncodingFailedException: * raise EncodingFailedException('Invalid point cloud') * except: # <<<<<<<<<<<<<< @@ -4968,22 +5278,22 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ /*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_19) < 0) __PYX_ERR(0, 160, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_19); + if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5) < 0) __PYX_ERR(0, 187, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_5); - /* "DracoPy.pyx":161 + /* "DracoPy.pyx":188 * 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) { + __pyx_t_2 = ((__pyx_v_quant_origin != NULL) != 0); + if (__pyx_t_2) { - /* "DracoPy.pyx":162 + /* "DracoPy.pyx":189 * except: * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -4992,7 +5302,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":161 + /* "DracoPy.pyx":188 * raise EncodingFailedException('Invalid point cloud') * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -5001,71 +5311,73 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ } - /* "DracoPy.pyx":163 + /* "DracoPy.pyx":190 * if quant_origin != NULL: * PyMem_Free(quant_origin) * raise ValueError("Input invalid") # <<<<<<<<<<<<<< * * def raise_decoding_error(decoding_status): */ - __pyx_t_20 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 163, __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, 163, __pyx_L5_except_error) + __pyx_t_21 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 190, __pyx_L7_except_error) + __Pyx_GOTREF(__pyx_t_21); + __Pyx_Raise(__pyx_t_21, 0, 0, 0); + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __PYX_ERR(0, 190, __pyx_L7_except_error) } - __pyx_L5_except_error:; + __pyx_L7_except_error:; - /* "DracoPy.pyx":142 - * """ + /* "DracoPy.pyx":168 + * geometry_metadata = create_empty_geometry_metadata() * 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); + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); 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); + __pyx_L9_try_return:; + __Pyx_XGIVEREF(__pyx_t_6); + __Pyx_XGIVEREF(__pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); goto __pyx_L0; - __pyx_L8_try_end:; + __pyx_L10_try_end:; } - /* "DracoPy.pyx":128 + /* "DracoPy.pyx":145 * raise ValueError("Input invalid") * - * def encode_point_cloud_to_buffer(points, point_cloud_object, # <<<<<<<<<<<<<< - * quantization_bits=14, compression_level=1, - * quantization_range=-1, quantization_origin=None, + * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< + * quantization_bits=14, + * compression_level=1, */ /* 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_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_21); __Pyx_XDECREF(__pyx_t_22); + __Pyx_XDECREF(__pyx_t_23); __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_XDECREF(__pyx_v_metadatas); + __Pyx_XDECREF(__pyx_v_geometry_metadata); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "DracoPy.pyx":165 +/* "DracoPy.pyx":192 * raise ValueError("Input invalid") * * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< @@ -5074,20 +5386,20 @@ static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED P */ /* 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) { +static PyObject *__pyx_pw_7DracoPy_7raise_decoding_error(PyObject *__pyx_self, PyObject *__pyx_v_decoding_status); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_7raise_decoding_error = {"raise_decoding_error", (PyCFunction)__pyx_pw_7DracoPy_7raise_decoding_error, METH_O, 0}; +static PyObject *__pyx_pw_7DracoPy_7raise_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)); + __pyx_r = __pyx_pf_7DracoPy_6raise_decoding_error(__pyx_self, ((PyObject *)__pyx_v_decoding_status)); /* 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_6raise_decoding_error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_decoding_status) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -5099,29 +5411,29 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject int __pyx_clineno = 0; __Pyx_RefNannySetupContext("raise_decoding_error", 0); - /* "DracoPy.pyx":166 + /* "DracoPy.pyx":193 * * 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, 166, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::not_draco_encoded); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __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, 166, __pyx_L1_error) + __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, 193, __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, 166, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":167 + /* "DracoPy.pyx":194 * 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, 167, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FileTypeException); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { @@ -5135,14 +5447,14 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_kp_s_Input_mesh_is_not_draco_encoded) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_s_Input_mesh_is_not_draco_encoded); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 167, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __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, 167, __pyx_L1_error) + __PYX_ERR(0, 194, __pyx_L1_error) - /* "DracoPy.pyx":166 + /* "DracoPy.pyx":193 * * def raise_decoding_error(decoding_status): * if decoding_status == DracoPy.decoding_status.not_draco_encoded: # <<<<<<<<<<<<<< @@ -5151,35 +5463,35 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":168 + /* "DracoPy.pyx":195 * 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, 168, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::failed_during_decoding); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 195, __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, 168, __pyx_L1_error) + __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, 195, __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, 168, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 195, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":169 + /* "DracoPy.pyx":196 * 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__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 169, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 196, __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, 169, __pyx_L1_error) + __PYX_ERR(0, 196, __pyx_L1_error) - /* "DracoPy.pyx":168 + /* "DracoPy.pyx":195 * 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: # <<<<<<<<<<<<<< @@ -5188,35 +5500,35 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":170 + /* "DracoPy.pyx":197 * 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, 170, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::no_position_attribute); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __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, 170, __pyx_L1_error) + __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, 197, __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, 170, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 197, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":171 + /* "DracoPy.pyx":198 * 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__4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 171, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 198, __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, 171, __pyx_L1_error) + __PYX_ERR(0, 198, __pyx_L1_error) - /* "DracoPy.pyx":170 + /* "DracoPy.pyx":197 * 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: # <<<<<<<<<<<<<< @@ -5225,7 +5537,7 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":165 + /* "DracoPy.pyx":192 * raise ValueError("Input invalid") * * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< @@ -5248,7 +5560,7 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject return __pyx_r; } -/* "DracoPy.pyx":173 +/* "DracoPy.pyx":200 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer, deduplicate=False): # <<<<<<<<<<<<<< @@ -5257,9 +5569,9 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_7decode_buffer_to_mesh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_7decode_buffer_to_mesh = {"decode_buffer_to_mesh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_7decode_buffer_to_mesh, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_7DracoPy_7decode_buffer_to_mesh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7DracoPy_9decode_buffer_to_mesh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_9decode_buffer_to_mesh = {"decode_buffer_to_mesh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_9decode_buffer_to_mesh, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_7DracoPy_9decode_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; @@ -5296,7 +5608,7 @@ static PyObject *__pyx_pw_7DracoPy_7decode_buffer_to_mesh(PyObject *__pyx_self, } } 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, 173, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode_buffer_to_mesh") < 0)) __PYX_ERR(0, 200, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -5312,20 +5624,20 @@ static PyObject *__pyx_pw_7DracoPy_7decode_buffer_to_mesh(PyObject *__pyx_self, } 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, 173, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decode_buffer_to_mesh", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 200, __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_6decode_buffer_to_mesh(__pyx_self, __pyx_v_buffer, __pyx_v_deduplicate); + __pyx_r = __pyx_pf_7DracoPy_8decode_buffer_to_mesh(__pyx_self, __pyx_v_buffer, __pyx_v_deduplicate); /* 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, PyObject *__pyx_v_deduplicate) { +static PyObject *__pyx_pf_7DracoPy_8decode_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 @@ -5343,25 +5655,25 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject int __pyx_clineno = 0; __Pyx_RefNannySetupContext("decode_buffer_to_mesh", 0); - /* "DracoPy.pyx":174 + /* "DracoPy.pyx":201 * * def decode_buffer_to_mesh(buffer, deduplicate=False): * 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, 174, __pyx_L1_error) - __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 174, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_deduplicate); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 174, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 201, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 201, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_deduplicate); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 201, __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, 174, __pyx_L1_error) + __PYX_ERR(0, 201, __pyx_L1_error) } __pyx_v_mesh_struct = __pyx_t_4; - /* "DracoPy.pyx":175 + /* "DracoPy.pyx":202 * def decode_buffer_to_mesh(buffer, deduplicate=False): * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< @@ -5371,7 +5683,7 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject __pyx_t_5 = ((__pyx_v_mesh_struct.decode_status == DracoFunctions::successful) != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":176 + /* "DracoPy.pyx":203 * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: * return DracoMesh(mesh_struct) # <<<<<<<<<<<<<< @@ -5379,9 +5691,9 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject * 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, 176, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_DracoMesh); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 203, __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, 176, __pyx_L1_error) + __pyx_t_8 = __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(__pyx_v_mesh_struct); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { @@ -5396,14 +5708,14 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject __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, 176, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 203, __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":175 + /* "DracoPy.pyx":202 * def decode_buffer_to_mesh(buffer, deduplicate=False): * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< @@ -5412,7 +5724,7 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":178 + /* "DracoPy.pyx":205 * return DracoMesh(mesh_struct) * else: * raise_decoding_error(mesh_struct.decode_status) # <<<<<<<<<<<<<< @@ -5420,9 +5732,9 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject * 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, 178, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_raise_decoding_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 205, __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, 178, __pyx_L1_error) + __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, 205, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { @@ -5437,13 +5749,13 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject __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, 178, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 205, __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":173 + /* "DracoPy.pyx":200 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer, deduplicate=False): # <<<<<<<<<<<<<< @@ -5467,7 +5779,7 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject return __pyx_r; } -/* "DracoPy.pyx":180 +/* "DracoPy.pyx":207 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer, deduplicate=False): # <<<<<<<<<<<<<< @@ -5476,9 +5788,9 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_9decode_point_cloud_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_9decode_point_cloud_buffer = {"decode_point_cloud_buffer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_9decode_point_cloud_buffer, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_7DracoPy_9decode_point_cloud_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7DracoPy_11decode_point_cloud_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_11decode_point_cloud_buffer = {"decode_point_cloud_buffer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_11decode_point_cloud_buffer, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_7DracoPy_11decode_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; @@ -5515,7 +5827,7 @@ static PyObject *__pyx_pw_7DracoPy_9decode_point_cloud_buffer(PyObject *__pyx_se } } 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, 180, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode_point_cloud_buffer") < 0)) __PYX_ERR(0, 207, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -5531,20 +5843,20 @@ static PyObject *__pyx_pw_7DracoPy_9decode_point_cloud_buffer(PyObject *__pyx_se } 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, 180, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decode_point_cloud_buffer", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 207, __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_8decode_point_cloud_buffer(__pyx_self, __pyx_v_buffer, __pyx_v_deduplicate); + __pyx_r = __pyx_pf_7DracoPy_10decode_point_cloud_buffer(__pyx_self, __pyx_v_buffer, __pyx_v_deduplicate); /* 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, PyObject *__pyx_v_deduplicate) { +static PyObject *__pyx_pf_7DracoPy_10decode_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 @@ -5562,25 +5874,25 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb int __pyx_clineno = 0; __Pyx_RefNannySetupContext("decode_point_cloud_buffer", 0); - /* "DracoPy.pyx":181 + /* "DracoPy.pyx":208 * * def decode_point_cloud_buffer(buffer, deduplicate=False): * 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, 181, __pyx_L1_error) - __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 181, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_deduplicate); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 181, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_deduplicate); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 208, __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, 181, __pyx_L1_error) + __PYX_ERR(0, 208, __pyx_L1_error) } __pyx_v_point_cloud_struct = __pyx_t_4; - /* "DracoPy.pyx":182 + /* "DracoPy.pyx":209 * def decode_point_cloud_buffer(buffer, deduplicate=False): * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer), deduplicate) * if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< @@ -5590,7 +5902,7 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb __pyx_t_5 = ((__pyx_v_point_cloud_struct.decode_status == DracoFunctions::successful) != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":183 + /* "DracoPy.pyx":210 * 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) # <<<<<<<<<<<<<< @@ -5598,9 +5910,9 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb * 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, 183, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 210, __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, 183, __pyx_L1_error) + __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, 210, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { @@ -5615,14 +5927,14 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb __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, 183, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 210, __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":182 + /* "DracoPy.pyx":209 * def decode_point_cloud_buffer(buffer, deduplicate=False): * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer), deduplicate) * if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< @@ -5631,15 +5943,15 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb */ } - /* "DracoPy.pyx":185 + /* "DracoPy.pyx":212 * 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, 185, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_raise_decoding_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 212, __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, 185, __pyx_L1_error) + __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, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { @@ -5654,13 +5966,13 @@ static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyOb __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, 185, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 212, __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":180 + /* "DracoPy.pyx":207 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer, deduplicate=False): # <<<<<<<<<<<<<< @@ -7715,1115 +8027,76 @@ static PyObject *__pyx_convert_vector_to_py_unsigned_char(const 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; +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; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - double __pyx_t_5; + 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_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; + __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_float", 0); - /* "vector.from_py":49 - * for item in o: - * v.push_back(item) - * return v # <<<<<<<<<<<<<< + /* "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_r = __pyx_v_v; + __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.from_py":45 + /* "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())] * - * @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_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_XDECREF(__pyx_v_item); + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "FromPyStructUtility":11 - * - * @cname("__pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointCloudObject") - * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointCloudObject(obj) except *: # <<<<<<<<<<<<<< - * cdef struct_type result - * if not PyMapping_Check(obj): - */ - -static struct DracoFunctions::PointCloudObject __pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointCloudObject(PyObject *__pyx_v_obj) { - struct DracoFunctions::PointCloudObject __pyx_v_result; - PyObject *__pyx_v_value = NULL; - struct DracoFunctions::PointCloudObject __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 - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; + 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_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - std::vector __pyx_t_10; - bool __pyx_t_11; - double __pyx_t_12; - std::vector __pyx_t_13; - enum DracoFunctions::decoding_status __pyx_t_14; - struct DracoFunctions::GeometryMetadataObject __pyx_t_15; - std::vector __pyx_t_16; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointCloudObject", 0); - - /* "FromPyStructUtility":13 - * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointCloudObject(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_PointCloudObject(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['points'] - * 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['points'] # <<<<<<<<<<<<<< - * except KeyError: - * raise ValueError("No value specified for struct attribute 'points'") - */ - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_points); 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['points'] - * 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['points'] - * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'points'") - * result.points = 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_PointCloudObject", __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['points'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'points'") # <<<<<<<<<<<<<< - * result.points = 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['points'] - * 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 'points'") - * result.points = value # <<<<<<<<<<<<<< - * try: - * value = obj['encoding_options_set'] - */ - __pyx_t_10 = __pyx_convert_vector_from_py_float(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 20, __pyx_L1_error) - __pyx_v_result.points = __pyx_t_10; - - /* "FromPyStructUtility":21 - * raise ValueError("No value specified for struct attribute 'points'") - * result.points = value - * try: # <<<<<<<<<<<<<< - * value = obj['encoding_options_set'] - * 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.points = value - * try: - * value = obj['encoding_options_set'] # <<<<<<<<<<<<<< - * except KeyError: - * raise ValueError("No value specified for struct attribute 'encoding_options_set'") - */ - __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_encoding_options_set); 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 'points'") - * result.points = value - * try: # <<<<<<<<<<<<<< - * value = obj['encoding_options_set'] - * 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['encoding_options_set'] - * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'encoding_options_set'") - * result.encoding_options_set = 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_PointCloudObject", __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['encoding_options_set'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'encoding_options_set'") # <<<<<<<<<<<<<< - * result.encoding_options_set = value - * try: - */ - __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 'points'") - * result.points = value - * try: # <<<<<<<<<<<<<< - * value = obj['encoding_options_set'] - * 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 'encoding_options_set'") - * result.encoding_options_set = value # <<<<<<<<<<<<<< - * try: - * value = obj['quantization_bits'] - */ - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_v_value); if (unlikely((__pyx_t_11 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(1, 25, __pyx_L1_error) - __pyx_v_result.encoding_options_set = __pyx_t_11; - - /* "FromPyStructUtility":26 - * raise ValueError("No value specified for struct attribute 'encoding_options_set'") - * result.encoding_options_set = value - * try: # <<<<<<<<<<<<<< - * value = obj['quantization_bits'] - * 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.encoding_options_set = value - * try: - * value = obj['quantization_bits'] # <<<<<<<<<<<<<< - * except KeyError: - * raise ValueError("No value specified for struct attribute 'quantization_bits'") - */ - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_quantization_bits); 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 'encoding_options_set'") - * result.encoding_options_set = value - * try: # <<<<<<<<<<<<<< - * value = obj['quantization_bits'] - * 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['quantization_bits'] - * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'quantization_bits'") - * result.quantization_bits = 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_PointCloudObject", __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['quantization_bits'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'quantization_bits'") # <<<<<<<<<<<<<< - * result.quantization_bits = value - * try: - */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__14, 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 'encoding_options_set'") - * result.encoding_options_set = value - * try: # <<<<<<<<<<<<<< - * value = obj['quantization_bits'] - * 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 'quantization_bits'") - * result.quantization_bits = value # <<<<<<<<<<<<<< - * try: - * value = obj['quantization_range'] - */ - __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_v_value); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 30, __pyx_L1_error) - __pyx_v_result.quantization_bits = __pyx_t_6; - - /* "FromPyStructUtility":31 - * raise ValueError("No value specified for struct attribute 'quantization_bits'") - * result.quantization_bits = value - * try: # <<<<<<<<<<<<<< - * value = obj['quantization_range'] - * 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.quantization_bits = value - * try: - * value = obj['quantization_range'] # <<<<<<<<<<<<<< - * except KeyError: - * raise ValueError("No value specified for struct attribute 'quantization_range'") - */ - __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_quantization_range); 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 'quantization_bits'") - * result.quantization_bits = value - * try: # <<<<<<<<<<<<<< - * value = obj['quantization_range'] - * 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['quantization_range'] - * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'quantization_range'") - * result.quantization_range = 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_PointCloudObject", __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['quantization_range'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'quantization_range'") # <<<<<<<<<<<<<< - * result.quantization_range = value - * try: - */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, 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 'quantization_bits'") - * result.quantization_bits = value - * try: # <<<<<<<<<<<<<< - * value = obj['quantization_range'] - * 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 'quantization_range'") - * result.quantization_range = value # <<<<<<<<<<<<<< - * try: - * value = obj['quantization_origin'] - */ - __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_v_value); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 35, __pyx_L1_error) - __pyx_v_result.quantization_range = __pyx_t_12; - - /* "FromPyStructUtility":36 - * raise ValueError("No value specified for struct attribute 'quantization_range'") - * result.quantization_range = value - * try: # <<<<<<<<<<<<<< - * value = obj['quantization_origin'] - * 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":37 - * result.quantization_range = value - * try: - * value = obj['quantization_origin'] # <<<<<<<<<<<<<< - * except KeyError: - * raise ValueError("No value specified for struct attribute 'quantization_origin'") - */ - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 37, __pyx_L36_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2); - __pyx_t_2 = 0; - - /* "FromPyStructUtility":36 - * raise ValueError("No value specified for struct attribute 'quantization_range'") - * result.quantization_range = value - * try: # <<<<<<<<<<<<<< - * value = obj['quantization_origin'] - * 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_L41_try_end; - __pyx_L36_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":38 - * try: - * value = obj['quantization_origin'] - * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'quantization_origin'") - * result.quantization_origin = 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_PointCloudObject", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 38, __pyx_L38_except_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_8); - - /* "FromPyStructUtility":39 - * value = obj['quantization_origin'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'quantization_origin'") # <<<<<<<<<<<<<< - * result.quantization_origin = value - * try: - */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 39, __pyx_L38_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, 39, __pyx_L38_except_error) - } - goto __pyx_L38_except_error; - __pyx_L38_except_error:; - - /* "FromPyStructUtility":36 - * raise ValueError("No value specified for struct attribute 'quantization_range'") - * result.quantization_range = value - * try: # <<<<<<<<<<<<<< - * value = obj['quantization_origin'] - * 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_L41_try_end:; - } - - /* "FromPyStructUtility":40 - * except KeyError: - * raise ValueError("No value specified for struct attribute 'quantization_origin'") - * result.quantization_origin = value # <<<<<<<<<<<<<< - * try: - * value = obj['decode_status'] - */ - __pyx_t_13 = __pyx_convert_vector_from_py_double(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 40, __pyx_L1_error) - __pyx_v_result.quantization_origin = __pyx_t_13; - - /* "FromPyStructUtility":41 - * raise ValueError("No value specified for struct attribute 'quantization_origin'") - * result.quantization_origin = value - * try: # <<<<<<<<<<<<<< - * value = obj['decode_status'] - * 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":42 - * result.quantization_origin = value - * try: - * value = obj['decode_status'] # <<<<<<<<<<<<<< - * except KeyError: - * raise ValueError("No value specified for struct attribute 'decode_status'") - */ - __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_decode_status); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 42, __pyx_L44_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_8); - __pyx_t_8 = 0; - - /* "FromPyStructUtility":41 - * raise ValueError("No value specified for struct attribute 'quantization_origin'") - * result.quantization_origin = value - * try: # <<<<<<<<<<<<<< - * value = obj['decode_status'] - * 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_L49_try_end; - __pyx_L44_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":43 - * try: - * value = obj['decode_status'] - * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'decode_status'") - * result.decode_status = 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_PointCloudObject", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_2) < 0) __PYX_ERR(1, 43, __pyx_L46_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_2); - - /* "FromPyStructUtility":44 - * value = obj['decode_status'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'decode_status'") # <<<<<<<<<<<<<< - * result.decode_status = value - * try: - */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 44, __pyx_L46_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, 44, __pyx_L46_except_error) - } - goto __pyx_L46_except_error; - __pyx_L46_except_error:; - - /* "FromPyStructUtility":41 - * raise ValueError("No value specified for struct attribute 'quantization_origin'") - * result.quantization_origin = value - * try: # <<<<<<<<<<<<<< - * value = obj['decode_status'] - * 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_L49_try_end:; - } - - /* "FromPyStructUtility":45 - * except KeyError: - * raise ValueError("No value specified for struct attribute 'decode_status'") - * result.decode_status = value # <<<<<<<<<<<<<< - * try: - * value = obj['geometry_metadata'] - */ - __pyx_t_14 = ((enum DracoFunctions::decoding_status)__Pyx_PyInt_As_enum__DracoFunctions_3a__3a_decoding_status(__pyx_v_value)); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 45, __pyx_L1_error) - __pyx_v_result.decode_status = __pyx_t_14; - - /* "FromPyStructUtility":46 - * raise ValueError("No value specified for struct attribute 'decode_status'") - * result.decode_status = value - * try: # <<<<<<<<<<<<<< - * value = obj['geometry_metadata'] - * 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":47 - * result.decode_status = value - * try: - * value = obj['geometry_metadata'] # <<<<<<<<<<<<<< - * except KeyError: - * raise ValueError("No value specified for struct attribute 'geometry_metadata'") - */ - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_geometry_metadata); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 47, __pyx_L52_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2); - __pyx_t_2 = 0; - - /* "FromPyStructUtility":46 - * raise ValueError("No value specified for struct attribute 'decode_status'") - * result.decode_status = value - * try: # <<<<<<<<<<<<<< - * value = obj['geometry_metadata'] - * 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_L57_try_end; - __pyx_L52_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":48 - * try: - * value = obj['geometry_metadata'] - * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'geometry_metadata'") - * result.geometry_metadata = 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_PointCloudObject", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 48, __pyx_L54_except_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_8); - - /* "FromPyStructUtility":49 - * value = obj['geometry_metadata'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'geometry_metadata'") # <<<<<<<<<<<<<< - * result.geometry_metadata = value - * try: - */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 49, __pyx_L54_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, 49, __pyx_L54_except_error) - } - goto __pyx_L54_except_error; - __pyx_L54_except_error:; - - /* "FromPyStructUtility":46 - * raise ValueError("No value specified for struct attribute 'decode_status'") - * result.decode_status = value - * try: # <<<<<<<<<<<<<< - * value = obj['geometry_metadata'] - * 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_L57_try_end:; - } - - /* "FromPyStructUtility":50 - * except KeyError: - * raise ValueError("No value specified for struct attribute 'geometry_metadata'") - * result.geometry_metadata = value # <<<<<<<<<<<<<< - * try: - * value = obj['metadatas'] - */ - __pyx_t_15 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 50, __pyx_L1_error) - __pyx_v_result.geometry_metadata = __pyx_t_15; - - /* "FromPyStructUtility":51 - * raise ValueError("No value specified for struct attribute 'geometry_metadata'") - * result.geometry_metadata = value - * try: # <<<<<<<<<<<<<< - * value = obj['metadatas'] - * 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":52 - * result.geometry_metadata = value - * try: - * value = obj['metadatas'] # <<<<<<<<<<<<<< - * except KeyError: - * raise ValueError("No value specified for struct attribute 'metadatas'") - */ - __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_metadatas); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 52, __pyx_L60_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_8); - __pyx_t_8 = 0; - - /* "FromPyStructUtility":51 - * raise ValueError("No value specified for struct attribute 'geometry_metadata'") - * result.geometry_metadata = value - * try: # <<<<<<<<<<<<<< - * value = obj['metadatas'] - * 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_L65_try_end; - __pyx_L60_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":53 - * try: - * value = obj['metadatas'] - * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'metadatas'") - * result.metadatas = 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_PointCloudObject", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_2) < 0) __PYX_ERR(1, 53, __pyx_L62_except_error) - __Pyx_GOTREF(__pyx_t_8); - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_2); - - /* "FromPyStructUtility":54 - * value = obj['metadatas'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'metadatas'") # <<<<<<<<<<<<<< - * result.metadatas = value - * return result - */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 54, __pyx_L62_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, 54, __pyx_L62_except_error) - } - goto __pyx_L62_except_error; - __pyx_L62_except_error:; - - /* "FromPyStructUtility":51 - * raise ValueError("No value specified for struct attribute 'geometry_metadata'") - * result.geometry_metadata = value - * try: # <<<<<<<<<<<<<< - * value = obj['metadatas'] - * 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_L65_try_end:; - } - - /* "FromPyStructUtility":55 - * except KeyError: - * raise ValueError("No value specified for struct attribute 'metadatas'") - * result.metadatas = value # <<<<<<<<<<<<<< - * return result - * - */ - __pyx_t_16 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 55, __pyx_L1_error) - __pyx_v_result.metadatas = __pyx_t_16; - - /* "FromPyStructUtility":56 - * raise ValueError("No value specified for struct attribute 'metadatas'") - * result.metadatas = value - * return result # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_result; - goto __pyx_L0; - - /* "FromPyStructUtility":11 - * - * @cname("__pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointCloudObject") - * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointCloudObject(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_PointCloudObject", __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.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())] - * - */ - -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); + __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_unsigned_int", 0); /* "vector.to_py":61 * @cname("__pyx_convert_vector_to_py_unsigned_int") @@ -9734,20 +9007,12 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_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_10, __pyx_k_No_value_specified_for_struct_at_10, sizeof(__pyx_k_No_value_specified_for_struct_at_10), 0, 0, 1, 0}, - {&__pyx_kp_s_No_value_specified_for_struct_at_11, __pyx_k_No_value_specified_for_struct_at_11, sizeof(__pyx_k_No_value_specified_for_struct_at_11), 0, 0, 1, 0}, - {&__pyx_kp_s_No_value_specified_for_struct_at_12, __pyx_k_No_value_specified_for_struct_at_12, sizeof(__pyx_k_No_value_specified_for_struct_at_12), 0, 0, 1, 0}, - {&__pyx_kp_s_No_value_specified_for_struct_at_13, __pyx_k_No_value_specified_for_struct_at_13, sizeof(__pyx_k_No_value_specified_for_struct_at_13), 0, 0, 1, 0}, - {&__pyx_kp_s_No_value_specified_for_struct_at_14, __pyx_k_No_value_specified_for_struct_at_14, sizeof(__pyx_k_No_value_specified_for_struct_at_14), 0, 0, 1, 0}, - {&__pyx_kp_s_No_value_specified_for_struct_at_15, __pyx_k_No_value_specified_for_struct_at_15, sizeof(__pyx_k_No_value_specified_for_struct_at_15), 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_kp_s_No_value_specified_for_struct_at_8, __pyx_k_No_value_specified_for_struct_at_8, sizeof(__pyx_k_No_value_specified_for_struct_at_8), 0, 0, 1, 0}, - {&__pyx_kp_s_No_value_specified_for_struct_at_9, __pyx_k_No_value_specified_for_struct_at_9, sizeof(__pyx_k_No_value_specified_for_struct_at_9), 0, 0, 1, 0}, {&__pyx_kp_s_Specified_value_out_of_encoded_r, __pyx_k_Specified_value_out_of_encoded_r, sizeof(__pyx_k_Specified_value_out_of_encoded_r), 0, 0, 1, 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}, @@ -9755,6 +9020,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_empty_geometry_metadata, __pyx_k_create_empty_geometry_metadata, sizeof(__pyx_k_create_empty_geometry_metadata), 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, __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}, @@ -9800,7 +9066,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_object, __pyx_k_point_cloud_object, sizeof(__pyx_k_point_cloud_object), 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_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1}, @@ -9829,7 +9094,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) __PYX_ERR(0, 27, __pyx_L1_error) __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 66, __pyx_L1_error) __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 73, __pyx_L1_error) - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 169, __pyx_L1_error) + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 196, __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:; @@ -9851,36 +9116,36 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_); - /* "DracoPy.pyx":126 + /* "DracoPy.pyx":143 * if quant_origin != NULL: * PyMem_Free(quant_origin) * raise ValueError("Input invalid") # <<<<<<<<<<<<<< * - * def encode_point_cloud_to_buffer(points, point_cloud_object, + * def encode_point_cloud_to_buffer(points, */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_Input_invalid); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 126, __pyx_L1_error) + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_Input_invalid); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 143, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); - /* "DracoPy.pyx":169 + /* "DracoPy.pyx":196 * 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_s_Failed_to_decode_input_mesh_Data); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 169, __pyx_L1_error) + __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_Failed_to_decode_input_mesh_Data); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); - /* "DracoPy.pyx":171 + /* "DracoPy.pyx":198 * 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__4 = PyTuple_Pack(1, __pyx_kp_s_DracoPy_only_supports_meshes_wit); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 171, __pyx_L1_error) + __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_DracoPy_only_supports_meshes_wit); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 198, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4); @@ -9924,130 +9189,42 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * result.datatype = value * try: */ - __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_4); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); - - /* "FromPyStructUtility":29 - * value = obj['dimension'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'dimension'") # <<<<<<<<<<<<<< - * result.dimension = value - * try: - */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_5); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 29, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); - - /* "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__10 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_6); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__10); - __Pyx_GIVEREF(__pyx_tuple__10); - - /* "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__11 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_7); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__11); - __Pyx_GIVEREF(__pyx_tuple__11); - - /* "FromPyStructUtility":19 - * value = obj['points'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'points'") # <<<<<<<<<<<<<< - * result.points = value - * try: - */ - __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_8); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__12); - __Pyx_GIVEREF(__pyx_tuple__12); - - /* "FromPyStructUtility":24 - * value = obj['encoding_options_set'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'encoding_options_set'") # <<<<<<<<<<<<<< - * result.encoding_options_set = value - * try: - */ - __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_9); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__13); - __Pyx_GIVEREF(__pyx_tuple__13); - - /* "FromPyStructUtility":29 - * value = obj['quantization_bits'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'quantization_bits'") # <<<<<<<<<<<<<< - * result.quantization_bits = value - * try: - */ - __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_10); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 29, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__14); - __Pyx_GIVEREF(__pyx_tuple__14); - - /* "FromPyStructUtility":34 - * value = obj['quantization_range'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'quantization_range'") # <<<<<<<<<<<<<< - * result.quantization_range = value - * try: - */ - __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_11); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__15); - __Pyx_GIVEREF(__pyx_tuple__15); - - /* "FromPyStructUtility":39 - * value = obj['quantization_origin'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'quantization_origin'") # <<<<<<<<<<<<<< - * result.quantization_origin = value - * try: - */ - __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_12); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(1, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__16); - __Pyx_GIVEREF(__pyx_tuple__16); + __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_4); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__8); - /* "FromPyStructUtility":44 - * value = obj['decode_status'] + /* "FromPyStructUtility":29 + * value = obj['dimension'] * except KeyError: - * raise ValueError("No value specified for struct attribute 'decode_status'") # <<<<<<<<<<<<<< - * result.decode_status = value + * raise ValueError("No value specified for struct attribute 'dimension'") # <<<<<<<<<<<<<< + * result.dimension = value * try: */ - __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_13); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(1, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__17); - __Pyx_GIVEREF(__pyx_tuple__17); + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_5); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 29, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__9); + __Pyx_GIVEREF(__pyx_tuple__9); - /* "FromPyStructUtility":49 - * value = obj['geometry_metadata'] + /* "FromPyStructUtility":34 + * value = obj['metadata_id'] * except KeyError: - * raise ValueError("No value specified for struct attribute 'geometry_metadata'") # <<<<<<<<<<<<<< - * result.geometry_metadata = value - * try: + * raise ValueError("No value specified for struct attribute 'metadata_id'") # <<<<<<<<<<<<<< + * result.metadata_id = value + * return result */ - __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_14); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(1, 49, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__18); - __Pyx_GIVEREF(__pyx_tuple__18); + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_6); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__10); + __Pyx_GIVEREF(__pyx_tuple__10); - /* "FromPyStructUtility":54 - * value = obj['metadatas'] + /* "FromPyStructUtility":24 + * value = obj['generic_attributes'] * except KeyError: - * raise ValueError("No value specified for struct attribute 'metadatas'") # <<<<<<<<<<<<<< - * result.metadatas = value + * raise ValueError("No value specified for struct attribute 'generic_attributes'") # <<<<<<<<<<<<<< + * result.generic_attributes = value * return result */ - __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_15); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__19); - __Pyx_GIVEREF(__pyx_tuple__19); + __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_7); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__11); + __Pyx_GIVEREF(__pyx_tuple__11); /* "DracoPy.pyx":9 * @@ -10056,9 +9233,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * def __init__(self, data_struct): * self.data_struct = data_struct */ - __pyx_tuple__20 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__20); - __Pyx_GIVEREF(__pyx_tuple__20); + __pyx_tuple__12 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__12); + __Pyx_GIVEREF(__pyx_tuple__12); /* "DracoPy.pyx":10 * @@ -10067,10 +9244,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * self.data_struct = data_struct * if data_struct['encoding_options_set']: */ - __pyx_tuple__21 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_data_struct); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 10, __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_init, 10, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 10, __pyx_L1_error) + __pyx_tuple__13 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_data_struct); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__13); + __Pyx_GIVEREF(__pyx_tuple__13); + __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_init, 10, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 10, __pyx_L1_error) /* "DracoPy.pyx":19 * # self.metadata = decode_metadata(data_struct["binary_metadata"]) @@ -10079,10 +9256,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * if self.encoding_options is not None: * return self.encoding_options.get_encoded_coordinate(value, axis) */ - __pyx_tuple__23 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_value, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__23); - __Pyx_GIVEREF(__pyx_tuple__23); - __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 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, 19, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 19, __pyx_L1_error) + __pyx_tuple__15 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_value, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__15); + __Pyx_GIVEREF(__pyx_tuple__15); + __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_get_encoded_coordinate, 19, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 19, __pyx_L1_error) /* "DracoPy.pyx":23 * return self.encoding_options.get_encoded_coordinate(value, axis) @@ -10091,10 +9268,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * if self.encoding_options is not None: * return self.encoding_options.get_encoded_point(point) */ - __pyx_tuple__25 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_point); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 23, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__25); - __Pyx_GIVEREF(__pyx_tuple__25); - __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 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, 23, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 23, __pyx_L1_error) + __pyx_tuple__17 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_point); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 23, __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_get_encoded_point, 23, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 23, __pyx_L1_error) /* "DracoPy.pyx":28 * @@ -10103,10 +9280,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return 3 * */ - __pyx_tuple__27 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 28, __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, 28, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 28, __pyx_L1_error) + __pyx_tuple__19 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 28, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__19); + __Pyx_GIVEREF(__pyx_tuple__19); + __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_num_axes, 28, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 28, __pyx_L1_error) /* "DracoPy.pyx":32 * @@ -10115,10 +9292,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return self.data_struct['points'] * */ - __pyx_tuple__29 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 32, __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_points, 32, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 32, __pyx_L1_error) + __pyx_tuple__21 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__21); + __Pyx_GIVEREF(__pyx_tuple__21); + __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_points, 32, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 32, __pyx_L1_error) /* "DracoPy.pyx":36 * @@ -10127,10 +9304,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return self.data_struct['geometry_metadata'] * # */ - __pyx_tuple__31 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 36, __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_geometry_metadata, 36, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 36, __pyx_L1_error) + __pyx_tuple__23 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 36, __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_geometry_metadata, 36, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 36, __pyx_L1_error) /* "DracoPy.pyx":44 * @@ -10139,10 +9316,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return self.data_struct['metadatas'] * */ - __pyx_tuple__33 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 44, __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_metadatas, 44, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_tuple__25 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 44, __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_metadatas, 44, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 44, __pyx_L1_error) /* "DracoPy.pyx":50 * class DracoMesh(DracoPointCloud): @@ -10151,10 +9328,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return self.data_struct['faces'] * */ - __pyx_tuple__35 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__35); - __Pyx_GIVEREF(__pyx_tuple__35); - __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_faces, 50, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 50, __pyx_L1_error) + __pyx_tuple__27 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 50, __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_faces, 50, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 50, __pyx_L1_error) /* "DracoPy.pyx":54 * @@ -10163,10 +9340,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return self.data_struct['normals'] * */ - __pyx_tuple__37 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__37); - __Pyx_GIVEREF(__pyx_tuple__37); - __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_normals, 54, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 54, __pyx_L1_error) + __pyx_tuple__29 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 54, __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_normals, 54, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 54, __pyx_L1_error) /* "DracoPy.pyx":57 * return self.data_struct['normals'] @@ -10175,9 +9352,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * def __init__(self, quantization_bits, quantization_range, quantization_origin): * self.quantization_bits = quantization_bits */ - __pyx_tuple__39 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__39); - __Pyx_GIVEREF(__pyx_tuple__39); + __pyx_tuple__31 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__31); + __Pyx_GIVEREF(__pyx_tuple__31); /* "DracoPy.pyx":58 * @@ -10186,10 +9363,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * self.quantization_bits = quantization_bits * self.quantization_range = quantization_range */ - __pyx_tuple__40 = 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__40)) __PYX_ERR(0, 58, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__40); - __Pyx_GIVEREF(__pyx_tuple__40); - __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(4, 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_init, 58, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 58, __pyx_L1_error) + __pyx_tuple__32 = 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__32)) __PYX_ERR(0, 58, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__32); + __Pyx_GIVEREF(__pyx_tuple__32); + __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_init, 58, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 58, __pyx_L1_error) /* "DracoPy.pyx":64 * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) @@ -10198,10 +9375,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * 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__42 = 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__42)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__42); - __Pyx_GIVEREF(__pyx_tuple__42); - __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_get_encoded_coordinate, 64, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_tuple__34 = 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__34)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__34); + __Pyx_GIVEREF(__pyx_tuple__34); + __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_get_encoded_coordinate, 64, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 64, __pyx_L1_error) /* "DracoPy.pyx":71 * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) @@ -10210,10 +9387,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * encoded_point = [] * for axis in range(self.num_axes): */ - __pyx_tuple__44 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_point, __pyx_n_s_encoded_point, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 71, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__44); - __Pyx_GIVEREF(__pyx_tuple__44); - __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_get_encoded_point, 71, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 71, __pyx_L1_error) + __pyx_tuple__36 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_point, __pyx_n_s_encoded_point, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 71, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__36); + __Pyx_GIVEREF(__pyx_tuple__36); + __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(2, 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_get_encoded_point, 71, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 71, __pyx_L1_error) /* "DracoPy.pyx":78 * @@ -10222,70 +9399,79 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return 3 * */ - __pyx_tuple__46 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 78, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__46); - __Pyx_GIVEREF(__pyx_tuple__46); - __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_num_axes, 78, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_tuple__38 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__38); + __Pyx_GIVEREF(__pyx_tuple__38); + __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_num_axes, 78, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 78, __pyx_L1_error) /* "DracoPy.pyx":87 * pass * - * def encode_mesh_to_buffer(points, faces, metadatas, # <<<<<<<<<<<<<< - * geometry_metadata, + * def create_empty_geometry_metadata() -> dict: # <<<<<<<<<<<<<< + * return { + * "metadata_id": 0, + */ + __pyx_codeobj__40 = (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, 87, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 87, __pyx_L1_error) + + /* "DracoPy.pyx":94 + * + * + * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< * quantization_bits=14, compression_level=1, + * quantization_range=-1, quantization_origin=None, */ - __pyx_tuple__48 = PyTuple_Pack(15, __pyx_n_s_points, __pyx_n_s_faces, __pyx_n_s_metadatas, __pyx_n_s_geometry_metadata, __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, __pyx_n_s_e, __pyx_n_s_traceback); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 87, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__48); - __Pyx_GIVEREF(__pyx_tuple__48); - __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(9, 0, 15, 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_mesh_to_buffer, 87, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_tuple__41 = PyTuple_Pack(15, __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_metadatas, __pyx_n_s_geometry_metadata, __pyx_n_s_quant_origin, __pyx_n_s_num_dims, __pyx_n_s_dim, __pyx_n_s_encoded_mesh, __pyx_n_s_e, __pyx_n_s_traceback); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 94, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__41); + __Pyx_GIVEREF(__pyx_tuple__41); + __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(9, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_encode_mesh_to_buffer, 94, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 94, __pyx_L1_error) - /* "DracoPy.pyx":128 + /* "DracoPy.pyx":145 * raise ValueError("Input invalid") * - * def encode_point_cloud_to_buffer(points, point_cloud_object, # <<<<<<<<<<<<<< - * quantization_bits=14, compression_level=1, - * quantization_range=-1, quantization_origin=None, + * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< + * quantization_bits=14, + * compression_level=1, */ - __pyx_tuple__50 = PyTuple_Pack(11, __pyx_n_s_points, __pyx_n_s_point_cloud_object, __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__50)) __PYX_ERR(0, 128, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__50); - __Pyx_GIVEREF(__pyx_tuple__50); - __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(7, 0, 11, 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_point_cloud_to_buffer, 128, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 128, __pyx_L1_error) + __pyx_tuple__43 = PyTuple_Pack(12, __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_metadatas, __pyx_n_s_geometry_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__43)) __PYX_ERR(0, 145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__43); + __Pyx_GIVEREF(__pyx_tuple__43); + __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(8, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_encode_point_cloud_to_buffer, 145, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 145, __pyx_L1_error) - /* "DracoPy.pyx":165 + /* "DracoPy.pyx":192 * 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, 165, __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, 165, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 165, __pyx_L1_error) + __pyx_tuple__45 = PyTuple_Pack(1, __pyx_n_s_decoding_status); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 192, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__45); + __Pyx_GIVEREF(__pyx_tuple__45); + __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_raise_decoding_error, 192, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 192, __pyx_L1_error) - /* "DracoPy.pyx":173 + /* "DracoPy.pyx":200 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer, deduplicate=False): # <<<<<<<<<<<<<< * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: */ - __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, 173, __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, 173, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 173, __pyx_L1_error) + __pyx_tuple__47 = PyTuple_Pack(3, __pyx_n_s_buffer, __pyx_n_s_deduplicate, __pyx_n_s_mesh_struct); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 200, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__47); + __Pyx_GIVEREF(__pyx_tuple__47); + __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_buffer_to_mesh, 200, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) __PYX_ERR(0, 200, __pyx_L1_error) - /* "DracoPy.pyx":180 + /* "DracoPy.pyx":207 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer, deduplicate=False): # <<<<<<<<<<<<<< * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer), deduplicate) * if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: */ - __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, 180, __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, 180, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 180, __pyx_L1_error) + __pyx_tuple__49 = PyTuple_Pack(3, __pyx_n_s_buffer, __pyx_n_s_deduplicate, __pyx_n_s_point_cloud_struct); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 207, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__49); + __Pyx_GIVEREF(__pyx_tuple__49); + __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_point_cloud_buffer, 207, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -10296,6 +9482,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { 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) @@ -10630,9 +9817,9 @@ if (!__Pyx_RefNanny) { * def __init__(self, data_struct): * self.data_struct = data_struct */ - __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__20); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__20, __pyx_n_s_DracoPointCloud, __pyx_n_s_DracoPointCloud, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error) + __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__12, __pyx_n_s_DracoPointCloud, __pyx_n_s_DracoPointCloud, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); /* "DracoPy.pyx":10 @@ -10642,7 +9829,7 @@ if (!__Pyx_RefNanny) { * 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__22)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 10, __pyx_L1_error) + __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__14)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 10, __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, 10, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -10654,7 +9841,7 @@ if (!__Pyx_RefNanny) { * 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__24)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 19, __pyx_L1_error) + __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__16)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 19, __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, 19, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -10666,7 +9853,7 @@ if (!__Pyx_RefNanny) { * 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__26)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 23, __pyx_L1_error) + __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__18)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 23, __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, 23, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -10678,7 +9865,7 @@ if (!__Pyx_RefNanny) { * 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__28)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error) + __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__20)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); /* "DracoPy.pyx":27 @@ -10710,7 +9897,7 @@ if (!__Pyx_RefNanny) { __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, 32, __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__30)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 32, __pyx_L1_error) + __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__22)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 32, __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; @@ -10741,7 +9928,7 @@ if (!__Pyx_RefNanny) { __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_t_5) < 0) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __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__32)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 36, __pyx_L1_error) + __pyx_t_5 = __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__24)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 36, __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; @@ -10778,7 +9965,7 @@ if (!__Pyx_RefNanny) { __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, 44, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_13metadatas, 0, __pyx_n_s_DracoPointCloud_metadatas, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_13metadatas, 0, __pyx_n_s_DracoPointCloud_metadatas, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 44, __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; @@ -10803,7 +9990,7 @@ if (!__Pyx_RefNanny) { * def __init__(self, data_struct): * self.data_struct = data_struct */ - __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoPointCloud, __pyx_tuple__20, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 9, __pyx_L1_error) + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoPointCloud, __pyx_tuple__12, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoPointCloud, __pyx_t_4) < 0) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -10845,7 +10032,7 @@ if (!__Pyx_RefNanny) { __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_return, __pyx_t_5) < 0) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_9DracoMesh_1faces, 0, __pyx_n_s_DracoMesh_faces, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__36)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 50, __pyx_L1_error) + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_9DracoMesh_1faces, 0, __pyx_n_s_DracoMesh_faces, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; @@ -10870,7 +10057,7 @@ if (!__Pyx_RefNanny) { * return self.data_struct['normals'] * */ - __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_9DracoMesh_3normals, 0, __pyx_n_s_DracoMesh_normals, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__38)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 54, __pyx_L1_error) + __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_9DracoMesh_3normals, 0, __pyx_n_s_DracoMesh_normals, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); /* "DracoPy.pyx":53 @@ -10908,9 +10095,9 @@ if (!__Pyx_RefNanny) { * def __init__(self, quantization_bits, quantization_range, quantization_origin): * self.quantization_bits = quantization_bits */ - __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__39); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error) + __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__31); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_tuple__39, __pyx_n_s_EncodingOptions, __pyx_n_s_EncodingOptions, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error) + __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_tuple__31, __pyx_n_s_EncodingOptions, __pyx_n_s_EncodingOptions, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); /* "DracoPy.pyx":58 @@ -10920,7 +10107,7 @@ if (!__Pyx_RefNanny) { * 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__41)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __pyx_L1_error) + __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__33)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __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, 58, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -10932,7 +10119,7 @@ if (!__Pyx_RefNanny) { * 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__43)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 64, __pyx_L1_error) + __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__35)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 64, __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, 64, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -10944,7 +10131,7 @@ if (!__Pyx_RefNanny) { * 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__45)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error) + __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__37)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __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, 71, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -10956,7 +10143,7 @@ if (!__Pyx_RefNanny) { * 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__47)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L1_error) + __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__39)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); /* "DracoPy.pyx":77 @@ -10979,7 +10166,7 @@ if (!__Pyx_RefNanny) { * def __init__(self, quantization_bits, quantization_range, quantization_origin): * self.quantization_bits = quantization_bits */ - __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_EncodingOptions, __pyx_tuple__39, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 57, __pyx_L1_error) + __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_EncodingOptions, __pyx_tuple__31, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingOptions, __pyx_t_5) < 0) __PYX_ERR(0, 57, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -11037,61 +10224,73 @@ if (!__Pyx_RefNanny) { /* "DracoPy.pyx":87 * pass * - * def encode_mesh_to_buffer(points, faces, metadatas, # <<<<<<<<<<<<<< - * geometry_metadata, + * def create_empty_geometry_metadata() -> dict: # <<<<<<<<<<<<<< + * return { + * "metadata_id": 0, + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_1create_empty_geometry_metadata, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __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, 87, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":94 + * + * + * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< * quantization_bits=14, compression_level=1, + * quantization_range=-1, quantization_origin=None, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_1encode_mesh_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_3encode_mesh_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __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, 87, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_mesh_to_buffer, __pyx_t_2) < 0) __PYX_ERR(0, 94, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":128 + /* "DracoPy.pyx":145 * raise ValueError("Input invalid") * - * def encode_point_cloud_to_buffer(points, point_cloud_object, # <<<<<<<<<<<<<< - * quantization_bits=14, compression_level=1, - * quantization_range=-1, quantization_origin=None, + * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< + * quantization_bits=14, + * compression_level=1, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_3encode_point_cloud_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 128, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_5encode_point_cloud_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 145, __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, 128, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_point_cloud_to_buffer, __pyx_t_2) < 0) __PYX_ERR(0, 145, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":165 + /* "DracoPy.pyx":192 * 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_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_5raise_decoding_error, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 165, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_7raise_decoding_error, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_raise_decoding_error, __pyx_t_2) < 0) __PYX_ERR(0, 165, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_raise_decoding_error, __pyx_t_2) < 0) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":173 + /* "DracoPy.pyx":200 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer, deduplicate=False): # <<<<<<<<<<<<<< * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_7decode_buffer_to_mesh, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 173, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_9decode_buffer_to_mesh, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 200, __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, 173, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode_buffer_to_mesh, __pyx_t_2) < 0) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":180 + /* "DracoPy.pyx":207 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer, deduplicate=False): # <<<<<<<<<<<<<< * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer), deduplicate) * if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_9decode_point_cloud_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 180, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_11decode_point_cloud_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __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, 180, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode_point_cloud_buffer, __pyx_t_2) < 0) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "DracoPy.pyx":1 @@ -12230,6 +11429,28 @@ static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floa } #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 + /* GetTopmostException */ #if CYTHON_USE_EXC_INFO_STACK static _PyErr_StackItem * @@ -12550,28 +11771,6 @@ static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tsta return module; } -/* 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 - /* IterFinish */ static CYTHON_INLINE int __Pyx_IterFinish(void) { #if CYTHON_FAST_THREAD_STATE @@ -14881,202 +14080,6 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu } } -/* CIntFromPy */ - static CYTHON_INLINE enum DracoFunctions::decoding_status __Pyx_PyInt_As_enum__DracoFunctions_3a__3a_decoding_status(PyObject *x) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - const enum DracoFunctions::decoding_status neg_one = (enum DracoFunctions::decoding_status) -1, const_zero = (enum DracoFunctions::decoding_status) 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(enum DracoFunctions::decoding_status) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(enum DracoFunctions::decoding_status, long, PyInt_AS_LONG(x)) - } else { - long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { - goto raise_neg_overflow; - } - return (enum DracoFunctions::decoding_status) 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 (enum DracoFunctions::decoding_status) 0; - case 1: __PYX_VERIFY_RETURN_INT(enum DracoFunctions::decoding_status, digit, digits[0]) - case 2: - if (8 * sizeof(enum DracoFunctions::decoding_status) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum DracoFunctions::decoding_status, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(enum DracoFunctions::decoding_status) >= 2 * PyLong_SHIFT) { - return (enum DracoFunctions::decoding_status) (((((enum DracoFunctions::decoding_status)digits[1]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[0])); - } - } - break; - case 3: - if (8 * sizeof(enum DracoFunctions::decoding_status) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum DracoFunctions::decoding_status, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(enum DracoFunctions::decoding_status) >= 3 * PyLong_SHIFT) { - return (enum DracoFunctions::decoding_status) (((((((enum DracoFunctions::decoding_status)digits[2]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[1]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[0])); - } - } - break; - case 4: - if (8 * sizeof(enum DracoFunctions::decoding_status) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum DracoFunctions::decoding_status, 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 DracoFunctions::decoding_status) >= 4 * PyLong_SHIFT) { - return (enum DracoFunctions::decoding_status) (((((((((enum DracoFunctions::decoding_status)digits[3]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[2]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[1]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)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 (enum DracoFunctions::decoding_status) -1; - if (unlikely(result == 1)) - goto raise_neg_overflow; - } -#endif - if (sizeof(enum DracoFunctions::decoding_status) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(enum DracoFunctions::decoding_status, unsigned long, PyLong_AsUnsignedLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(enum DracoFunctions::decoding_status) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(enum DracoFunctions::decoding_status, 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 (enum DracoFunctions::decoding_status) 0; - case -1: __PYX_VERIFY_RETURN_INT(enum DracoFunctions::decoding_status, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(enum DracoFunctions::decoding_status, digit, +digits[0]) - case -2: - if (8 * sizeof(enum DracoFunctions::decoding_status) - 1 > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum DracoFunctions::decoding_status, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(enum DracoFunctions::decoding_status) - 1 > 2 * PyLong_SHIFT) { - return (enum DracoFunctions::decoding_status) (((enum DracoFunctions::decoding_status)-1)*(((((enum DracoFunctions::decoding_status)digits[1]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[0]))); - } - } - break; - case 2: - if (8 * sizeof(enum DracoFunctions::decoding_status) > 1 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum DracoFunctions::decoding_status, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(enum DracoFunctions::decoding_status) - 1 > 2 * PyLong_SHIFT) { - return (enum DracoFunctions::decoding_status) ((((((enum DracoFunctions::decoding_status)digits[1]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[0]))); - } - } - break; - case -3: - if (8 * sizeof(enum DracoFunctions::decoding_status) - 1 > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum DracoFunctions::decoding_status, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(enum DracoFunctions::decoding_status) - 1 > 3 * PyLong_SHIFT) { - return (enum DracoFunctions::decoding_status) (((enum DracoFunctions::decoding_status)-1)*(((((((enum DracoFunctions::decoding_status)digits[2]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[1]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[0]))); - } - } - break; - case 3: - if (8 * sizeof(enum DracoFunctions::decoding_status) > 2 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum DracoFunctions::decoding_status, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(enum DracoFunctions::decoding_status) - 1 > 3 * PyLong_SHIFT) { - return (enum DracoFunctions::decoding_status) ((((((((enum DracoFunctions::decoding_status)digits[2]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[1]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[0]))); - } - } - break; - case -4: - if (8 * sizeof(enum DracoFunctions::decoding_status) - 1 > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum DracoFunctions::decoding_status, 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 DracoFunctions::decoding_status) - 1 > 4 * PyLong_SHIFT) { - return (enum DracoFunctions::decoding_status) (((enum DracoFunctions::decoding_status)-1)*(((((((((enum DracoFunctions::decoding_status)digits[3]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[2]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[1]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[0]))); - } - } - break; - case 4: - if (8 * sizeof(enum DracoFunctions::decoding_status) > 3 * PyLong_SHIFT) { - if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(enum DracoFunctions::decoding_status, 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 DracoFunctions::decoding_status) - 1 > 4 * PyLong_SHIFT) { - return (enum DracoFunctions::decoding_status) ((((((((((enum DracoFunctions::decoding_status)digits[3]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[2]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[1]) << PyLong_SHIFT) | (enum DracoFunctions::decoding_status)digits[0]))); - } - } - break; - } -#endif - if (sizeof(enum DracoFunctions::decoding_status) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(enum DracoFunctions::decoding_status, long, PyLong_AsLong(x)) -#ifdef HAVE_LONG_LONG - } else if (sizeof(enum DracoFunctions::decoding_status) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(enum DracoFunctions::decoding_status, 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 DracoFunctions::decoding_status 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 DracoFunctions::decoding_status) -1; - } - } else { - enum DracoFunctions::decoding_status val; - PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (enum DracoFunctions::decoding_status) -1; - val = __Pyx_PyInt_As_enum__DracoFunctions_3a__3a_decoding_status(tmp); - Py_DECREF(tmp); - return val; - } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to enum DracoFunctions::decoding_status"); - return (enum DracoFunctions::decoding_status) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to enum DracoFunctions::decoding_status"); - return (enum DracoFunctions::decoding_status) -1; -} - /* CIntToPy */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(enum DracoFunctions::decoding_status value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC diff --git a/src/DracoPy.h b/src/DracoPy.h index cc0fa98..d8d3e63 100644 --- a/src/DracoPy.h +++ b/src/DracoPy.h @@ -50,9 +50,9 @@ namespace DracoFunctions { decoding_status decode_status; - // so far Geometry + // geometry metadata + attributes GeometryMetadataObject geometry_metadata; - // contains + // contains all metadata here std::vector metadatas; }; @@ -406,9 +406,13 @@ namespace DracoFunctions { return encodedMeshObject; } - EncodedObject encode_point_cloud(const std::vector &points, const PointCloudObject& pco, - int quantization_bits, int compression_level, - float quantization_range, const float *quantization_origin, + EncodedObject encode_point_cloud(const std::vector &points, + const std::vector& metadatas, + const GeometryMetadataObject& geometry_metadata_object, + int quantization_bits, + int compression_level, + float quantization_range, + const float *quantization_origin, bool create_metadata) { int num_points = points.size() / 3; draco::PointCloudBuilder pcb; @@ -422,7 +426,7 @@ namespace DracoFunctions { std::unique_ptr ptr_point_cloud = pcb.Finalize(true); draco::PointCloud *point_cloud = ptr_point_cloud.get(); - encode_geometry_metadata(*point_cloud, pco.metadatas, pco.geometry_metadata); + encode_geometry_metadata(*point_cloud, metadatas, geometry_metadata_object); draco::Encoder encoder; setup_encoder_and_metadata(point_cloud, encoder, compression_level, quantization_bits, quantization_range, quantization_origin, create_metadata); diff --git a/src/DracoPy.pxd b/src/DracoPy.pxd index 2b1053d..c272bae 100644 --- a/src/DracoPy.pxd +++ b/src/DracoPy.pxd @@ -103,12 +103,20 @@ cdef extern from "DracoPy.h" namespace "DracoFunctions": vector[uint32_t] faces, vector[MetadataObject] metadatas, GeometryMetadataObject geometry_metadata, - int quantization_bits, int compression_level, - float quantization_range, const float *quantization_origin, - bool create_metadata) except + + int quantization_bits, + int compression_level, + float quantization_range, + const float *quantization_origin, + bool create_metadata + ) except + EncodedObject encode_point_cloud( - vector[float] points, PointCloudObject pco, - int quantization_bits, int compression_level, - float quantization_range, const float *quantization_origin, - bool create_metadata) except + + vector[float] points, + vector[MetadataObject] metadatas, + GeometryMetadataObject geometry_metadata_object, + int quantization_bits, + int compression_level, + float quantization_range, + const float *quantization_origin, + bool create_metadata + ) except + diff --git a/src/DracoPy.pyx b/src/DracoPy.pyx index 8c93f81..f0cd87c 100644 --- a/src/DracoPy.pyx +++ b/src/DracoPy.pyx @@ -84,11 +84,20 @@ class FileTypeException(Exception): class EncodingFailedException(Exception): pass -def encode_mesh_to_buffer(points, faces, metadatas, - geometry_metadata, +def create_empty_geometry_metadata() -> dict: + return { + "metadata_id": 0, + "generic_attributes": [], + } + + +def encode_mesh_to_buffer(points, faces, quantization_bits=14, compression_level=1, quantization_range=-1, quantization_origin=None, - create_metadata=False): + create_metadata=False, + metadatas = None, + geometry_metadata = None, + ): """ 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 @@ -98,6 +107,10 @@ def encode_mesh_to_buffer(points, faces, metadatas, 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. """ + 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 @@ -105,10 +118,14 @@ def encode_mesh_to_buffer(points, faces, metadatas, 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, metadatas, + encoded_mesh = DracoPy.encode_mesh(points, + faces, + metadatas, geometry_metadata, - quantization_bits, compression_level, - quantization_range, quant_origin, + quantization_bits, + compression_level, + quantization_range, + quant_origin, create_metadata) if quant_origin != NULL: PyMem_Free(quant_origin) @@ -125,10 +142,15 @@ def encode_mesh_to_buffer(points, faces, metadatas, PyMem_Free(quant_origin) raise ValueError("Input invalid") -def encode_point_cloud_to_buffer(points, point_cloud_object, - 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, + 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 @@ -138,6 +160,10 @@ def encode_point_cloud_to_buffer(points, point_cloud_object, 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. """ + 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 @@ -145,10 +171,11 @@ def encode_point_cloud_to_buffer(points, point_cloud_object, quant_origin = PyMem_Malloc(sizeof(float) * num_dims) for dim in range(num_dims): quant_origin[dim] = quantization_origin[dim] - # binary_metadata = encode_metadata(metadata) encoded_point_cloud = DracoPy.encode_point_cloud( - points, point_cloud_object, quantization_bits, compression_level, - quantization_range, quant_origin, create_metadata) + points, metadatas, geometry_metadata, + 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: diff --git a/tests.py b/tests.py index 6292cc8..79b5025 100644 --- a/tests.py +++ b/tests.py @@ -40,14 +40,6 @@ def create_tetrahedron() -> Tuple[List[float], List[int]]: ] return points, faces - -def create_empty_geometry_metadata() -> dict: - return { - "metadata_id": 0, - "attribute_metadatas": [], - } - - def create_points_map(in_points: List[int], out_points: List[int]) -> Dict[int, int]: index_map = { @@ -68,7 +60,6 @@ def create_points_map(in_points: List[int], ################ Tests itselves ############### ############################################### -@pytest.mark.skip def test_decoding_and_encoding_mesh_file(): expected_points = 104502 expected_faces = 208353 @@ -78,8 +69,7 @@ def test_decoding_and_encoding_mesh_file(): assert len(mesh_object.points) == expected_points assert len(mesh_object.faces) == expected_faces encoding_test = DracoPy.encode_mesh_to_buffer( - mesh_object.points, mesh_object.faces, mesh_object.data_struct, - ) + mesh_object.points, mesh_object.faces) with open(os.path.join(testdata_directory, "bunny_test.drc"), "wb") as test_file: test_file.write(encoding_test) @@ -100,14 +90,13 @@ def test_decoding_improper_file(): with pytest.raises(DracoPy.FileTypeException): DracoPy.decode_buffer_to_mesh(file_content) -@pytest.mark.skip + def test_metadata(): with open(os.path.join(testdata_directory, "bunny.drc"), "rb") as draco_file: file_content = draco_file.read() mesh_object = DracoPy.decode_buffer_to_mesh(file_content) encoding_options = { - "mesh_object": mesh_object.data_struct, "quantization_bits": 12, "compression_level": 3, "quantization_range": 1000, @@ -132,7 +121,7 @@ def test_metadata(): assert (eo.quantization_range) == 1000 assert (eo.quantization_origin) == [-100, -100, -100] -@pytest.mark.skip + def test_decoding_and_encoding_point_cloud_file(): expected_points = 107841 with open( @@ -160,12 +149,11 @@ def test_decoding_and_encoding_point_cloud_file(): def test_encode_decode_tetrahedron(): points, faces = create_tetrahedron() - buffer = DracoPy.encode_mesh_to_buffer(points, faces, [], - create_empty_geometry_metadata(), - []) + buffer = DracoPy.encode_mesh_to_buffer(points, faces) mesh = DracoPy.decode_buffer_to_mesh(buffer) print(mesh) + def test_encode_decode_geometry_attributes(): # prepare input data points, faces = create_tetrahedron() @@ -191,7 +179,7 @@ def test_encode_decode_geometry_attributes(): } # encode - decode buffer = DracoPy.encode_mesh_to_buffer( - points, faces, metadatas, geometry_metadata) + 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 @@ -227,8 +215,9 @@ def test_encode_decode_metadata_entries(): "generic_attributes": [], } # encode - decode - buffer = DracoPy.encode_mesh_to_buffer(points, faces, metadatas, - geometry_metadata_specific) + buffer = DracoPy.encode_mesh_to_buffer( + points, faces, metadatas=metadatas, + geometry_metadata=geometry_metadata_specific) mesh = DracoPy.decode_buffer_to_mesh(buffer) # validate results out_metadatas = mesh.metadatas From 30e46fd7693442e233e7ff35ade4ca1a781471f4 Mon Sep 17 00:00:00 2001 From: Andrey Romanov Date: Thu, 11 Nov 2021 16:53:00 +0300 Subject: [PATCH 11/21] add tests for point cloud --- src/DracoPy.h | 7 +- tests.py | 178 +++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 160 insertions(+), 25 deletions(-) diff --git a/src/DracoPy.h b/src/DracoPy.h index d8d3e63..e687b3f 100644 --- a/src/DracoPy.h +++ b/src/DracoPy.h @@ -225,6 +225,10 @@ namespace DracoFunctions { } } + //////////////////////////////////////////////////// + ///////// Decode/Encode functions ////////////////// + //////////////////////////////////////////////////// + MeshObject decode_buffer(const char *buffer, std::size_t buffer_len, bool deduplicate) { MeshObject meshObject; @@ -387,10 +391,7 @@ namespace DracoFunctions { std::unique_ptr ptr_mesh = mb.Finalize(); draco::Mesh *mesh = ptr_mesh.get(); - encode_geometry_metadata(*mesh, metadatas, geometry_metadata_object); - - draco::Encoder encoder; setup_encoder_and_metadata(mesh, encoder, compression_level, quantization_bits, quantization_range, quantization_origin, create_metadata); draco::EncoderBuffer buffer; diff --git a/tests.py b/tests.py index 79b5025..c144b57 100644 --- a/tests.py +++ b/tests.py @@ -40,20 +40,42 @@ def create_tetrahedron() -> Tuple[List[float], List[int]]: ] return points, faces -def create_points_map(in_points: List[int], + +def create_points_map(in_points: List[float], out_points: List[int]) -> Dict[int, int]: - index_map = { - tuple(out_points[i * 3:(i + 1) * 3]): i + # 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]) - out_index = index_map.pop(in_vertex) - in_index = i - index_map[in_index] = out_index - for key in index_map: - assert isinstance(key, int), f"input point {key} is not in output" - return index_map + 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 ############################################### @@ -63,7 +85,8 @@ def create_points_map(in_points: List[int], def test_decoding_and_encoding_mesh_file(): expected_points = 104502 expected_faces = 208353 - with open(os.path.join(testdata_directory, "bunny.drc"), "rb") as draco_file: + with open(os.path.join(testdata_directory, "bunny.drc"), + "rb") as draco_file: file_content = draco_file.read() mesh_object = DracoPy.decode_buffer_to_mesh(file_content) assert len(mesh_object.points) == expected_points @@ -147,14 +170,37 @@ def test_decoding_and_encoding_point_cloud_file(): assert len(point_cloud_object.points) == expected_points -def test_encode_decode_tetrahedron(): +def test_encode_decode_tetrahedron_mesh(): points, faces = create_tetrahedron() buffer = DracoPy.encode_mesh_to_buffer(points, faces) mesh = DracoPy.decode_buffer_to_mesh(buffer) - print(mesh) + 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 + 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_point_cloud_to_buffer(points) + point_cloud = DracoPy.decode_point_cloud_buffer(buffer) + 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(): + +def test_encode_decode_geometry_attributes_mesh(): # prepare input data points, faces = create_tetrahedron() metadatas = [ @@ -179,7 +225,9 @@ def test_encode_decode_geometry_attributes(): } # encode - decode buffer = DracoPy.encode_mesh_to_buffer( - points, faces, metadatas=metadatas, geometry_metadata=geometry_metadata) + 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 @@ -190,12 +238,57 @@ def test_encode_decode_geometry_attributes(): assert out_attribute["dimension"] == attribute["dimension"] assert out_attribute["metadata_id"] == attribute["metadata_id"] assert len(out_attribute["data"]) == len(attribute["data"]) - for in_index, point_value in attribute["data"].items(): - out_index = points_map[in_index] - assert out_attribute["data"][out_index] == point_value + for out_index, point_value in out_attribute["data"].items(): + in_index = points_map[out_index] + assert point_value == attribute["data"][in_index] -def test_encode_decode_metadata_entries(): +# data encoding-decoding still does not work for point cloud +@pytest.mark.xfail +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, "little", signed=False) + for i in range(4) + }, + "datatype": 6, + "dimension": 1, + "metadata_id": 1, + } + geometry_metadata = { + "metadata_id": 0, + "generic_attributes": [attribute], + } + # encode - decode + buffer = DracoPy.encode_point_cloud_to_buffer( + points, + metadatas=metadatas, + geometry_metadata=geometry_metadata) + point_cloud = DracoPy.decode_point_cloud_buffer(buffer, True) + points_map = create_points_map(points, point_cloud.points) + # validate results + out_generic_attributes = point_cloud.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] + + +def test_encode_decode_submetadata_entries_mesh(): # prepare input data points, faces = create_tetrahedron() geometry_metadata = { @@ -216,18 +309,59 @@ def test_encode_decode_metadata_entries(): } # encode - decode buffer = DracoPy.encode_mesh_to_buffer( - points, faces, metadatas=metadatas, + 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"]] + 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_point_cloud_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_id = out_geometry_metadata["sub_metadata_ids"][ + b"custom_metadata_name"] custom_metadata = out_metadatas[custom_metadata_id] assert custom_metadata == metadatas[1] -# test_encode_decode_metadata_entries() \ No newline at end of file From adb80b0d6a9b1485ebea77af79e8aa5507a0ae41 Mon Sep 17 00:00:00 2001 From: Andrey Romanov Date: Thu, 11 Nov 2021 17:26:25 +0300 Subject: [PATCH 12/21] revert not functional differences with master --- src/DracoPy.cpp | 1285 +++++++++++++++++++++++------------------------ src/DracoPy.h | 4 +- src/DracoPy.pxd | 12 - src/DracoPy.pyx | 14 +- tests.py | 33 +- 5 files changed, 636 insertions(+), 712 deletions(-) diff --git a/src/DracoPy.cpp b/src/DracoPy.cpp index 8e6721b..fc65bab 100644 --- a/src/DracoPy.cpp +++ b/src/DracoPy.cpp @@ -1216,17 +1216,6 @@ static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); #endif -/* 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 - -/* Import.proto */ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); - /* IterFinish.proto */ static CYTHON_INLINE int __Pyx_IterFinish(void); @@ -1269,6 +1258,14 @@ static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int 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 + /* ListCompAppend.proto */ #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { @@ -1286,6 +1283,9 @@ static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) #endif +/* Import.proto */ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); + /* ImportFrom.proto */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); @@ -1546,7 +1546,6 @@ static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_TypeError; static PyObject *__pyx_builtin_KeyError; -static const char __pyx_k_e[] = "e"; static const char __pyx_k_dim[] = "dim"; static const char __pyx_k_doc[] = "__doc__"; static const char __pyx_k_Dict[] = "Dict"; @@ -1587,8 +1586,6 @@ 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_print_exc[] = "print_exc"; -static const char __pyx_k_traceback[] = "traceback"; static const char __pyx_k_ValueError[] = "ValueError"; static const char __pyx_k_difference[] = "difference"; static const char __pyx_k_data_struct[] = "data_struct"; @@ -1711,7 +1708,6 @@ 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_e; 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; @@ -1746,7 +1742,6 @@ static PyObject *__pyx_n_s_point; static PyObject *__pyx_n_s_point_cloud_struct; static PyObject *__pyx_n_s_points; static PyObject *__pyx_n_s_prepare; -static PyObject *__pyx_n_s_print_exc; static PyObject *__pyx_n_s_property; static PyObject *__pyx_n_s_qualname; static PyObject *__pyx_n_s_quant_origin; @@ -1761,7 +1756,6 @@ static PyObject *__pyx_n_s_self; static PyObject *__pyx_kp_s_src_DracoPy_pyx; static PyObject *__pyx_n_s_sub_metadata_ids; static PyObject *__pyx_n_s_test; -static PyObject *__pyx_n_s_traceback; static PyObject *__pyx_n_s_typing; static PyObject *__pyx_n_s_value; static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data_struct); /* proto */ @@ -2591,7 +2585,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_8points(CYTHON_UNUSED PyObj * @property * def geometry_metadata(self) -> Dict: # <<<<<<<<<<<<<< * return self.data_struct['geometry_metadata'] - * # + * */ /* Python wrapper */ @@ -2622,8 +2616,8 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_10geometry_metadata(CYTHON_ * @property * def geometry_metadata(self) -> Dict: * return self.data_struct['geometry_metadata'] # <<<<<<<<<<<<<< - * # - * # @property + * + * @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) @@ -2640,7 +2634,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_10geometry_metadata(CYTHON_ * @property * def geometry_metadata(self) -> Dict: # <<<<<<<<<<<<<< * return self.data_struct['geometry_metadata'] - * # + * */ /* function exit code */ @@ -2655,7 +2649,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_10geometry_metadata(CYTHON_ return __pyx_r; } -/* "DracoPy.pyx":44 +/* "DracoPy.pyx":40 * * @property * def metadatas(self) -> List[Dict]: # <<<<<<<<<<<<<< @@ -2687,7 +2681,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_12metadatas(CYTHON_UNUSED P int __pyx_clineno = 0; __Pyx_RefNannySetupContext("metadatas", 0); - /* "DracoPy.pyx":45 + /* "DracoPy.pyx":41 * @property * def metadatas(self) -> List[Dict]: * return self.data_struct['metadatas'] # <<<<<<<<<<<<<< @@ -2695,16 +2689,16 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_12metadatas(CYTHON_UNUSED P * */ __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, 45, __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, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_metadatas); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 45, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_metadatas); 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; goto __pyx_L0; - /* "DracoPy.pyx":44 + /* "DracoPy.pyx":40 * * @property * def metadatas(self) -> List[Dict]: # <<<<<<<<<<<<<< @@ -2724,7 +2718,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_12metadatas(CYTHON_UNUSED P return __pyx_r; } -/* "DracoPy.pyx":50 +/* "DracoPy.pyx":46 * class DracoMesh(DracoPointCloud): * @property * def faces(self) -> List[int]: # <<<<<<<<<<<<<< @@ -2756,7 +2750,7 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_faces(CYTHON_UNUSED PyObject *__py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("faces", 0); - /* "DracoPy.pyx":51 + /* "DracoPy.pyx":47 * @property * def faces(self) -> List[int]: * return self.data_struct['faces'] # <<<<<<<<<<<<<< @@ -2764,16 +2758,16 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_faces(CYTHON_UNUSED PyObject *__py * @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, 51, __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, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_faces); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_faces); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __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":50 + /* "DracoPy.pyx":46 * class DracoMesh(DracoPointCloud): * @property * def faces(self) -> List[int]: # <<<<<<<<<<<<<< @@ -2793,7 +2787,7 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_faces(CYTHON_UNUSED PyObject *__py return __pyx_r; } -/* "DracoPy.pyx":54 +/* "DracoPy.pyx":50 * * @property * def normals(self): # <<<<<<<<<<<<<< @@ -2825,7 +2819,7 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_2normals(CYTHON_UNUSED PyObject *_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("normals", 0); - /* "DracoPy.pyx":55 + /* "DracoPy.pyx":51 * @property * def normals(self): * return self.data_struct['normals'] # <<<<<<<<<<<<<< @@ -2833,16 +2827,16 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_2normals(CYTHON_UNUSED PyObject *_ * 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, 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, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_normals); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_normals); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __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":54 + /* "DracoPy.pyx":50 * * @property * def normals(self): # <<<<<<<<<<<<<< @@ -2862,7 +2856,7 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_2normals(CYTHON_UNUSED PyObject *_ return __pyx_r; } -/* "DracoPy.pyx":58 +/* "DracoPy.pyx":54 * * class EncodingOptions(object): * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< @@ -2911,23 +2905,23 @@ static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_1__init__(PyObject *__pyx_s 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, 58, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); __PYX_ERR(0, 54, __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, 58, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 2); __PYX_ERR(0, 54, __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("__init__", 1, 4, 4, 3); __PYX_ERR(0, 58, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 3); __PYX_ERR(0, 54, __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, 58, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 54, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; @@ -2944,7 +2938,7 @@ static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_1__init__(PyObject *__pyx_s } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 58, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 54, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("DracoPy.EncodingOptions.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -2967,52 +2961,52 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions___init__(CYTHON_UNUSED PyOb int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "DracoPy.pyx":59 + /* "DracoPy.pyx":55 * 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, 59, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_quantization_bits, __pyx_v_quantization_bits) < 0) __PYX_ERR(0, 55, __pyx_L1_error) - /* "DracoPy.pyx":60 + /* "DracoPy.pyx":56 * 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, 60, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_quantization_range, __pyx_v_quantization_range) < 0) __PYX_ERR(0, 56, __pyx_L1_error) - /* "DracoPy.pyx":61 + /* "DracoPy.pyx":57 * 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_origin, __pyx_v_quantization_origin) < 0) __PYX_ERR(0, 61, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin, __pyx_v_quantization_origin) < 0) __PYX_ERR(0, 57, __pyx_L1_error) - /* "DracoPy.pyx":62 + /* "DracoPy.pyx":58 * 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): */ - __pyx_t_1 = __Pyx_PyNumber_PowerOf2(__pyx_int_2, __pyx_v_quantization_bits, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyNumber_PowerOf2(__pyx_int_2, __pyx_v_quantization_bits, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 58, __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, 62, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_SubtractObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 58, __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, 62, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_quantization_range, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 58, __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, 62, __pyx_L1_error) + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_inverse_alpha, __pyx_t_1) < 0) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":58 + /* "DracoPy.pyx":54 * * class EncodingOptions(object): * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< @@ -3034,7 +3028,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions___init__(CYTHON_UNUSED PyOb return __pyx_r; } -/* "DracoPy.pyx":64 +/* "DracoPy.pyx":60 * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) * * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< @@ -3080,17 +3074,17 @@ static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_3get_encoded_coordinate(PyO 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, 64, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, 1); __PYX_ERR(0, 60, __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, 64, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, 2); __PYX_ERR(0, 60, __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, 64, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_encoded_coordinate") < 0)) __PYX_ERR(0, 60, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -3105,7 +3099,7 @@ static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_3get_encoded_coordinate(PyO } 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, 64, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 60, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("DracoPy.EncodingOptions.get_encoded_coordinate", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3134,60 +3128,60 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_2get_encoded_coordinate(CYT int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_encoded_coordinate", 0); - /* "DracoPy.pyx":65 + /* "DracoPy.pyx":61 * * 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_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __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, 65, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_axis); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 61, __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, 65, __pyx_L1_error) + __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, 61, __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, 65, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 61, __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, 65, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __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, 65, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_axis); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 61, __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, 65, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_range); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __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, 65, __pyx_L1_error) + __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_t_2); 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; __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, 65, __pyx_L1_error) + __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, 61, __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, 65, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 61, __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":66 + /* "DracoPy.pyx":62 * 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, 66, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __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, 66, __pyx_L1_error) + __PYX_ERR(0, 62, __pyx_L1_error) - /* "DracoPy.pyx":65 + /* "DracoPy.pyx":61 * * def get_encoded_coordinate(self, value, axis): * if value < self.quantization_origin[axis] or value > (self.quantization_origin[axis] + self.quantization_range): # <<<<<<<<<<<<<< @@ -3196,39 +3190,39 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_2get_encoded_coordinate(CYT */ } - /* "DracoPy.pyx":67 + /* "DracoPy.pyx":63 * 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_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 63, __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, 67, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_axis); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 63, __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, 67, __pyx_L1_error) + __pyx_t_2 = PyNumber_Subtract(__pyx_v_value, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 63, __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":68 + /* "DracoPy.pyx":64 * 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_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_floor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_floor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 64, __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, 68, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_inverse_alpha); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 64, __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, 68, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_v_difference, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 64, __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, 68, __pyx_L1_error) + __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, 64, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; @@ -3244,13 +3238,13 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_2get_encoded_coordinate(CYT __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, 68, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __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":69 + /* "DracoPy.pyx":65 * 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) # <<<<<<<<<<<<<< @@ -3258,17 +3252,17 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_2get_encoded_coordinate(CYT * 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, 69, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __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, 69, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_axis); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 65, __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, 69, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_inverse_alpha); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __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, 69, __pyx_L1_error) + __pyx_t_3 = PyNumber_Multiply(__pyx_v_quantized_index, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __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, 69, __pyx_L1_error) + __pyx_t_2 = PyNumber_Add(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 65, __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; @@ -3276,7 +3270,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_2get_encoded_coordinate(CYT __pyx_t_2 = 0; goto __pyx_L0; - /* "DracoPy.pyx":64 + /* "DracoPy.pyx":60 * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) * * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< @@ -3300,7 +3294,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_2get_encoded_coordinate(CYT return __pyx_r; } -/* "DracoPy.pyx":71 +/* "DracoPy.pyx":67 * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) * * def get_encoded_point(self, point): # <<<<<<<<<<<<<< @@ -3343,11 +3337,11 @@ static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_5get_encoded_point(PyObject 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, 71, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_point", 1, 2, 2, 1); __PYX_ERR(0, 67, __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, 71, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_encoded_point") < 0)) __PYX_ERR(0, 67, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -3360,7 +3354,7 @@ static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_5get_encoded_point(PyObject } 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, 71, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_point", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 67, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("DracoPy.EncodingOptions.get_encoded_point", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3393,37 +3387,37 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_encoded_point", 0); - /* "DracoPy.pyx":72 + /* "DracoPy.pyx":68 * * 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, 72, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_v_encoded_point = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":73 + /* "DracoPy.pyx":69 * 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_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_num_axes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_num_axes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __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, 73, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __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, 73, __pyx_L1_error) + __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __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, 73, __pyx_L1_error) + __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 69, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; for (;;) { @@ -3431,17 +3425,17 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U 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, 73, __pyx_L1_error) + __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, 69, __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, 73, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __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, 73, __pyx_L1_error) + __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, 69, __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, 73, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 69, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); #endif } @@ -3451,7 +3445,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 73, __pyx_L1_error) + else __PYX_ERR(0, 69, __pyx_L1_error) } break; } @@ -3460,16 +3454,16 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U __Pyx_XDECREF_SET(__pyx_v_axis, __pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":74 + /* "DracoPy.pyx":70 * 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, 74, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_encoded_coordinate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 70, __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, 74, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_point, __pyx_v_axis); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; __pyx_t_8 = 0; @@ -3486,7 +3480,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U #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, 74, __pyx_L1_error) + __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, 70, __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; @@ -3495,14 +3489,14 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U #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, 74, __pyx_L1_error) + __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, 70, __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, 74, __pyx_L1_error) + __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 70, __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; @@ -3513,15 +3507,15 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U __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, 74, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __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, 74, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_encoded_point, __pyx_t_2); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":73 + /* "DracoPy.pyx":69 * def get_encoded_point(self, point): * encoded_point = [] * for axis in range(self.num_axes): # <<<<<<<<<<<<<< @@ -3531,7 +3525,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":75 + /* "DracoPy.pyx":71 * for axis in range(self.num_axes): * encoded_point.append(self.get_encoded_coordinate(point[axis], axis)) * return encoded_point # <<<<<<<<<<<<<< @@ -3543,7 +3537,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U __pyx_r = __pyx_v_encoded_point; goto __pyx_L0; - /* "DracoPy.pyx":71 + /* "DracoPy.pyx":67 * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) * * def get_encoded_point(self, point): # <<<<<<<<<<<<<< @@ -3569,7 +3563,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_U return __pyx_r; } -/* "DracoPy.pyx":78 +/* "DracoPy.pyx":74 * * @property * def num_axes(self): # <<<<<<<<<<<<<< @@ -3596,7 +3590,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_6num_axes(CYTHON_UNUSED PyO __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("num_axes", 0); - /* "DracoPy.pyx":79 + /* "DracoPy.pyx":75 * @property * def num_axes(self): * return 3 # <<<<<<<<<<<<<< @@ -3608,7 +3602,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_6num_axes(CYTHON_UNUSED PyO __pyx_r = __pyx_int_3; goto __pyx_L0; - /* "DracoPy.pyx":78 + /* "DracoPy.pyx":74 * * @property * def num_axes(self): # <<<<<<<<<<<<<< @@ -3623,7 +3617,7 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_6num_axes(CYTHON_UNUSED PyO return __pyx_r; } -/* "DracoPy.pyx":87 +/* "DracoPy.pyx":83 * pass * * def create_empty_geometry_metadata() -> dict: # <<<<<<<<<<<<<< @@ -3655,7 +3649,7 @@ static PyObject *__pyx_pf_7DracoPy_create_empty_geometry_metadata(CYTHON_UNUSED int __pyx_clineno = 0; __Pyx_RefNannySetupContext("create_empty_geometry_metadata", 0); - /* "DracoPy.pyx":88 + /* "DracoPy.pyx":84 * * def create_empty_geometry_metadata() -> dict: * return { # <<<<<<<<<<<<<< @@ -3664,33 +3658,33 @@ static PyObject *__pyx_pf_7DracoPy_create_empty_geometry_metadata(CYTHON_UNUSED */ __Pyx_XDECREF(__pyx_r); - /* "DracoPy.pyx":89 + /* "DracoPy.pyx":85 * def create_empty_geometry_metadata() -> dict: * return { * "metadata_id": 0, # <<<<<<<<<<<<<< * "generic_attributes": [], * } */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 89, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_metadata_id, __pyx_int_0) < 0) __PYX_ERR(0, 89, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_metadata_id, __pyx_int_0) < 0) __PYX_ERR(0, 85, __pyx_L1_error) - /* "DracoPy.pyx":90 + /* "DracoPy.pyx":86 * return { * "metadata_id": 0, * "generic_attributes": [], # <<<<<<<<<<<<<< * } * */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error) + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_generic_attributes, __pyx_t_2) < 0) __PYX_ERR(0, 89, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_generic_attributes, __pyx_t_2) < 0) __PYX_ERR(0, 85, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - /* "DracoPy.pyx":87 + /* "DracoPy.pyx":83 * pass * * def create_empty_geometry_metadata() -> dict: # <<<<<<<<<<<<<< @@ -3710,12 +3704,12 @@ static PyObject *__pyx_pf_7DracoPy_create_empty_geometry_metadata(CYTHON_UNUSED return __pyx_r; } -/* "DracoPy.pyx":94 +/* "DracoPy.pyx":90 * * * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< - * quantization_bits=14, compression_level=1, - * quantization_range=-1, quantization_origin=None, + * quantization_bits=14, + * compression_level=1, */ /* Python wrapper */ @@ -3745,26 +3739,26 @@ static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, values[3] = ((PyObject *)__pyx_int_1); values[4] = ((PyObject *)__pyx_int_neg_1); - /* "DracoPy.pyx":96 - * def encode_mesh_to_buffer(points, faces, - * quantization_bits=14, compression_level=1, - * quantization_range=-1, quantization_origin=None, # <<<<<<<<<<<<<< + /* "DracoPy.pyx":94 + * compression_level=1, + * quantization_range=-1, + * quantization_origin=None, # <<<<<<<<<<<<<< * create_metadata=False, * metadatas = None, */ values[5] = ((PyObject *)Py_None); - /* "DracoPy.pyx":97 - * quantization_bits=14, compression_level=1, - * quantization_range=-1, quantization_origin=None, + /* "DracoPy.pyx":95 + * quantization_range=-1, + * quantization_origin=None, * create_metadata=False, # <<<<<<<<<<<<<< * metadatas = None, * geometry_metadata = None, */ values[6] = ((PyObject *)Py_False); - /* "DracoPy.pyx":98 - * quantization_range=-1, quantization_origin=None, + /* "DracoPy.pyx":96 + * quantization_origin=None, * create_metadata=False, * metadatas = None, # <<<<<<<<<<<<<< * geometry_metadata = None, @@ -3772,7 +3766,7 @@ static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, */ values[7] = ((PyObject *)Py_None); - /* "DracoPy.pyx":99 + /* "DracoPy.pyx":97 * create_metadata=False, * metadatas = None, * geometry_metadata = None, # <<<<<<<<<<<<<< @@ -3814,7 +3808,7 @@ static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, 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, 9, 1); __PYX_ERR(0, 94, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 2, 9, 1); __PYX_ERR(0, 90, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -3860,7 +3854,7 @@ static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, } } 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, 94, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode_mesh_to_buffer") < 0)) __PYX_ERR(0, 90, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -3896,7 +3890,7 @@ static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 2, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 94, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 2, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 90, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("DracoPy.encode_mesh_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3904,12 +3898,12 @@ static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7DracoPy_2encode_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_v_metadatas, __pyx_v_geometry_metadata); - /* "DracoPy.pyx":94 + /* "DracoPy.pyx":90 * * * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< - * quantization_bits=14, compression_level=1, - * quantization_range=-1, quantization_origin=None, + * quantization_bits=14, + * compression_level=1, */ /* function exit code */ @@ -3922,8 +3916,6 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject PyObject *__pyx_v_num_dims = NULL; PyObject *__pyx_v_dim = NULL; struct DracoFunctions::EncodedObject __pyx_v_encoded_mesh; - CYTHON_UNUSED PyObject *__pyx_v_e = NULL; - PyObject *__pyx_v_traceback = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -3957,7 +3949,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_INCREF(__pyx_v_metadatas); __Pyx_INCREF(__pyx_v_geometry_metadata); - /* "DracoPy.pyx":110 + /* "DracoPy.pyx":108 * a point where each coordinate is the minimum of that coordinate among the input vertices. * """ * if metadatas is None: # <<<<<<<<<<<<<< @@ -3968,19 +3960,19 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "DracoPy.pyx":111 + /* "DracoPy.pyx":109 * """ * if metadatas is None: * metadatas = [] # <<<<<<<<<<<<<< * if geometry_metadata is None: * geometry_metadata = create_empty_geometry_metadata() */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 111, __pyx_L1_error) + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 109, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF_SET(__pyx_v_metadatas, __pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":110 + /* "DracoPy.pyx":108 * a point where each coordinate is the minimum of that coordinate among the input vertices. * """ * if metadatas is None: # <<<<<<<<<<<<<< @@ -3989,7 +3981,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":112 + /* "DracoPy.pyx":110 * if metadatas is None: * metadatas = [] * if geometry_metadata is None: # <<<<<<<<<<<<<< @@ -4000,14 +3992,14 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "DracoPy.pyx":113 + /* "DracoPy.pyx":111 * metadatas = [] * if geometry_metadata is None: * geometry_metadata = create_empty_geometry_metadata() # <<<<<<<<<<<<<< * cdef float* quant_origin = NULL * try: */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_create_empty_geometry_metadata); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 113, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_create_empty_geometry_metadata); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { @@ -4021,13 +4013,13 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject } __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 113, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 111, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF_SET(__pyx_v_geometry_metadata, __pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":112 + /* "DracoPy.pyx":110 * if metadatas is None: * metadatas = [] * if geometry_metadata is None: # <<<<<<<<<<<<<< @@ -4036,7 +4028,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":114 + /* "DracoPy.pyx":112 * if geometry_metadata is None: * geometry_metadata = create_empty_geometry_metadata() * cdef float* quant_origin = NULL # <<<<<<<<<<<<<< @@ -4045,7 +4037,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ __pyx_v_quant_origin = NULL; - /* "DracoPy.pyx":115 + /* "DracoPy.pyx":113 * geometry_metadata = create_empty_geometry_metadata() * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -4061,7 +4053,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_XGOTREF(__pyx_t_8); /*try:*/ { - /* "DracoPy.pyx":116 + /* "DracoPy.pyx":114 * cdef float* quant_origin = NULL * try: * num_dims = 3 # <<<<<<<<<<<<<< @@ -4071,7 +4063,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_INCREF(__pyx_int_3); __pyx_v_num_dims = __pyx_int_3; - /* "DracoPy.pyx":117 + /* "DracoPy.pyx":115 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -4082,38 +4074,38 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "DracoPy.pyx":118 + /* "DracoPy.pyx":116 * 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_3 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 118, __pyx_L5_error) + __pyx_t_3 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 116, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 118, __pyx_L5_error) + __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 116, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_9 = __Pyx_PyInt_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 118, __pyx_L5_error) + __pyx_t_9 = __Pyx_PyInt_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 116, __pyx_L5_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_quant_origin = ((float *)PyMem_Malloc(__pyx_t_9)); - /* "DracoPy.pyx":119 + /* "DracoPy.pyx":117 * 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, */ - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 119, __pyx_L5_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 117, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_4); if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_10 = 0; __pyx_t_11 = NULL; } else { - __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 119, __pyx_L5_error) + __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 117, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 119, __pyx_L5_error) + __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 117, __pyx_L5_error) } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; for (;;) { @@ -4121,17 +4113,17 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject if (likely(PyList_CheckExact(__pyx_t_3))) { if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 119, __pyx_L5_error) + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 117, __pyx_L5_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 119, __pyx_L5_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 117, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_4); #endif } else { if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 119, __pyx_L5_error) + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 117, __pyx_L5_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 119, __pyx_L5_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 117, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_4); #endif } @@ -4141,7 +4133,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject 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_L5_error) + else __PYX_ERR(0, 117, __pyx_L5_error) } break; } @@ -4150,21 +4142,21 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_4); __pyx_t_4 = 0; - /* "DracoPy.pyx":120 + /* "DracoPy.pyx":118 * 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, */ - __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 120, __pyx_L5_error) + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 118, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 120, __pyx_L5_error) + __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 118, __pyx_L5_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 120, __pyx_L5_error) + __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 118, __pyx_L5_error) (__pyx_v_quant_origin[__pyx_t_13]) = __pyx_t_12; - /* "DracoPy.pyx":119 + /* "DracoPy.pyx":117 * if quantization_origin is not None: * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) * for dim in range(num_dims): # <<<<<<<<<<<<<< @@ -4174,7 +4166,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":117 + /* "DracoPy.pyx":115 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -4183,79 +4175,79 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":121 + /* "DracoPy.pyx":119 * for dim in range(num_dims): * quant_origin[dim] = quantization_origin[dim] * encoded_mesh = DracoPy.encode_mesh(points, # <<<<<<<<<<<<<< * faces, * metadatas, */ - __pyx_t_14 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 121, __pyx_L5_error) + __pyx_t_14 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 119, __pyx_L5_error) - /* "DracoPy.pyx":122 + /* "DracoPy.pyx":120 * quant_origin[dim] = quantization_origin[dim] * encoded_mesh = DracoPy.encode_mesh(points, * faces, # <<<<<<<<<<<<<< * metadatas, * geometry_metadata, */ - __pyx_t_15 = __pyx_convert_vector_from_py_uint32_t(__pyx_v_faces); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 122, __pyx_L5_error) + __pyx_t_15 = __pyx_convert_vector_from_py_uint32_t(__pyx_v_faces); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 120, __pyx_L5_error) - /* "DracoPy.pyx":123 + /* "DracoPy.pyx":121 * encoded_mesh = DracoPy.encode_mesh(points, * faces, * metadatas, # <<<<<<<<<<<<<< * geometry_metadata, * quantization_bits, */ - __pyx_t_16 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_metadatas); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 123, __pyx_L5_error) + __pyx_t_16 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_metadatas); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 121, __pyx_L5_error) - /* "DracoPy.pyx":124 + /* "DracoPy.pyx":122 * faces, * metadatas, * geometry_metadata, # <<<<<<<<<<<<<< * quantization_bits, * compression_level, */ - __pyx_t_17 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_geometry_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 124, __pyx_L5_error) + __pyx_t_17 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_geometry_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 122, __pyx_L5_error) - /* "DracoPy.pyx":125 + /* "DracoPy.pyx":123 * metadatas, * geometry_metadata, * quantization_bits, # <<<<<<<<<<<<<< * compression_level, * quantization_range, */ - __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L5_error) + __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 123, __pyx_L5_error) - /* "DracoPy.pyx":126 + /* "DracoPy.pyx":124 * geometry_metadata, * quantization_bits, * compression_level, # <<<<<<<<<<<<<< * quantization_range, * quant_origin, */ - __pyx_t_19 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_19 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 126, __pyx_L5_error) + __pyx_t_19 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_19 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 124, __pyx_L5_error) - /* "DracoPy.pyx":127 + /* "DracoPy.pyx":125 * quantization_bits, * compression_level, * quantization_range, # <<<<<<<<<<<<<< * quant_origin, * create_metadata) */ - __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 127, __pyx_L5_error) + __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L5_error) - /* "DracoPy.pyx":129 + /* "DracoPy.pyx":127 * quantization_range, * quant_origin, * create_metadata) # <<<<<<<<<<<<<< * if quant_origin != NULL: * PyMem_Free(quant_origin) */ - __pyx_t_20 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_20 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 129, __pyx_L5_error) + __pyx_t_20 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_20 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 127, __pyx_L5_error) - /* "DracoPy.pyx":121 + /* "DracoPy.pyx":119 * for dim in range(num_dims): * quant_origin[dim] = quantization_origin[dim] * encoded_mesh = DracoPy.encode_mesh(points, # <<<<<<<<<<<<<< @@ -4266,11 +4258,11 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_21 = DracoFunctions::encode_mesh(__pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_12, __pyx_v_quant_origin, __pyx_t_20); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 121, __pyx_L5_error) + __PYX_ERR(0, 119, __pyx_L5_error) } __pyx_v_encoded_mesh = __pyx_t_21; - /* "DracoPy.pyx":130 + /* "DracoPy.pyx":128 * quant_origin, * create_metadata) * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -4280,7 +4272,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_2 = ((__pyx_v_quant_origin != NULL) != 0); if (__pyx_t_2) { - /* "DracoPy.pyx":131 + /* "DracoPy.pyx":129 * create_metadata) * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -4289,7 +4281,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":130 + /* "DracoPy.pyx":128 * quant_origin, * create_metadata) * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -4298,7 +4290,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":132 + /* "DracoPy.pyx":130 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -4308,7 +4300,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject switch (__pyx_v_encoded_mesh.encode_status) { case DracoFunctions::successful_encoding: - /* "DracoPy.pyx":133 + /* "DracoPy.pyx":131 * PyMem_Free(quant_origin) * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: * return bytes(encoded_mesh.buffer) # <<<<<<<<<<<<<< @@ -4316,16 +4308,16 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject * raise EncodingFailedException('Invalid mesh') */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_encoded_mesh.buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 133, __pyx_L5_error) + __pyx_t_3 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_encoded_mesh.buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 131, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 133, __pyx_L5_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 131, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L9_try_return; - /* "DracoPy.pyx":132 + /* "DracoPy.pyx":130 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -4335,14 +4327,14 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject break; case DracoFunctions::failed_during_encoding: - /* "DracoPy.pyx":135 + /* "DracoPy.pyx":133 * 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_3, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 135, __pyx_L5_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 133, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { @@ -4356,14 +4348,14 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject } __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s_Invalid_mesh) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_Invalid_mesh); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 135, __pyx_L5_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 133, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 135, __pyx_L5_error) + __PYX_ERR(0, 133, __pyx_L5_error) - /* "DracoPy.pyx":134 + /* "DracoPy.pyx":132 * 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: # <<<<<<<<<<<<<< @@ -4374,7 +4366,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject default: break; } - /* "DracoPy.pyx":115 + /* "DracoPy.pyx":113 * geometry_metadata = create_empty_geometry_metadata() * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -4391,15 +4383,15 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "DracoPy.pyx":136 + /* "DracoPy.pyx":134 * elif encoded_mesh.encode_status == DracoPy.encoding_status.failed_during_encoding: * raise EncodingFailedException('Invalid mesh') * except EncodingFailedException: # <<<<<<<<<<<<<< * raise EncodingFailedException('Invalid mesh') - * except Exception as e: + * except: */ __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 136, __pyx_L7_except_error) + __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 134, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_22); __pyx_t_19 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_4, __pyx_t_22); __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; @@ -4407,19 +4399,19 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_5 = 0; if (__pyx_t_19) { __Pyx_AddTraceback("DracoPy.encode_mesh_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 136, __pyx_L7_except_error) + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 134, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_4); - /* "DracoPy.pyx":137 + /* "DracoPy.pyx":135 * raise EncodingFailedException('Invalid mesh') * except EncodingFailedException: * raise EncodingFailedException('Invalid mesh') # <<<<<<<<<<<<<< - * except Exception as e: - * import traceback + * except: + * if quant_origin != NULL: */ - __Pyx_GetModuleGlobalName(__pyx_t_23, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 137, __pyx_L7_except_error) + __Pyx_GetModuleGlobalName(__pyx_t_23, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 135, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_23); __pyx_t_24 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_23))) { @@ -4433,72 +4425,31 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject } __pyx_t_22 = (__pyx_t_24) ? __Pyx_PyObject_Call2Args(__pyx_t_23, __pyx_t_24, __pyx_kp_s_Invalid_mesh) : __Pyx_PyObject_CallOneArg(__pyx_t_23, __pyx_kp_s_Invalid_mesh); __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0; - if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 137, __pyx_L7_except_error) + if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 135, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_22); __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; __Pyx_Raise(__pyx_t_22, 0, 0, 0); __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; - __PYX_ERR(0, 137, __pyx_L7_except_error) + __PYX_ERR(0, 135, __pyx_L7_except_error) } - /* "DracoPy.pyx":138 + /* "DracoPy.pyx":136 * except EncodingFailedException: * raise EncodingFailedException('Invalid mesh') - * except Exception as e: # <<<<<<<<<<<<<< - * import traceback - * traceback.print_exc() + * except: # <<<<<<<<<<<<<< + * if quant_origin != NULL: + * PyMem_Free(quant_origin) */ - __pyx_t_19 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - if (__pyx_t_19) { + /*except:*/ { __Pyx_AddTraceback("DracoPy.encode_mesh_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5) < 0) __PYX_ERR(0, 138, __pyx_L7_except_error) + if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5) < 0) __PYX_ERR(0, 136, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_t_3); - __pyx_v_e = __pyx_t_3; - /* "DracoPy.pyx":139 + /* "DracoPy.pyx":137 * raise EncodingFailedException('Invalid mesh') - * except Exception as e: - * import traceback # <<<<<<<<<<<<<< - * traceback.print_exc() - * if quant_origin != NULL: - */ - __pyx_t_22 = __Pyx_Import(__pyx_n_s_traceback, 0, -1); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 139, __pyx_L7_except_error) - __Pyx_GOTREF(__pyx_t_22); - __pyx_v_traceback = __pyx_t_22; - __pyx_t_22 = 0; - - /* "DracoPy.pyx":140 - * except Exception as e: - * import traceback - * traceback.print_exc() # <<<<<<<<<<<<<< - * if quant_origin != NULL: - * PyMem_Free(quant_origin) - */ - __pyx_t_23 = __Pyx_PyObject_GetAttrStr(__pyx_v_traceback, __pyx_n_s_print_exc); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 140, __pyx_L7_except_error) - __Pyx_GOTREF(__pyx_t_23); - __pyx_t_24 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_23))) { - __pyx_t_24 = PyMethod_GET_SELF(__pyx_t_23); - if (likely(__pyx_t_24)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_23); - __Pyx_INCREF(__pyx_t_24); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_23, function); - } - } - __pyx_t_22 = (__pyx_t_24) ? __Pyx_PyObject_CallOneArg(__pyx_t_23, __pyx_t_24) : __Pyx_PyObject_CallNoArg(__pyx_t_23); - __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0; - if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 140, __pyx_L7_except_error) - __Pyx_GOTREF(__pyx_t_22); - __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; - - /* "DracoPy.pyx":141 - * import traceback - * traceback.print_exc() + * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< * PyMem_Free(quant_origin) * raise ValueError("Input invalid") @@ -4506,8 +4457,8 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_2 = ((__pyx_v_quant_origin != NULL) != 0); if (__pyx_t_2) { - /* "DracoPy.pyx":142 - * traceback.print_exc() + /* "DracoPy.pyx":138 + * except: * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< * raise ValueError("Input invalid") @@ -4515,32 +4466,31 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":141 - * import traceback - * traceback.print_exc() + /* "DracoPy.pyx":137 + * raise EncodingFailedException('Invalid mesh') + * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< * PyMem_Free(quant_origin) * raise ValueError("Input invalid") */ } - /* "DracoPy.pyx":143 + /* "DracoPy.pyx":139 * if quant_origin != NULL: * PyMem_Free(quant_origin) * raise ValueError("Input invalid") # <<<<<<<<<<<<<< * * def encode_point_cloud_to_buffer(points, */ - __pyx_t_22 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 143, __pyx_L7_except_error) + __pyx_t_22 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 139, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_22); __Pyx_Raise(__pyx_t_22, 0, 0, 0); __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; - __PYX_ERR(0, 143, __pyx_L7_except_error) + __PYX_ERR(0, 139, __pyx_L7_except_error) } - goto __pyx_L7_except_error; __pyx_L7_except_error:; - /* "DracoPy.pyx":115 + /* "DracoPy.pyx":113 * geometry_metadata = create_empty_geometry_metadata() * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -4561,12 +4511,12 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_L10_try_end:; } - /* "DracoPy.pyx":94 + /* "DracoPy.pyx":90 * * * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< - * quantization_bits=14, compression_level=1, - * quantization_range=-1, quantization_origin=None, + * quantization_bits=14, + * compression_level=1, */ /* function exit code */ @@ -4584,8 +4534,6 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_L0:; __Pyx_XDECREF(__pyx_v_num_dims); __Pyx_XDECREF(__pyx_v_dim); - __Pyx_XDECREF(__pyx_v_e); - __Pyx_XDECREF(__pyx_v_traceback); __Pyx_XDECREF(__pyx_v_metadatas); __Pyx_XDECREF(__pyx_v_geometry_metadata); __Pyx_XGIVEREF(__pyx_r); @@ -4593,7 +4541,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject return __pyx_r; } -/* "DracoPy.pyx":145 +/* "DracoPy.pyx":141 * raise ValueError("Input invalid") * * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< @@ -4627,7 +4575,7 @@ static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx values[2] = ((PyObject *)__pyx_int_1); values[3] = ((PyObject *)__pyx_int_neg_1); - /* "DracoPy.pyx":149 + /* "DracoPy.pyx":145 * compression_level=1, * quantization_range=-1, * quantization_origin=None, # <<<<<<<<<<<<<< @@ -4636,7 +4584,7 @@ static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx */ values[4] = ((PyObject *)Py_None); - /* "DracoPy.pyx":150 + /* "DracoPy.pyx":146 * quantization_range=-1, * quantization_origin=None, * create_metadata=False, # <<<<<<<<<<<<<< @@ -4645,7 +4593,7 @@ static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx */ values[5] = ((PyObject *)Py_False); - /* "DracoPy.pyx":151 + /* "DracoPy.pyx":147 * quantization_origin=None, * create_metadata=False, * metadatas = None, # <<<<<<<<<<<<<< @@ -4654,7 +4602,7 @@ static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx */ values[6] = ((PyObject *)Py_None); - /* "DracoPy.pyx":152 + /* "DracoPy.pyx":148 * create_metadata=False, * metadatas = None, * geometry_metadata = None, # <<<<<<<<<<<<<< @@ -4734,7 +4682,7 @@ static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx } } 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, 145, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode_point_cloud_to_buffer") < 0)) __PYX_ERR(0, 141, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -4768,7 +4716,7 @@ static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("encode_point_cloud_to_buffer", 0, 1, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 145, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode_point_cloud_to_buffer", 0, 1, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 141, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("DracoPy.encode_point_cloud_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -4776,7 +4724,7 @@ static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7DracoPy_4encode_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_v_metadatas, __pyx_v_geometry_metadata); - /* "DracoPy.pyx":145 + /* "DracoPy.pyx":141 * raise ValueError("Input invalid") * * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< @@ -4826,7 +4774,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_INCREF(__pyx_v_metadatas); __Pyx_INCREF(__pyx_v_geometry_metadata); - /* "DracoPy.pyx":163 + /* "DracoPy.pyx":159 * a point where each coordinate is the minimum of that coordinate among the input vertices. * """ * if metadatas is None: # <<<<<<<<<<<<<< @@ -4837,19 +4785,19 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "DracoPy.pyx":164 + /* "DracoPy.pyx":160 * """ * if metadatas is None: * metadatas = [] # <<<<<<<<<<<<<< * if geometry_metadata is None: * geometry_metadata = create_empty_geometry_metadata() */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 164, __pyx_L1_error) + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 160, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF_SET(__pyx_v_metadatas, __pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":163 + /* "DracoPy.pyx":159 * a point where each coordinate is the minimum of that coordinate among the input vertices. * """ * if metadatas is None: # <<<<<<<<<<<<<< @@ -4858,7 +4806,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P */ } - /* "DracoPy.pyx":165 + /* "DracoPy.pyx":161 * if metadatas is None: * metadatas = [] * if geometry_metadata is None: # <<<<<<<<<<<<<< @@ -4869,14 +4817,14 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "DracoPy.pyx":166 + /* "DracoPy.pyx":162 * metadatas = [] * if geometry_metadata is None: * geometry_metadata = create_empty_geometry_metadata() # <<<<<<<<<<<<<< * cdef float* quant_origin = NULL * try: */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_create_empty_geometry_metadata); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 166, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_create_empty_geometry_metadata); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { @@ -4890,13 +4838,13 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P } __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 166, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 162, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF_SET(__pyx_v_geometry_metadata, __pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":165 + /* "DracoPy.pyx":161 * if metadatas is None: * metadatas = [] * if geometry_metadata is None: # <<<<<<<<<<<<<< @@ -4905,7 +4853,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P */ } - /* "DracoPy.pyx":167 + /* "DracoPy.pyx":163 * if geometry_metadata is None: * geometry_metadata = create_empty_geometry_metadata() * cdef float* quant_origin = NULL # <<<<<<<<<<<<<< @@ -4914,7 +4862,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P */ __pyx_v_quant_origin = NULL; - /* "DracoPy.pyx":168 + /* "DracoPy.pyx":164 * geometry_metadata = create_empty_geometry_metadata() * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -4930,7 +4878,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_XGOTREF(__pyx_t_8); /*try:*/ { - /* "DracoPy.pyx":169 + /* "DracoPy.pyx":165 * cdef float* quant_origin = NULL * try: * num_dims = 3 # <<<<<<<<<<<<<< @@ -4940,7 +4888,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_INCREF(__pyx_int_3); __pyx_v_num_dims = __pyx_int_3; - /* "DracoPy.pyx":170 + /* "DracoPy.pyx":166 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -4951,38 +4899,38 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "DracoPy.pyx":171 + /* "DracoPy.pyx":167 * 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_3 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 171, __pyx_L5_error) + __pyx_t_3 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 167, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 171, __pyx_L5_error) + __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 167, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_9 = __Pyx_PyInt_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 171, __pyx_L5_error) + __pyx_t_9 = __Pyx_PyInt_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 167, __pyx_L5_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_quant_origin = ((float *)PyMem_Malloc(__pyx_t_9)); - /* "DracoPy.pyx":172 + /* "DracoPy.pyx":168 * 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( */ - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 172, __pyx_L5_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 168, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_4); if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_10 = 0; __pyx_t_11 = NULL; } else { - __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 172, __pyx_L5_error) + __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 168, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 172, __pyx_L5_error) + __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 168, __pyx_L5_error) } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; for (;;) { @@ -4990,17 +4938,17 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P if (likely(PyList_CheckExact(__pyx_t_3))) { if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 172, __pyx_L5_error) + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 168, __pyx_L5_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 172, __pyx_L5_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 168, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_4); #endif } else { if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 172, __pyx_L5_error) + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 168, __pyx_L5_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 172, __pyx_L5_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 168, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_4); #endif } @@ -5010,7 +4958,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 172, __pyx_L5_error) + else __PYX_ERR(0, 168, __pyx_L5_error) } break; } @@ -5019,21 +4967,21 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_4); __pyx_t_4 = 0; - /* "DracoPy.pyx":173 + /* "DracoPy.pyx":169 * 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, metadatas, geometry_metadata, */ - __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 173, __pyx_L5_error) + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 169, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 173, __pyx_L5_error) + __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 169, __pyx_L5_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 173, __pyx_L5_error) + __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 169, __pyx_L5_error) (__pyx_v_quant_origin[__pyx_t_13]) = __pyx_t_12; - /* "DracoPy.pyx":172 + /* "DracoPy.pyx":168 * if quantization_origin is not None: * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) * for dim in range(num_dims): # <<<<<<<<<<<<<< @@ -5043,7 +4991,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":170 + /* "DracoPy.pyx":166 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -5052,38 +5000,38 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P */ } - /* "DracoPy.pyx":175 + /* "DracoPy.pyx":171 * quant_origin[dim] = quantization_origin[dim] * encoded_point_cloud = DracoPy.encode_point_cloud( * points, metadatas, geometry_metadata, # <<<<<<<<<<<<<< * quantization_bits, compression_level, * quantization_range, quant_origin, create_metadata, */ - __pyx_t_14 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 175, __pyx_L5_error) - __pyx_t_15 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_metadatas); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 175, __pyx_L5_error) - __pyx_t_16 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_geometry_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 175, __pyx_L5_error) + __pyx_t_14 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 171, __pyx_L5_error) + __pyx_t_15 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_metadatas); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 171, __pyx_L5_error) + __pyx_t_16 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_geometry_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 171, __pyx_L5_error) - /* "DracoPy.pyx":176 + /* "DracoPy.pyx":172 * encoded_point_cloud = DracoPy.encode_point_cloud( * points, metadatas, geometry_metadata, * quantization_bits, compression_level, # <<<<<<<<<<<<<< * quantization_range, quant_origin, create_metadata, * ) */ - __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 176, __pyx_L5_error) - __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 176, __pyx_L5_error) + __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 172, __pyx_L5_error) + __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 172, __pyx_L5_error) - /* "DracoPy.pyx":177 + /* "DracoPy.pyx":173 * points, metadatas, geometry_metadata, * quantization_bits, compression_level, * quantization_range, quant_origin, create_metadata, # <<<<<<<<<<<<<< * ) * if quant_origin != NULL: */ - __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 177, __pyx_L5_error) - __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_19 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 177, __pyx_L5_error) + __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 173, __pyx_L5_error) + __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_19 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 173, __pyx_L5_error) - /* "DracoPy.pyx":174 + /* "DracoPy.pyx":170 * for dim in range(num_dims): * quant_origin[dim] = quantization_origin[dim] * encoded_point_cloud = DracoPy.encode_point_cloud( # <<<<<<<<<<<<<< @@ -5094,11 +5042,11 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_20 = DracoFunctions::encode_point_cloud(__pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_12, __pyx_v_quant_origin, __pyx_t_19); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 174, __pyx_L5_error) + __PYX_ERR(0, 170, __pyx_L5_error) } __pyx_v_encoded_point_cloud = __pyx_t_20; - /* "DracoPy.pyx":179 + /* "DracoPy.pyx":175 * quantization_range, quant_origin, create_metadata, * ) * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -5108,7 +5056,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_2 = ((__pyx_v_quant_origin != NULL) != 0); if (__pyx_t_2) { - /* "DracoPy.pyx":180 + /* "DracoPy.pyx":176 * ) * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -5117,7 +5065,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":179 + /* "DracoPy.pyx":175 * quantization_range, quant_origin, create_metadata, * ) * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -5126,7 +5074,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P */ } - /* "DracoPy.pyx":181 + /* "DracoPy.pyx":177 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -5136,7 +5084,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P switch (__pyx_v_encoded_point_cloud.encode_status) { case DracoFunctions::successful_encoding: - /* "DracoPy.pyx":182 + /* "DracoPy.pyx":178 * PyMem_Free(quant_origin) * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: * return bytes(encoded_point_cloud.buffer) # <<<<<<<<<<<<<< @@ -5144,16 +5092,16 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P * raise EncodingFailedException('Invalid point cloud') */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_encoded_point_cloud.buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 182, __pyx_L5_error) + __pyx_t_3 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_encoded_point_cloud.buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 178, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 182, __pyx_L5_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 178, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L9_try_return; - /* "DracoPy.pyx":181 + /* "DracoPy.pyx":177 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -5163,14 +5111,14 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P break; case DracoFunctions::failed_during_encoding: - /* "DracoPy.pyx":184 + /* "DracoPy.pyx":180 * 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_3, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L5_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 180, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { @@ -5184,14 +5132,14 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P } __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s_Invalid_point_cloud) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_Invalid_point_cloud); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 184, __pyx_L5_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 180, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 184, __pyx_L5_error) + __PYX_ERR(0, 180, __pyx_L5_error) - /* "DracoPy.pyx":183 + /* "DracoPy.pyx":179 * 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: # <<<<<<<<<<<<<< @@ -5202,7 +5150,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P default: break; } - /* "DracoPy.pyx":168 + /* "DracoPy.pyx":164 * geometry_metadata = create_empty_geometry_metadata() * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -5219,7 +5167,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "DracoPy.pyx":185 + /* "DracoPy.pyx":181 * elif encoded_point_cloud.encode_status == DracoPy.encoding_status.failed_during_encoding: * raise EncodingFailedException('Invalid point cloud') * except EncodingFailedException: # <<<<<<<<<<<<<< @@ -5227,7 +5175,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P * except: */ __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 185, __pyx_L7_except_error) + __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 181, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_21); __pyx_t_18 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_4, __pyx_t_21); __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; @@ -5235,19 +5183,19 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_5 = 0; if (__pyx_t_18) { __Pyx_AddTraceback("DracoPy.encode_point_cloud_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 185, __pyx_L7_except_error) + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 181, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_4); - /* "DracoPy.pyx":186 + /* "DracoPy.pyx":182 * raise EncodingFailedException('Invalid point cloud') * except EncodingFailedException: * raise EncodingFailedException('Invalid point cloud') # <<<<<<<<<<<<<< * except: * if quant_origin != NULL: */ - __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 186, __pyx_L7_except_error) + __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 182, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_22); __pyx_t_23 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_22))) { @@ -5261,15 +5209,15 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P } __pyx_t_21 = (__pyx_t_23) ? __Pyx_PyObject_Call2Args(__pyx_t_22, __pyx_t_23, __pyx_kp_s_Invalid_point_cloud) : __Pyx_PyObject_CallOneArg(__pyx_t_22, __pyx_kp_s_Invalid_point_cloud); __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0; - if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 186, __pyx_L7_except_error) + if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 182, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_21); __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; __Pyx_Raise(__pyx_t_21, 0, 0, 0); __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - __PYX_ERR(0, 186, __pyx_L7_except_error) + __PYX_ERR(0, 182, __pyx_L7_except_error) } - /* "DracoPy.pyx":187 + /* "DracoPy.pyx":183 * except EncodingFailedException: * raise EncodingFailedException('Invalid point cloud') * except: # <<<<<<<<<<<<<< @@ -5278,12 +5226,12 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P */ /*except:*/ { __Pyx_AddTraceback("DracoPy.encode_point_cloud_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5) < 0) __PYX_ERR(0, 187, __pyx_L7_except_error) + if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5) < 0) __PYX_ERR(0, 183, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_5); - /* "DracoPy.pyx":188 + /* "DracoPy.pyx":184 * raise EncodingFailedException('Invalid point cloud') * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -5293,7 +5241,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_2 = ((__pyx_v_quant_origin != NULL) != 0); if (__pyx_t_2) { - /* "DracoPy.pyx":189 + /* "DracoPy.pyx":185 * except: * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -5302,7 +5250,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":188 + /* "DracoPy.pyx":184 * raise EncodingFailedException('Invalid point cloud') * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -5311,22 +5259,22 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P */ } - /* "DracoPy.pyx":190 + /* "DracoPy.pyx":186 * if quant_origin != NULL: * PyMem_Free(quant_origin) * raise ValueError("Input invalid") # <<<<<<<<<<<<<< * * def raise_decoding_error(decoding_status): */ - __pyx_t_21 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 190, __pyx_L7_except_error) + __pyx_t_21 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 186, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_21); __Pyx_Raise(__pyx_t_21, 0, 0, 0); __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - __PYX_ERR(0, 190, __pyx_L7_except_error) + __PYX_ERR(0, 186, __pyx_L7_except_error) } __pyx_L7_except_error:; - /* "DracoPy.pyx":168 + /* "DracoPy.pyx":164 * geometry_metadata = create_empty_geometry_metadata() * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -5347,7 +5295,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_L10_try_end:; } - /* "DracoPy.pyx":145 + /* "DracoPy.pyx":141 * raise ValueError("Input invalid") * * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< @@ -5377,7 +5325,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P return __pyx_r; } -/* "DracoPy.pyx":192 +/* "DracoPy.pyx":188 * raise ValueError("Input invalid") * * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< @@ -5411,29 +5359,29 @@ static PyObject *__pyx_pf_7DracoPy_6raise_decoding_error(CYTHON_UNUSED PyObject int __pyx_clineno = 0; __Pyx_RefNannySetupContext("raise_decoding_error", 0); - /* "DracoPy.pyx":193 + /* "DracoPy.pyx":189 * * 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, 193, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::not_draco_encoded); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 189, __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, 193, __pyx_L1_error) + __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, 189, __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, 193, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 189, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":194 + /* "DracoPy.pyx":190 * 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, 194, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FileTypeException); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 190, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { @@ -5447,14 +5395,14 @@ static PyObject *__pyx_pf_7DracoPy_6raise_decoding_error(CYTHON_UNUSED PyObject } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_kp_s_Input_mesh_is_not_draco_encoded) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_s_Input_mesh_is_not_draco_encoded); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 190, __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, 194, __pyx_L1_error) + __PYX_ERR(0, 190, __pyx_L1_error) - /* "DracoPy.pyx":193 + /* "DracoPy.pyx":189 * * def raise_decoding_error(decoding_status): * if decoding_status == DracoPy.decoding_status.not_draco_encoded: # <<<<<<<<<<<<<< @@ -5463,35 +5411,35 @@ static PyObject *__pyx_pf_7DracoPy_6raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":195 + /* "DracoPy.pyx":191 * 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, 195, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::failed_during_decoding); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 191, __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, 195, __pyx_L1_error) + __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, 191, __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, 195, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 191, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":196 + /* "DracoPy.pyx":192 * 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__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 196, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __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, 196, __pyx_L1_error) + __PYX_ERR(0, 192, __pyx_L1_error) - /* "DracoPy.pyx":195 + /* "DracoPy.pyx":191 * 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: # <<<<<<<<<<<<<< @@ -5500,35 +5448,35 @@ static PyObject *__pyx_pf_7DracoPy_6raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":197 + /* "DracoPy.pyx":193 * 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, 197, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::no_position_attribute); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 193, __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, 197, __pyx_L1_error) + __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, 193, __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, 197, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 193, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":198 + /* "DracoPy.pyx":194 * 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__4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 198, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __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, 198, __pyx_L1_error) + __PYX_ERR(0, 194, __pyx_L1_error) - /* "DracoPy.pyx":197 + /* "DracoPy.pyx":193 * 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: # <<<<<<<<<<<<<< @@ -5537,7 +5485,7 @@ static PyObject *__pyx_pf_7DracoPy_6raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":192 + /* "DracoPy.pyx":188 * raise ValueError("Input invalid") * * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< @@ -5560,7 +5508,7 @@ static PyObject *__pyx_pf_7DracoPy_6raise_decoding_error(CYTHON_UNUSED PyObject return __pyx_r; } -/* "DracoPy.pyx":200 +/* "DracoPy.pyx":196 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer, deduplicate=False): # <<<<<<<<<<<<<< @@ -5608,7 +5556,7 @@ static PyObject *__pyx_pw_7DracoPy_9decode_buffer_to_mesh(PyObject *__pyx_self, } } 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, 200, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode_buffer_to_mesh") < 0)) __PYX_ERR(0, 196, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -5624,7 +5572,7 @@ static PyObject *__pyx_pw_7DracoPy_9decode_buffer_to_mesh(PyObject *__pyx_self, } 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, 200, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decode_buffer_to_mesh", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 196, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("DracoPy.decode_buffer_to_mesh", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -5655,25 +5603,25 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject int __pyx_clineno = 0; __Pyx_RefNannySetupContext("decode_buffer_to_mesh", 0); - /* "DracoPy.pyx":201 + /* "DracoPy.pyx":197 * * def decode_buffer_to_mesh(buffer, deduplicate=False): * 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, 201, __pyx_L1_error) - __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 201, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_deduplicate); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 201, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 197, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_deduplicate); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 197, __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, 201, __pyx_L1_error) + __PYX_ERR(0, 197, __pyx_L1_error) } __pyx_v_mesh_struct = __pyx_t_4; - /* "DracoPy.pyx":202 + /* "DracoPy.pyx":198 * def decode_buffer_to_mesh(buffer, deduplicate=False): * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< @@ -5683,7 +5631,7 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject __pyx_t_5 = ((__pyx_v_mesh_struct.decode_status == DracoFunctions::successful) != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":203 + /* "DracoPy.pyx":199 * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: * return DracoMesh(mesh_struct) # <<<<<<<<<<<<<< @@ -5691,9 +5639,9 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject * 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, 203, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_DracoMesh); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 199, __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, 203, __pyx_L1_error) + __pyx_t_8 = __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(__pyx_v_mesh_struct); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 199, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { @@ -5708,14 +5656,14 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject __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, 203, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 199, __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":202 + /* "DracoPy.pyx":198 * def decode_buffer_to_mesh(buffer, deduplicate=False): * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< @@ -5724,7 +5672,7 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":205 + /* "DracoPy.pyx":201 * return DracoMesh(mesh_struct) * else: * raise_decoding_error(mesh_struct.decode_status) # <<<<<<<<<<<<<< @@ -5732,9 +5680,9 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject * 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, 205, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_raise_decoding_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 201, __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, 205, __pyx_L1_error) + __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, 201, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { @@ -5749,13 +5697,13 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject __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, 205, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 201, __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":200 + /* "DracoPy.pyx":196 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer, deduplicate=False): # <<<<<<<<<<<<<< @@ -5779,7 +5727,7 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject return __pyx_r; } -/* "DracoPy.pyx":207 +/* "DracoPy.pyx":203 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer, deduplicate=False): # <<<<<<<<<<<<<< @@ -5827,7 +5775,7 @@ static PyObject *__pyx_pw_7DracoPy_11decode_point_cloud_buffer(PyObject *__pyx_s } } 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, 207, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode_point_cloud_buffer") < 0)) __PYX_ERR(0, 203, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -5843,7 +5791,7 @@ static PyObject *__pyx_pw_7DracoPy_11decode_point_cloud_buffer(PyObject *__pyx_s } 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, 207, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decode_point_cloud_buffer", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 203, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("DracoPy.decode_point_cloud_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -5874,25 +5822,25 @@ static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyO int __pyx_clineno = 0; __Pyx_RefNannySetupContext("decode_point_cloud_buffer", 0); - /* "DracoPy.pyx":208 + /* "DracoPy.pyx":204 * * def decode_point_cloud_buffer(buffer, deduplicate=False): * 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, 208, __pyx_L1_error) - __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 208, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_deduplicate); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 208, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 204, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 204, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_deduplicate); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 204, __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, 208, __pyx_L1_error) + __PYX_ERR(0, 204, __pyx_L1_error) } __pyx_v_point_cloud_struct = __pyx_t_4; - /* "DracoPy.pyx":209 + /* "DracoPy.pyx":205 * def decode_point_cloud_buffer(buffer, deduplicate=False): * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer), deduplicate) * if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< @@ -5902,7 +5850,7 @@ static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyO __pyx_t_5 = ((__pyx_v_point_cloud_struct.decode_status == DracoFunctions::successful) != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":210 + /* "DracoPy.pyx":206 * 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) # <<<<<<<<<<<<<< @@ -5910,9 +5858,9 @@ static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyO * 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, 210, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 206, __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, 210, __pyx_L1_error) + __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, 206, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { @@ -5927,14 +5875,14 @@ static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyO __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, 210, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 206, __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":209 + /* "DracoPy.pyx":205 * def decode_point_cloud_buffer(buffer, deduplicate=False): * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer), deduplicate) * if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< @@ -5943,15 +5891,15 @@ static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyO */ } - /* "DracoPy.pyx":212 + /* "DracoPy.pyx":208 * 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, 212, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_raise_decoding_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 208, __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, 212, __pyx_L1_error) + __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, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { @@ -5966,13 +5914,13 @@ static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyO __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, 212, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 208, __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":207 + /* "DracoPy.pyx":203 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer, deduplicate=False): # <<<<<<<<<<<<<< @@ -9034,7 +8982,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_dim, __pyx_k_dim, sizeof(__pyx_k_dim), 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_e, __pyx_k_e, sizeof(__pyx_k_e), 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}, @@ -9069,7 +9016,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1}, - {&__pyx_n_s_print_exc, __pyx_k_print_exc, sizeof(__pyx_k_print_exc), 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}, @@ -9084,7 +9030,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_src_DracoPy_pyx, __pyx_k_src_DracoPy_pyx, sizeof(__pyx_k_src_DracoPy_pyx), 0, 0, 1, 0}, {&__pyx_n_s_sub_metadata_ids, __pyx_k_sub_metadata_ids, sizeof(__pyx_k_sub_metadata_ids), 0, 0, 1, 1}, {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_traceback, __pyx_k_traceback, sizeof(__pyx_k_traceback), 0, 0, 1, 1}, {&__pyx_n_s_typing, __pyx_k_typing, sizeof(__pyx_k_typing), 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} @@ -9092,9 +9037,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { 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, 27, __pyx_L1_error) - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 66, __pyx_L1_error) - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 73, __pyx_L1_error) - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 196, __pyx_L1_error) + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 62, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 69, __pyx_L1_error) + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 192, __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:; @@ -9105,47 +9050,47 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "DracoPy.pyx":66 + /* "DracoPy.pyx":62 * 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_ = PyTuple_Pack(1, __pyx_kp_s_Specified_value_out_of_encoded_r); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 66, __pyx_L1_error) + __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_Specified_value_out_of_encoded_r); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_); - /* "DracoPy.pyx":143 + /* "DracoPy.pyx":139 * if quant_origin != NULL: * PyMem_Free(quant_origin) * raise ValueError("Input invalid") # <<<<<<<<<<<<<< * * def encode_point_cloud_to_buffer(points, */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_Input_invalid); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 143, __pyx_L1_error) + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_Input_invalid); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 139, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); - /* "DracoPy.pyx":196 + /* "DracoPy.pyx":192 * 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_s_Failed_to_decode_input_mesh_Data); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 196, __pyx_L1_error) + __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_Failed_to_decode_input_mesh_Data); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 192, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); - /* "DracoPy.pyx":198 + /* "DracoPy.pyx":194 * 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__4 = PyTuple_Pack(1, __pyx_kp_s_DracoPy_only_supports_meshes_wit); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 198, __pyx_L1_error) + __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_DracoPy_only_supports_meshes_wit); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 194, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4); @@ -9302,176 +9247,176 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * @property * def geometry_metadata(self) -> Dict: # <<<<<<<<<<<<<< * return self.data_struct['geometry_metadata'] - * # + * */ __pyx_tuple__23 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 36, __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_geometry_metadata, 36, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 36, __pyx_L1_error) - /* "DracoPy.pyx":44 + /* "DracoPy.pyx":40 * * @property * def metadatas(self) -> List[Dict]: # <<<<<<<<<<<<<< * return self.data_struct['metadatas'] * */ - __pyx_tuple__25 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_tuple__25 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 40, __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_metadatas, 44, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 44, __pyx_L1_error) + __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_metadatas, 40, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 40, __pyx_L1_error) - /* "DracoPy.pyx":50 + /* "DracoPy.pyx":46 * class DracoMesh(DracoPointCloud): * @property * def faces(self) -> List[int]: # <<<<<<<<<<<<<< * return self.data_struct['faces'] * */ - __pyx_tuple__27 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 50, __pyx_L1_error) + __pyx_tuple__27 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 46, __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_faces, 50, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 50, __pyx_L1_error) + __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_faces, 46, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 46, __pyx_L1_error) - /* "DracoPy.pyx":54 + /* "DracoPy.pyx":50 * * @property * def normals(self): # <<<<<<<<<<<<<< * return self.data_struct['normals'] * */ - __pyx_tuple__29 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 54, __pyx_L1_error) + __pyx_tuple__29 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 50, __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_normals, 54, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 54, __pyx_L1_error) + __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_normals, 50, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 50, __pyx_L1_error) - /* "DracoPy.pyx":57 + /* "DracoPy.pyx":53 * return self.data_struct['normals'] * * class EncodingOptions(object): # <<<<<<<<<<<<<< * def __init__(self, quantization_bits, quantization_range, quantization_origin): * self.quantization_bits = quantization_bits */ - __pyx_tuple__31 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 57, __pyx_L1_error) + __pyx_tuple__31 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__31); __Pyx_GIVEREF(__pyx_tuple__31); - /* "DracoPy.pyx":58 + /* "DracoPy.pyx":54 * * class EncodingOptions(object): * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< * self.quantization_bits = quantization_bits * self.quantization_range = quantization_range */ - __pyx_tuple__32 = 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__32)) __PYX_ERR(0, 58, __pyx_L1_error) + __pyx_tuple__32 = 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__32)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__32); __Pyx_GIVEREF(__pyx_tuple__32); - __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_init, 58, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 58, __pyx_L1_error) + __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_init, 54, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 54, __pyx_L1_error) - /* "DracoPy.pyx":64 + /* "DracoPy.pyx":60 * 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__34 = 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__34)) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_tuple__34 = 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__34)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__34); __Pyx_GIVEREF(__pyx_tuple__34); - __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_get_encoded_coordinate, 64, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_get_encoded_coordinate, 60, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 60, __pyx_L1_error) - /* "DracoPy.pyx":71 + /* "DracoPy.pyx":67 * 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__36 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_point, __pyx_n_s_encoded_point, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 71, __pyx_L1_error) + __pyx_tuple__36 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_point, __pyx_n_s_encoded_point, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__36); __Pyx_GIVEREF(__pyx_tuple__36); - __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(2, 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_get_encoded_point, 71, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 71, __pyx_L1_error) + __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(2, 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_get_encoded_point, 67, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 67, __pyx_L1_error) - /* "DracoPy.pyx":78 + /* "DracoPy.pyx":74 * * @property * def num_axes(self): # <<<<<<<<<<<<<< * return 3 * */ - __pyx_tuple__38 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_tuple__38 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__38); __Pyx_GIVEREF(__pyx_tuple__38); - __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_num_axes, 78, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 78, __pyx_L1_error) + __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_num_axes, 74, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 74, __pyx_L1_error) - /* "DracoPy.pyx":87 + /* "DracoPy.pyx":83 * pass * * def create_empty_geometry_metadata() -> dict: # <<<<<<<<<<<<<< * return { * "metadata_id": 0, */ - __pyx_codeobj__40 = (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, 87, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_codeobj__40 = (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, 83, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 83, __pyx_L1_error) - /* "DracoPy.pyx":94 + /* "DracoPy.pyx":90 * * * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< - * quantization_bits=14, compression_level=1, - * quantization_range=-1, quantization_origin=None, + * quantization_bits=14, + * compression_level=1, */ - __pyx_tuple__41 = PyTuple_Pack(15, __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_metadatas, __pyx_n_s_geometry_metadata, __pyx_n_s_quant_origin, __pyx_n_s_num_dims, __pyx_n_s_dim, __pyx_n_s_encoded_mesh, __pyx_n_s_e, __pyx_n_s_traceback); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 94, __pyx_L1_error) + __pyx_tuple__41 = PyTuple_Pack(13, __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_metadatas, __pyx_n_s_geometry_metadata, __pyx_n_s_quant_origin, __pyx_n_s_num_dims, __pyx_n_s_dim, __pyx_n_s_encoded_mesh); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__41); __Pyx_GIVEREF(__pyx_tuple__41); - __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(9, 0, 15, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_encode_mesh_to_buffer, 94, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 94, __pyx_L1_error) + __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(9, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_encode_mesh_to_buffer, 90, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 90, __pyx_L1_error) - /* "DracoPy.pyx":145 + /* "DracoPy.pyx":141 * raise ValueError("Input invalid") * * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< * quantization_bits=14, * compression_level=1, */ - __pyx_tuple__43 = PyTuple_Pack(12, __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_metadatas, __pyx_n_s_geometry_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__43)) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_tuple__43 = PyTuple_Pack(12, __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_metadatas, __pyx_n_s_geometry_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__43)) __PYX_ERR(0, 141, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__43); __Pyx_GIVEREF(__pyx_tuple__43); - __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(8, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_encode_point_cloud_to_buffer, 145, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(8, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_encode_point_cloud_to_buffer, 141, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 141, __pyx_L1_error) - /* "DracoPy.pyx":192 + /* "DracoPy.pyx":188 * 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__45 = PyTuple_Pack(1, __pyx_n_s_decoding_status); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 192, __pyx_L1_error) + __pyx_tuple__45 = PyTuple_Pack(1, __pyx_n_s_decoding_status); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 188, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__45); __Pyx_GIVEREF(__pyx_tuple__45); - __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_raise_decoding_error, 192, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 192, __pyx_L1_error) + __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_raise_decoding_error, 188, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 188, __pyx_L1_error) - /* "DracoPy.pyx":200 + /* "DracoPy.pyx":196 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer, deduplicate=False): # <<<<<<<<<<<<<< * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: */ - __pyx_tuple__47 = PyTuple_Pack(3, __pyx_n_s_buffer, __pyx_n_s_deduplicate, __pyx_n_s_mesh_struct); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 200, __pyx_L1_error) + __pyx_tuple__47 = PyTuple_Pack(3, __pyx_n_s_buffer, __pyx_n_s_deduplicate, __pyx_n_s_mesh_struct); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__47); __Pyx_GIVEREF(__pyx_tuple__47); - __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_buffer_to_mesh, 200, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) __PYX_ERR(0, 200, __pyx_L1_error) + __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_buffer_to_mesh, 196, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) __PYX_ERR(0, 196, __pyx_L1_error) - /* "DracoPy.pyx":207 + /* "DracoPy.pyx":203 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer, deduplicate=False): # <<<<<<<<<<<<<< * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer), deduplicate) * if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: */ - __pyx_tuple__49 = PyTuple_Pack(3, __pyx_n_s_buffer, __pyx_n_s_deduplicate, __pyx_n_s_point_cloud_struct); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 207, __pyx_L1_error) + __pyx_tuple__49 = PyTuple_Pack(3, __pyx_n_s_buffer, __pyx_n_s_deduplicate, __pyx_n_s_point_cloud_struct); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__49); __Pyx_GIVEREF(__pyx_tuple__49); - __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_point_cloud_buffer, 207, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(0, 207, __pyx_L1_error) + __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_point_cloud_buffer, 203, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -9920,7 +9865,7 @@ if (!__Pyx_RefNanny) { * @property * def geometry_metadata(self) -> Dict: # <<<<<<<<<<<<<< * return self.data_struct['geometry_metadata'] - * # + * */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); @@ -9946,41 +9891,41 @@ if (!__Pyx_RefNanny) { if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_geometry_metadata, __pyx_t_4) < 0) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "DracoPy.pyx":44 + /* "DracoPy.pyx":40 * * @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, 44, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_List); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_List); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 40, __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, 44, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Dict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 40, __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, 44, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 40, __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, 44, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_t_6) < 0) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_13metadatas, 0, __pyx_n_s_DracoPointCloud_metadatas, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_13metadatas, 0, __pyx_n_s_DracoPointCloud_metadatas, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 40, __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":43 - * # return self.data_struct['attributes'] + /* "DracoPy.pyx":39 + * return self.data_struct['geometry_metadata'] * * @property # <<<<<<<<<<<<<< * def metadatas(self) -> List[Dict]: * return self.data_struct['metadatas'] */ - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 43, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 39, __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_metadatas, __pyx_t_4) < 0) __PYX_ERR(0, 44, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_metadatas, __pyx_t_4) < 0) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; /* "DracoPy.pyx":9 @@ -9997,300 +9942,300 @@ if (!__Pyx_RefNanny) { __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":48 + /* "DracoPy.pyx":44 * * * 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, 48, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __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, 48, __pyx_L1_error) + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __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, 48, __pyx_L1_error) + __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, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - /* "DracoPy.pyx":50 + /* "DracoPy.pyx":46 * class DracoMesh(DracoPointCloud): * @property * def faces(self) -> List[int]: # <<<<<<<<<<<<<< * return self.data_struct['faces'] * */ - __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 50, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_List); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_List); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_3, ((PyObject *)(&PyInt_Type))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 50, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_3, ((PyObject *)(&PyInt_Type))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_return, __pyx_t_5) < 0) __PYX_ERR(0, 50, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_return, __pyx_t_5) < 0) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_9DracoMesh_1faces, 0, __pyx_n_s_DracoMesh_faces, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 50, __pyx_L1_error) + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_9DracoMesh_1faces, 0, __pyx_n_s_DracoMesh_faces, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "DracoPy.pyx":49 + /* "DracoPy.pyx":45 * * class DracoMesh(DracoPointCloud): * @property # <<<<<<<<<<<<<< * def faces(self) -> List[int]: * return self.data_struct['faces'] */ - __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 49, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 45, __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_faces, __pyx_t_6) < 0) __PYX_ERR(0, 50, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_4, __pyx_n_s_faces, __pyx_t_6) < 0) __PYX_ERR(0, 46, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "DracoPy.pyx":54 + /* "DracoPy.pyx":50 * * @property * def normals(self): # <<<<<<<<<<<<<< * return self.data_struct['normals'] * */ - __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_9DracoMesh_3normals, 0, __pyx_n_s_DracoMesh_normals, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 54, __pyx_L1_error) + __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_9DracoMesh_3normals, 0, __pyx_n_s_DracoMesh_normals, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - /* "DracoPy.pyx":53 + /* "DracoPy.pyx":49 * return self.data_struct['faces'] * * @property # <<<<<<<<<<<<<< * def normals(self): * return self.data_struct['normals'] */ - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 53, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 49, __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_normals, __pyx_t_5) < 0) __PYX_ERR(0, 54, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_4, __pyx_n_s_normals, __pyx_t_5) < 0) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "DracoPy.pyx":48 + /* "DracoPy.pyx":44 * * * class DracoMesh(DracoPointCloud): # <<<<<<<<<<<<<< * @property * def faces(self) -> List[int]: */ - __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoMesh, __pyx_t_2, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 48, __pyx_L1_error) + __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoMesh, __pyx_t_2, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoMesh, __pyx_t_5) < 0) __PYX_ERR(0, 48, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoMesh, __pyx_t_5) < 0) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 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":57 + /* "DracoPy.pyx":53 * return self.data_struct['normals'] * * 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__31); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 57, __pyx_L1_error) + __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__31); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_tuple__31, __pyx_n_s_EncodingOptions, __pyx_n_s_EncodingOptions, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 57, __pyx_L1_error) + __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_tuple__31, __pyx_n_s_EncodingOptions, __pyx_n_s_EncodingOptions, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - /* "DracoPy.pyx":58 + /* "DracoPy.pyx":54 * * 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__33)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 58, __pyx_L1_error) + __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__33)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __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, 58, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_4) < 0) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "DracoPy.pyx":64 + /* "DracoPy.pyx":60 * 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__35)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 64, __pyx_L1_error) + __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__35)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 60, __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, 64, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_encoded_coordinate, __pyx_t_4) < 0) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "DracoPy.pyx":71 + /* "DracoPy.pyx":67 * 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__37)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 71, __pyx_L1_error) + __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__37)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 67, __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, 71, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_encoded_point, __pyx_t_4) < 0) __PYX_ERR(0, 67, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "DracoPy.pyx":78 + /* "DracoPy.pyx":74 * * @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__39)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 78, __pyx_L1_error) + __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__39)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - /* "DracoPy.pyx":77 + /* "DracoPy.pyx":73 * return encoded_point * * @property # <<<<<<<<<<<<<< * def num_axes(self): * return 3 */ - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 77, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 73, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_num_axes, __pyx_t_5) < 0) __PYX_ERR(0, 78, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_num_axes, __pyx_t_5) < 0) __PYX_ERR(0, 74, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "DracoPy.pyx":57 + /* "DracoPy.pyx":53 * return self.data_struct['normals'] * * class EncodingOptions(object): # <<<<<<<<<<<<<< * def __init__(self, quantization_bits, quantization_range, quantization_origin): * self.quantization_bits = quantization_bits */ - __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_EncodingOptions, __pyx_tuple__31, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 57, __pyx_L1_error) + __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_EncodingOptions, __pyx_tuple__31, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingOptions, __pyx_t_5) < 0) __PYX_ERR(0, 57, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingOptions, __pyx_t_5) < 0) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":81 + /* "DracoPy.pyx":77 * return 3 * * class FileTypeException(Exception): # <<<<<<<<<<<<<< * pass * */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __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, 81, __pyx_L1_error) + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __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_5)) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_t_5 = __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_5)) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_FileTypeException, __pyx_t_2, __pyx_t_5, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 81, __pyx_L1_error) + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_FileTypeException, __pyx_t_2, __pyx_t_5, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_FileTypeException, __pyx_t_4) < 0) __PYX_ERR(0, 81, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_FileTypeException, __pyx_t_4) < 0) __PYX_ERR(0, 77, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":84 + /* "DracoPy.pyx":80 * pass * * class EncodingFailedException(Exception): # <<<<<<<<<<<<<< * pass * */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __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, 84, __pyx_L1_error) + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __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_5)) __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_t_5 = __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_5)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_EncodingFailedException, __pyx_t_2, __pyx_t_5, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L1_error) + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_EncodingFailedException, __pyx_t_2, __pyx_t_5, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingFailedException, __pyx_t_4) < 0) __PYX_ERR(0, 84, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingFailedException, __pyx_t_4) < 0) __PYX_ERR(0, 80, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":87 + /* "DracoPy.pyx":83 * pass * * def create_empty_geometry_metadata() -> dict: # <<<<<<<<<<<<<< * return { * "metadata_id": 0, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_1create_empty_geometry_metadata, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 87, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_1create_empty_geometry_metadata, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __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, 87, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_create_empty_geometry_metadata, __pyx_t_2) < 0) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":94 + /* "DracoPy.pyx":90 * * * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< - * quantization_bits=14, compression_level=1, - * quantization_range=-1, quantization_origin=None, + * quantization_bits=14, + * compression_level=1, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_3encode_mesh_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_3encode_mesh_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __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, 94, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_mesh_to_buffer, __pyx_t_2) < 0) __PYX_ERR(0, 90, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":145 + /* "DracoPy.pyx":141 * raise ValueError("Input invalid") * * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< * quantization_bits=14, * compression_level=1, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_5encode_point_cloud_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 145, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_5encode_point_cloud_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 141, __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, 145, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_point_cloud_to_buffer, __pyx_t_2) < 0) __PYX_ERR(0, 141, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":192 + /* "DracoPy.pyx":188 * 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_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_7raise_decoding_error, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 192, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_7raise_decoding_error, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 188, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_raise_decoding_error, __pyx_t_2) < 0) __PYX_ERR(0, 192, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_raise_decoding_error, __pyx_t_2) < 0) __PYX_ERR(0, 188, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":200 + /* "DracoPy.pyx":196 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer, deduplicate=False): # <<<<<<<<<<<<<< * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_9decode_buffer_to_mesh, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 200, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_9decode_buffer_to_mesh, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 196, __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, 200, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode_buffer_to_mesh, __pyx_t_2) < 0) __PYX_ERR(0, 196, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":207 + /* "DracoPy.pyx":203 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer, deduplicate=False): # <<<<<<<<<<<<<< * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer), deduplicate) * if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_11decode_point_cloud_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 207, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_11decode_point_cloud_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 203, __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, 207, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode_point_cloud_buffer, __pyx_t_2) < 0) __PYX_ERR(0, 203, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "DracoPy.pyx":1 @@ -11681,96 +11626,6 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) 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 - -/* Import */ - static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *empty_list = 0; - PyObject *module = 0; - PyObject *global_dict = 0; - PyObject *empty_dict = 0; - PyObject *list; - #if PY_MAJOR_VERSION < 3 - PyObject *py_import; - py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (!py_import) - goto bad; - #endif - if (from_list) - list = from_list; - else { - empty_list = PyList_New(0); - if (!empty_list) - goto bad; - list = empty_list; - } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; - empty_dict = PyDict_New(); - if (!empty_dict) - goto bad; - { - #if PY_MAJOR_VERSION >= 3 - if (level == -1) { - if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, 1); - if (!module) { - if (!PyErr_ExceptionMatches(PyExc_ImportError)) - goto bad; - PyErr_Clear(); - } - } - level = 0; - } - #endif - if (!module) { - #if PY_MAJOR_VERSION < 3 - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, (PyObject *)NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, level); - #endif - } - } -bad: - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(py_import); - #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); - return module; -} - /* IterFinish */ static CYTHON_INLINE int __Pyx_IterFinish(void) { #if CYTHON_FAST_THREAD_STATE @@ -12124,6 +11979,96 @@ static CYTHON_INLINE int __Pyx_dict_iter_next( 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 + +/* Import */ + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + #if PY_MAJOR_VERSION < 3 + PyObject *py_import; + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); + if (!py_import) + goto bad; + #endif + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, 1); + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; + } + #endif + if (!module) { + #if PY_MAJOR_VERSION < 3 + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, (PyObject *)NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, level); + #endif + } + } +bad: + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_import); + #endif + Py_XDECREF(empty_list); + Py_XDECREF(empty_dict); + return module; +} + /* ImportFrom */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); diff --git a/src/DracoPy.h b/src/DracoPy.h index e687b3f..13d880a 100644 --- a/src/DracoPy.h +++ b/src/DracoPy.h @@ -11,6 +11,7 @@ #include "draco/point_cloud/point_cloud_builder.h" namespace DracoFunctions { + enum decoding_status { successful, not_draco_encoded, no_position_attribute, failed_during_decoding }; enum encoding_status { successful_encoding, failed_during_encoding }; @@ -347,7 +348,7 @@ namespace DracoFunctions { 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); - auto metadata = std::make_unique(); + std::unique_ptr metadata = std::unique_ptr(new draco::GeometryMetadata()); if (quantization_origin == NULL || quantization_range == -1) { encoder.SetAttributeQuantization(draco::GeometryAttribute::POSITION, quantization_bits); } @@ -443,4 +444,5 @@ namespace DracoFunctions { } return encodedPointCloudObject; } + } diff --git a/src/DracoPy.pxd b/src/DracoPy.pxd index c272bae..6b82419 100644 --- a/src/DracoPy.pxd +++ b/src/DracoPy.pxd @@ -82,18 +82,6 @@ cdef extern from "DracoPy.h" namespace "DracoFunctions": vector[unsigned char] buffer encoding_status encode_status - cdef cppclass MetadataReader: - MetadataReader(const string& s) except + - uint32_t read_uint() except + - string read_bytes() except + - - cdef cppclass MetadataWriter: - MetadataWriter() except + - void write_uint(const uint32_t& value) except + - void write_bytes_from_str(const string& value) except + - void write_bytes_from_vec(const vector[uint8_t]& value) except + - string get() 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, bool deduplicate) except + diff --git a/src/DracoPy.pyx b/src/DracoPy.pyx index f0cd87c..1b3f2c7 100644 --- a/src/DracoPy.pyx +++ b/src/DracoPy.pyx @@ -35,10 +35,6 @@ class DracoPointCloud(object): @property def geometry_metadata(self) -> Dict: return self.data_struct['geometry_metadata'] - # - # @property - # def attributes(self) -> List[Dict]: - # return self.data_struct['attributes'] @property def metadatas(self) -> List[Dict]: @@ -92,8 +88,10 @@ def create_empty_geometry_metadata() -> dict: def encode_mesh_to_buffer(points, faces, - quantization_bits=14, compression_level=1, - quantization_range=-1, quantization_origin=None, + quantization_bits=14, + compression_level=1, + quantization_range=-1, + quantization_origin=None, create_metadata=False, metadatas = None, geometry_metadata = None, @@ -135,9 +133,7 @@ def encode_mesh_to_buffer(points, faces, raise EncodingFailedException('Invalid mesh') except EncodingFailedException: raise EncodingFailedException('Invalid mesh') - except Exception as e: - import traceback - traceback.print_exc() + except: if quant_origin != NULL: PyMem_Free(quant_origin) raise ValueError("Input invalid") diff --git a/tests.py b/tests.py index c144b57..ea66b0d 100644 --- a/tests.py +++ b/tests.py @@ -85,20 +85,18 @@ def create_faces_map(in_faces: List[int], def test_decoding_and_encoding_mesh_file(): expected_points = 104502 expected_faces = 208353 - with open(os.path.join(testdata_directory, "bunny.drc"), - "rb") as draco_file: + with open(os.path.join(testdata_directory, "bunny.drc"), "rb") as draco_file: file_content = draco_file.read() mesh_object = DracoPy.decode_buffer_to_mesh(file_content) assert len(mesh_object.points) == expected_points assert len(mesh_object.faces) == expected_faces encoding_test = DracoPy.encode_mesh_to_buffer( - mesh_object.points, mesh_object.faces) - with open(os.path.join(testdata_directory, "bunny_test.drc"), - "wb") as test_file: + mesh_object.points, mesh_object.faces + ) + with open(os.path.join(testdata_directory, "bunny_test.drc"), "wb") as test_file: test_file.write(encoding_test) - with open(os.path.join(testdata_directory, "bunny_test.drc"), - "rb") as test_file: + with open(os.path.join(testdata_directory, "bunny_test.drc"), "rb") as test_file: file_content = test_file.read() mesh_object = DracoPy.decode_buffer_to_mesh(file_content) assert (mesh_object.encoding_options) is None @@ -107,16 +105,14 @@ def test_decoding_and_encoding_mesh_file(): def test_decoding_improper_file(): - with open(os.path.join(testdata_directory, "bunny.obj"), - "rb") as improper_file: + with open(os.path.join(testdata_directory, "bunny.obj"), "rb") as improper_file: file_content = improper_file.read() with pytest.raises(DracoPy.FileTypeException): DracoPy.decode_buffer_to_mesh(file_content) def test_metadata(): - with open(os.path.join(testdata_directory, "bunny.drc"), - "rb") as draco_file: + with open(os.path.join(testdata_directory, "bunny.drc"), "rb") as draco_file: file_content = draco_file.read() mesh_object = DracoPy.decode_buffer_to_mesh(file_content) encoding_options = { @@ -130,12 +126,11 @@ def test_metadata(): mesh_object.points, mesh_object.faces, **encoding_options ) with open( - os.path.join(testdata_directory, "bunny_test.drc"), "wb" + os.path.join(testdata_directory, "bunny_test.drc"), "wb" ) as test_file: test_file.write(encoding_test) - with open(os.path.join(testdata_directory, "bunny_test.drc"), - "rb") as test_file: + with open(os.path.join(testdata_directory, "bunny_test.drc"), "rb") as test_file: file_content = test_file.read() mesh_object = DracoPy.decode_buffer_to_mesh(file_content) eo = mesh_object.encoding_options @@ -148,21 +143,19 @@ def test_metadata(): def test_decoding_and_encoding_point_cloud_file(): expected_points = 107841 with open( - os.path.join(testdata_directory, "point_cloud_bunny.drc"), "rb" + os.path.join(testdata_directory, "point_cloud_bunny.drc"), "rb" ) as draco_file: file_content = draco_file.read() point_cloud_object = DracoPy.decode_point_cloud_buffer(file_content) assert len(point_cloud_object.points) == expected_points - encoding_test = DracoPy.encode_point_cloud_to_buffer( - point_cloud_object.points) + encoding_test = DracoPy.encode_point_cloud_to_buffer(point_cloud_object.points) with open( - os.path.join(testdata_directory, "point_cloud_bunny_test.drc"), - "wb" + os.path.join(testdata_directory, "point_cloud_bunny_test.drc"), "wb" ) as test_file: test_file.write(encoding_test) with open( - os.path.join(testdata_directory, "point_cloud_bunny_test.drc"), "rb" + os.path.join(testdata_directory, "point_cloud_bunny_test.drc"), "rb" ) as test_file: file_content = test_file.read() point_cloud_object = DracoPy.decode_point_cloud_buffer(file_content) From 90a2d2aefbaeba232f397a9669f4ba710a2b231d Mon Sep 17 00:00:00 2001 From: Andrey Romanov Date: Thu, 11 Nov 2021 18:24:37 +0300 Subject: [PATCH 13/21] fix name in comments --- tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests.py b/tests.py index ea66b0d..362039b 100644 --- a/tests.py +++ b/tests.py @@ -13,7 +13,7 @@ def create_tetrahedron() -> Tuple[List[float], List[int]]: """ - Tetrader + Tetrahedron (3) | | From 33f374a2ff8a6a7e4dfe6e59bcd89a8b8af2e26f Mon Sep 17 00:00:00 2001 From: Andrey Romanov Date: Fri, 12 Nov 2021 13:22:47 +0300 Subject: [PATCH 14/21] full support c++11 --- src/DracoPy.h | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/DracoPy.h b/src/DracoPy.h index 13d880a..82c59f5 100644 --- a/src/DracoPy.h +++ b/src/DracoPy.h @@ -86,16 +86,22 @@ namespace DracoFunctions { to_parse_metadatas_next; !to_parse_metadata.empty(); to_parse_metadata = std::move(to_parse_metadatas_next)) { - for (auto& [metadata, metadata_object_idx]: to_parse_metadata) { + 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& [name, vec_value]: metadata->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& [name, sub_metadata]: metadata->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}); @@ -128,7 +134,7 @@ namespace DracoFunctions { 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.data()); + attribute->GetMappedValue(v, &value[0]); } attribute_objects.push_back(std::move(pao)); } @@ -182,15 +188,21 @@ namespace DracoFunctions { to_parse_metadatas_next; !to_parse_metadata.empty(); to_parse_metadata = std::move(to_parse_metadatas_next)) { - for (auto& [metadata, metadata_object]: to_parse_metadata) { + 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& [name, str_value]: metadata_object->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& [name, metadata_id]: metadata_object->sub_metadata_ids) { + 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; auto sub_metadata = std::make_unique(); to_parse_metadatas_next.push_back({sub_metadata.get(), &metadatas[metadata_id]}); metadata->AddSubMetadata(name, std::move(sub_metadata)); From 52a0c95bf7cc7a785e74012369d4d0fa3f7f0c78 Mon Sep 17 00:00:00 2001 From: Andrey Romanov Date: Mon, 15 Nov 2021 22:40:10 +0300 Subject: [PATCH 15/21] consider create_geometry input parameter; add comments; add tests --- src/DracoPy.cpp | 5052 ++++++++++++++++++++++++++++++++++++++++------- src/DracoPy.h | 49 +- src/DracoPy.pxd | 28 +- src/DracoPy.pyx | 86 +- tests.py | 145 +- 5 files changed, 4524 insertions(+), 836 deletions(-) diff --git a/src/DracoPy.cpp b/src/DracoPy.cpp index fc65bab..2eafe6e 100644 --- a/src/DracoPy.cpp +++ b/src/DracoPy.cpp @@ -864,6 +864,19 @@ static const char *__pyx_f[] = { }; /*--- Type declarations ---*/ +struct __pyx_obj___Pyx_EnumMeta; + +/* "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 */ @@ -1283,12 +1296,41 @@ static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) #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); @@ -1372,6 +1414,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) @@ -1480,12 +1525,12 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value); /* CIntToPy.proto */ 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_long(long value); - /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); + /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); @@ -1510,6 +1555,10 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'cpython.mem' */ /* Module declarations from 'DracoPy' */ +static PyTypeObject *__pyx_ptype___Pyx_EnumMeta = 0; +static PyObject *__Pyx_OrderedDict = 0; +static PyObject *__Pyx_EnumBase = 0; +static PyObject *__Pyx_globals = 0; static std::vector __pyx_convert_vector_from_py_float(PyObject *); /*proto*/ static std::vector __pyx_convert_vector_from_py_uint32_t(PyObject *); /*proto*/ static std::string __pyx_convert_string_from_py_std__in_string(PyObject *); /*proto*/ @@ -1535,6 +1584,7 @@ static PyObject *__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_PointA 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_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; @@ -1544,67 +1594,121 @@ static PyObject *__pyx_builtin_object; static PyObject *__pyx_builtin_property; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_range; +static PyObject *__pyx_builtin_RuntimeError; static PyObject *__pyx_builtin_TypeError; static PyObject *__pyx_builtin_KeyError; +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_dim[] = "dim"; 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_repr[] = "__repr__"; static const char __pyx_k_self[] = "self"; static const char __pyx_k_test[] = "__test__"; +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_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_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_IntEnum[] = "IntEnum"; static const char __pyx_k_entries[] = "entries"; +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_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_TypeError[] = "TypeError"; 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_metadata_id[] = "metadata_id"; static const char __pyx_k_Invalid_mesh[] = "Invalid mesh"; +static const char __pyx_k_Pyx_EnumBase[] = "__Pyx_EnumBase"; +static const char __pyx_k_RuntimeError[] = "RuntimeError"; static const char __pyx_k_encoded_mesh[] = "encoded_mesh"; +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_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_DracoMesh_faces[] = "DracoMesh.faces"; static const char __pyx_k_DracoPointCloud[] = "DracoPointCloud"; static const char __pyx_k_EncodingOptions[] = "EncodingOptions"; 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_setstate_cython[] = "__setstate_cython__"; static const char __pyx_k_src_DracoPy_pyx[] = "src\\DracoPy.pyx"; static const char __pyx_k_encoding_options[] = "encoding_options"; static const char __pyx_k_sub_metadata_ids[] = "sub_metadata_ids"; @@ -1614,13 +1718,17 @@ 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_Pyx_EnumBase___repr[] = "__Pyx_EnumBase.__repr__"; static const char __pyx_k_encoded_point_cloud[] = "encoded_point_cloud"; 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_decode_buffer_to_mesh[] = "decode_buffer_to_mesh"; @@ -1634,6 +1742,7 @@ 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_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"; @@ -1644,14 +1753,30 @@ static const char __pyx_k_DracoPy_only_supports_meshes_wit[] = "DracoPy only sup 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 'entries'"; 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"; static const char __pyx_k_No_value_specified_for_struct_at_2[] = "No value specified for struct attribute 'sub_metadata_ids'"; static const char __pyx_k_No_value_specified_for_struct_at_3[] = "No value specified for struct attribute 'data'"; static const char __pyx_k_No_value_specified_for_struct_at_4[] = "No value specified for struct attribute 'datatype'"; static const char __pyx_k_No_value_specified_for_struct_at_5[] = "No value specified for struct attribute 'dimension'"; static const char __pyx_k_No_value_specified_for_struct_at_6[] = "No value specified for struct attribute 'metadata_id'"; static const char __pyx_k_No_value_specified_for_struct_at_7[] = "No value specified for struct attribute 'generic_attributes'"; +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; @@ -1672,10 +1797,14 @@ 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_s_Failed_to_decode_input_mesh_Data; static PyObject *__pyx_n_s_FileTypeException; +static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xd4; static PyObject *__pyx_kp_s_Input_invalid; static PyObject *__pyx_kp_s_Input_mesh_is_not_draco_encoded; +static PyObject *__pyx_n_s_IntEnum; static PyObject *__pyx_kp_s_Invalid_mesh; static PyObject *__pyx_kp_s_Invalid_point_cloud; static PyObject *__pyx_n_s_KeyError; @@ -1687,23 +1816,37 @@ 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_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_kp_s_Specified_value_out_of_encoded_r; 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_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_metadata; 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_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_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; @@ -1716,33 +1859,47 @@ static PyObject *__pyx_n_s_encoded_point_cloud; static PyObject *__pyx_n_s_encoding_options; static PyObject *__pyx_n_s_encoding_options_set; static PyObject *__pyx_n_s_entries; +static PyObject *__pyx_n_s_enum; static PyObject *__pyx_n_s_faces; static PyObject *__pyx_n_s_floor; static PyObject *__pyx_n_s_generic_attributes; +static PyObject *__pyx_kp_s_generic_attributes_encoding_deco; static PyObject *__pyx_n_s_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_n_s_import; static PyObject *__pyx_n_s_init; static PyObject *__pyx_n_s_inverse_alpha; 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_s_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_n_s_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_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_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_s_quantization_bits; @@ -1751,13 +1908,27 @@ static PyObject *__pyx_n_s_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_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 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 */ @@ -1777,12 +1948,23 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P static PyObject *__pyx_pf_7DracoPy_6raise_decoding_error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_decoding_status); /* proto */ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer, PyObject *__pyx_v_deduplicate); /* proto */ static PyObject *__pyx_pf_7DracoPy_10decode_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___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 PyObject *__pyx_tuple_; static PyObject *__pyx_tuple__2; @@ -1797,43 +1979,53 @@ static PyObject *__pyx_tuple__10; static PyObject *__pyx_tuple__11; static PyObject *__pyx_tuple__12; static PyObject *__pyx_tuple__13; -static PyObject *__pyx_tuple__15; -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; -static PyObject *__pyx_tuple__27; -static PyObject *__pyx_tuple__29; -static PyObject *__pyx_tuple__31; +static PyObject *__pyx_tuple__14; +static PyObject *__pyx_tuple__16; +static PyObject *__pyx_tuple__18; +static PyObject *__pyx_tuple__20; +static PyObject *__pyx_tuple__22; +static PyObject *__pyx_tuple__24; +static PyObject *__pyx_tuple__26; +static PyObject *__pyx_tuple__28; +static PyObject *__pyx_tuple__30; static PyObject *__pyx_tuple__32; -static PyObject *__pyx_tuple__34; -static PyObject *__pyx_tuple__36; -static PyObject *__pyx_tuple__38; -static PyObject *__pyx_tuple__41; -static PyObject *__pyx_tuple__43; -static PyObject *__pyx_tuple__45; -static PyObject *__pyx_tuple__47; -static PyObject *__pyx_tuple__49; -static PyObject *__pyx_codeobj__14; -static PyObject *__pyx_codeobj__16; -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; -static PyObject *__pyx_codeobj__28; -static PyObject *__pyx_codeobj__30; -static PyObject *__pyx_codeobj__33; -static PyObject *__pyx_codeobj__35; -static PyObject *__pyx_codeobj__37; -static PyObject *__pyx_codeobj__39; +static PyObject *__pyx_tuple__33; +static PyObject *__pyx_tuple__35; +static PyObject *__pyx_tuple__37; +static PyObject *__pyx_tuple__39; +static PyObject *__pyx_tuple__42; +static PyObject *__pyx_tuple__44; +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__55; +static PyObject *__pyx_tuple__57; +static PyObject *__pyx_tuple__59; +static PyObject *__pyx_codeobj__15; +static PyObject *__pyx_codeobj__17; +static PyObject *__pyx_codeobj__19; +static PyObject *__pyx_codeobj__21; +static PyObject *__pyx_codeobj__23; +static PyObject *__pyx_codeobj__25; +static PyObject *__pyx_codeobj__27; +static PyObject *__pyx_codeobj__29; +static PyObject *__pyx_codeobj__31; +static PyObject *__pyx_codeobj__34; +static PyObject *__pyx_codeobj__36; +static PyObject *__pyx_codeobj__38; static PyObject *__pyx_codeobj__40; -static PyObject *__pyx_codeobj__42; -static PyObject *__pyx_codeobj__44; -static PyObject *__pyx_codeobj__46; -static PyObject *__pyx_codeobj__48; -static PyObject *__pyx_codeobj__50; +static PyObject *__pyx_codeobj__41; +static PyObject *__pyx_codeobj__43; +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__56; +static PyObject *__pyx_codeobj__58; +static PyObject *__pyx_codeobj__60; /* Late includes */ /* "DracoPy.pyx":10 @@ -2583,8 +2775,8 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_8points(CYTHON_UNUSED PyObj /* "DracoPy.pyx":36 * * @property - * def geometry_metadata(self) -> Dict: # <<<<<<<<<<<<<< - * return self.data_struct['geometry_metadata'] + * def geometry_metadata(self) -> Optional[Dict]: # <<<<<<<<<<<<<< + * return self.data_struct['geometry_metadata'] if self.metadatas else None * */ @@ -2607,6 +2799,8 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_10geometry_metadata(CYTHON_ __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; @@ -2614,26 +2808,37 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_10geometry_metadata(CYTHON_ /* "DracoPy.pyx":37 * @property - * def geometry_metadata(self) -> Dict: - * return self.data_struct['geometry_metadata'] # <<<<<<<<<<<<<< + * def geometry_metadata(self) -> Optional[Dict]: + * return self.data_struct['geometry_metadata'] if self.metadatas else None # <<<<<<<<<<<<<< * * @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_s_geometry_metadata); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_metadatas); 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; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 37, __pyx_L1_error) + __Pyx_DECREF(__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, 37, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_t_2, __pyx_n_s_geometry_metadata); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 37, __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":36 * * @property - * def geometry_metadata(self) -> Dict: # <<<<<<<<<<<<<< - * return self.data_struct['geometry_metadata'] + * def geometry_metadata(self) -> Optional[Dict]: # <<<<<<<<<<<<<< + * return self.data_struct['geometry_metadata'] if self.metadatas else None * */ @@ -2641,6 +2846,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_10geometry_metadata(CYTHON_ __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:; @@ -3714,7 +3920,7 @@ static PyObject *__pyx_pf_7DracoPy_create_empty_geometry_metadata(CYTHON_UNUSED /* Python wrapper */ static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7DracoPy_2encode_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 char __pyx_doc_7DracoPy_2encode_mesh_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 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 :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 exists in 'metadatas' fields\n :return bytes: encoded mesh\n "; static PyMethodDef __pyx_mdef_7DracoPy_3encode_mesh_to_buffer = {"encode_mesh_to_buffer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_3encode_mesh_to_buffer, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7DracoPy_2encode_mesh_to_buffer}; static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_points = 0; @@ -3949,8 +4155,8 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_INCREF(__pyx_v_metadatas); __Pyx_INCREF(__pyx_v_geometry_metadata); - /* "DracoPy.pyx":108 - * a point where each coordinate is the minimum of that coordinate among the input vertices. + /* "DracoPy.pyx":128 + * :return bytes: encoded mesh * """ * if metadatas is None: # <<<<<<<<<<<<<< * metadatas = [] @@ -3960,20 +4166,20 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "DracoPy.pyx":109 + /* "DracoPy.pyx":129 * """ * if metadatas is None: * metadatas = [] # <<<<<<<<<<<<<< * if geometry_metadata is None: * geometry_metadata = create_empty_geometry_metadata() */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 109, __pyx_L1_error) + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 129, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF_SET(__pyx_v_metadatas, __pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":108 - * a point where each coordinate is the minimum of that coordinate among the input vertices. + /* "DracoPy.pyx":128 + * :return bytes: encoded mesh * """ * if metadatas is None: # <<<<<<<<<<<<<< * metadatas = [] @@ -3981,7 +4187,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":110 + /* "DracoPy.pyx":130 * if metadatas is None: * metadatas = [] * if geometry_metadata is None: # <<<<<<<<<<<<<< @@ -3992,14 +4198,14 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "DracoPy.pyx":111 + /* "DracoPy.pyx":131 * metadatas = [] * if geometry_metadata is None: * geometry_metadata = create_empty_geometry_metadata() # <<<<<<<<<<<<<< * cdef float* quant_origin = NULL * try: */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_create_empty_geometry_metadata); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 111, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_create_empty_geometry_metadata); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { @@ -4013,13 +4219,13 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject } __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 111, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 131, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF_SET(__pyx_v_geometry_metadata, __pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":110 + /* "DracoPy.pyx":130 * if metadatas is None: * metadatas = [] * if geometry_metadata is None: # <<<<<<<<<<<<<< @@ -4028,7 +4234,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":112 + /* "DracoPy.pyx":132 * if geometry_metadata is None: * geometry_metadata = create_empty_geometry_metadata() * cdef float* quant_origin = NULL # <<<<<<<<<<<<<< @@ -4037,7 +4243,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ __pyx_v_quant_origin = NULL; - /* "DracoPy.pyx":113 + /* "DracoPy.pyx":133 * geometry_metadata = create_empty_geometry_metadata() * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -4053,7 +4259,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_XGOTREF(__pyx_t_8); /*try:*/ { - /* "DracoPy.pyx":114 + /* "DracoPy.pyx":134 * cdef float* quant_origin = NULL * try: * num_dims = 3 # <<<<<<<<<<<<<< @@ -4063,7 +4269,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_INCREF(__pyx_int_3); __pyx_v_num_dims = __pyx_int_3; - /* "DracoPy.pyx":115 + /* "DracoPy.pyx":135 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -4074,38 +4280,38 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "DracoPy.pyx":116 + /* "DracoPy.pyx":136 * 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_3 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 116, __pyx_L5_error) + __pyx_t_3 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 136, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 116, __pyx_L5_error) + __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 136, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_9 = __Pyx_PyInt_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 116, __pyx_L5_error) + __pyx_t_9 = __Pyx_PyInt_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L5_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_quant_origin = ((float *)PyMem_Malloc(__pyx_t_9)); - /* "DracoPy.pyx":117 + /* "DracoPy.pyx":137 * 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, */ - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 117, __pyx_L5_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 137, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_4); if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_10 = 0; __pyx_t_11 = NULL; } else { - __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 117, __pyx_L5_error) + __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 137, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 117, __pyx_L5_error) + __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 137, __pyx_L5_error) } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; for (;;) { @@ -4113,17 +4319,17 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject if (likely(PyList_CheckExact(__pyx_t_3))) { if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 117, __pyx_L5_error) + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 137, __pyx_L5_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 117, __pyx_L5_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 137, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_4); #endif } else { if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 117, __pyx_L5_error) + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 137, __pyx_L5_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 117, __pyx_L5_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 137, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_4); #endif } @@ -4133,7 +4339,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 117, __pyx_L5_error) + else __PYX_ERR(0, 137, __pyx_L5_error) } break; } @@ -4142,21 +4348,21 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_4); __pyx_t_4 = 0; - /* "DracoPy.pyx":118 + /* "DracoPy.pyx":138 * 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, */ - __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 118, __pyx_L5_error) + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 138, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 118, __pyx_L5_error) + __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 138, __pyx_L5_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 118, __pyx_L5_error) + __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 138, __pyx_L5_error) (__pyx_v_quant_origin[__pyx_t_13]) = __pyx_t_12; - /* "DracoPy.pyx":117 + /* "DracoPy.pyx":137 * if quantization_origin is not None: * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) * for dim in range(num_dims): # <<<<<<<<<<<<<< @@ -4166,7 +4372,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":115 + /* "DracoPy.pyx":135 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -4175,79 +4381,79 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":119 + /* "DracoPy.pyx":139 * for dim in range(num_dims): * quant_origin[dim] = quantization_origin[dim] * encoded_mesh = DracoPy.encode_mesh(points, # <<<<<<<<<<<<<< * faces, * metadatas, */ - __pyx_t_14 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 119, __pyx_L5_error) + __pyx_t_14 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L5_error) - /* "DracoPy.pyx":120 + /* "DracoPy.pyx":140 * quant_origin[dim] = quantization_origin[dim] * encoded_mesh = DracoPy.encode_mesh(points, * faces, # <<<<<<<<<<<<<< * metadatas, * geometry_metadata, */ - __pyx_t_15 = __pyx_convert_vector_from_py_uint32_t(__pyx_v_faces); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 120, __pyx_L5_error) + __pyx_t_15 = __pyx_convert_vector_from_py_uint32_t(__pyx_v_faces); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 140, __pyx_L5_error) - /* "DracoPy.pyx":121 + /* "DracoPy.pyx":141 * encoded_mesh = DracoPy.encode_mesh(points, * faces, * metadatas, # <<<<<<<<<<<<<< * geometry_metadata, * quantization_bits, */ - __pyx_t_16 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_metadatas); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 121, __pyx_L5_error) + __pyx_t_16 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_metadatas); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L5_error) - /* "DracoPy.pyx":122 + /* "DracoPy.pyx":142 * faces, * metadatas, * geometry_metadata, # <<<<<<<<<<<<<< * quantization_bits, * compression_level, */ - __pyx_t_17 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_geometry_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 122, __pyx_L5_error) + __pyx_t_17 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_geometry_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 142, __pyx_L5_error) - /* "DracoPy.pyx":123 + /* "DracoPy.pyx":143 * metadatas, * geometry_metadata, * quantization_bits, # <<<<<<<<<<<<<< * compression_level, * quantization_range, */ - __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 123, __pyx_L5_error) + __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 143, __pyx_L5_error) - /* "DracoPy.pyx":124 + /* "DracoPy.pyx":144 * geometry_metadata, * quantization_bits, * compression_level, # <<<<<<<<<<<<<< * quantization_range, * quant_origin, */ - __pyx_t_19 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_19 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 124, __pyx_L5_error) + __pyx_t_19 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_19 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 144, __pyx_L5_error) - /* "DracoPy.pyx":125 + /* "DracoPy.pyx":145 * quantization_bits, * compression_level, * quantization_range, # <<<<<<<<<<<<<< * quant_origin, * create_metadata) */ - __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 125, __pyx_L5_error) + __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 145, __pyx_L5_error) - /* "DracoPy.pyx":127 + /* "DracoPy.pyx":147 * quantization_range, * quant_origin, * create_metadata) # <<<<<<<<<<<<<< * if quant_origin != NULL: * PyMem_Free(quant_origin) */ - __pyx_t_20 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_20 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 127, __pyx_L5_error) + __pyx_t_20 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_20 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 147, __pyx_L5_error) - /* "DracoPy.pyx":119 + /* "DracoPy.pyx":139 * for dim in range(num_dims): * quant_origin[dim] = quantization_origin[dim] * encoded_mesh = DracoPy.encode_mesh(points, # <<<<<<<<<<<<<< @@ -4258,11 +4464,11 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_21 = DracoFunctions::encode_mesh(__pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_12, __pyx_v_quant_origin, __pyx_t_20); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 119, __pyx_L5_error) + __PYX_ERR(0, 139, __pyx_L5_error) } __pyx_v_encoded_mesh = __pyx_t_21; - /* "DracoPy.pyx":128 + /* "DracoPy.pyx":148 * quant_origin, * create_metadata) * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -4272,7 +4478,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_2 = ((__pyx_v_quant_origin != NULL) != 0); if (__pyx_t_2) { - /* "DracoPy.pyx":129 + /* "DracoPy.pyx":149 * create_metadata) * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -4281,7 +4487,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":128 + /* "DracoPy.pyx":148 * quant_origin, * create_metadata) * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -4290,7 +4496,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":130 + /* "DracoPy.pyx":150 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -4300,7 +4506,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject switch (__pyx_v_encoded_mesh.encode_status) { case DracoFunctions::successful_encoding: - /* "DracoPy.pyx":131 + /* "DracoPy.pyx":151 * PyMem_Free(quant_origin) * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: * return bytes(encoded_mesh.buffer) # <<<<<<<<<<<<<< @@ -4308,16 +4514,16 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject * raise EncodingFailedException('Invalid mesh') */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_encoded_mesh.buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 131, __pyx_L5_error) + __pyx_t_3 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_encoded_mesh.buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 151, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 131, __pyx_L5_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 151, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; goto __pyx_L9_try_return; - /* "DracoPy.pyx":130 + /* "DracoPy.pyx":150 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -4327,14 +4533,14 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject break; case DracoFunctions::failed_during_encoding: - /* "DracoPy.pyx":133 + /* "DracoPy.pyx":153 * 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_3, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 133, __pyx_L5_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 153, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { @@ -4348,14 +4554,14 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject } __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s_Invalid_mesh) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_Invalid_mesh); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 133, __pyx_L5_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 153, __pyx_L5_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 133, __pyx_L5_error) + __PYX_ERR(0, 153, __pyx_L5_error) - /* "DracoPy.pyx":132 + /* "DracoPy.pyx":152 * 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: # <<<<<<<<<<<<<< @@ -4366,7 +4572,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject default: break; } - /* "DracoPy.pyx":113 + /* "DracoPy.pyx":133 * geometry_metadata = create_empty_geometry_metadata() * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -4383,7 +4589,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "DracoPy.pyx":134 + /* "DracoPy.pyx":154 * elif encoded_mesh.encode_status == DracoPy.encoding_status.failed_during_encoding: * raise EncodingFailedException('Invalid mesh') * except EncodingFailedException: # <<<<<<<<<<<<<< @@ -4391,7 +4597,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject * except: */ __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 134, __pyx_L7_except_error) + __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 154, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_22); __pyx_t_19 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_4, __pyx_t_22); __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; @@ -4399,19 +4605,19 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_5 = 0; if (__pyx_t_19) { __Pyx_AddTraceback("DracoPy.encode_mesh_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 134, __pyx_L7_except_error) + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 154, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_4); - /* "DracoPy.pyx":135 + /* "DracoPy.pyx":155 * raise EncodingFailedException('Invalid mesh') * except EncodingFailedException: * raise EncodingFailedException('Invalid mesh') # <<<<<<<<<<<<<< * except: * if quant_origin != NULL: */ - __Pyx_GetModuleGlobalName(__pyx_t_23, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 135, __pyx_L7_except_error) + __Pyx_GetModuleGlobalName(__pyx_t_23, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 155, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_23); __pyx_t_24 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_23))) { @@ -4425,15 +4631,15 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject } __pyx_t_22 = (__pyx_t_24) ? __Pyx_PyObject_Call2Args(__pyx_t_23, __pyx_t_24, __pyx_kp_s_Invalid_mesh) : __Pyx_PyObject_CallOneArg(__pyx_t_23, __pyx_kp_s_Invalid_mesh); __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0; - if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 135, __pyx_L7_except_error) + if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 155, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_22); __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; __Pyx_Raise(__pyx_t_22, 0, 0, 0); __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; - __PYX_ERR(0, 135, __pyx_L7_except_error) + __PYX_ERR(0, 155, __pyx_L7_except_error) } - /* "DracoPy.pyx":136 + /* "DracoPy.pyx":156 * except EncodingFailedException: * raise EncodingFailedException('Invalid mesh') * except: # <<<<<<<<<<<<<< @@ -4442,12 +4648,12 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ /*except:*/ { __Pyx_AddTraceback("DracoPy.encode_mesh_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5) < 0) __PYX_ERR(0, 136, __pyx_L7_except_error) + if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5) < 0) __PYX_ERR(0, 156, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_5); - /* "DracoPy.pyx":137 + /* "DracoPy.pyx":157 * raise EncodingFailedException('Invalid mesh') * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -4457,7 +4663,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject __pyx_t_2 = ((__pyx_v_quant_origin != NULL) != 0); if (__pyx_t_2) { - /* "DracoPy.pyx":138 + /* "DracoPy.pyx":158 * except: * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -4466,7 +4672,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":137 + /* "DracoPy.pyx":157 * raise EncodingFailedException('Invalid mesh') * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -4475,22 +4681,22 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":139 + /* "DracoPy.pyx":159 * if quant_origin != NULL: * PyMem_Free(quant_origin) * raise ValueError("Input invalid") # <<<<<<<<<<<<<< * * def encode_point_cloud_to_buffer(points, */ - __pyx_t_22 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 139, __pyx_L7_except_error) + __pyx_t_22 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 159, __pyx_L7_except_error) __Pyx_GOTREF(__pyx_t_22); __Pyx_Raise(__pyx_t_22, 0, 0, 0); __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; - __PYX_ERR(0, 139, __pyx_L7_except_error) + __PYX_ERR(0, 159, __pyx_L7_except_error) } __pyx_L7_except_error:; - /* "DracoPy.pyx":113 + /* "DracoPy.pyx":133 * geometry_metadata = create_empty_geometry_metadata() * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< @@ -4541,7 +4747,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject return __pyx_r; } -/* "DracoPy.pyx":141 +/* "DracoPy.pyx":161 * raise ValueError("Input invalid") * * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< @@ -4551,7 +4757,7 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject /* Python wrapper */ static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7DracoPy_4encode_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 char __pyx_doc_7DracoPy_4encode_point_cloud_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 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 :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 exists in 'metadatas' fields\n :return bytes: encoded mesh\n "; static PyMethodDef __pyx_mdef_7DracoPy_5encode_point_cloud_to_buffer = {"encode_point_cloud_to_buffer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7DracoPy_4encode_point_cloud_to_buffer}; static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_points = 0; @@ -4575,7 +4781,7 @@ static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx values[2] = ((PyObject *)__pyx_int_1); values[3] = ((PyObject *)__pyx_int_neg_1); - /* "DracoPy.pyx":145 + /* "DracoPy.pyx":165 * compression_level=1, * quantization_range=-1, * quantization_origin=None, # <<<<<<<<<<<<<< @@ -4584,7 +4790,7 @@ static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx */ values[4] = ((PyObject *)Py_None); - /* "DracoPy.pyx":146 + /* "DracoPy.pyx":166 * quantization_range=-1, * quantization_origin=None, * create_metadata=False, # <<<<<<<<<<<<<< @@ -4593,7 +4799,7 @@ static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx */ values[5] = ((PyObject *)Py_False); - /* "DracoPy.pyx":147 + /* "DracoPy.pyx":167 * quantization_origin=None, * create_metadata=False, * metadatas = None, # <<<<<<<<<<<<<< @@ -4602,7 +4808,7 @@ static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx */ values[6] = ((PyObject *)Py_None); - /* "DracoPy.pyx":148 + /* "DracoPy.pyx":168 * create_metadata=False, * metadatas = None, * geometry_metadata = None, # <<<<<<<<<<<<<< @@ -4682,7 +4888,7 @@ static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx } } 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, 141, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode_point_cloud_to_buffer") < 0)) __PYX_ERR(0, 161, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -4716,7 +4922,7 @@ static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("encode_point_cloud_to_buffer", 0, 1, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 141, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode_point_cloud_to_buffer", 0, 1, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 161, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("DracoPy.encode_point_cloud_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -4724,7 +4930,7 @@ static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7DracoPy_4encode_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_v_metadatas, __pyx_v_geometry_metadata); - /* "DracoPy.pyx":141 + /* "DracoPy.pyx":161 * raise ValueError("Input invalid") * * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< @@ -4749,11 +4955,11 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; + Py_ssize_t __pyx_t_6; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; - size_t __pyx_t_9; - Py_ssize_t __pyx_t_10; + PyObject *__pyx_t_9 = NULL; + size_t __pyx_t_10; PyObject *(*__pyx_t_11)(PyObject *); float __pyx_t_12; Py_ssize_t __pyx_t_13; @@ -4774,8 +4980,8 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_INCREF(__pyx_v_metadatas); __Pyx_INCREF(__pyx_v_geometry_metadata); - /* "DracoPy.pyx":159 - * a point where each coordinate is the minimum of that coordinate among the input vertices. + /* "DracoPy.pyx":199 + * :return bytes: encoded mesh * """ * if metadatas is None: # <<<<<<<<<<<<<< * metadatas = [] @@ -4785,20 +4991,20 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "DracoPy.pyx":160 + /* "DracoPy.pyx":200 * """ * if metadatas is None: * metadatas = [] # <<<<<<<<<<<<<< * if geometry_metadata is None: * geometry_metadata = create_empty_geometry_metadata() */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 160, __pyx_L1_error) + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 200, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF_SET(__pyx_v_metadatas, __pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":159 - * a point where each coordinate is the minimum of that coordinate among the input vertices. + /* "DracoPy.pyx":199 + * :return bytes: encoded mesh * """ * if metadatas is None: # <<<<<<<<<<<<<< * metadatas = [] @@ -4806,25 +5012,25 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P */ } - /* "DracoPy.pyx":161 + /* "DracoPy.pyx":201 * if metadatas is None: * metadatas = [] * if geometry_metadata is None: # <<<<<<<<<<<<<< * geometry_metadata = create_empty_geometry_metadata() - * cdef float* quant_origin = NULL + * if len(geometry_metadata["generic_attributes"]) > 0: */ __pyx_t_2 = (__pyx_v_geometry_metadata == Py_None); __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "DracoPy.pyx":162 + /* "DracoPy.pyx":202 * metadatas = [] * if geometry_metadata is None: * geometry_metadata = create_empty_geometry_metadata() # <<<<<<<<<<<<<< - * cdef float* quant_origin = NULL - * try: + * if len(geometry_metadata["generic_attributes"]) > 0: + * raise RuntimeError("generic attributes encoding/decoding is not supported") */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_create_empty_geometry_metadata); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 162, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_create_empty_geometry_metadata); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { @@ -4838,32 +5044,68 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P } __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 162, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF_SET(__pyx_v_geometry_metadata, __pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":161 + /* "DracoPy.pyx":201 * if metadatas is None: * metadatas = [] * if geometry_metadata is None: # <<<<<<<<<<<<<< * geometry_metadata = create_empty_geometry_metadata() - * cdef float* quant_origin = NULL + * if len(geometry_metadata["generic_attributes"]) > 0: */ } - /* "DracoPy.pyx":163 + /* "DracoPy.pyx":203 + * if geometry_metadata is None: + * geometry_metadata = create_empty_geometry_metadata() + * if len(geometry_metadata["generic_attributes"]) > 0: # <<<<<<<<<<<<<< + * raise RuntimeError("generic attributes encoding/decoding is not supported") + * cdef float* quant_origin = NULL + */ + __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_geometry_metadata, __pyx_n_s_generic_attributes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 203, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 203, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = ((__pyx_t_6 > 0) != 0); + if (unlikely(__pyx_t_1)) { + + /* "DracoPy.pyx":204 + * geometry_metadata = create_empty_geometry_metadata() + * if len(geometry_metadata["generic_attributes"]) > 0: + * raise RuntimeError("generic attributes encoding/decoding is not supported") # <<<<<<<<<<<<<< + * cdef float* quant_origin = NULL + * try: + */ + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 204, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(0, 204, __pyx_L1_error) + + /* "DracoPy.pyx":203 * if geometry_metadata is None: * geometry_metadata = create_empty_geometry_metadata() + * if len(geometry_metadata["generic_attributes"]) > 0: # <<<<<<<<<<<<<< + * raise RuntimeError("generic attributes encoding/decoding is not supported") + * cdef float* quant_origin = NULL + */ + } + + /* "DracoPy.pyx":205 + * if len(geometry_metadata["generic_attributes"]) > 0: + * raise RuntimeError("generic attributes encoding/decoding is not supported") * cdef float* quant_origin = NULL # <<<<<<<<<<<<<< * try: * num_dims = 3 */ __pyx_v_quant_origin = NULL; - /* "DracoPy.pyx":164 - * geometry_metadata = create_empty_geometry_metadata() + /* "DracoPy.pyx":206 + * raise RuntimeError("generic attributes encoding/decoding is not supported") * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< * num_dims = 3 @@ -4872,13 +5114,13 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_6); + __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); __Pyx_XGOTREF(__pyx_t_7); __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); /*try:*/ { - /* "DracoPy.pyx":165 + /* "DracoPy.pyx":207 * cdef float* quant_origin = NULL * try: * num_dims = 3 # <<<<<<<<<<<<<< @@ -4888,7 +5130,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_INCREF(__pyx_int_3); __pyx_v_num_dims = __pyx_int_3; - /* "DracoPy.pyx":166 + /* "DracoPy.pyx":208 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -4899,56 +5141,56 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "DracoPy.pyx":167 + /* "DracoPy.pyx":209 * 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_3 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 167, __pyx_L5_error) + __pyx_t_3 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 209, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 167, __pyx_L5_error) + __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 209, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_9 = __Pyx_PyInt_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 167, __pyx_L5_error) + __pyx_t_10 = __Pyx_PyInt_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_10 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 209, __pyx_L6_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_quant_origin = ((float *)PyMem_Malloc(__pyx_t_9)); + __pyx_v_quant_origin = ((float *)PyMem_Malloc(__pyx_t_10)); - /* "DracoPy.pyx":168 + /* "DracoPy.pyx":210 * 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( */ - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 168, __pyx_L5_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 210, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_4); if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { - __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_10 = 0; + __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0; __pyx_t_11 = NULL; } else { - __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 168, __pyx_L5_error) + __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 210, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 168, __pyx_L5_error) + __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 210, __pyx_L6_error) } __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; for (;;) { if (likely(!__pyx_t_11)) { if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_3)) break; + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 168, __pyx_L5_error) + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 210, __pyx_L6_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 168, __pyx_L5_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 210, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_4); #endif } else { - if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 168, __pyx_L5_error) + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 210, __pyx_L6_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 168, __pyx_L5_error) + __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 210, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_4); #endif } @@ -4958,7 +5200,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 168, __pyx_L5_error) + else __PYX_ERR(0, 210, __pyx_L6_error) } break; } @@ -4967,21 +5209,21 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_4); __pyx_t_4 = 0; - /* "DracoPy.pyx":169 + /* "DracoPy.pyx":211 * 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, metadatas, geometry_metadata, */ - __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 169, __pyx_L5_error) + __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 211, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 169, __pyx_L5_error) + __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 211, __pyx_L6_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 169, __pyx_L5_error) + __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 211, __pyx_L6_error) (__pyx_v_quant_origin[__pyx_t_13]) = __pyx_t_12; - /* "DracoPy.pyx":168 + /* "DracoPy.pyx":210 * if quantization_origin is not None: * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) * for dim in range(num_dims): # <<<<<<<<<<<<<< @@ -4991,7 +5233,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":166 + /* "DracoPy.pyx":208 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -5000,38 +5242,38 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P */ } - /* "DracoPy.pyx":171 + /* "DracoPy.pyx":213 * quant_origin[dim] = quantization_origin[dim] * encoded_point_cloud = DracoPy.encode_point_cloud( * points, metadatas, geometry_metadata, # <<<<<<<<<<<<<< * quantization_bits, compression_level, * quantization_range, quant_origin, create_metadata, */ - __pyx_t_14 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 171, __pyx_L5_error) - __pyx_t_15 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_metadatas); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 171, __pyx_L5_error) - __pyx_t_16 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_geometry_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 171, __pyx_L5_error) + __pyx_t_14 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 213, __pyx_L6_error) + __pyx_t_15 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_metadatas); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 213, __pyx_L6_error) + __pyx_t_16 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_geometry_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 213, __pyx_L6_error) - /* "DracoPy.pyx":172 + /* "DracoPy.pyx":214 * encoded_point_cloud = DracoPy.encode_point_cloud( * points, metadatas, geometry_metadata, * quantization_bits, compression_level, # <<<<<<<<<<<<<< * quantization_range, quant_origin, create_metadata, * ) */ - __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 172, __pyx_L5_error) - __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 172, __pyx_L5_error) + __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 214, __pyx_L6_error) + __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 214, __pyx_L6_error) - /* "DracoPy.pyx":173 + /* "DracoPy.pyx":215 * points, metadatas, geometry_metadata, * quantization_bits, compression_level, * quantization_range, quant_origin, create_metadata, # <<<<<<<<<<<<<< * ) * if quant_origin != NULL: */ - __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 173, __pyx_L5_error) - __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_19 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 173, __pyx_L5_error) + __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L6_error) + __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_19 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L6_error) - /* "DracoPy.pyx":170 + /* "DracoPy.pyx":212 * for dim in range(num_dims): * quant_origin[dim] = quantization_origin[dim] * encoded_point_cloud = DracoPy.encode_point_cloud( # <<<<<<<<<<<<<< @@ -5042,11 +5284,11 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_20 = DracoFunctions::encode_point_cloud(__pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_12, __pyx_v_quant_origin, __pyx_t_19); } catch(...) { __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 170, __pyx_L5_error) + __PYX_ERR(0, 212, __pyx_L6_error) } __pyx_v_encoded_point_cloud = __pyx_t_20; - /* "DracoPy.pyx":175 + /* "DracoPy.pyx":217 * quantization_range, quant_origin, create_metadata, * ) * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -5056,7 +5298,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_2 = ((__pyx_v_quant_origin != NULL) != 0); if (__pyx_t_2) { - /* "DracoPy.pyx":176 + /* "DracoPy.pyx":218 * ) * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -5065,7 +5307,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":175 + /* "DracoPy.pyx":217 * quantization_range, quant_origin, create_metadata, * ) * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -5074,7 +5316,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P */ } - /* "DracoPy.pyx":177 + /* "DracoPy.pyx":219 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -5084,7 +5326,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P switch (__pyx_v_encoded_point_cloud.encode_status) { case DracoFunctions::successful_encoding: - /* "DracoPy.pyx":178 + /* "DracoPy.pyx":220 * PyMem_Free(quant_origin) * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: * return bytes(encoded_point_cloud.buffer) # <<<<<<<<<<<<<< @@ -5092,16 +5334,16 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P * raise EncodingFailedException('Invalid point cloud') */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_encoded_point_cloud.buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 178, __pyx_L5_error) + __pyx_t_3 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_encoded_point_cloud.buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 220, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 178, __pyx_L5_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 220, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_4; __pyx_t_4 = 0; - goto __pyx_L9_try_return; + goto __pyx_L10_try_return; - /* "DracoPy.pyx":177 + /* "DracoPy.pyx":219 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -5111,14 +5353,14 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P break; case DracoFunctions::failed_during_encoding: - /* "DracoPy.pyx":180 + /* "DracoPy.pyx":222 * 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_3, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 180, __pyx_L5_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 222, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { @@ -5132,14 +5374,14 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P } __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s_Invalid_point_cloud) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_Invalid_point_cloud); __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 180, __pyx_L5_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 222, __pyx_L6_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 180, __pyx_L5_error) + __PYX_ERR(0, 222, __pyx_L6_error) - /* "DracoPy.pyx":179 + /* "DracoPy.pyx":221 * 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: # <<<<<<<<<<<<<< @@ -5150,24 +5392,24 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P default: break; } - /* "DracoPy.pyx":164 - * geometry_metadata = create_empty_geometry_metadata() + /* "DracoPy.pyx":206 + * raise RuntimeError("generic attributes encoding/decoding is not supported") * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< * num_dims = 3 * if quantization_origin is not None: */ } - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L10_try_end; - __pyx_L5_error:; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + goto __pyx_L11_try_end; + __pyx_L6_error:; __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; - /* "DracoPy.pyx":181 + /* "DracoPy.pyx":223 * elif encoded_point_cloud.encode_status == DracoPy.encoding_status.failed_during_encoding: * raise EncodingFailedException('Invalid point cloud') * except EncodingFailedException: # <<<<<<<<<<<<<< @@ -5175,7 +5417,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P * except: */ __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 181, __pyx_L7_except_error) + __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 223, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_21); __pyx_t_18 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_4, __pyx_t_21); __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; @@ -5183,19 +5425,19 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_5 = 0; if (__pyx_t_18) { __Pyx_AddTraceback("DracoPy.encode_point_cloud_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 181, __pyx_L7_except_error) + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 223, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_4); - /* "DracoPy.pyx":182 + /* "DracoPy.pyx":224 * raise EncodingFailedException('Invalid point cloud') * except EncodingFailedException: * raise EncodingFailedException('Invalid point cloud') # <<<<<<<<<<<<<< * except: * if quant_origin != NULL: */ - __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 182, __pyx_L7_except_error) + __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 224, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_22); __pyx_t_23 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_22))) { @@ -5209,15 +5451,15 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P } __pyx_t_21 = (__pyx_t_23) ? __Pyx_PyObject_Call2Args(__pyx_t_22, __pyx_t_23, __pyx_kp_s_Invalid_point_cloud) : __Pyx_PyObject_CallOneArg(__pyx_t_22, __pyx_kp_s_Invalid_point_cloud); __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0; - if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 182, __pyx_L7_except_error) + if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 224, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_21); __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; __Pyx_Raise(__pyx_t_21, 0, 0, 0); __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - __PYX_ERR(0, 182, __pyx_L7_except_error) + __PYX_ERR(0, 224, __pyx_L8_except_error) } - /* "DracoPy.pyx":183 + /* "DracoPy.pyx":225 * except EncodingFailedException: * raise EncodingFailedException('Invalid point cloud') * except: # <<<<<<<<<<<<<< @@ -5226,12 +5468,12 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P */ /*except:*/ { __Pyx_AddTraceback("DracoPy.encode_point_cloud_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5) < 0) __PYX_ERR(0, 183, __pyx_L7_except_error) + if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5) < 0) __PYX_ERR(0, 225, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_3); __Pyx_GOTREF(__pyx_t_5); - /* "DracoPy.pyx":184 + /* "DracoPy.pyx":226 * raise EncodingFailedException('Invalid point cloud') * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -5241,7 +5483,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_2 = ((__pyx_v_quant_origin != NULL) != 0); if (__pyx_t_2) { - /* "DracoPy.pyx":185 + /* "DracoPy.pyx":227 * except: * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -5250,7 +5492,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":184 + /* "DracoPy.pyx":226 * raise EncodingFailedException('Invalid point cloud') * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -5259,43 +5501,43 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P */ } - /* "DracoPy.pyx":186 + /* "DracoPy.pyx":228 * if quant_origin != NULL: * PyMem_Free(quant_origin) * raise ValueError("Input invalid") # <<<<<<<<<<<<<< * * def raise_decoding_error(decoding_status): */ - __pyx_t_21 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 186, __pyx_L7_except_error) + __pyx_t_21 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 228, __pyx_L8_except_error) __Pyx_GOTREF(__pyx_t_21); __Pyx_Raise(__pyx_t_21, 0, 0, 0); __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - __PYX_ERR(0, 186, __pyx_L7_except_error) + __PYX_ERR(0, 228, __pyx_L8_except_error) } - __pyx_L7_except_error:; + __pyx_L8_except_error:; - /* "DracoPy.pyx":164 - * geometry_metadata = create_empty_geometry_metadata() + /* "DracoPy.pyx":206 + * raise RuntimeError("generic attributes encoding/decoding is not supported") * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< * num_dims = 3 * if quantization_origin is not None: */ - __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); goto __pyx_L1_error; - __pyx_L9_try_return:; - __Pyx_XGIVEREF(__pyx_t_6); + __pyx_L10_try_return:; __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); goto __pyx_L0; - __pyx_L10_try_end:; + __pyx_L11_try_end:; } - /* "DracoPy.pyx":141 + /* "DracoPy.pyx":161 * raise ValueError("Input invalid") * * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< @@ -5325,7 +5567,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P return __pyx_r; } -/* "DracoPy.pyx":188 +/* "DracoPy.pyx":230 * raise ValueError("Input invalid") * * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< @@ -5359,29 +5601,29 @@ static PyObject *__pyx_pf_7DracoPy_6raise_decoding_error(CYTHON_UNUSED PyObject int __pyx_clineno = 0; __Pyx_RefNannySetupContext("raise_decoding_error", 0); - /* "DracoPy.pyx":189 + /* "DracoPy.pyx":231 * * 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, 189, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::not_draco_encoded); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 231, __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, 189, __pyx_L1_error) + __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, 231, __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, 189, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 231, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":190 + /* "DracoPy.pyx":232 * 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, 190, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FileTypeException); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 232, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { @@ -5395,14 +5637,14 @@ static PyObject *__pyx_pf_7DracoPy_6raise_decoding_error(CYTHON_UNUSED PyObject } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_kp_s_Input_mesh_is_not_draco_encoded) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_s_Input_mesh_is_not_draco_encoded); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 190, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 232, __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, 190, __pyx_L1_error) + __PYX_ERR(0, 232, __pyx_L1_error) - /* "DracoPy.pyx":189 + /* "DracoPy.pyx":231 * * def raise_decoding_error(decoding_status): * if decoding_status == DracoPy.decoding_status.not_draco_encoded: # <<<<<<<<<<<<<< @@ -5411,35 +5653,35 @@ static PyObject *__pyx_pf_7DracoPy_6raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":191 + /* "DracoPy.pyx":233 * 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, 191, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::failed_during_decoding); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 233, __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, 191, __pyx_L1_error) + __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, 233, __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, 191, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 233, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":192 + /* "DracoPy.pyx":234 * 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__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 192, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __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, 192, __pyx_L1_error) + __PYX_ERR(0, 234, __pyx_L1_error) - /* "DracoPy.pyx":191 + /* "DracoPy.pyx":233 * 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: # <<<<<<<<<<<<<< @@ -5448,35 +5690,35 @@ static PyObject *__pyx_pf_7DracoPy_6raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":193 + /* "DracoPy.pyx":235 * 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, 193, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::no_position_attribute); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __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, 193, __pyx_L1_error) + __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, 235, __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, 193, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 235, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":194 + /* "DracoPy.pyx":236 * 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__4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 236, __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, 194, __pyx_L1_error) + __PYX_ERR(0, 236, __pyx_L1_error) - /* "DracoPy.pyx":193 + /* "DracoPy.pyx":235 * 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: # <<<<<<<<<<<<<< @@ -5485,7 +5727,7 @@ static PyObject *__pyx_pf_7DracoPy_6raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":188 + /* "DracoPy.pyx":230 * raise ValueError("Input invalid") * * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< @@ -5508,17 +5750,18 @@ static PyObject *__pyx_pf_7DracoPy_6raise_decoding_error(CYTHON_UNUSED PyObject return __pyx_r; } -/* "DracoPy.pyx":196 +/* "DracoPy.pyx":238 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer, deduplicate=False): # <<<<<<<<<<<<<< - * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) - * if mesh_struct.decode_status == DracoPy.decoding_status.successful: + * """ + * Decode buffer to mesh */ /* Python wrapper */ static PyObject *__pyx_pw_7DracoPy_9decode_buffer_to_mesh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_9decode_buffer_to_mesh = {"decode_buffer_to_mesh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_9decode_buffer_to_mesh, METH_VARARGS|METH_KEYWORDS, 0}; +static char __pyx_doc_7DracoPy_8decode_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_9decode_buffer_to_mesh = {"decode_buffer_to_mesh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_9decode_buffer_to_mesh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7DracoPy_8decode_buffer_to_mesh}; static PyObject *__pyx_pw_7DracoPy_9decode_buffer_to_mesh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_buffer = 0; PyObject *__pyx_v_deduplicate = 0; @@ -5556,7 +5799,7 @@ static PyObject *__pyx_pw_7DracoPy_9decode_buffer_to_mesh(PyObject *__pyx_self, } } 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, 196, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode_buffer_to_mesh") < 0)) __PYX_ERR(0, 238, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -5572,7 +5815,7 @@ static PyObject *__pyx_pw_7DracoPy_9decode_buffer_to_mesh(PyObject *__pyx_self, } 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, 196, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decode_buffer_to_mesh", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 238, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("DracoPy.decode_buffer_to_mesh", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -5603,26 +5846,26 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject int __pyx_clineno = 0; __Pyx_RefNannySetupContext("decode_buffer_to_mesh", 0); - /* "DracoPy.pyx":197 - * - * def decode_buffer_to_mesh(buffer, deduplicate=False): + /* "DracoPy.pyx":245 + * :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, 197, __pyx_L1_error) - __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 197, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_deduplicate); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 245, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 245, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_deduplicate); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 245, __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, 197, __pyx_L1_error) + __PYX_ERR(0, 245, __pyx_L1_error) } __pyx_v_mesh_struct = __pyx_t_4; - /* "DracoPy.pyx":198 - * def decode_buffer_to_mesh(buffer, deduplicate=False): + /* "DracoPy.pyx":246 + * """ * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< * return DracoMesh(mesh_struct) @@ -5631,7 +5874,7 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject __pyx_t_5 = ((__pyx_v_mesh_struct.decode_status == DracoFunctions::successful) != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":199 + /* "DracoPy.pyx":247 * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: * return DracoMesh(mesh_struct) # <<<<<<<<<<<<<< @@ -5639,9 +5882,9 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject * 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, 199, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_DracoMesh); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 247, __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, 199, __pyx_L1_error) + __pyx_t_8 = __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(__pyx_v_mesh_struct); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 247, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { @@ -5656,15 +5899,15 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject __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, 199, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 247, __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":198 - * def decode_buffer_to_mesh(buffer, deduplicate=False): + /* "DracoPy.pyx":246 + * """ * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< * return DracoMesh(mesh_struct) @@ -5672,7 +5915,7 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":201 + /* "DracoPy.pyx":249 * return DracoMesh(mesh_struct) * else: * raise_decoding_error(mesh_struct.decode_status) # <<<<<<<<<<<<<< @@ -5680,9 +5923,9 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject * 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, 201, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_raise_decoding_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 249, __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, 201, __pyx_L1_error) + __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, 249, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { @@ -5697,18 +5940,18 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject __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, 201, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 249, __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":196 + /* "DracoPy.pyx":238 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer, deduplicate=False): # <<<<<<<<<<<<<< - * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) - * if mesh_struct.decode_status == DracoPy.decoding_status.successful: + * """ + * Decode buffer to mesh */ /* function exit code */ @@ -5727,17 +5970,18 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject return __pyx_r; } -/* "DracoPy.pyx":203 +/* "DracoPy.pyx":251 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer, deduplicate=False): # <<<<<<<<<<<<<< - * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer), deduplicate) - * if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: + * """ + * Decode buffer to point cloud */ /* Python wrapper */ static PyObject *__pyx_pw_7DracoPy_11decode_point_cloud_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_11decode_point_cloud_buffer = {"decode_point_cloud_buffer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_11decode_point_cloud_buffer, METH_VARARGS|METH_KEYWORDS, 0}; +static char __pyx_doc_7DracoPy_10decode_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_11decode_point_cloud_buffer = {"decode_point_cloud_buffer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_11decode_point_cloud_buffer, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7DracoPy_10decode_point_cloud_buffer}; static PyObject *__pyx_pw_7DracoPy_11decode_point_cloud_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_buffer = 0; PyObject *__pyx_v_deduplicate = 0; @@ -5775,7 +6019,7 @@ static PyObject *__pyx_pw_7DracoPy_11decode_point_cloud_buffer(PyObject *__pyx_s } } 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, 203, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode_point_cloud_buffer") < 0)) __PYX_ERR(0, 251, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -5791,7 +6035,7 @@ static PyObject *__pyx_pw_7DracoPy_11decode_point_cloud_buffer(PyObject *__pyx_s } 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, 203, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decode_point_cloud_buffer", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 251, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("DracoPy.decode_point_cloud_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -5822,26 +6066,26 @@ static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyO int __pyx_clineno = 0; __Pyx_RefNannySetupContext("decode_point_cloud_buffer", 0); - /* "DracoPy.pyx":204 - * - * def decode_point_cloud_buffer(buffer, deduplicate=False): + /* "DracoPy.pyx":258 + * :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, 204, __pyx_L1_error) - __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 204, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_deduplicate); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 204, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 258, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 258, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_deduplicate); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 258, __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, 204, __pyx_L1_error) + __PYX_ERR(0, 258, __pyx_L1_error) } __pyx_v_point_cloud_struct = __pyx_t_4; - /* "DracoPy.pyx":205 - * def decode_point_cloud_buffer(buffer, deduplicate=False): + /* "DracoPy.pyx":259 + * """ * 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) @@ -5850,7 +6094,7 @@ static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyO __pyx_t_5 = ((__pyx_v_point_cloud_struct.decode_status == DracoFunctions::successful) != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":206 + /* "DracoPy.pyx":260 * 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) # <<<<<<<<<<<<<< @@ -5858,9 +6102,9 @@ static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyO * 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, 206, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 260, __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, 206, __pyx_L1_error) + __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, 260, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { @@ -5875,15 +6119,15 @@ static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyO __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, 206, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 260, __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":205 - * def decode_point_cloud_buffer(buffer, deduplicate=False): + /* "DracoPy.pyx":259 + * """ * 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) @@ -5891,15 +6135,15 @@ static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyO */ } - /* "DracoPy.pyx":208 + /* "DracoPy.pyx":262 * 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, 208, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_raise_decoding_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 262, __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, 208, __pyx_L1_error) + __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, 262, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { @@ -5914,18 +6158,18 @@ static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyO __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, 208, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 262, __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":203 + /* "DracoPy.pyx":251 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer, deduplicate=False): # <<<<<<<<<<<<<< - * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer), deduplicate) - * if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: + * """ + * Decode buffer to point cloud */ /* function exit code */ @@ -6593,7 +6837,7 @@ static struct DracoFunctions::MetadataObject __pyx_convert__from_py_struct__Drac * result.entries = value * try: */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 19, __pyx_L6_except_error) + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, 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; @@ -6695,7 +6939,7 @@ static struct DracoFunctions::MetadataObject __pyx_convert__from_py_struct__Drac * result.sub_metadata_ids = value * return result */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 24, __pyx_L14_except_error) + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, 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; @@ -7124,7 +7368,7 @@ static struct DracoFunctions::PointAttributeObject __pyx_convert__from_py_struct * result.data = value * try: */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 19, __pyx_L6_except_error) + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, 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; @@ -7226,7 +7470,7 @@ static struct DracoFunctions::PointAttributeObject __pyx_convert__from_py_struct * result.datatype = value * try: */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 24, __pyx_L14_except_error) + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, 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; @@ -7328,7 +7572,7 @@ static struct DracoFunctions::PointAttributeObject __pyx_convert__from_py_struct * result.dimension = value * try: */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 29, __pyx_L22_except_error) + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, 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; @@ -7430,7 +7674,7 @@ static struct DracoFunctions::PointAttributeObject __pyx_convert__from_py_struct * result.metadata_id = value * return result */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 34, __pyx_L30_except_error) + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, 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; @@ -7742,7 +7986,7 @@ static struct DracoFunctions::GeometryMetadataObject __pyx_convert__from_py_stru * result.metadata_id = value * try: */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 19, __pyx_L6_except_error) + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, 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; @@ -7844,7 +8088,7 @@ static struct DracoFunctions::GeometryMetadataObject __pyx_convert__from_py_stru * result.generic_attributes = value * return result */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 24, __pyx_L14_except_error) + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, 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; @@ -8880,52 +9124,1754 @@ static PyObject *__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_Metada return __pyx_r; } -static PyMethodDef __pyx_methods[] = { - {0, 0, 0, 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() + */ -#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 +/* 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); -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 */ + /* 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 - __pyx_methods /* m_methods */, - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_moduledef_slots, /* m_slots */ - #else - NULL, /* m_reload */ + #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 - 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 - + { + __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___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 +}; + +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_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}, @@ -8946,10 +10892,14 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_s_Failed_to_decode_input_mesh_Data, __pyx_k_Failed_to_decode_input_mesh_Data, sizeof(__pyx_k_Failed_to_decode_input_mesh_Data), 0, 0, 1, 0}, {&__pyx_n_s_FileTypeException, __pyx_k_FileTypeException, sizeof(__pyx_k_FileTypeException), 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_s_Input_invalid, __pyx_k_Input_invalid, sizeof(__pyx_k_Input_invalid), 0, 0, 1, 0}, {&__pyx_kp_s_Input_mesh_is_not_draco_encoded, __pyx_k_Input_mesh_is_not_draco_encoded, sizeof(__pyx_k_Input_mesh_is_not_draco_encoded), 0, 0, 1, 0}, + {&__pyx_n_s_IntEnum, __pyx_k_IntEnum, sizeof(__pyx_k_IntEnum), 0, 0, 1, 1}, {&__pyx_kp_s_Invalid_mesh, __pyx_k_Invalid_mesh, sizeof(__pyx_k_Invalid_mesh), 0, 0, 1, 0}, {&__pyx_kp_s_Invalid_point_cloud, __pyx_k_Invalid_point_cloud, sizeof(__pyx_k_Invalid_point_cloud), 0, 0, 1, 0}, {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1}, @@ -8961,23 +10911,37 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_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_kp_s_Specified_value_out_of_encoded_r, __pyx_k_Specified_value_out_of_encoded_r, sizeof(__pyx_k_Specified_value_out_of_encoded_r), 0, 0, 1, 0}, {&__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_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_metadata, __pyx_k_create_metadata, sizeof(__pyx_k_create_metadata), 0, 0, 1, 1}, {&__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_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_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_dim, __pyx_k_dim, sizeof(__pyx_k_dim), 0, 0, 1, 1}, {&__pyx_n_s_dimension, __pyx_k_dimension, sizeof(__pyx_k_dimension), 0, 0, 1, 1}, @@ -8990,33 +10954,47 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_s_entries, __pyx_k_entries, sizeof(__pyx_k_entries), 0, 0, 1, 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_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_kp_s_generic_attributes_encoding_deco, __pyx_k_generic_attributes_encoding_deco, sizeof(__pyx_k_generic_attributes_encoding_deco), 0, 0, 1, 0}, {&__pyx_n_s_geometry_metadata, __pyx_k_geometry_metadata, sizeof(__pyx_k_geometry_metadata), 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_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 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_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_s_metadatas, __pyx_k_metadatas, sizeof(__pyx_k_metadatas), 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_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_n_s_normals, __pyx_k_normals, sizeof(__pyx_k_normals), 0, 0, 1, 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_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_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_s_quantization_bits, __pyx_k_quantization_bits, sizeof(__pyx_k_quantization_bits), 0, 0, 1, 1}, @@ -9025,13 +11003,27 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_sub_metadata_ids, __pyx_k_sub_metadata_ids, sizeof(__pyx_k_sub_metadata_ids), 0, 0, 1, 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) { @@ -9039,7 +11031,8 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) __PYX_ERR(0, 27, __pyx_L1_error) __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 62, __pyx_L1_error) __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 69, __pyx_L1_error) - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 192, __pyx_L1_error) + __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 204, __pyx_L1_error) + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 234, __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:; @@ -9061,38 +11054,49 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_); - /* "DracoPy.pyx":139 + /* "DracoPy.pyx":159 * if quant_origin != NULL: * PyMem_Free(quant_origin) * raise ValueError("Input invalid") # <<<<<<<<<<<<<< * * def encode_point_cloud_to_buffer(points, */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_Input_invalid); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 139, __pyx_L1_error) + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_Input_invalid); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 159, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); - /* "DracoPy.pyx":192 + /* "DracoPy.pyx":204 + * geometry_metadata = create_empty_geometry_metadata() + * if len(geometry_metadata["generic_attributes"]) > 0: + * raise RuntimeError("generic attributes encoding/decoding is not supported") # <<<<<<<<<<<<<< + * cdef float* quant_origin = NULL + * try: + */ + __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_generic_attributes_encoding_deco); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 204, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__3); + __Pyx_GIVEREF(__pyx_tuple__3); + + /* "DracoPy.pyx":234 * 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_s_Failed_to_decode_input_mesh_Data); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 192, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__3); - __Pyx_GIVEREF(__pyx_tuple__3); + __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_Failed_to_decode_input_mesh_Data); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 234, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__4); + __Pyx_GIVEREF(__pyx_tuple__4); - /* "DracoPy.pyx":194 + /* "DracoPy.pyx":236 * 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__4 = PyTuple_Pack(1, __pyx_kp_s_DracoPy_only_supports_meshes_wit); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 194, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__4); - __Pyx_GIVEREF(__pyx_tuple__4); + __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_DracoPy_only_supports_meshes_wit); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 236, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__5); + __Pyx_GIVEREF(__pyx_tuple__5); /* "FromPyStructUtility":19 * value = obj['entries'] @@ -9101,9 +11105,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * result.entries = value * try: */ - __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(1, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); + __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__6); + __Pyx_GIVEREF(__pyx_tuple__6); /* "FromPyStructUtility":24 * value = obj['sub_metadata_ids'] @@ -9112,9 +11116,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * result.sub_metadata_ids = value * return result */ - __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_2); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__6); - __Pyx_GIVEREF(__pyx_tuple__6); + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_2); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__7); + __Pyx_GIVEREF(__pyx_tuple__7); /* "FromPyStructUtility":19 * value = obj['data'] @@ -9123,9 +11127,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * result.data = value * try: */ - __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_3); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); + __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_3); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__8); /* "FromPyStructUtility":24 * value = obj['datatype'] @@ -9134,9 +11138,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * result.datatype = value * try: */ - __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_4); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_4); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__9); + __Pyx_GIVEREF(__pyx_tuple__9); /* "FromPyStructUtility":29 * value = obj['dimension'] @@ -9145,9 +11149,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * result.dimension = value * try: */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_5); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 29, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_5); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 29, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__10); + __Pyx_GIVEREF(__pyx_tuple__10); /* "FromPyStructUtility":34 * value = obj['metadata_id'] @@ -9156,9 +11160,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * result.metadata_id = value * return result */ - __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_6); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__10); - __Pyx_GIVEREF(__pyx_tuple__10); + __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_6); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__11); + __Pyx_GIVEREF(__pyx_tuple__11); /* "FromPyStructUtility":24 * value = obj['generic_attributes'] @@ -9167,9 +11171,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * result.generic_attributes = value * return result */ - __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_7); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__11); - __Pyx_GIVEREF(__pyx_tuple__11); + __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_7); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__12); + __Pyx_GIVEREF(__pyx_tuple__12); /* "DracoPy.pyx":9 * @@ -9178,9 +11182,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * def __init__(self, data_struct): * self.data_struct = data_struct */ - __pyx_tuple__12 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__12); - __Pyx_GIVEREF(__pyx_tuple__12); + __pyx_tuple__13 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__13); + __Pyx_GIVEREF(__pyx_tuple__13); /* "DracoPy.pyx":10 * @@ -9189,10 +11193,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * self.data_struct = data_struct * if data_struct['encoding_options_set']: */ - __pyx_tuple__13 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_data_struct); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 10, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__13); - __Pyx_GIVEREF(__pyx_tuple__13); - __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_init, 10, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 10, __pyx_L1_error) + __pyx_tuple__14 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_data_struct); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 10, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__14); + __Pyx_GIVEREF(__pyx_tuple__14); + __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 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_init, 10, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 10, __pyx_L1_error) /* "DracoPy.pyx":19 * # self.metadata = decode_metadata(data_struct["binary_metadata"]) @@ -9201,10 +11205,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * if self.encoding_options is not None: * return self.encoding_options.get_encoded_coordinate(value, axis) */ - __pyx_tuple__15 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_value, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__15); - __Pyx_GIVEREF(__pyx_tuple__15); - __pyx_codeobj__16 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_get_encoded_coordinate, 19, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__16)) __PYX_ERR(0, 19, __pyx_L1_error) + __pyx_tuple__16 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_value, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__16); + __Pyx_GIVEREF(__pyx_tuple__16); + __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 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_get_encoded_coordinate, 19, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 19, __pyx_L1_error) /* "DracoPy.pyx":23 * return self.encoding_options.get_encoded_coordinate(value, axis) @@ -9213,10 +11217,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * if self.encoding_options is not None: * return self.encoding_options.get_encoded_point(point) */ - __pyx_tuple__17 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_point); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 23, __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_get_encoded_point, 23, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 23, __pyx_L1_error) + __pyx_tuple__18 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_point); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 23, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__18); + __Pyx_GIVEREF(__pyx_tuple__18); + __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 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_get_encoded_point, 23, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 23, __pyx_L1_error) /* "DracoPy.pyx":28 * @@ -9225,10 +11229,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return 3 * */ - __pyx_tuple__19 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 28, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__19); - __Pyx_GIVEREF(__pyx_tuple__19); - __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_num_axes, 28, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 28, __pyx_L1_error) + __pyx_tuple__20 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 28, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__20); + __Pyx_GIVEREF(__pyx_tuple__20); + __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_num_axes, 28, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 28, __pyx_L1_error) /* "DracoPy.pyx":32 * @@ -9237,22 +11241,22 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return self.data_struct['points'] * */ - __pyx_tuple__21 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__21); - __Pyx_GIVEREF(__pyx_tuple__21); - __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_points, 32, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 32, __pyx_L1_error) + __pyx_tuple__22 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__22); + __Pyx_GIVEREF(__pyx_tuple__22); + __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_points, 32, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 32, __pyx_L1_error) /* "DracoPy.pyx":36 * * @property - * def geometry_metadata(self) -> Dict: # <<<<<<<<<<<<<< - * return self.data_struct['geometry_metadata'] + * def geometry_metadata(self) -> Optional[Dict]: # <<<<<<<<<<<<<< + * return self.data_struct['geometry_metadata'] if self.metadatas else None * */ - __pyx_tuple__23 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 36, __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_geometry_metadata, 36, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 36, __pyx_L1_error) + __pyx_tuple__24 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__24); + __Pyx_GIVEREF(__pyx_tuple__24); + __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_geometry_metadata, 36, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 36, __pyx_L1_error) /* "DracoPy.pyx":40 * @@ -9261,10 +11265,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return self.data_struct['metadatas'] * */ - __pyx_tuple__25 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 40, __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_metadatas, 40, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 40, __pyx_L1_error) + __pyx_tuple__26 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__26); + __Pyx_GIVEREF(__pyx_tuple__26); + __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_metadatas, 40, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 40, __pyx_L1_error) /* "DracoPy.pyx":46 * class DracoMesh(DracoPointCloud): @@ -9273,10 +11277,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return self.data_struct['faces'] * */ - __pyx_tuple__27 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 46, __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_faces, 46, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 46, __pyx_L1_error) + __pyx_tuple__28 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__28); + __Pyx_GIVEREF(__pyx_tuple__28); + __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_faces, 46, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 46, __pyx_L1_error) /* "DracoPy.pyx":50 * @@ -9285,10 +11289,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return self.data_struct['normals'] * */ - __pyx_tuple__29 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 50, __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_normals, 50, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 50, __pyx_L1_error) + __pyx_tuple__30 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__30); + __Pyx_GIVEREF(__pyx_tuple__30); + __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_normals, 50, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 50, __pyx_L1_error) /* "DracoPy.pyx":53 * return self.data_struct['normals'] @@ -9297,9 +11301,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * def __init__(self, quantization_bits, quantization_range, quantization_origin): * self.quantization_bits = quantization_bits */ - __pyx_tuple__31 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__31); - __Pyx_GIVEREF(__pyx_tuple__31); + __pyx_tuple__32 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__32); + __Pyx_GIVEREF(__pyx_tuple__32); /* "DracoPy.pyx":54 * @@ -9308,10 +11312,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * self.quantization_bits = quantization_bits * self.quantization_range = quantization_range */ - __pyx_tuple__32 = 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__32)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__32); - __Pyx_GIVEREF(__pyx_tuple__32); - __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_init, 54, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 54, __pyx_L1_error) + __pyx_tuple__33 = 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__33)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__33); + __Pyx_GIVEREF(__pyx_tuple__33); + __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 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_init, 54, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 54, __pyx_L1_error) /* "DracoPy.pyx":60 * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) @@ -9320,10 +11324,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * 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__34 = 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__34)) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__34); - __Pyx_GIVEREF(__pyx_tuple__34); - __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_get_encoded_coordinate, 60, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 60, __pyx_L1_error) + __pyx_tuple__35 = 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__35)) __PYX_ERR(0, 60, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__35); + __Pyx_GIVEREF(__pyx_tuple__35); + __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_get_encoded_coordinate, 60, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 60, __pyx_L1_error) /* "DracoPy.pyx":67 * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) @@ -9332,10 +11336,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * encoded_point = [] * for axis in range(self.num_axes): */ - __pyx_tuple__36 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_point, __pyx_n_s_encoded_point, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 67, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__36); - __Pyx_GIVEREF(__pyx_tuple__36); - __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(2, 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_get_encoded_point, 67, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 67, __pyx_L1_error) + __pyx_tuple__37 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_point, __pyx_n_s_encoded_point, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 67, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__37); + __Pyx_GIVEREF(__pyx_tuple__37); + __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 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_get_encoded_point, 67, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 67, __pyx_L1_error) /* "DracoPy.pyx":74 * @@ -9344,10 +11348,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return 3 * */ - __pyx_tuple__38 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 74, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__38); - __Pyx_GIVEREF(__pyx_tuple__38); - __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_num_axes, 74, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 74, __pyx_L1_error) + __pyx_tuple__39 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 74, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__39); + __Pyx_GIVEREF(__pyx_tuple__39); + __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_num_axes, 74, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 74, __pyx_L1_error) /* "DracoPy.pyx":83 * pass @@ -9356,7 +11360,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return { * "metadata_id": 0, */ - __pyx_codeobj__40 = (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, 83, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 83, __pyx_L1_error) + __pyx_codeobj__41 = (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, 83, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 83, __pyx_L1_error) /* "DracoPy.pyx":90 * @@ -9365,58 +11369,107 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * quantization_bits=14, * compression_level=1, */ - __pyx_tuple__41 = PyTuple_Pack(13, __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_metadatas, __pyx_n_s_geometry_metadata, __pyx_n_s_quant_origin, __pyx_n_s_num_dims, __pyx_n_s_dim, __pyx_n_s_encoded_mesh); if (unlikely(!__pyx_tuple__41)) __PYX_ERR(0, 90, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__41); - __Pyx_GIVEREF(__pyx_tuple__41); - __pyx_codeobj__42 = (PyObject*)__Pyx_PyCode_New(9, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_encode_mesh_to_buffer, 90, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__42)) __PYX_ERR(0, 90, __pyx_L1_error) + __pyx_tuple__42 = PyTuple_Pack(13, __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_metadatas, __pyx_n_s_geometry_metadata, __pyx_n_s_quant_origin, __pyx_n_s_num_dims, __pyx_n_s_dim, __pyx_n_s_encoded_mesh); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__42); + __Pyx_GIVEREF(__pyx_tuple__42); + __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(9, 0, 13, 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_encode_mesh_to_buffer, 90, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 90, __pyx_L1_error) - /* "DracoPy.pyx":141 + /* "DracoPy.pyx":161 * raise ValueError("Input invalid") * * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< * quantization_bits=14, * compression_level=1, */ - __pyx_tuple__43 = PyTuple_Pack(12, __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_metadatas, __pyx_n_s_geometry_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__43)) __PYX_ERR(0, 141, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__43); - __Pyx_GIVEREF(__pyx_tuple__43); - __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(8, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_encode_point_cloud_to_buffer, 141, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 141, __pyx_L1_error) + __pyx_tuple__44 = PyTuple_Pack(12, __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_metadatas, __pyx_n_s_geometry_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__44)) __PYX_ERR(0, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__44); + __Pyx_GIVEREF(__pyx_tuple__44); + __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(8, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_encode_point_cloud_to_buffer, 161, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 161, __pyx_L1_error) - /* "DracoPy.pyx":188 + /* "DracoPy.pyx":230 * 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__45 = PyTuple_Pack(1, __pyx_n_s_decoding_status); if (unlikely(!__pyx_tuple__45)) __PYX_ERR(0, 188, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__45); - __Pyx_GIVEREF(__pyx_tuple__45); - __pyx_codeobj__46 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_raise_decoding_error, 188, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__46)) __PYX_ERR(0, 188, __pyx_L1_error) + __pyx_tuple__46 = PyTuple_Pack(1, __pyx_n_s_decoding_status); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 230, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__46); + __Pyx_GIVEREF(__pyx_tuple__46); + __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_raise_decoding_error, 230, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 230, __pyx_L1_error) - /* "DracoPy.pyx":196 + /* "DracoPy.pyx":238 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer, deduplicate=False): # <<<<<<<<<<<<<< - * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) - * if mesh_struct.decode_status == DracoPy.decoding_status.successful: + * """ + * Decode buffer to mesh */ - __pyx_tuple__47 = PyTuple_Pack(3, __pyx_n_s_buffer, __pyx_n_s_deduplicate, __pyx_n_s_mesh_struct); if (unlikely(!__pyx_tuple__47)) __PYX_ERR(0, 196, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__47); - __Pyx_GIVEREF(__pyx_tuple__47); - __pyx_codeobj__48 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_buffer_to_mesh, 196, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__48)) __PYX_ERR(0, 196, __pyx_L1_error) + __pyx_tuple__48 = PyTuple_Pack(3, __pyx_n_s_buffer, __pyx_n_s_deduplicate, __pyx_n_s_mesh_struct); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 238, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__48); + __Pyx_GIVEREF(__pyx_tuple__48); + __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 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_decode_buffer_to_mesh, 238, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 238, __pyx_L1_error) - /* "DracoPy.pyx":203 + /* "DracoPy.pyx":251 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer, deduplicate=False): # <<<<<<<<<<<<<< - * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer), deduplicate) - * if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: - */ - __pyx_tuple__49 = PyTuple_Pack(3, __pyx_n_s_buffer, __pyx_n_s_deduplicate, __pyx_n_s_point_cloud_struct); if (unlikely(!__pyx_tuple__49)) __PYX_ERR(0, 203, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__49); - __Pyx_GIVEREF(__pyx_tuple__49); - __pyx_codeobj__50 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_point_cloud_buffer, 203, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__50)) __PYX_ERR(0, 203, __pyx_L1_error) + * """ + * Decode buffer to point cloud + */ + __pyx_tuple__50 = PyTuple_Pack(3, __pyx_n_s_buffer, __pyx_n_s_deduplicate, __pyx_n_s_point_cloud_struct); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 251, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__50); + __Pyx_GIVEREF(__pyx_tuple__50); + __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 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_decode_point_cloud_buffer, 251, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 251, __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__52 = 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__52)) __PYX_ERR(1, 28, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__52); + __Pyx_GIVEREF(__pyx_tuple__52); + __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_stringsource, __pyx_n_s_new, 28, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(1, 28, __pyx_L1_error) + __pyx_tuple__54 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(1, 28, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__54); + __Pyx_GIVEREF(__pyx_tuple__54); + + /* "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__55 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(1, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__55); + __Pyx_GIVEREF(__pyx_tuple__55); + __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_repr, 39, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) __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__57 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(1, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__57); + __Pyx_GIVEREF(__pyx_tuple__57); + __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_str, 41, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) __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__59 = 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__59)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__59); + __Pyx_GIVEREF(__pyx_tuple__59); + __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __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__60)) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -9432,6 +11485,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { __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:; @@ -9450,6 +11504,9 @@ 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; } @@ -9472,10 +11529,26 @@ static int __Pyx_modinit_function_export_code(void) { 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 ---*/ + __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) { @@ -9602,6 +11675,15 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec_DracoPy(PyObject *__pyx_pyinit_mod 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; @@ -9680,7 +11762,7 @@ if (!__Pyx_RefNanny) { 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) + 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 { @@ -9698,7 +11780,7 @@ if (!__Pyx_RefNanny) { (void)__Pyx_modinit_global_init_code(); (void)__Pyx_modinit_variable_export_code(); (void)__Pyx_modinit_function_export_code(); - (void)__Pyx_modinit_type_init_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(); @@ -9709,11 +11791,11 @@ if (!__Pyx_RefNanny) { /* "DracoPy.pyx":2 * # distutils: language = c++ - * from typing import Dict, List # <<<<<<<<<<<<<< + * from typing import Dict, List, Optional # <<<<<<<<<<<<<< * * from cpython.mem cimport PyMem_Malloc, PyMem_Free */ - __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error) + __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_n_s_Dict); __Pyx_GIVEREF(__pyx_n_s_Dict); @@ -9721,6 +11803,9 @@ if (!__Pyx_RefNanny) { __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, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -9732,6 +11817,10 @@ if (!__Pyx_RefNanny) { __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_List, __pyx_t_1) < 0) __PYX_ERR(0, 2, __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, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Optional, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "DracoPy.pyx":6 @@ -9762,9 +11851,9 @@ if (!__Pyx_RefNanny) { * def __init__(self, data_struct): * self.data_struct = data_struct */ - __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__12); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__13); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__12, __pyx_n_s_DracoPointCloud, __pyx_n_s_DracoPointCloud, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error) + __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__13, __pyx_n_s_DracoPointCloud, __pyx_n_s_DracoPointCloud, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); /* "DracoPy.pyx":10 @@ -9774,7 +11863,7 @@ if (!__Pyx_RefNanny) { * 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__14)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 10, __pyx_L1_error) + __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__15)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 10, __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, 10, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -9786,7 +11875,7 @@ if (!__Pyx_RefNanny) { * 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__16)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 19, __pyx_L1_error) + __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__17)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 19, __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, 19, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -9798,7 +11887,7 @@ if (!__Pyx_RefNanny) { * 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__18)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 23, __pyx_L1_error) + __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__19)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 23, __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, 23, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -9810,7 +11899,7 @@ if (!__Pyx_RefNanny) { * 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__20)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error) + __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__21)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); /* "DracoPy.pyx":27 @@ -9842,7 +11931,7 @@ if (!__Pyx_RefNanny) { __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, 32, __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__22)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 32, __pyx_L1_error) + __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__23)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 32, __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; @@ -9863,31 +11952,37 @@ if (!__Pyx_RefNanny) { /* "DracoPy.pyx":36 * * @property - * def geometry_metadata(self) -> Dict: # <<<<<<<<<<<<<< - * return self.data_struct['geometry_metadata'] + * 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, 36, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Dict); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Optional); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_t_5) < 0) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Dict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __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, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __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__24)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_4); + __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, 36, __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__25)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 36, __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":35 * return self.data_struct['points'] * * @property # <<<<<<<<<<<<<< - * def geometry_metadata(self) -> Dict: - * return self.data_struct['geometry_metadata'] + * 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_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 35, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __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, 36, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -9900,31 +11995,31 @@ if (!__Pyx_RefNanny) { */ __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 40, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_List); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_List); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 40, __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, 40, __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, 40, __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, 40, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_13metadatas, 0, __pyx_n_s_DracoPointCloud_metadatas, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_4); + __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, 40, __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__27)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 40, __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":39 - * return self.data_struct['geometry_metadata'] + * 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_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 39, __pyx_L1_error) + __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_6); __pyx_t_6 = 0; + __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, 40, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -9935,7 +12030,7 @@ if (!__Pyx_RefNanny) { * def __init__(self, data_struct): * self.data_struct = data_struct */ - __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoPointCloud, __pyx_tuple__12, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 9, __pyx_L1_error) + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoPointCloud, __pyx_tuple__13, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoPointCloud, __pyx_t_4) < 0) __PYX_ERR(0, 9, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -9968,19 +12063,19 @@ if (!__Pyx_RefNanny) { * return self.data_struct['faces'] * */ - __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 46, __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, 46, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_3, ((PyObject *)(&PyInt_Type))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_3, ((PyObject *)(&PyInt_Type))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_return, __pyx_t_5) < 0) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_9DracoMesh_1faces, 0, __pyx_n_s_DracoMesh_faces, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_6); + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, __pyx_t_6) < 0) __PYX_ERR(0, 46, __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__29)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 46, __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":45 * @@ -9989,11 +12084,11 @@ if (!__Pyx_RefNanny) { * def faces(self) -> List[int]: * return self.data_struct['faces'] */ - __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 45, __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_faces, __pyx_t_6) < 0) __PYX_ERR(0, 46, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 45, __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, 46, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; /* "DracoPy.pyx":50 * @@ -10002,8 +12097,8 @@ if (!__Pyx_RefNanny) { * return self.data_struct['normals'] * */ - __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_9DracoMesh_3normals, 0, __pyx_n_s_DracoMesh_normals, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); + __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__31)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); /* "DracoPy.pyx":49 * return self.data_struct['faces'] @@ -10012,11 +12107,11 @@ if (!__Pyx_RefNanny) { * def normals(self): * return self.data_struct['normals'] */ - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 49, __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_normals, __pyx_t_5) < 0) __PYX_ERR(0, 50, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 49, __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, 50, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; /* "DracoPy.pyx":44 * @@ -10025,236 +12120,1416 @@ if (!__Pyx_RefNanny) { * @property * def faces(self) -> List[int]: */ - __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoMesh, __pyx_t_2, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoMesh, __pyx_t_5) < 0) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoMesh, __pyx_t_2, __pyx_t_4, NULL, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoMesh, __pyx_t_6) < 0) __PYX_ERR(0, 44, __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":53 + * return self.data_struct['normals'] + * + * 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__32); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_tuple__32, __pyx_n_s_EncodingOptions, __pyx_n_s_EncodingOptions, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + + /* "DracoPy.pyx":54 + * + * 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__34)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __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, 54, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "DracoPy.pyx":60 + * 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__36)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 60, __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, 60, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "DracoPy.pyx":67 + * 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__38)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 67, __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, 67, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "DracoPy.pyx":74 + * + * @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__40)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 74, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + + /* "DracoPy.pyx":73 + * 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, 73, __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, 74, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "DracoPy.pyx":53 + * return self.data_struct['normals'] + * + * 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__32, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingOptions, __pyx_t_6) < 0) __PYX_ERR(0, 53, __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":77 + * return 3 + * + * class FileTypeException(Exception): # <<<<<<<<<<<<<< + * pass + * + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __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, 77, __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, 77, __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, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 77, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_FileTypeException, __pyx_t_4) < 0) __PYX_ERR(0, 77, __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":80 + * pass + * + * class EncodingFailedException(Exception): # <<<<<<<<<<<<<< + * pass + * + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __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, 80, __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, 80, __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, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 80, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingFailedException, __pyx_t_4) < 0) __PYX_ERR(0, 80, __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":53 - * return self.data_struct['normals'] + /* "DracoPy.pyx":83 + * pass + * + * def create_empty_geometry_metadata() -> dict: # <<<<<<<<<<<<<< + * return { + * "metadata_id": 0, + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_1create_empty_geometry_metadata, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __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, 83, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":90 + * + * + * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< + * quantization_bits=14, + * compression_level=1, + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_3encode_mesh_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __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, 90, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":161 + * raise ValueError("Input invalid") + * + * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< + * quantization_bits=14, + * compression_level=1, + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_5encode_point_cloud_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 161, __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, 161, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":230 + * 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_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_7raise_decoding_error, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 230, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_raise_decoding_error, __pyx_t_2) < 0) __PYX_ERR(0, 230, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":238 + * raise ValueError('DracoPy only supports meshes with position attributes') + * + * def decode_buffer_to_mesh(buffer, deduplicate=False): # <<<<<<<<<<<<<< + * """ + * Decode buffer to mesh + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_9decode_buffer_to_mesh, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 238, __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, 238, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":251 + * raise_decoding_error(mesh_struct.decode_status) + * + * def decode_point_cloud_buffer(buffer, deduplicate=False): # <<<<<<<<<<<<<< + * """ + * Decode buffer to point cloud + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_11decode_point_cloud_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 251, __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, 251, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":1 + * # distutils: language = c++ # <<<<<<<<<<<<<< + * 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 + * + * cdef object __Pyx_OrderedDict + * if PY_VERSION_HEX >= 0x02070000: # <<<<<<<<<<<<<< + * from collections import OrderedDict as __Pyx_OrderedDict + * else: + */ + __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; + + /* "EnumBase":9 + * + * 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 + */ + /*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:; + + /* "EnumBase":26 * - * class EncodingOptions(object): # <<<<<<<<<<<<<< - * def __init__(self, quantization_bits, quantization_range, quantization_origin): - * self.quantization_bits = quantization_bits + * cdef object __Pyx_EnumBase + * class __Pyx_EnumBase(int): # <<<<<<<<<<<<<< + * __metaclass__ = __Pyx_EnumMeta + * def __new__(cls, value, name=None): */ - __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__31); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_tuple__31, __pyx_n_s_EncodingOptions, __pyx_n_s_EncodingOptions, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error) + __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); - /* "DracoPy.pyx":54 - * - * class EncodingOptions(object): - * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< - * self.quantization_bits = quantization_bits - * self.quantization_range = quantization_range + /* "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_CyFunction_New(&__pyx_mdef_7DracoPy_15EncodingOptions_1__init__, 0, __pyx_n_s_EncodingOptions___init, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__33)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __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__53)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 28, __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, 54, __pyx_L1_error) + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__54); + 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":60 - * 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') + /* "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_15EncodingOptions_3get_encoded_coordinate, 0, __pyx_n_s_EncodingOptions_get_encoded_coor, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__35)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 60, __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__56)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 39, __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, 60, __pyx_L1_error) + 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":67 - * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) + /* "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) * - * 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__37)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 67, __pyx_L1_error) + __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__58)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 41, __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, 67, __pyx_L1_error) + 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; - /* "DracoPy.pyx":74 - * - * @property - * def num_axes(self): # <<<<<<<<<<<<<< - * return 3 + /* "EnumBase":26 * + * cdef object __Pyx_EnumBase + * class __Pyx_EnumBase(int): # <<<<<<<<<<<<<< + * __metaclass__ = __Pyx_EnumMeta + * def __new__(cls, value, name=None): */ - __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__39)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 74, __pyx_L1_error) + __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; - /* "DracoPy.pyx":73 - * return encoded_point + /* "EnumBase":44 + * return "%s.%s" % (self.__class__.__name__, self.name) + * + * if PY_VERSION_HEX >= 0x03040000: # <<<<<<<<<<<<<< + * from enum import IntEnum as __Pyx_EnumBase * - * @property # <<<<<<<<<<<<<< - * def num_axes(self): - * return 3 */ - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_num_axes, __pyx_t_5) < 0) __PYX_ERR(0, 74, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = ((PY_VERSION_HEX >= 0x03040000) != 0); + if (__pyx_t_7) { - /* "DracoPy.pyx":53 - * return self.data_struct['normals'] + /* "EnumBase":45 + * + * if PY_VERSION_HEX >= 0x03040000: + * from enum import IntEnum as __Pyx_EnumBase # <<<<<<<<<<<<<< * - * class EncodingOptions(object): # <<<<<<<<<<<<<< - * def __init__(self, quantization_bits, quantization_range, quantization_origin): - * self.quantization_bits = quantization_bits */ - __pyx_t_5 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_EncodingOptions, __pyx_tuple__31, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingOptions, __pyx_t_5) < 0) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __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; - /* "DracoPy.pyx":77 - * return 3 + /* "EnumBase":44 + * return "%s.%s" % (self.__class__.__name__, self.name) * - * class FileTypeException(Exception): # <<<<<<<<<<<<<< - * pass + * if PY_VERSION_HEX >= 0x03040000: # <<<<<<<<<<<<<< + * from enum import IntEnum as __Pyx_EnumBase * */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __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_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); - __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, 77, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __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_5)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_FileTypeException, __pyx_t_2, __pyx_t_5, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_FileTypeException, __pyx_t_4) < 0) __PYX_ERR(0, 77, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + 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":80 - * pass + /* "EnumType":50 * - * class EncodingFailedException(Exception): # <<<<<<<<<<<<<< - * pass + * + * cdef dict __Pyx_globals = globals() # <<<<<<<<<<<<<< + * if PY_VERSION_HEX >= 0x03040000: * */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error) + __pyx_t_2 = __Pyx_Globals(); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 50, __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, 80, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __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_5)) __PYX_ERR(0, 80, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_EncodingFailedException, __pyx_t_2, __pyx_t_5, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 80, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingFailedException, __pyx_t_4) < 0) __PYX_ERR(0, 80, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + 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; - /* "DracoPy.pyx":83 - * pass + /* "EnumType":51 * - * def create_empty_geometry_metadata() -> dict: # <<<<<<<<<<<<<< - * return { - * "metadata_id": 0, + * cdef dict __Pyx_globals = globals() + * if PY_VERSION_HEX >= 0x03040000: # <<<<<<<<<<<<<< + * + * DataType = __Pyx_EnumBase('DataType', __Pyx_OrderedDict([ */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_1create_empty_geometry_metadata, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __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, 83, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_7 = ((PY_VERSION_HEX >= 0x03040000) != 0); + if (__pyx_t_7) { - /* "DracoPy.pyx":90 + /* "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: * - * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< - * quantization_bits=14, - * compression_level=1, + * DataType = __Pyx_EnumBase('DataType', __Pyx_OrderedDict([ # <<<<<<<<<<<<<< + * ('DT_INVALID', DT_INVALID), + * ('DT_INT8', DT_INT8), */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_3encode_mesh_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __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, 90, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __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; - /* "DracoPy.pyx":141 - * raise ValueError("Input invalid") + /* "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_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; + + /* "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_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; + + /* "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_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; + + /* "EnumType":51 * - * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< - * quantization_bits=14, - * compression_level=1, + * cdef dict __Pyx_globals = globals() + * if PY_VERSION_HEX >= 0x03040000: # <<<<<<<<<<<<<< + * + * DataType = __Pyx_EnumBase('DataType', __Pyx_OrderedDict([ */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_5encode_point_cloud_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 141, __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, 141, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L4; + } + + /* "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') + */ + /*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; + + /* "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_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_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_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":188 - * 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') + /* "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_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_7raise_decoding_error, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 188, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_raise_decoding_error, __pyx_t_2) < 0) __PYX_ERR(0, 188, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __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_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":196 - * raise ValueError('DracoPy only supports meshes with position attributes') - * - * def decode_buffer_to_mesh(buffer, deduplicate=False): # <<<<<<<<<<<<<< - * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) - * if mesh_struct.decode_status == DracoPy.decoding_status.successful: + /* "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_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_9decode_buffer_to_mesh, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 196, __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, 196, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __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":203 - * raise_decoding_error(mesh_struct.decode_status) - * - * def decode_point_cloud_buffer(buffer, deduplicate=False): # <<<<<<<<<<<<<< - * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer), deduplicate) - * if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: + /* "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_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_11decode_point_cloud_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 203, __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, 203, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __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; - /* "DracoPy.pyx":1 - * # distutils: language = c++ # <<<<<<<<<<<<<< - * from typing import Dict, List + /* "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') * */ - __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; + __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; - /* "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())] + /* "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') # <<<<<<<<<<<<<< * */ + __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:; /*--- Wrapped vars code ---*/ @@ -10266,6 +13541,14 @@ if (!__Pyx_RefNanny) { __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); @@ -12004,6 +15287,34 @@ static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tsta } #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; @@ -12083,6 +15394,180 @@ static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tsta 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); @@ -12846,6 +16331,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) { @@ -14215,44 +17745,6 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu } } -/* 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); - } -} - /* CIntFromPy */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC @@ -14449,6 +17941,44 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu return (long) -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); + } +} + /* CheckBinaryVersion */ static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; diff --git a/src/DracoPy.h b/src/DracoPy.h index 82c59f5..4419acc 100644 --- a/src/DracoPy.h +++ b/src/DracoPy.h @@ -180,7 +180,7 @@ namespace DracoFunctions { void encode_metadata(const std::vector& metadatas, const MetadataObject& main_metadata_object, draco::Metadata& out_metadata) { - // it should not encode metadata as it doesn't exist + // it should not encode metadata if it doesn't exist if (metadatas.empty()) return; using MetadataPair = std::pair; @@ -203,7 +203,7 @@ namespace DracoFunctions { 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; - auto sub_metadata = std::make_unique(); + 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)); } @@ -212,29 +212,29 @@ namespace DracoFunctions { } } - bool encode_geometry_metadata( + draco::GeometryMetadata& encode_geometry_metadata( draco::PointCloud& pc, const std::vector& metadatas, const GeometryMetadataObject& geometry_metadata_object) { - // it should not encode geometry metadata if actually no metadata was passed - if (metadatas.empty()) - return false; const auto& gmo = geometry_metadata_object; - auto geometry_metadata_ptr = std::make_unique(); + 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; - auto attribute_metadata = std::make_unique(); + 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 true; + return geometry_metadata; } } @@ -357,10 +357,22 @@ namespace DracoFunctions { 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) { + 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, + const std::vector& metadatas, + const GeometryMetadataObject& geometry_metadata_object) { int speed = 10 - compression_level; encoder.SetSpeedOptions(speed, speed); - std::unique_ptr metadata = std::unique_ptr(new draco::GeometryMetadata()); + draco::GeometryMetadata* metadata = nullptr; + if (create_metadata) { + metadata = &encode_geometry_metadata(*point_cloud_or_mesh, metadatas, geometry_metadata_object); + metadata->AddEntryInt("quantization_bits", quantization_bits); + } if (quantization_origin == NULL || quantization_range == -1) { encoder.SetAttributeQuantization(draco::GeometryAttribute::POSITION, quantization_bits); } @@ -375,10 +387,6 @@ namespace DracoFunctions { 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, @@ -404,9 +412,10 @@ namespace DracoFunctions { std::unique_ptr ptr_mesh = mb.Finalize(); draco::Mesh *mesh = ptr_mesh.get(); - encode_geometry_metadata(*mesh, metadatas, geometry_metadata_object); draco::Encoder encoder; - setup_encoder_and_metadata(mesh, encoder, compression_level, quantization_bits, quantization_range, quantization_origin, create_metadata); + setup_encoder_and_metadata(mesh, encoder, compression_level, quantization_bits, + quantization_range, quantization_origin, create_metadata, + metadatas, geometry_metadata_object); draco::EncoderBuffer buffer; const draco::Status status = encoder.EncodeMeshToBuffer(*mesh, &buffer); EncodedObject encodedMeshObject; @@ -440,10 +449,10 @@ namespace DracoFunctions { std::unique_ptr ptr_point_cloud = pcb.Finalize(true); draco::PointCloud *point_cloud = ptr_point_cloud.get(); - encode_geometry_metadata(*point_cloud, metadatas, geometry_metadata_object); - draco::Encoder encoder; - setup_encoder_and_metadata(point_cloud, encoder, compression_level, quantization_bits, quantization_range, quantization_origin, create_metadata); + setup_encoder_and_metadata(point_cloud, encoder, compression_level, quantization_bits, + quantization_range, quantization_origin, create_metadata, + metadatas, geometry_metadata_object); draco::EncoderBuffer buffer; const draco::Status status = encoder.EncodePointCloudToBuffer(*point_cloud, &buffer); EncodedObject encodedPointCloudObject; diff --git a/src/DracoPy.pxd b/src/DracoPy.pxd index 6b82419..01e5b46 100644 --- a/src/DracoPy.pxd +++ b/src/DracoPy.pxd @@ -5,20 +5,20 @@ from libc.stdint cimport uint32_t, uint8_t from libcpp cimport bool cdef extern from "DracoPy.h" namespace "draco": - cdef enum DataType: - DT_INVALID - DT_INT8 - DT_UINT8 - DT_INT16 - DT_UINT16 - DT_INT32 - DT_UINT32 - DT_INT64 - DT_UINT64 - DT_FLOAT32 - DT_FLOAT64 - DT_BOOL - DT_TYPES_COUNT + 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" cdef extern from "DracoPy.h" namespace "DracoFunctions": diff --git a/src/DracoPy.pyx b/src/DracoPy.pyx index 1b3f2c7..0524190 100644 --- a/src/DracoPy.pyx +++ b/src/DracoPy.pyx @@ -1,5 +1,5 @@ # distutils: language = c++ -from typing import Dict, List +from typing import Dict, List, Optional from cpython.mem cimport PyMem_Malloc, PyMem_Free cimport DracoPy @@ -33,8 +33,8 @@ class DracoPointCloud(object): return self.data_struct['points'] @property - def geometry_metadata(self) -> Dict: - return self.data_struct['geometry_metadata'] + def geometry_metadata(self) -> Optional[Dict]: + return self.data_struct['geometry_metadata'] if self.metadatas else None @property def metadatas(self) -> List[Dict]: @@ -97,13 +97,33 @@ def encode_mesh_to_buffer(points, faces, geometry_metadata = None, ): """ - 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. + Encode a list or numpy array of points/vertices (float) to a draco buffer. + :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 + :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 exists in 'metadatas' fields + :return bytes: encoded mesh """ if metadatas is None: metadatas = [] @@ -149,17 +169,39 @@ def encode_point_cloud_to_buffer(points, ): """ 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 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 + :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 exists in 'metadatas' fields + :return bytes: encoded mesh """ if metadatas is None: metadatas = [] if geometry_metadata is None: geometry_metadata = create_empty_geometry_metadata() + if len(geometry_metadata["generic_attributes"]) > 0: + raise RuntimeError("generic attributes encoding/decoding is not supported") cdef float* quant_origin = NULL try: num_dims = 3 @@ -194,6 +236,12 @@ def raise_decoding_error(decoding_status): raise ValueError('DracoPy only supports meshes with position attributes') 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) @@ -201,6 +249,12 @@ def decode_buffer_to_mesh(buffer, deduplicate=False): raise_decoding_error(mesh_struct.decode_status) 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) diff --git a/tests.py b/tests.py index 362039b..1212742 100644 --- a/tests.py +++ b/tests.py @@ -1,4 +1,5 @@ import os +import sys from typing import Tuple, List, Dict import DracoPy @@ -166,10 +167,11 @@ def test_decoding_and_encoding_point_cloud_file(): def test_encode_decode_tetrahedron_mesh(): points, faces = create_tetrahedron() buffer = DracoPy.encode_mesh_to_buffer(points, faces) - mesh = DracoPy.decode_buffer_to_mesh(buffer) + 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] @@ -185,7 +187,7 @@ def test_encode_decode_tetrahedron_mesh(): def test_encode_decode_tetrahedron_point_cloud(): points, _ = create_tetrahedron() buffer = DracoPy.encode_point_cloud_to_buffer(points) - point_cloud = DracoPy.decode_point_cloud_buffer(buffer) + 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) # consider duplicated points for j in range(len(point_cloud.points) // 3): @@ -193,6 +195,37 @@ def test_encode_decode_tetrahedron_point_cloud(): 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_mesh_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) # consider duplicated points + assert len(faces) == len(mesh.faces) # consider duplicated points + 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_point_cloud_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() @@ -205,10 +238,10 @@ def test_encode_decode_geometry_attributes_mesh(): ] attribute = { "data": { - i: int.to_bytes(4 - i, 4, "little", signed=False) + i: int.to_bytes(4 - i, 4, sys.byteorder, signed=False) for i in range(4) }, - "datatype": 6, + "datatype": DracoPy.DataType.DT_INT32, "dimension": 1, "metadata_id": 1, } @@ -219,8 +252,10 @@ def test_encode_decode_geometry_attributes_mesh(): # encode - decode buffer = DracoPy.encode_mesh_to_buffer( points, faces, + create_metadata=True, metadatas=metadatas, - geometry_metadata=geometry_metadata) + geometry_metadata=geometry_metadata, + ) mesh = DracoPy.decode_buffer_to_mesh(buffer, True) points_map = create_points_map(points, mesh.points) # validate results @@ -237,7 +272,6 @@ def test_encode_decode_geometry_attributes_mesh(): # data encoding-decoding still does not work for point cloud -@pytest.mark.xfail def test_encode_decode_geometry_attributes_point_cloud(): # prepare input data points, _ = create_tetrahedron() @@ -250,10 +284,10 @@ def test_encode_decode_geometry_attributes_point_cloud(): ] attribute = { "data": { - i: int.to_bytes(4 - i, 4, "little", signed=False) + i: int.to_bytes(4 - i, 4, sys.byteorder, signed=False) for i in range(4) }, - "datatype": 6, + "datatype": DracoPy.DataType.DT_UINT32, "dimension": 1, "metadata_id": 1, } @@ -262,23 +296,12 @@ def test_encode_decode_geometry_attributes_point_cloud(): "generic_attributes": [attribute], } # encode - decode - buffer = DracoPy.encode_point_cloud_to_buffer( - points, - metadatas=metadatas, - geometry_metadata=geometry_metadata) - point_cloud = DracoPy.decode_point_cloud_buffer(buffer, True) - points_map = create_points_map(points, point_cloud.points) - # validate results - out_generic_attributes = point_cloud.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] + with pytest.raises(RuntimeError): + DracoPy.encode_point_cloud_to_buffer( + points, + create_metadata=True, + metadatas=metadatas, + geometry_metadata=geometry_metadata) def test_encode_decode_submetadata_entries_mesh(): @@ -303,9 +326,13 @@ def test_encode_decode_submetadata_entries_mesh(): # encode - decode buffer = DracoPy.encode_mesh_to_buffer( points, faces, + create_metadata=True, metadatas=metadatas, geometry_metadata=geometry_metadata_specific) mesh = DracoPy.decode_buffer_to_mesh(buffer) + # add default value for quantization_bits + geometry_metadata["entries"][b"quantization_bits"] = int.to_bytes( + 14, 4, sys.byteorder) # validate results out_metadatas = mesh.metadatas assert len(out_metadatas) == len(metadatas) @@ -342,9 +369,13 @@ def test_encode_decode_submetadata_entries_point_cloud(): # encode - decode buffer = DracoPy.encode_point_cloud_to_buffer( points, + create_metadata=True, metadatas=metadatas, geometry_metadata=geometry_metadata_specific) point_cloud = DracoPy.decode_point_cloud_buffer(buffer) + # add default value for quantization_bits + geometry_metadata["entries"][b"quantization_bits"] = int.to_bytes( + 14, 4, sys.byteorder) # validate results out_metadatas = point_cloud.metadatas assert len(out_metadatas) == len(metadatas) @@ -358,3 +389,67 @@ def test_encode_decode_submetadata_entries_point_cloud(): custom_metadata = out_metadatas[custom_metadata_id] assert custom_metadata == metadatas[1] + +def test_no_metadata_exists_if_create_metadata_false_mesh(): + points, faces = create_tetrahedron() + metadatas = [ + { + "entries": {}, + "sub_metadata_ids": {}, + } + ] + geometry_metadata_specific = { + "metadata_id": 0, + "generic_attributes": [], + } + # encode - decode + buffer = DracoPy.encode_mesh_to_buffer( + points, faces, + create_metadata=False, + metadatas=metadatas, + geometry_metadata=geometry_metadata_specific) + mesh = DracoPy.decode_buffer_to_mesh(buffer) + # validate results + assert len(mesh.metadatas) == 0 + assert mesh.geometry_metadata is None + + +def test_no_metadata_exists_if_create_metadata_false_point_cloud(): + points, _ = create_tetrahedron() + metadatas = [ + { + "entries": {}, + "sub_metadata_ids": {}, + } + ] + geometry_metadata_specific = { + "metadata_id": 0, + "generic_attributes": [], + } + # encode - decode + buffer = DracoPy.encode_point_cloud_to_buffer( + points, + create_metadata=False, + metadatas=metadatas, + geometry_metadata=geometry_metadata_specific) + point_cloud = DracoPy.decode_point_cloud_buffer(buffer) + # validate results + assert len(point_cloud.metadatas) == 0 + assert point_cloud.geometry_metadata is None + + +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 From c4e2a020e71ac58d3388f6ee091f87a83542ce20 Mon Sep 17 00:00:00 2001 From: Andrey Romanov Date: Tue, 16 Nov 2021 11:56:17 +0300 Subject: [PATCH 16/21] change comments --- tests.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests.py b/tests.py index 1212742..ba56bc9 100644 --- a/tests.py +++ b/tests.py @@ -189,7 +189,7 @@ def test_encode_decode_tetrahedron_point_cloud(): buffer = DracoPy.encode_point_cloud_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) # consider duplicated 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] @@ -201,8 +201,8 @@ def test_encode_decode_tetrahedron_with_deduplication_mesh(): 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) # consider duplicated points - assert len(faces) == len(mesh.faces) # consider duplicated points + 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] @@ -441,7 +441,6 @@ def test_no_metadata_exists_if_create_metadata_false_point_cloud(): 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 From defb743de1a1a0ccebdf42113b2503eed8bd3955 Mon Sep 17 00:00:00 2001 From: Andrey Romanov Date: Tue, 16 Nov 2021 17:27:58 +0300 Subject: [PATCH 17/21] unify encode_to_mesh and encode_to_point_cloud into one function --- src/DracoPy.cpp | 2336 ++++++++++++++++++++++++----------------------- src/DracoPy.pyx | 124 +-- 2 files changed, 1234 insertions(+), 1226 deletions(-) diff --git a/src/DracoPy.cpp b/src/DracoPy.cpp index 2eafe6e..b1fddf5 100644 --- a/src/DracoPy.cpp +++ b/src/DracoPy.cpp @@ -1688,15 +1688,14 @@ 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_metadata_id[] = "metadata_id"; -static const char __pyx_k_Invalid_mesh[] = "Invalid mesh"; static const char __pyx_k_Pyx_EnumBase[] = "__Pyx_EnumBase"; static const char __pyx_k_RuntimeError[] = "RuntimeError"; -static const char __pyx_k_encoded_mesh[] = "encoded_mesh"; 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__"; @@ -1710,6 +1709,7 @@ static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError"; static const char __pyx_k_quantized_index[] = "quantized_index"; 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"; @@ -1724,9 +1724,7 @@ 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_Pyx_EnumBase___repr[] = "__Pyx_EnumBase.__repr__"; -static const char __pyx_k_encoded_point_cloud[] = "encoded_point_cloud"; 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"; @@ -1738,6 +1736,7 @@ static const char __pyx_k_DracoPointCloud_points[] = "DracoPointCloud.points"; static const char __pyx_k_EncodingOptions___init[] = "EncodingOptions.__init__"; 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_DracoPointCloud_metadatas[] = "DracoPointCloud.metadatas"; @@ -1756,7 +1755,7 @@ static const char __pyx_k_Failed_to_decode_input_mesh_Data[] = "Failed to decode 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 'entries'"; 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"; +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_value_specified_for_struct_at_2[] = "No value specified for struct attribute 'sub_metadata_ids'"; static const char __pyx_k_No_value_specified_for_struct_at_3[] = "No value specified for struct attribute 'data'"; static const char __pyx_k_No_value_specified_for_struct_at_4[] = "No value specified for struct attribute 'datatype'"; @@ -1805,8 +1804,7 @@ static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xd4; static PyObject *__pyx_kp_s_Input_invalid; static PyObject *__pyx_kp_s_Input_mesh_is_not_draco_encoded; static PyObject *__pyx_n_s_IntEnum; -static PyObject *__pyx_kp_s_Invalid_mesh; -static PyObject *__pyx_kp_s_Invalid_point_cloud; +static PyObject *__pyx_kp_s_Invalid_draco_structure; static PyObject *__pyx_n_s_KeyError; static PyObject *__pyx_n_s_List; static PyObject *__pyx_kp_s_No_value_specified_for_struct_at; @@ -1851,11 +1849,11 @@ 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_encoding_options; static PyObject *__pyx_n_s_encoding_options_set; static PyObject *__pyx_n_s_entries; @@ -1945,9 +1943,10 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_6num_axes(CYTHON_UNUSED PyO static PyObject *__pyx_pf_7DracoPy_create_empty_geometry_metadata(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ static PyObject *__pyx_pf_7DracoPy_2encode_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, PyObject *__pyx_v_metadatas, PyObject *__pyx_v_geometry_metadata); /* proto */ static PyObject *__pyx_pf_7DracoPy_4encode_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, PyObject *__pyx_v_metadatas, PyObject *__pyx_v_geometry_metadata); /* proto */ -static PyObject *__pyx_pf_7DracoPy_6raise_decoding_error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_decoding_status); /* proto */ -static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer, PyObject *__pyx_v_deduplicate); /* proto */ -static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer, PyObject *__pyx_v_deduplicate); /* proto */ +static PyObject *__pyx_pf_7DracoPy_6encode_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, PyObject *__pyx_v_metadatas, PyObject *__pyx_v_geometry_metadata); /* proto */ +static PyObject *__pyx_pf_7DracoPy_8raise_decoding_error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_decoding_status); /* proto */ +static PyObject *__pyx_pf_7DracoPy_10decode_buffer_to_mesh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer, PyObject *__pyx_v_deduplicate); /* proto */ +static PyObject *__pyx_pf_7DracoPy_12decode_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 */ @@ -2000,9 +1999,10 @@ static PyObject *__pyx_tuple__48; static PyObject *__pyx_tuple__50; static PyObject *__pyx_tuple__52; static PyObject *__pyx_tuple__54; -static PyObject *__pyx_tuple__55; +static PyObject *__pyx_tuple__56; static PyObject *__pyx_tuple__57; static PyObject *__pyx_tuple__59; +static PyObject *__pyx_tuple__61; static PyObject *__pyx_codeobj__15; static PyObject *__pyx_codeobj__17; static PyObject *__pyx_codeobj__19; @@ -2023,9 +2023,10 @@ static PyObject *__pyx_codeobj__47; static PyObject *__pyx_codeobj__49; static PyObject *__pyx_codeobj__51; static PyObject *__pyx_codeobj__53; -static PyObject *__pyx_codeobj__56; +static PyObject *__pyx_codeobj__55; static PyObject *__pyx_codeobj__58; static PyObject *__pyx_codeobj__60; +static PyObject *__pyx_codeobj__62; /* Late includes */ /* "DracoPy.pyx":10 @@ -3910,8 +3911,8 @@ static PyObject *__pyx_pf_7DracoPy_create_empty_geometry_metadata(CYTHON_UNUSED return __pyx_r; } -/* "DracoPy.pyx":90 - * +/* "DracoPy.pyx":89 + * } * * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< * quantization_bits=14, @@ -3920,8 +3921,7 @@ static PyObject *__pyx_pf_7DracoPy_create_empty_geometry_metadata(CYTHON_UNUSED /* Python wrapper */ static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7DracoPy_2encode_mesh_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 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 :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 exists in 'metadatas' fields\n :return bytes: encoded mesh\n "; -static PyMethodDef __pyx_mdef_7DracoPy_3encode_mesh_to_buffer = {"encode_mesh_to_buffer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_3encode_mesh_to_buffer, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7DracoPy_2encode_mesh_to_buffer}; +static PyMethodDef __pyx_mdef_7DracoPy_3encode_mesh_to_buffer = {"encode_mesh_to_buffer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_3encode_mesh_to_buffer, METH_VARARGS|METH_KEYWORDS, 0}; static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_points = 0; PyObject *__pyx_v_faces = 0; @@ -3945,7 +3945,7 @@ static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, values[3] = ((PyObject *)__pyx_int_1); values[4] = ((PyObject *)__pyx_int_neg_1); - /* "DracoPy.pyx":94 + /* "DracoPy.pyx":93 * compression_level=1, * quantization_range=-1, * quantization_origin=None, # <<<<<<<<<<<<<< @@ -3954,7 +3954,7 @@ static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, */ values[5] = ((PyObject *)Py_None); - /* "DracoPy.pyx":95 + /* "DracoPy.pyx":94 * quantization_range=-1, * quantization_origin=None, * create_metadata=False, # <<<<<<<<<<<<<< @@ -3963,7 +3963,7 @@ static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, */ values[6] = ((PyObject *)Py_False); - /* "DracoPy.pyx":96 + /* "DracoPy.pyx":95 * quantization_origin=None, * create_metadata=False, * metadatas = None, # <<<<<<<<<<<<<< @@ -3972,12 +3972,12 @@ static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, */ values[7] = ((PyObject *)Py_None); - /* "DracoPy.pyx":97 + /* "DracoPy.pyx":96 * create_metadata=False, * metadatas = None, * geometry_metadata = None, # <<<<<<<<<<<<<< * ): - * """ + * return encode_to_buffer(points, faces, quantization_bits, compression_level, */ values[8] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { @@ -4014,7 +4014,7 @@ static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, 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, 9, 1); __PYX_ERR(0, 90, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 2, 9, 1); __PYX_ERR(0, 89, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -4060,7 +4060,7 @@ static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, } } 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, 90, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode_mesh_to_buffer") < 0)) __PYX_ERR(0, 89, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -4096,7 +4096,7 @@ static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 2, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 90, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 2, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 89, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("DracoPy.encode_mesh_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -4104,8 +4104,8 @@ static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, __pyx_L4_argument_unpacking_done:; __pyx_r = __pyx_pf_7DracoPy_2encode_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_v_metadatas, __pyx_v_geometry_metadata); - /* "DracoPy.pyx":90 - * + /* "DracoPy.pyx":89 + * } * * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< * quantization_bits=14, @@ -4118,649 +4118,461 @@ static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, } static PyObject *__pyx_pf_7DracoPy_2encode_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, PyObject *__pyx_v_metadatas, PyObject *__pyx_v_geometry_metadata) { - float *__pyx_v_quant_origin; - PyObject *__pyx_v_num_dims = NULL; - PyObject *__pyx_v_dim = NULL; - struct DracoFunctions::EncodedObject __pyx_v_encoded_mesh; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; - int __pyx_t_2; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; + int __pyx_t_4; PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - size_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - PyObject *(*__pyx_t_11)(PyObject *); - float __pyx_t_12; - Py_ssize_t __pyx_t_13; - std::vector __pyx_t_14; - std::vector __pyx_t_15; - std::vector __pyx_t_16; - struct DracoFunctions::GeometryMetadataObject __pyx_t_17; - int __pyx_t_18; - int __pyx_t_19; - bool __pyx_t_20; - struct DracoFunctions::EncodedObject __pyx_t_21; - PyObject *__pyx_t_22 = NULL; - PyObject *__pyx_t_23 = NULL; - PyObject *__pyx_t_24 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("encode_mesh_to_buffer", 0); - __Pyx_INCREF(__pyx_v_metadatas); - __Pyx_INCREF(__pyx_v_geometry_metadata); - - /* "DracoPy.pyx":128 - * :return bytes: encoded mesh - * """ - * if metadatas is None: # <<<<<<<<<<<<<< - * metadatas = [] - * if geometry_metadata is None: - */ - __pyx_t_1 = (__pyx_v_metadatas == Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - /* "DracoPy.pyx":129 - * """ - * if metadatas is None: - * metadatas = [] # <<<<<<<<<<<<<< - * if geometry_metadata is None: - * geometry_metadata = create_empty_geometry_metadata() + /* "DracoPy.pyx":98 + * geometry_metadata = None, + * ): + * return encode_to_buffer(points, faces, quantization_bits, compression_level, # <<<<<<<<<<<<<< + * quantization_range, quantization_origin, + * create_metadata, metadatas, geometry_metadata) */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 129, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF_SET(__pyx_v_metadatas, __pyx_t_3); - __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode_to_buffer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); - /* "DracoPy.pyx":128 - * :return bytes: encoded mesh - * """ - * if metadatas is None: # <<<<<<<<<<<<<< - * metadatas = [] - * if geometry_metadata is None: + /* "DracoPy.pyx":100 + * return encode_to_buffer(points, faces, quantization_bits, compression_level, + * quantization_range, quantization_origin, + * create_metadata, metadatas, geometry_metadata) # <<<<<<<<<<<<<< + * + * */ + __pyx_t_3 = NULL; + __pyx_t_4 = 0; + 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_4 = 1; + } } - - /* "DracoPy.pyx":130 - * if metadatas is None: - * metadatas = [] - * if geometry_metadata is None: # <<<<<<<<<<<<<< - * geometry_metadata = create_empty_geometry_metadata() - * cdef float* quant_origin = NULL - */ - __pyx_t_2 = (__pyx_v_geometry_metadata == Py_None); - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { - - /* "DracoPy.pyx":131 - * metadatas = [] - * if geometry_metadata is None: - * geometry_metadata = create_empty_geometry_metadata() # <<<<<<<<<<<<<< - * cdef float* quant_origin = NULL - * try: - */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_create_empty_geometry_metadata); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 131, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); - } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[10] = {__pyx_t_3, __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_v_metadatas, __pyx_v_geometry_metadata}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 9+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __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[10] = {__pyx_t_3, __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_v_metadatas, __pyx_v_geometry_metadata}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 9+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + { + __pyx_t_5 = PyTuple_New(9+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 98, __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_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 131, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF_SET(__pyx_v_geometry_metadata, __pyx_t_3); - __pyx_t_3 = 0; - - /* "DracoPy.pyx":130 - * if metadatas is None: - * metadatas = [] - * if geometry_metadata is None: # <<<<<<<<<<<<<< - * geometry_metadata = create_empty_geometry_metadata() - * cdef float* quant_origin = NULL - */ + __Pyx_INCREF(__pyx_v_points); + __Pyx_GIVEREF(__pyx_v_points); + PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_points); + __Pyx_INCREF(__pyx_v_faces); + __Pyx_GIVEREF(__pyx_v_faces); + PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_faces); + __Pyx_INCREF(__pyx_v_quantization_bits); + __Pyx_GIVEREF(__pyx_v_quantization_bits); + PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_quantization_bits); + __Pyx_INCREF(__pyx_v_compression_level); + __Pyx_GIVEREF(__pyx_v_compression_level); + PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_v_compression_level); + __Pyx_INCREF(__pyx_v_quantization_range); + __Pyx_GIVEREF(__pyx_v_quantization_range); + PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_4, __pyx_v_quantization_range); + __Pyx_INCREF(__pyx_v_quantization_origin); + __Pyx_GIVEREF(__pyx_v_quantization_origin); + PyTuple_SET_ITEM(__pyx_t_5, 5+__pyx_t_4, __pyx_v_quantization_origin); + __Pyx_INCREF(__pyx_v_create_metadata); + __Pyx_GIVEREF(__pyx_v_create_metadata); + PyTuple_SET_ITEM(__pyx_t_5, 6+__pyx_t_4, __pyx_v_create_metadata); + __Pyx_INCREF(__pyx_v_metadatas); + __Pyx_GIVEREF(__pyx_v_metadatas); + PyTuple_SET_ITEM(__pyx_t_5, 7+__pyx_t_4, __pyx_v_metadatas); + __Pyx_INCREF(__pyx_v_geometry_metadata); + __Pyx_GIVEREF(__pyx_v_geometry_metadata); + PyTuple_SET_ITEM(__pyx_t_5, 8+__pyx_t_4, __pyx_v_geometry_metadata); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __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_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "DracoPy.pyx":132 - * if geometry_metadata is None: - * geometry_metadata = create_empty_geometry_metadata() - * cdef float* quant_origin = NULL # <<<<<<<<<<<<<< - * try: - * num_dims = 3 + /* "DracoPy.pyx":89 + * } + * + * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< + * quantization_bits=14, + * compression_level=1, */ - __pyx_v_quant_origin = NULL; - /* "DracoPy.pyx":133 - * geometry_metadata = create_empty_geometry_metadata() - * 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_6, &__pyx_t_7, &__pyx_t_8); - __Pyx_XGOTREF(__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_8); - /*try:*/ { + /* 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_AddTraceback("DracoPy.encode_mesh_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "DracoPy.pyx":134 - * cdef float* quant_origin = NULL - * try: - * num_dims = 3 # <<<<<<<<<<<<<< - * if quantization_origin is not None: - * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) +/* "DracoPy.pyx":103 + * + * + * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< + * quantization_bits=14, + * compression_level=1, */ - __Pyx_INCREF(__pyx_int_3); - __pyx_v_num_dims = __pyx_int_3; - /* "DracoPy.pyx":135 - * 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_1 = (__pyx_v_quantization_origin != Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { +/* Python wrapper */ +static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_5encode_point_cloud_to_buffer = {"encode_point_cloud_to_buffer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_7DracoPy_5encode_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; + PyObject *__pyx_v_metadatas = 0; + PyObject *__pyx_v_geometry_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,&__pyx_n_s_metadatas,&__pyx_n_s_geometry_metadata,0}; + PyObject* values[8] = {0,0,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":136 - * 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] + /* "DracoPy.pyx":107 + * compression_level=1, + * quantization_range=-1, + * quantization_origin=None, # <<<<<<<<<<<<<< + * create_metadata=False, + * metadatas = None, */ - __pyx_t_3 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 136, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 136, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_9 = __Pyx_PyInt_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_9 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 136, __pyx_L5_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_quant_origin = ((float *)PyMem_Malloc(__pyx_t_9)); + values[4] = ((PyObject *)Py_None); - /* "DracoPy.pyx":137 - * 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, + /* "DracoPy.pyx":108 + * quantization_range=-1, + * quantization_origin=None, + * create_metadata=False, # <<<<<<<<<<<<<< + * metadatas = None, + * geometry_metadata = None, */ - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 137, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_4); - if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { - __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_10 = 0; - __pyx_t_11 = NULL; - } else { - __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 137, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 137, __pyx_L5_error) - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - for (;;) { - if (likely(!__pyx_t_11)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 137, __pyx_L5_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 137, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_4); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 137, __pyx_L5_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 137, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_11(__pyx_t_3); - 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(0, 137, __pyx_L5_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_4); - __pyx_t_4 = 0; + values[5] = ((PyObject *)Py_False); - /* "DracoPy.pyx":138 - * 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, + /* "DracoPy.pyx":109 + * quantization_origin=None, + * create_metadata=False, + * metadatas = None, # <<<<<<<<<<<<<< + * geometry_metadata = None, + * ): */ - __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 138, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 138, __pyx_L5_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 138, __pyx_L5_error) - (__pyx_v_quant_origin[__pyx_t_13]) = __pyx_t_12; + values[6] = ((PyObject *)Py_None); - /* "DracoPy.pyx":137 - * 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, - */ - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "DracoPy.pyx":135 - * 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":110 + * create_metadata=False, + * metadatas = None, + * geometry_metadata = None, # <<<<<<<<<<<<<< + * ): + * return encode_to_buffer(points, None, quantization_bits, compression_level, */ + values[7] = ((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 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + CYTHON_FALLTHROUGH; + 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; } - - /* "DracoPy.pyx":139 - * for dim in range(num_dims): - * quant_origin[dim] = quantization_origin[dim] - * encoded_mesh = DracoPy.encode_mesh(points, # <<<<<<<<<<<<<< - * faces, - * metadatas, - */ - __pyx_t_14 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 139, __pyx_L5_error) - - /* "DracoPy.pyx":140 - * quant_origin[dim] = quantization_origin[dim] - * encoded_mesh = DracoPy.encode_mesh(points, - * faces, # <<<<<<<<<<<<<< - * metadatas, - * geometry_metadata, - */ - __pyx_t_15 = __pyx_convert_vector_from_py_uint32_t(__pyx_v_faces); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 140, __pyx_L5_error) - - /* "DracoPy.pyx":141 - * encoded_mesh = DracoPy.encode_mesh(points, - * faces, - * metadatas, # <<<<<<<<<<<<<< - * geometry_metadata, - * quantization_bits, - */ - __pyx_t_16 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_metadatas); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 141, __pyx_L5_error) - - /* "DracoPy.pyx":142 - * faces, - * metadatas, - * geometry_metadata, # <<<<<<<<<<<<<< - * quantization_bits, - * compression_level, - */ - __pyx_t_17 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_geometry_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 142, __pyx_L5_error) - - /* "DracoPy.pyx":143 - * metadatas, - * geometry_metadata, - * quantization_bits, # <<<<<<<<<<<<<< - * compression_level, - * quantization_range, - */ - __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 143, __pyx_L5_error) - - /* "DracoPy.pyx":144 - * geometry_metadata, - * quantization_bits, - * compression_level, # <<<<<<<<<<<<<< - * quantization_range, - * quant_origin, - */ - __pyx_t_19 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_19 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 144, __pyx_L5_error) - - /* "DracoPy.pyx":145 - * quantization_bits, - * compression_level, - * quantization_range, # <<<<<<<<<<<<<< - * quant_origin, - * create_metadata) - */ - __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 145, __pyx_L5_error) - - /* "DracoPy.pyx":147 - * quantization_range, - * quant_origin, - * create_metadata) # <<<<<<<<<<<<<< - * if quant_origin != NULL: - * PyMem_Free(quant_origin) - */ - __pyx_t_20 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_20 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 147, __pyx_L5_error) - - /* "DracoPy.pyx":139 - * for dim in range(num_dims): - * quant_origin[dim] = quantization_origin[dim] - * encoded_mesh = DracoPy.encode_mesh(points, # <<<<<<<<<<<<<< - * faces, - * metadatas, - */ - try { - __pyx_t_21 = DracoFunctions::encode_mesh(__pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_12, __pyx_v_quant_origin, __pyx_t_20); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 139, __pyx_L5_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--; } + } + CYTHON_FALLTHROUGH; + case 6: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_metadatas); + if (value) { values[6] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 7: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geometry_metadata); + if (value) { values[7] = value; kw_args--; } + } } - __pyx_v_encoded_mesh = __pyx_t_21; - - /* "DracoPy.pyx":148 - * quant_origin, - * create_metadata) - * if quant_origin != NULL: # <<<<<<<<<<<<<< - * PyMem_Free(quant_origin) - * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: - */ - __pyx_t_2 = ((__pyx_v_quant_origin != NULL) != 0); - if (__pyx_t_2) { - - /* "DracoPy.pyx":149 - * 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":148 - * quant_origin, - * create_metadata) - * if quant_origin != NULL: # <<<<<<<<<<<<<< - * PyMem_Free(quant_origin) - * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: - */ + 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, 103, __pyx_L3_error) } - - /* "DracoPy.pyx":150 - * 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":151 - * 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_3 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_encoded_mesh.buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 151, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 151, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L9_try_return; - - /* "DracoPy.pyx":150 - * 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":153 - * 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_3, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 153, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - } - } - __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s_Invalid_mesh) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_Invalid_mesh); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 153, __pyx_L5_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 153, __pyx_L5_error) - - /* "DracoPy.pyx":152 - * 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: - */ + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + CYTHON_FALLTHROUGH; + 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); break; - default: break; + default: goto __pyx_L5_argtuple_error; } - - /* "DracoPy.pyx":133 - * geometry_metadata = create_empty_geometry_metadata() - * cdef float* quant_origin = NULL - * try: # <<<<<<<<<<<<<< - * num_dims = 3 - * if quantization_origin is not None: - */ } - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - goto __pyx_L10_try_end; - __pyx_L5_error:; - __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; + __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_metadatas = values[6]; + __pyx_v_geometry_metadata = values[7]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("encode_point_cloud_to_buffer", 0, 1, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 103, __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_4encode_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_v_metadatas, __pyx_v_geometry_metadata); - /* "DracoPy.pyx":154 - * elif encoded_mesh.encode_status == DracoPy.encoding_status.failed_during_encoding: - * raise EncodingFailedException('Invalid mesh') - * except EncodingFailedException: # <<<<<<<<<<<<<< - * raise EncodingFailedException('Invalid mesh') - * except: + /* "DracoPy.pyx":103 + * + * + * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< + * quantization_bits=14, + * compression_level=1, */ - __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 154, __pyx_L7_except_error) - __Pyx_GOTREF(__pyx_t_22); - __pyx_t_19 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_4, __pyx_t_22); - __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; - __Pyx_ErrRestore(__pyx_t_4, __pyx_t_3, __pyx_t_5); - __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_5 = 0; - if (__pyx_t_19) { - __Pyx_AddTraceback("DracoPy.encode_mesh_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 154, __pyx_L7_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_t_4); - /* "DracoPy.pyx":155 - * raise EncodingFailedException('Invalid mesh') - * except EncodingFailedException: - * raise EncodingFailedException('Invalid mesh') # <<<<<<<<<<<<<< - * except: - * if quant_origin != NULL: - */ - __Pyx_GetModuleGlobalName(__pyx_t_23, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 155, __pyx_L7_except_error) - __Pyx_GOTREF(__pyx_t_23); - __pyx_t_24 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_23))) { - __pyx_t_24 = PyMethod_GET_SELF(__pyx_t_23); - if (likely(__pyx_t_24)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_23); - __Pyx_INCREF(__pyx_t_24); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_23, function); - } - } - __pyx_t_22 = (__pyx_t_24) ? __Pyx_PyObject_Call2Args(__pyx_t_23, __pyx_t_24, __pyx_kp_s_Invalid_mesh) : __Pyx_PyObject_CallOneArg(__pyx_t_23, __pyx_kp_s_Invalid_mesh); - __Pyx_XDECREF(__pyx_t_24); __pyx_t_24 = 0; - if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 155, __pyx_L7_except_error) - __Pyx_GOTREF(__pyx_t_22); - __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - __Pyx_Raise(__pyx_t_22, 0, 0, 0); - __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; - __PYX_ERR(0, 155, __pyx_L7_except_error) - } + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "DracoPy.pyx":156 - * except EncodingFailedException: - * raise EncodingFailedException('Invalid mesh') - * except: # <<<<<<<<<<<<<< - * if quant_origin != NULL: - * PyMem_Free(quant_origin) - */ - /*except:*/ { - __Pyx_AddTraceback("DracoPy.encode_mesh_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5) < 0) __PYX_ERR(0, 156, __pyx_L7_except_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_t_5); +static PyObject *__pyx_pf_7DracoPy_4encode_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, PyObject *__pyx_v_metadatas, PyObject *__pyx_v_geometry_metadata) { + 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; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("encode_point_cloud_to_buffer", 0); - /* "DracoPy.pyx":157 - * raise EncodingFailedException('Invalid mesh') - * except: - * if quant_origin != NULL: # <<<<<<<<<<<<<< - * PyMem_Free(quant_origin) - * raise ValueError("Input invalid") + /* "DracoPy.pyx":112 + * geometry_metadata = None, + * ): + * return encode_to_buffer(points, None, quantization_bits, compression_level, # <<<<<<<<<<<<<< + * quantization_range, quantization_origin, + * create_metadata, metadatas, geometry_metadata) */ - __pyx_t_2 = ((__pyx_v_quant_origin != NULL) != 0); - if (__pyx_t_2) { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode_to_buffer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); - /* "DracoPy.pyx":158 - * except: - * if quant_origin != NULL: - * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< - * raise ValueError("Input invalid") + /* "DracoPy.pyx":114 + * return encode_to_buffer(points, None, quantization_bits, compression_level, + * quantization_range, quantization_origin, + * create_metadata, metadatas, geometry_metadata) # <<<<<<<<<<<<<< * - */ - PyMem_Free(__pyx_v_quant_origin); - - /* "DracoPy.pyx":157 - * raise EncodingFailedException('Invalid mesh') - * except: - * if quant_origin != NULL: # <<<<<<<<<<<<<< - * PyMem_Free(quant_origin) - * raise ValueError("Input invalid") - */ - } - - /* "DracoPy.pyx":159 - * if quant_origin != NULL: - * PyMem_Free(quant_origin) - * raise ValueError("Input invalid") # <<<<<<<<<<<<<< * - * def encode_point_cloud_to_buffer(points, */ - __pyx_t_22 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 159, __pyx_L7_except_error) - __Pyx_GOTREF(__pyx_t_22); - __Pyx_Raise(__pyx_t_22, 0, 0, 0); - __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; - __PYX_ERR(0, 159, __pyx_L7_except_error) + __pyx_t_3 = NULL; + __pyx_t_4 = 0; + 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_4 = 1; } - __pyx_L7_except_error:; - - /* "DracoPy.pyx":133 - * geometry_metadata = create_empty_geometry_metadata() - * cdef float* quant_origin = NULL - * try: # <<<<<<<<<<<<<< - * num_dims = 3 - * if quantization_origin is not None: - */ - __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); - goto __pyx_L1_error; - __pyx_L9_try_return:; - __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_XGIVEREF(__pyx_t_8); - __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); - goto __pyx_L0; - __pyx_L10_try_end:; } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[10] = {__pyx_t_3, __pyx_v_points, Py_None, __pyx_v_quantization_bits, __pyx_v_compression_level, __pyx_v_quantization_range, __pyx_v_quantization_origin, __pyx_v_create_metadata, __pyx_v_metadatas, __pyx_v_geometry_metadata}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 9+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __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[10] = {__pyx_t_3, __pyx_v_points, Py_None, __pyx_v_quantization_bits, __pyx_v_compression_level, __pyx_v_quantization_range, __pyx_v_quantization_origin, __pyx_v_create_metadata, __pyx_v_metadatas, __pyx_v_geometry_metadata}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 9+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + { + __pyx_t_5 = PyTuple_New(9+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 112, __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(__pyx_v_points); + __Pyx_GIVEREF(__pyx_v_points); + PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_v_points); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, Py_None); + __Pyx_INCREF(__pyx_v_quantization_bits); + __Pyx_GIVEREF(__pyx_v_quantization_bits); + PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_quantization_bits); + __Pyx_INCREF(__pyx_v_compression_level); + __Pyx_GIVEREF(__pyx_v_compression_level); + PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_v_compression_level); + __Pyx_INCREF(__pyx_v_quantization_range); + __Pyx_GIVEREF(__pyx_v_quantization_range); + PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_4, __pyx_v_quantization_range); + __Pyx_INCREF(__pyx_v_quantization_origin); + __Pyx_GIVEREF(__pyx_v_quantization_origin); + PyTuple_SET_ITEM(__pyx_t_5, 5+__pyx_t_4, __pyx_v_quantization_origin); + __Pyx_INCREF(__pyx_v_create_metadata); + __Pyx_GIVEREF(__pyx_v_create_metadata); + PyTuple_SET_ITEM(__pyx_t_5, 6+__pyx_t_4, __pyx_v_create_metadata); + __Pyx_INCREF(__pyx_v_metadatas); + __Pyx_GIVEREF(__pyx_v_metadatas); + PyTuple_SET_ITEM(__pyx_t_5, 7+__pyx_t_4, __pyx_v_metadatas); + __Pyx_INCREF(__pyx_v_geometry_metadata); + __Pyx_GIVEREF(__pyx_v_geometry_metadata); + PyTuple_SET_ITEM(__pyx_t_5, 8+__pyx_t_4, __pyx_v_geometry_metadata); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __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_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "DracoPy.pyx":90 + /* "DracoPy.pyx":103 * * - * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< - * quantization_bits=14, - * compression_level=1, + * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< + * quantization_bits=14, + * compression_level=1, */ /* 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_3); - __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_22); - __Pyx_XDECREF(__pyx_t_23); - __Pyx_XDECREF(__pyx_t_24); - __Pyx_AddTraceback("DracoPy.encode_mesh_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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_XDECREF(__pyx_v_metadatas); - __Pyx_XDECREF(__pyx_v_geometry_metadata); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "DracoPy.pyx":161 - * raise ValueError("Input invalid") +/* "DracoPy.pyx":117 * - * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< - * quantization_bits=14, - * compression_level=1, + * + * def encode_to_buffer(points: List[float], # <<<<<<<<<<<<<< + * faces: List[int] = None, + * quantization_bits=14, */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7DracoPy_4encode_point_cloud_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 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 :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 exists in 'metadatas' fields\n :return bytes: encoded mesh\n "; -static PyMethodDef __pyx_mdef_7DracoPy_5encode_point_cloud_to_buffer = {"encode_point_cloud_to_buffer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7DracoPy_4encode_point_cloud_to_buffer}; -static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7DracoPy_7encode_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7DracoPy_6encode_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 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 :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 exists in 'metadatas' fields\n :return bytes: en""coded mesh\n "; +static PyMethodDef __pyx_mdef_7DracoPy_7encode_to_buffer = {"encode_to_buffer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_7encode_to_buffer, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7DracoPy_6encode_to_buffer}; +static PyObject *__pyx_pw_7DracoPy_7encode_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; @@ -4773,53 +4585,64 @@ static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("encode_point_cloud_to_buffer (wrapper)", 0); + __Pyx_RefNannySetupContext("encode_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,&__pyx_n_s_metadatas,&__pyx_n_s_geometry_metadata,0}; - PyObject* values[8] = {0,0,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); + 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,&__pyx_n_s_metadatas,&__pyx_n_s_geometry_metadata,0}; + PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; - /* "DracoPy.pyx":165 - * compression_level=1, - * quantization_range=-1, - * quantization_origin=None, # <<<<<<<<<<<<<< - * create_metadata=False, - * metadatas = None, + /* "DracoPy.pyx":118 + * + * def encode_to_buffer(points: List[float], + * faces: List[int] = None, # <<<<<<<<<<<<<< + * quantization_bits=14, + * compression_level=1, */ - values[4] = ((PyObject *)Py_None); + values[1] = ((PyObject *)Py_None); + values[2] = ((PyObject *)__pyx_int_14); + values[3] = ((PyObject *)__pyx_int_1); + values[4] = ((PyObject *)__pyx_int_neg_1); - /* "DracoPy.pyx":166 - * quantization_range=-1, - * quantization_origin=None, - * create_metadata=False, # <<<<<<<<<<<<<< - * metadatas = None, - * geometry_metadata = None, + /* "DracoPy.pyx":122 + * compression_level=1, + * quantization_range=-1, + * quantization_origin=None, # <<<<<<<<<<<<<< + * create_metadata=False, + * metadatas = None, */ - values[5] = ((PyObject *)Py_False); + values[5] = ((PyObject *)Py_None); - /* "DracoPy.pyx":167 - * quantization_origin=None, - * create_metadata=False, - * metadatas = None, # <<<<<<<<<<<<<< - * geometry_metadata = None, - * ): + /* "DracoPy.pyx":123 + * quantization_range=-1, + * quantization_origin=None, + * create_metadata=False, # <<<<<<<<<<<<<< + * metadatas = None, + * geometry_metadata = None, */ - values[6] = ((PyObject *)Py_None); + values[6] = ((PyObject *)Py_False); - /* "DracoPy.pyx":168 - * create_metadata=False, - * metadatas = None, - * geometry_metadata = None, # <<<<<<<<<<<<<< - * ): - * """ + /* "DracoPy.pyx":124 + * quantization_origin=None, + * create_metadata=False, + * metadatas = None, # <<<<<<<<<<<<<< + * geometry_metadata = None, + * ): */ values[7] = ((PyObject *)Py_None); + + /* "DracoPy.pyx":125 + * create_metadata=False, + * metadatas = None, + * geometry_metadata = None, # <<<<<<<<<<<<<< + * ): + * """ + */ + values[8] = ((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 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + CYTHON_FALLTHROUGH; case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); CYTHON_FALLTHROUGH; case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); @@ -4847,51 +4670,59 @@ static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx CYTHON_FALLTHROUGH; case 1: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_bits); + 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_compression_level); + 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_quantization_range); + 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_origin); + 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_create_metadata); + 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_metadatas); + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_create_metadata); if (value) { values[6] = value; kw_args--; } } CYTHON_FALLTHROUGH; case 7: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geometry_metadata); + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_metadatas); if (value) { values[7] = value; kw_args--; } } + CYTHON_FALLTHROUGH; + case 8: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geometry_metadata); + if (value) { values[8] = 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, 161, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode_to_buffer") < 0)) __PYX_ERR(0, 117, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { + case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + CYTHON_FALLTHROUGH; case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); CYTHON_FALLTHROUGH; case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); @@ -4910,32 +4741,33 @@ static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx 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]; - __pyx_v_metadatas = values[6]; - __pyx_v_geometry_metadata = values[7]; + } + __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_metadatas = values[7]; + __pyx_v_geometry_metadata = values[8]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("encode_point_cloud_to_buffer", 0, 1, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 161, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode_to_buffer", 0, 1, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 117, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("DracoPy.encode_point_cloud_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("DracoPy.encode_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7DracoPy_4encode_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_v_metadatas, __pyx_v_geometry_metadata); + __pyx_r = __pyx_pf_7DracoPy_6encode_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_v_metadatas, __pyx_v_geometry_metadata); - /* "DracoPy.pyx":161 - * raise ValueError("Input invalid") + /* "DracoPy.pyx":117 * - * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< - * quantization_bits=14, - * compression_level=1, + * + * def encode_to_buffer(points: List[float], # <<<<<<<<<<<<<< + * faces: List[int] = None, + * quantization_bits=14, */ /* function exit code */ @@ -4943,46 +4775,116 @@ static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_4encode_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, PyObject *__pyx_v_metadatas, PyObject *__pyx_v_geometry_metadata) { +static PyObject *__pyx_pf_7DracoPy_6encode_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, PyObject *__pyx_v_metadatas, PyObject *__pyx_v_geometry_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; + struct DracoFunctions::EncodedObject __pyx_v_draco_encoded; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; + int __pyx_t_3; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - Py_ssize_t __pyx_t_6; + 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; - size_t __pyx_t_10; - PyObject *(*__pyx_t_11)(PyObject *); - float __pyx_t_12; - Py_ssize_t __pyx_t_13; - std::vector __pyx_t_14; - std::vector __pyx_t_15; - struct DracoFunctions::GeometryMetadataObject __pyx_t_16; - int __pyx_t_17; - int __pyx_t_18; - bool __pyx_t_19; - struct DracoFunctions::EncodedObject __pyx_t_20; - PyObject *__pyx_t_21 = NULL; - PyObject *__pyx_t_22 = NULL; + PyObject *__pyx_t_10 = NULL; + size_t __pyx_t_11; + PyObject *(*__pyx_t_12)(PyObject *); + float __pyx_t_13; + Py_ssize_t __pyx_t_14; + std::vector __pyx_t_15; + std::vector __pyx_t_16; + std::vector __pyx_t_17; + struct DracoFunctions::GeometryMetadataObject __pyx_t_18; + int __pyx_t_19; + int __pyx_t_20; + bool __pyx_t_21; + struct DracoFunctions::EncodedObject __pyx_t_22; PyObject *__pyx_t_23 = NULL; + PyObject *__pyx_t_24 = NULL; + PyObject *__pyx_t_25 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("encode_point_cloud_to_buffer", 0); + __Pyx_RefNannySetupContext("encode_to_buffer", 0); __Pyx_INCREF(__pyx_v_metadatas); __Pyx_INCREF(__pyx_v_geometry_metadata); - /* "DracoPy.pyx":199 + /* "DracoPy.pyx":159 + * :return bytes: encoded mesh + * """ + * if faces is None and isinstance(geometry_metadata, dict) and \ # <<<<<<<<<<<<<< + * len(geometry_metadata["generic_attributes"]) > 0: + * raise RuntimeError("generic attributes encoding/decoding " + */ + __pyx_t_2 = (__pyx_v_faces == Py_None); + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = PyDict_Check(__pyx_v_geometry_metadata); + __pyx_t_2 = (__pyx_t_3 != 0); + if (__pyx_t_2) { + } else { + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; + } + + /* "DracoPy.pyx":160 + * """ + * if faces is None 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_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_geometry_metadata, __pyx_n_s_generic_attributes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 160, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 160, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_2 = ((__pyx_t_5 > 0) != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + + /* "DracoPy.pyx":159 + * :return bytes: encoded mesh + * """ + * if faces is None and isinstance(geometry_metadata, dict) and \ # <<<<<<<<<<<<<< + * len(geometry_metadata["generic_attributes"]) > 0: + * raise RuntimeError("generic attributes encoding/decoding " + */ + if (unlikely(__pyx_t_1)) { + + /* "DracoPy.pyx":161 + * if faces is None 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_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 161, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(0, 161, __pyx_L1_error) + + /* "DracoPy.pyx":159 * :return bytes: encoded mesh * """ + * if faces is None and isinstance(geometry_metadata, dict) and \ # <<<<<<<<<<<<<< + * len(geometry_metadata["generic_attributes"]) > 0: + * raise RuntimeError("generic attributes encoding/decoding " + */ + } + + /* "DracoPy.pyx":163 + * raise RuntimeError("generic attributes encoding/decoding " + * "is not supported for point cloud") * if metadatas is None: # <<<<<<<<<<<<<< * metadatas = [] * if geometry_metadata is None: @@ -4991,121 +4893,85 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "DracoPy.pyx":200 - * """ + /* "DracoPy.pyx":164 + * "is not supported for point cloud") * if metadatas is None: * metadatas = [] # <<<<<<<<<<<<<< * if geometry_metadata is None: * geometry_metadata = create_empty_geometry_metadata() */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 200, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF_SET(__pyx_v_metadatas, __pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 164, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF_SET(__pyx_v_metadatas, __pyx_t_4); + __pyx_t_4 = 0; - /* "DracoPy.pyx":199 - * :return bytes: encoded mesh - * """ + /* "DracoPy.pyx":163 + * raise RuntimeError("generic attributes encoding/decoding " + * "is not supported for point cloud") * if metadatas is None: # <<<<<<<<<<<<<< * metadatas = [] * if geometry_metadata is None: */ } - /* "DracoPy.pyx":201 + /* "DracoPy.pyx":165 * if metadatas is None: * metadatas = [] * if geometry_metadata is None: # <<<<<<<<<<<<<< * geometry_metadata = create_empty_geometry_metadata() - * if len(geometry_metadata["generic_attributes"]) > 0: + * cdef float* quant_origin = NULL */ __pyx_t_2 = (__pyx_v_geometry_metadata == Py_None); __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "DracoPy.pyx":202 + /* "DracoPy.pyx":166 * metadatas = [] * if geometry_metadata is None: * geometry_metadata = create_empty_geometry_metadata() # <<<<<<<<<<<<<< - * if len(geometry_metadata["generic_attributes"]) > 0: - * raise RuntimeError("generic attributes encoding/decoding is not supported") + * cdef float* quant_origin = NULL + * try: */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_create_empty_geometry_metadata); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 202, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_create_empty_geometry_metadata); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 166, __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_4, function); + __Pyx_DECREF_SET(__pyx_t_6, function); } } - __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 202, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF_SET(__pyx_v_geometry_metadata, __pyx_t_3); - __pyx_t_3 = 0; + __pyx_t_4 = (__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_4)) __PYX_ERR(0, 166, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF_SET(__pyx_v_geometry_metadata, __pyx_t_4); + __pyx_t_4 = 0; - /* "DracoPy.pyx":201 + /* "DracoPy.pyx":165 * if metadatas is None: * metadatas = [] * if geometry_metadata is None: # <<<<<<<<<<<<<< * geometry_metadata = create_empty_geometry_metadata() - * if len(geometry_metadata["generic_attributes"]) > 0: - */ - } - - /* "DracoPy.pyx":203 - * if geometry_metadata is None: - * geometry_metadata = create_empty_geometry_metadata() - * if len(geometry_metadata["generic_attributes"]) > 0: # <<<<<<<<<<<<<< - * raise RuntimeError("generic attributes encoding/decoding is not supported") - * cdef float* quant_origin = NULL - */ - __pyx_t_3 = __Pyx_PyObject_Dict_GetItem(__pyx_v_geometry_metadata, __pyx_n_s_generic_attributes); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 203, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_6 == ((Py_ssize_t)-1))) __PYX_ERR(0, 203, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_1 = ((__pyx_t_6 > 0) != 0); - if (unlikely(__pyx_t_1)) { - - /* "DracoPy.pyx":204 - * geometry_metadata = create_empty_geometry_metadata() - * if len(geometry_metadata["generic_attributes"]) > 0: - * raise RuntimeError("generic attributes encoding/decoding is not supported") # <<<<<<<<<<<<<< * cdef float* quant_origin = NULL - * try: */ - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_Raise(__pyx_t_3, 0, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __PYX_ERR(0, 204, __pyx_L1_error) + } - /* "DracoPy.pyx":203 + /* "DracoPy.pyx":167 * if geometry_metadata is None: * geometry_metadata = create_empty_geometry_metadata() - * if len(geometry_metadata["generic_attributes"]) > 0: # <<<<<<<<<<<<<< - * raise RuntimeError("generic attributes encoding/decoding is not supported") - * cdef float* quant_origin = NULL - */ - } - - /* "DracoPy.pyx":205 - * if len(geometry_metadata["generic_attributes"]) > 0: - * raise RuntimeError("generic attributes encoding/decoding is not supported") * cdef float* quant_origin = NULL # <<<<<<<<<<<<<< * try: * num_dims = 3 */ __pyx_v_quant_origin = NULL; - /* "DracoPy.pyx":206 - * raise RuntimeError("generic attributes encoding/decoding is not supported") + /* "DracoPy.pyx":168 + * geometry_metadata = create_empty_geometry_metadata() * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< * num_dims = 3 @@ -5114,13 +4980,13 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P { __Pyx_PyThreadState_declare __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_8, &__pyx_t_9); - __Pyx_XGOTREF(__pyx_t_7); + __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":207 + /* "DracoPy.pyx":169 * cdef float* quant_origin = NULL * try: * num_dims = 3 # <<<<<<<<<<<<<< @@ -5130,7 +4996,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_INCREF(__pyx_int_3); __pyx_v_num_dims = __pyx_int_3; - /* "DracoPy.pyx":208 + /* "DracoPy.pyx":170 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -5141,99 +5007,99 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "DracoPy.pyx":209 + /* "DracoPy.pyx":171 * 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_3 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 209, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 209, __pyx_L6_error) + __pyx_t_4 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 171, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_10 = __Pyx_PyInt_As_size_t(__pyx_t_4); if (unlikely((__pyx_t_10 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 209, __pyx_L6_error) + __pyx_t_6 = PyNumber_Multiply(__pyx_t_4, __pyx_v_num_dims); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 171, __pyx_L9_error) + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_quant_origin = ((float *)PyMem_Malloc(__pyx_t_10)); + __pyx_t_11 = __Pyx_PyInt_As_size_t(__pyx_t_6); if (unlikely((__pyx_t_11 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 171, __pyx_L9_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_v_quant_origin = ((float *)PyMem_Malloc(__pyx_t_11)); - /* "DracoPy.pyx":210 + /* "DracoPy.pyx":172 * 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( + * if isinstance(faces, list): */ - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 210, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_4); - if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) { - __pyx_t_3 = __pyx_t_4; __Pyx_INCREF(__pyx_t_3); __pyx_t_6 = 0; - __pyx_t_11 = NULL; + __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 172, __pyx_L9_error) + __Pyx_GOTREF(__pyx_t_6); + if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) { + __pyx_t_4 = __pyx_t_6; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; + __pyx_t_12 = NULL; } else { - __pyx_t_6 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 210, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 210, __pyx_L6_error) + __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 172, __pyx_L9_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_12 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 172, __pyx_L9_error) } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; for (;;) { - if (likely(!__pyx_t_11)) { - if (likely(PyList_CheckExact(__pyx_t_3))) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_3)) break; + if (likely(!__pyx_t_12)) { + if (likely(PyList_CheckExact(__pyx_t_4))) { + if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 210, __pyx_L6_error) + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_6); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 172, __pyx_L9_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 210, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 172, __pyx_L9_error) + __Pyx_GOTREF(__pyx_t_6); #endif } else { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_6); __Pyx_INCREF(__pyx_t_4); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 210, __pyx_L6_error) + __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_6); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 172, __pyx_L9_error) #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 210, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 172, __pyx_L9_error) + __Pyx_GOTREF(__pyx_t_6); #endif } } else { - __pyx_t_4 = __pyx_t_11(__pyx_t_3); - if (unlikely(!__pyx_t_4)) { + __pyx_t_6 = __pyx_t_12(__pyx_t_4); + if (unlikely(!__pyx_t_6)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 210, __pyx_L6_error) + else __PYX_ERR(0, 172, __pyx_L9_error) } break; } - __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_6); } - __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_4); - __pyx_t_4 = 0; + __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_6); + __pyx_t_6 = 0; - /* "DracoPy.pyx":211 + /* "DracoPy.pyx":173 * 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, metadatas, geometry_metadata, + * if isinstance(faces, list): + * draco_encoded = DracoPy.encode_mesh(points, */ - __pyx_t_4 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 211, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_t_4); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 211, __pyx_L6_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 211, __pyx_L6_error) - (__pyx_v_quant_origin[__pyx_t_13]) = __pyx_t_12; + __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 173, __pyx_L9_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_13 = __pyx_PyFloat_AsFloat(__pyx_t_6); if (unlikely((__pyx_t_13 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 173, __pyx_L9_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 173, __pyx_L9_error) + (__pyx_v_quant_origin[__pyx_t_14]) = __pyx_t_13; - /* "DracoPy.pyx":210 + /* "DracoPy.pyx":172 * 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( + * if isinstance(faces, list): */ } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "DracoPy.pyx":208 + /* "DracoPy.pyx":170 * try: * num_dims = 3 * if quantization_origin is not None: # <<<<<<<<<<<<<< @@ -5242,248 +5108,391 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P */ } - /* "DracoPy.pyx":213 + /* "DracoPy.pyx":174 + * for dim in range(num_dims): * quant_origin[dim] = quantization_origin[dim] - * encoded_point_cloud = DracoPy.encode_point_cloud( - * points, metadatas, geometry_metadata, # <<<<<<<<<<<<<< - * quantization_bits, compression_level, - * quantization_range, quant_origin, create_metadata, - */ - __pyx_t_14 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 213, __pyx_L6_error) - __pyx_t_15 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_metadatas); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 213, __pyx_L6_error) - __pyx_t_16 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_geometry_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 213, __pyx_L6_error) - - /* "DracoPy.pyx":214 - * encoded_point_cloud = DracoPy.encode_point_cloud( - * points, metadatas, geometry_metadata, - * quantization_bits, compression_level, # <<<<<<<<<<<<<< - * quantization_range, quant_origin, create_metadata, - * ) - */ - __pyx_t_17 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_17 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 214, __pyx_L6_error) - __pyx_t_18 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_18 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 214, __pyx_L6_error) - - /* "DracoPy.pyx":215 - * points, metadatas, geometry_metadata, - * quantization_bits, compression_level, - * quantization_range, quant_origin, create_metadata, # <<<<<<<<<<<<<< - * ) - * if quant_origin != NULL: + * if isinstance(faces, list): # <<<<<<<<<<<<<< + * draco_encoded = DracoPy.encode_mesh(points, + * faces, + */ + __pyx_t_2 = PyList_Check(__pyx_v_faces); + __pyx_t_1 = (__pyx_t_2 != 0); + if (__pyx_t_1) { + + /* "DracoPy.pyx":175 + * quant_origin[dim] = quantization_origin[dim] + * if isinstance(faces, list): + * draco_encoded = DracoPy.encode_mesh(points, # <<<<<<<<<<<<<< + * faces, + * metadatas, + */ + __pyx_t_15 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 175, __pyx_L9_error) + + /* "DracoPy.pyx":176 + * if isinstance(faces, list): + * draco_encoded = DracoPy.encode_mesh(points, + * faces, # <<<<<<<<<<<<<< + * metadatas, + * geometry_metadata, + */ + __pyx_t_16 = __pyx_convert_vector_from_py_uint32_t(__pyx_v_faces); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 176, __pyx_L9_error) + + /* "DracoPy.pyx":177 + * draco_encoded = DracoPy.encode_mesh(points, + * faces, + * metadatas, # <<<<<<<<<<<<<< + * geometry_metadata, + * quantization_bits, + */ + __pyx_t_17 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_metadatas); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 177, __pyx_L9_error) + + /* "DracoPy.pyx":178 + * faces, + * metadatas, + * geometry_metadata, # <<<<<<<<<<<<<< + * quantization_bits, + * compression_level, + */ + __pyx_t_18 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_geometry_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 178, __pyx_L9_error) + + /* "DracoPy.pyx":179 + * metadatas, + * geometry_metadata, + * quantization_bits, # <<<<<<<<<<<<<< + * compression_level, + * quantization_range, + */ + __pyx_t_19 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_19 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 179, __pyx_L9_error) + + /* "DracoPy.pyx":180 + * geometry_metadata, + * quantization_bits, + * compression_level, # <<<<<<<<<<<<<< + * quantization_range, + * quant_origin, + */ + __pyx_t_20 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L9_error) + + /* "DracoPy.pyx":181 + * quantization_bits, + * compression_level, + * quantization_range, # <<<<<<<<<<<<<< + * quant_origin, + * create_metadata) + */ + __pyx_t_13 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_13 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 181, __pyx_L9_error) + + /* "DracoPy.pyx":183 + * quantization_range, + * quant_origin, + * create_metadata) # <<<<<<<<<<<<<< + * else: + * draco_encoded = DracoPy.encode_point_cloud(points, */ - __pyx_t_12 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_12 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L6_error) - __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_19 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 215, __pyx_L6_error) + __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_21 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L9_error) + + /* "DracoPy.pyx":175 + * quant_origin[dim] = quantization_origin[dim] + * if isinstance(faces, list): + * draco_encoded = DracoPy.encode_mesh(points, # <<<<<<<<<<<<<< + * faces, + * metadatas, + */ + try { + __pyx_t_22 = DracoFunctions::encode_mesh(__pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_13, __pyx_v_quant_origin, __pyx_t_21); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 175, __pyx_L9_error) + } + __pyx_v_draco_encoded = __pyx_t_22; - /* "DracoPy.pyx":212 + /* "DracoPy.pyx":174 * for dim in range(num_dims): * quant_origin[dim] = quantization_origin[dim] - * encoded_point_cloud = DracoPy.encode_point_cloud( # <<<<<<<<<<<<<< - * points, metadatas, geometry_metadata, - * quantization_bits, compression_level, - */ - try { - __pyx_t_20 = DracoFunctions::encode_point_cloud(__pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_12, __pyx_v_quant_origin, __pyx_t_19); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 212, __pyx_L6_error) + * if isinstance(faces, list): # <<<<<<<<<<<<<< + * draco_encoded = DracoPy.encode_mesh(points, + * faces, + */ + goto __pyx_L18; + } + + /* "DracoPy.pyx":185 + * create_metadata) + * else: + * draco_encoded = DracoPy.encode_point_cloud(points, # <<<<<<<<<<<<<< + * metadatas, + * geometry_metadata, + */ + /*else*/ { + __pyx_t_15 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L9_error) + + /* "DracoPy.pyx":186 + * else: + * draco_encoded = DracoPy.encode_point_cloud(points, + * metadatas, # <<<<<<<<<<<<<< + * geometry_metadata, + * quantization_bits, + */ + __pyx_t_17 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_metadatas); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 186, __pyx_L9_error) + + /* "DracoPy.pyx":187 + * draco_encoded = DracoPy.encode_point_cloud(points, + * metadatas, + * geometry_metadata, # <<<<<<<<<<<<<< + * quantization_bits, + * compression_level, + */ + __pyx_t_18 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_geometry_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 187, __pyx_L9_error) + + /* "DracoPy.pyx":188 + * metadatas, + * geometry_metadata, + * quantization_bits, # <<<<<<<<<<<<<< + * compression_level, + * quantization_range, + */ + __pyx_t_20 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 188, __pyx_L9_error) + + /* "DracoPy.pyx":189 + * geometry_metadata, + * quantization_bits, + * compression_level, # <<<<<<<<<<<<<< + * quantization_range, + * quant_origin, + */ + __pyx_t_19 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_19 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 189, __pyx_L9_error) + + /* "DracoPy.pyx":190 + * quantization_bits, + * compression_level, + * quantization_range, # <<<<<<<<<<<<<< + * quant_origin, + * create_metadata) + */ + __pyx_t_13 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_13 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 190, __pyx_L9_error) + + /* "DracoPy.pyx":192 + * quantization_range, + * quant_origin, + * create_metadata) # <<<<<<<<<<<<<< + * if quant_origin != NULL: + * PyMem_Free(quant_origin) + */ + __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_21 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 192, __pyx_L9_error) + + /* "DracoPy.pyx":185 + * create_metadata) + * else: + * draco_encoded = DracoPy.encode_point_cloud(points, # <<<<<<<<<<<<<< + * metadatas, + * geometry_metadata, + */ + try { + __pyx_t_22 = DracoFunctions::encode_point_cloud(__pyx_t_15, __pyx_t_17, __pyx_t_18, __pyx_t_20, __pyx_t_19, __pyx_t_13, __pyx_v_quant_origin, __pyx_t_21); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 185, __pyx_L9_error) + } + __pyx_v_draco_encoded = __pyx_t_22; } - __pyx_v_encoded_point_cloud = __pyx_t_20; + __pyx_L18:; - /* "DracoPy.pyx":217 - * quantization_range, quant_origin, create_metadata, - * ) + /* "DracoPy.pyx":193 + * quant_origin, + * create_metadata) * if quant_origin != NULL: # <<<<<<<<<<<<<< * PyMem_Free(quant_origin) - * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: + * if draco_encoded.encode_status == DracoPy.encoding_status.successful_encoding: */ - __pyx_t_2 = ((__pyx_v_quant_origin != NULL) != 0); - if (__pyx_t_2) { + __pyx_t_1 = ((__pyx_v_quant_origin != NULL) != 0); + if (__pyx_t_1) { - /* "DracoPy.pyx":218 - * ) + /* "DracoPy.pyx":194 + * 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) + * if draco_encoded.encode_status == DracoPy.encoding_status.successful_encoding: + * return bytes(draco_encoded.buffer) */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":217 - * quantization_range, quant_origin, create_metadata, - * ) + /* "DracoPy.pyx":193 + * quant_origin, + * create_metadata) * if quant_origin != NULL: # <<<<<<<<<<<<<< * PyMem_Free(quant_origin) - * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: + * if draco_encoded.encode_status == DracoPy.encoding_status.successful_encoding: */ } - /* "DracoPy.pyx":219 + /* "DracoPy.pyx":195 * 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: + * 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_encoded_point_cloud.encode_status) { + switch (__pyx_v_draco_encoded.encode_status) { case DracoFunctions::successful_encoding: - /* "DracoPy.pyx":220 + /* "DracoPy.pyx":196 * 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') */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_encoded_point_cloud.buffer); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 220, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 220, __pyx_L6_error) + __pyx_t_4 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_draco_encoded.buffer); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 196, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L10_try_return; + __pyx_t_6 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 196, __pyx_L9_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L13_try_return; - /* "DracoPy.pyx":219 + /* "DracoPy.pyx":195 * 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: + * 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: - /* "DracoPy.pyx":222 - * 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":198 + * 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') - */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 222, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); + * raise EncodingFailedException('Invalid draco structure') + */ + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 198, __pyx_L9_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); + __Pyx_DECREF_SET(__pyx_t_4, function); } } - __pyx_t_4 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_3, __pyx_t_5, __pyx_kp_s_Invalid_point_cloud) : __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_kp_s_Invalid_point_cloud); - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 222, __pyx_L6_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_7, __pyx_kp_s_Invalid_draco_structure) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_Invalid_draco_structure); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 198, __pyx_L9_error) + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 222, __pyx_L6_error) - - /* "DracoPy.pyx":221 - * 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') + __Pyx_Raise(__pyx_t_6, 0, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(0, 198, __pyx_L9_error) + + /* "DracoPy.pyx":197 + * 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; } - /* "DracoPy.pyx":206 - * raise RuntimeError("generic attributes encoding/decoding is not supported") + /* "DracoPy.pyx":168 + * geometry_metadata = create_empty_geometry_metadata() * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< * num_dims = 3 * if quantization_origin is not None: */ } - __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; - goto __pyx_L11_try_end; - __pyx_L6_error:; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L14_try_end; + __pyx_L9_error:; __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "DracoPy.pyx":223 - * elif encoded_point_cloud.encode_status == DracoPy.encoding_status.failed_during_encoding: - * raise EncodingFailedException('Invalid point cloud') + /* "DracoPy.pyx":199 + * 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: */ - __Pyx_ErrFetch(&__pyx_t_4, &__pyx_t_3, &__pyx_t_5); - __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 223, __pyx_L8_except_error) - __Pyx_GOTREF(__pyx_t_21); - __pyx_t_18 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_4, __pyx_t_21); - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - __Pyx_ErrRestore(__pyx_t_4, __pyx_t_3, __pyx_t_5); - __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_5 = 0; - if (__pyx_t_18) { - __Pyx_AddTraceback("DracoPy.encode_point_cloud_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_4) < 0) __PYX_ERR(0, 223, __pyx_L8_except_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_GOTREF(__pyx_t_3); + __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_4, &__pyx_t_7); + __Pyx_GetModuleGlobalName(__pyx_t_23, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 199, __pyx_L11_except_error) + __Pyx_GOTREF(__pyx_t_23); + __pyx_t_19 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_6, __pyx_t_23); + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + __Pyx_ErrRestore(__pyx_t_6, __pyx_t_4, __pyx_t_7); + __pyx_t_6 = 0; __pyx_t_4 = 0; __pyx_t_7 = 0; + if (__pyx_t_19) { + __Pyx_AddTraceback("DracoPy.encode_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_4, &__pyx_t_6) < 0) __PYX_ERR(0, 199, __pyx_L11_except_error) + __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_t_6); - /* "DracoPy.pyx":224 - * raise EncodingFailedException('Invalid point cloud') + /* "DracoPy.pyx":200 + * raise EncodingFailedException('Invalid draco structure') * except EncodingFailedException: - * raise EncodingFailedException('Invalid point cloud') # <<<<<<<<<<<<<< + * raise EncodingFailedException('Invalid draco structure') # <<<<<<<<<<<<<< * except: * if quant_origin != NULL: */ - __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_22)) __PYX_ERR(0, 224, __pyx_L8_except_error) - __Pyx_GOTREF(__pyx_t_22); - __pyx_t_23 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_22))) { - __pyx_t_23 = PyMethod_GET_SELF(__pyx_t_22); - if (likely(__pyx_t_23)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_22); - __Pyx_INCREF(__pyx_t_23); + __Pyx_GetModuleGlobalName(__pyx_t_24, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 200, __pyx_L11_except_error) + __Pyx_GOTREF(__pyx_t_24); + __pyx_t_25 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_24))) { + __pyx_t_25 = PyMethod_GET_SELF(__pyx_t_24); + if (likely(__pyx_t_25)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_24); + __Pyx_INCREF(__pyx_t_25); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_22, function); + __Pyx_DECREF_SET(__pyx_t_24, function); } } - __pyx_t_21 = (__pyx_t_23) ? __Pyx_PyObject_Call2Args(__pyx_t_22, __pyx_t_23, __pyx_kp_s_Invalid_point_cloud) : __Pyx_PyObject_CallOneArg(__pyx_t_22, __pyx_kp_s_Invalid_point_cloud); - __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0; - if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 224, __pyx_L8_except_error) - __Pyx_GOTREF(__pyx_t_21); - __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; - __Pyx_Raise(__pyx_t_21, 0, 0, 0); - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - __PYX_ERR(0, 224, __pyx_L8_except_error) + __pyx_t_23 = (__pyx_t_25) ? __Pyx_PyObject_Call2Args(__pyx_t_24, __pyx_t_25, __pyx_kp_s_Invalid_draco_structure) : __Pyx_PyObject_CallOneArg(__pyx_t_24, __pyx_kp_s_Invalid_draco_structure); + __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0; + if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 200, __pyx_L11_except_error) + __Pyx_GOTREF(__pyx_t_23); + __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; + __Pyx_Raise(__pyx_t_23, 0, 0, 0); + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + __PYX_ERR(0, 200, __pyx_L11_except_error) } - /* "DracoPy.pyx":225 + /* "DracoPy.pyx":201 * except EncodingFailedException: - * raise EncodingFailedException('Invalid point cloud') + * raise EncodingFailedException('Invalid draco structure') * 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_4, &__pyx_t_3, &__pyx_t_5) < 0) __PYX_ERR(0, 225, __pyx_L8_except_error) + __Pyx_AddTraceback("DracoPy.encode_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_4, &__pyx_t_7) < 0) __PYX_ERR(0, 201, __pyx_L11_except_error) + __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_4); - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_t_5); + __Pyx_GOTREF(__pyx_t_7); - /* "DracoPy.pyx":226 - * raise EncodingFailedException('Invalid point cloud') + /* "DracoPy.pyx":202 + * raise EncodingFailedException('Invalid draco structure') * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< * PyMem_Free(quant_origin) * raise ValueError("Input invalid") */ - __pyx_t_2 = ((__pyx_v_quant_origin != NULL) != 0); - if (__pyx_t_2) { + __pyx_t_1 = ((__pyx_v_quant_origin != NULL) != 0); + if (__pyx_t_1) { - /* "DracoPy.pyx":227 + /* "DracoPy.pyx":203 * except: * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -5492,8 +5501,8 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":226 - * raise EncodingFailedException('Invalid point cloud') + /* "DracoPy.pyx":202 + * raise EncodingFailedException('Invalid draco structure') * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< * PyMem_Free(quant_origin) @@ -5501,61 +5510,61 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P */ } - /* "DracoPy.pyx":228 + /* "DracoPy.pyx":204 * if quant_origin != NULL: * PyMem_Free(quant_origin) * raise ValueError("Input invalid") # <<<<<<<<<<<<<< * * def raise_decoding_error(decoding_status): */ - __pyx_t_21 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 228, __pyx_L8_except_error) - __Pyx_GOTREF(__pyx_t_21); - __Pyx_Raise(__pyx_t_21, 0, 0, 0); - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - __PYX_ERR(0, 228, __pyx_L8_except_error) + __pyx_t_23 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 204, __pyx_L11_except_error) + __Pyx_GOTREF(__pyx_t_23); + __Pyx_Raise(__pyx_t_23, 0, 0, 0); + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + __PYX_ERR(0, 204, __pyx_L11_except_error) } - __pyx_L8_except_error:; + __pyx_L11_except_error:; - /* "DracoPy.pyx":206 - * raise RuntimeError("generic attributes encoding/decoding is not supported") + /* "DracoPy.pyx":168 + * geometry_metadata = create_empty_geometry_metadata() * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< * num_dims = 3 * if quantization_origin is not None: */ - __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10); goto __pyx_L1_error; - __pyx_L10_try_return:; - __Pyx_XGIVEREF(__pyx_t_7); + __pyx_L13_try_return:; __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_9); - __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_8, __pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10); goto __pyx_L0; - __pyx_L11_try_end:; + __pyx_L14_try_end:; } - /* "DracoPy.pyx":161 - * raise ValueError("Input invalid") + /* "DracoPy.pyx":117 * - * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< - * quantization_bits=14, - * compression_level=1, + * + * def encode_to_buffer(points: List[float], # <<<<<<<<<<<<<< + * faces: List[int] = None, + * quantization_bits=14, */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_21); - __Pyx_XDECREF(__pyx_t_22); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_23); - __Pyx_AddTraceback("DracoPy.encode_point_cloud_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_24); + __Pyx_XDECREF(__pyx_t_25); + __Pyx_AddTraceback("DracoPy.encode_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_num_dims); @@ -5567,7 +5576,7 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P return __pyx_r; } -/* "DracoPy.pyx":230 +/* "DracoPy.pyx":206 * raise ValueError("Input invalid") * * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< @@ -5576,20 +5585,20 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_7raise_decoding_error(PyObject *__pyx_self, PyObject *__pyx_v_decoding_status); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_7raise_decoding_error = {"raise_decoding_error", (PyCFunction)__pyx_pw_7DracoPy_7raise_decoding_error, METH_O, 0}; -static PyObject *__pyx_pw_7DracoPy_7raise_decoding_error(PyObject *__pyx_self, PyObject *__pyx_v_decoding_status) { +static PyObject *__pyx_pw_7DracoPy_9raise_decoding_error(PyObject *__pyx_self, PyObject *__pyx_v_decoding_status); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_9raise_decoding_error = {"raise_decoding_error", (PyCFunction)__pyx_pw_7DracoPy_9raise_decoding_error, METH_O, 0}; +static PyObject *__pyx_pw_7DracoPy_9raise_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_6raise_decoding_error(__pyx_self, ((PyObject *)__pyx_v_decoding_status)); + __pyx_r = __pyx_pf_7DracoPy_8raise_decoding_error(__pyx_self, ((PyObject *)__pyx_v_decoding_status)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_6raise_decoding_error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_decoding_status) { +static PyObject *__pyx_pf_7DracoPy_8raise_decoding_error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_decoding_status) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -5601,29 +5610,29 @@ static PyObject *__pyx_pf_7DracoPy_6raise_decoding_error(CYTHON_UNUSED PyObject int __pyx_clineno = 0; __Pyx_RefNannySetupContext("raise_decoding_error", 0); - /* "DracoPy.pyx":231 + /* "DracoPy.pyx":207 * * 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, 231, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::not_draco_encoded); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __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, 231, __pyx_L1_error) + __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, 207, __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, 231, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 207, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":232 + /* "DracoPy.pyx":208 * 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, 232, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FileTypeException); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { @@ -5637,14 +5646,14 @@ static PyObject *__pyx_pf_7DracoPy_6raise_decoding_error(CYTHON_UNUSED PyObject } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_kp_s_Input_mesh_is_not_draco_encoded) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_s_Input_mesh_is_not_draco_encoded); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 232, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 208, __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, 232, __pyx_L1_error) + __PYX_ERR(0, 208, __pyx_L1_error) - /* "DracoPy.pyx":231 + /* "DracoPy.pyx":207 * * def raise_decoding_error(decoding_status): * if decoding_status == DracoPy.decoding_status.not_draco_encoded: # <<<<<<<<<<<<<< @@ -5653,35 +5662,35 @@ static PyObject *__pyx_pf_7DracoPy_6raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":233 + /* "DracoPy.pyx":209 * 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, 233, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::failed_during_decoding); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 209, __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, 233, __pyx_L1_error) + __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, 209, __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, 233, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 209, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":234 + /* "DracoPy.pyx":210 * 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__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __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, 234, __pyx_L1_error) + __PYX_ERR(0, 210, __pyx_L1_error) - /* "DracoPy.pyx":233 + /* "DracoPy.pyx":209 * 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: # <<<<<<<<<<<<<< @@ -5690,35 +5699,35 @@ static PyObject *__pyx_pf_7DracoPy_6raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":235 + /* "DracoPy.pyx":211 * 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, 235, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::no_position_attribute); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __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, 235, __pyx_L1_error) + __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, 211, __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, 235, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 211, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":236 + /* "DracoPy.pyx":212 * 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__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 236, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __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, 236, __pyx_L1_error) + __PYX_ERR(0, 212, __pyx_L1_error) - /* "DracoPy.pyx":235 + /* "DracoPy.pyx":211 * 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: # <<<<<<<<<<<<<< @@ -5727,7 +5736,7 @@ static PyObject *__pyx_pf_7DracoPy_6raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":230 + /* "DracoPy.pyx":206 * raise ValueError("Input invalid") * * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< @@ -5750,7 +5759,7 @@ static PyObject *__pyx_pf_7DracoPy_6raise_decoding_error(CYTHON_UNUSED PyObject return __pyx_r; } -/* "DracoPy.pyx":238 +/* "DracoPy.pyx":214 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer, deduplicate=False): # <<<<<<<<<<<<<< @@ -5759,10 +5768,10 @@ static PyObject *__pyx_pf_7DracoPy_6raise_decoding_error(CYTHON_UNUSED PyObject */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_9decode_buffer_to_mesh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7DracoPy_8decode_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_9decode_buffer_to_mesh = {"decode_buffer_to_mesh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_9decode_buffer_to_mesh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7DracoPy_8decode_buffer_to_mesh}; -static PyObject *__pyx_pw_7DracoPy_9decode_buffer_to_mesh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7DracoPy_11decode_buffer_to_mesh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7DracoPy_10decode_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_11decode_buffer_to_mesh = {"decode_buffer_to_mesh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_11decode_buffer_to_mesh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7DracoPy_10decode_buffer_to_mesh}; +static PyObject *__pyx_pw_7DracoPy_11decode_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; @@ -5799,7 +5808,7 @@ static PyObject *__pyx_pw_7DracoPy_9decode_buffer_to_mesh(PyObject *__pyx_self, } } 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, 238, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode_buffer_to_mesh") < 0)) __PYX_ERR(0, 214, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -5815,20 +5824,20 @@ static PyObject *__pyx_pw_7DracoPy_9decode_buffer_to_mesh(PyObject *__pyx_self, } 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, 238, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decode_buffer_to_mesh", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 214, __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_8decode_buffer_to_mesh(__pyx_self, __pyx_v_buffer, __pyx_v_deduplicate); + __pyx_r = __pyx_pf_7DracoPy_10decode_buffer_to_mesh(__pyx_self, __pyx_v_buffer, __pyx_v_deduplicate); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer, PyObject *__pyx_v_deduplicate) { +static PyObject *__pyx_pf_7DracoPy_10decode_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 @@ -5846,25 +5855,25 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject int __pyx_clineno = 0; __Pyx_RefNannySetupContext("decode_buffer_to_mesh", 0); - /* "DracoPy.pyx":245 + /* "DracoPy.pyx":221 * :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, 245, __pyx_L1_error) - __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 245, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_deduplicate); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 245, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 221, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 221, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_deduplicate); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 221, __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, 245, __pyx_L1_error) + __PYX_ERR(0, 221, __pyx_L1_error) } __pyx_v_mesh_struct = __pyx_t_4; - /* "DracoPy.pyx":246 + /* "DracoPy.pyx":222 * """ * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< @@ -5874,7 +5883,7 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject __pyx_t_5 = ((__pyx_v_mesh_struct.decode_status == DracoFunctions::successful) != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":247 + /* "DracoPy.pyx":223 * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: * return DracoMesh(mesh_struct) # <<<<<<<<<<<<<< @@ -5882,9 +5891,9 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject * 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, 247, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_DracoMesh); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 223, __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, 247, __pyx_L1_error) + __pyx_t_8 = __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(__pyx_v_mesh_struct); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 223, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { @@ -5899,14 +5908,14 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject __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, 247, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 223, __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":246 + /* "DracoPy.pyx":222 * """ * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< @@ -5915,7 +5924,7 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":249 + /* "DracoPy.pyx":225 * return DracoMesh(mesh_struct) * else: * raise_decoding_error(mesh_struct.decode_status) # <<<<<<<<<<<<<< @@ -5923,9 +5932,9 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject * 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, 249, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_raise_decoding_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 225, __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, 249, __pyx_L1_error) + __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, 225, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { @@ -5940,13 +5949,13 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject __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, 249, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 225, __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":238 + /* "DracoPy.pyx":214 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer, deduplicate=False): # <<<<<<<<<<<<<< @@ -5970,7 +5979,7 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject return __pyx_r; } -/* "DracoPy.pyx":251 +/* "DracoPy.pyx":227 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer, deduplicate=False): # <<<<<<<<<<<<<< @@ -5979,10 +5988,10 @@ static PyObject *__pyx_pf_7DracoPy_8decode_buffer_to_mesh(CYTHON_UNUSED PyObject */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_11decode_point_cloud_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7DracoPy_10decode_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_11decode_point_cloud_buffer = {"decode_point_cloud_buffer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_11decode_point_cloud_buffer, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7DracoPy_10decode_point_cloud_buffer}; -static PyObject *__pyx_pw_7DracoPy_11decode_point_cloud_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7DracoPy_13decode_point_cloud_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7DracoPy_12decode_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_13decode_point_cloud_buffer = {"decode_point_cloud_buffer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_13decode_point_cloud_buffer, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7DracoPy_12decode_point_cloud_buffer}; +static PyObject *__pyx_pw_7DracoPy_13decode_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; @@ -6019,7 +6028,7 @@ static PyObject *__pyx_pw_7DracoPy_11decode_point_cloud_buffer(PyObject *__pyx_s } } 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, 251, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode_point_cloud_buffer") < 0)) __PYX_ERR(0, 227, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -6035,20 +6044,20 @@ static PyObject *__pyx_pw_7DracoPy_11decode_point_cloud_buffer(PyObject *__pyx_s } 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, 251, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decode_point_cloud_buffer", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 227, __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_10decode_point_cloud_buffer(__pyx_self, __pyx_v_buffer, __pyx_v_deduplicate); + __pyx_r = __pyx_pf_7DracoPy_12decode_point_cloud_buffer(__pyx_self, __pyx_v_buffer, __pyx_v_deduplicate); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer, PyObject *__pyx_v_deduplicate) { +static PyObject *__pyx_pf_7DracoPy_12decode_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 @@ -6066,25 +6075,25 @@ static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyO int __pyx_clineno = 0; __Pyx_RefNannySetupContext("decode_point_cloud_buffer", 0); - /* "DracoPy.pyx":258 + /* "DracoPy.pyx":234 * :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, 258, __pyx_L1_error) - __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 258, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_deduplicate); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 258, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 234, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_deduplicate); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 234, __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, 258, __pyx_L1_error) + __PYX_ERR(0, 234, __pyx_L1_error) } __pyx_v_point_cloud_struct = __pyx_t_4; - /* "DracoPy.pyx":259 + /* "DracoPy.pyx":235 * """ * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer), deduplicate) * if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< @@ -6094,7 +6103,7 @@ static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyO __pyx_t_5 = ((__pyx_v_point_cloud_struct.decode_status == DracoFunctions::successful) != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":260 + /* "DracoPy.pyx":236 * 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) # <<<<<<<<<<<<<< @@ -6102,9 +6111,9 @@ static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyO * 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, 260, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 236, __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, 260, __pyx_L1_error) + __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, 236, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { @@ -6119,14 +6128,14 @@ static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyO __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, 260, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 236, __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":259 + /* "DracoPy.pyx":235 * """ * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer), deduplicate) * if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< @@ -6135,15 +6144,15 @@ static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyO */ } - /* "DracoPy.pyx":262 + /* "DracoPy.pyx":238 * 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, 262, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_raise_decoding_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 238, __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, 262, __pyx_L1_error) + __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, 238, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { @@ -6158,13 +6167,13 @@ static PyObject *__pyx_pf_7DracoPy_10decode_point_cloud_buffer(CYTHON_UNUSED PyO __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, 262, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 238, __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":251 + /* "DracoPy.pyx":227 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer, deduplicate=False): # <<<<<<<<<<<<<< @@ -10900,8 +10909,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_Input_invalid, __pyx_k_Input_invalid, sizeof(__pyx_k_Input_invalid), 0, 0, 1, 0}, {&__pyx_kp_s_Input_mesh_is_not_draco_encoded, __pyx_k_Input_mesh_is_not_draco_encoded, sizeof(__pyx_k_Input_mesh_is_not_draco_encoded), 0, 0, 1, 0}, {&__pyx_n_s_IntEnum, __pyx_k_IntEnum, sizeof(__pyx_k_IntEnum), 0, 0, 1, 1}, - {&__pyx_kp_s_Invalid_mesh, __pyx_k_Invalid_mesh, sizeof(__pyx_k_Invalid_mesh), 0, 0, 1, 0}, - {&__pyx_kp_s_Invalid_point_cloud, __pyx_k_Invalid_point_cloud, sizeof(__pyx_k_Invalid_point_cloud), 0, 0, 1, 0}, + {&__pyx_kp_s_Invalid_draco_structure, __pyx_k_Invalid_draco_structure, sizeof(__pyx_k_Invalid_draco_structure), 0, 0, 1, 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_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}, @@ -10946,11 +10954,11 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_dim, __pyx_k_dim, sizeof(__pyx_k_dim), 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_encoded_mesh, __pyx_k_encoded_mesh, sizeof(__pyx_k_encoded_mesh), 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_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_s_entries, __pyx_k_entries, sizeof(__pyx_k_entries), 0, 0, 1, 1}, @@ -11031,8 +11039,8 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) __PYX_ERR(0, 27, __pyx_L1_error) __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 62, __pyx_L1_error) __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 69, __pyx_L1_error) - __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 204, __pyx_L1_error) - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 234, __pyx_L1_error) + __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 161, __pyx_L1_error) + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 210, __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:; @@ -11054,47 +11062,47 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_tuple_); __Pyx_GIVEREF(__pyx_tuple_); - /* "DracoPy.pyx":159 - * if quant_origin != NULL: - * PyMem_Free(quant_origin) - * raise ValueError("Input invalid") # <<<<<<<<<<<<<< - * - * def encode_point_cloud_to_buffer(points, + /* "DracoPy.pyx":161 + * if faces is None 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__2 = PyTuple_Pack(1, __pyx_kp_s_Input_invalid); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 159, __pyx_L1_error) + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_generic_attributes_encoding_deco); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 161, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); /* "DracoPy.pyx":204 - * geometry_metadata = create_empty_geometry_metadata() - * if len(geometry_metadata["generic_attributes"]) > 0: - * raise RuntimeError("generic attributes encoding/decoding is not supported") # <<<<<<<<<<<<<< - * cdef float* quant_origin = NULL - * try: + * if quant_origin != NULL: + * PyMem_Free(quant_origin) + * raise ValueError("Input invalid") # <<<<<<<<<<<<<< + * + * def raise_decoding_error(decoding_status): */ - __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_generic_attributes_encoding_deco); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 204, __pyx_L1_error) + __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_Input_invalid); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 204, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); - /* "DracoPy.pyx":234 + /* "DracoPy.pyx":210 * 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__4 = PyTuple_Pack(1, __pyx_kp_s_Failed_to_decode_input_mesh_Data); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 234, __pyx_L1_error) + __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_Failed_to_decode_input_mesh_Data); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 210, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__4); __Pyx_GIVEREF(__pyx_tuple__4); - /* "DracoPy.pyx":236 + /* "DracoPy.pyx":212 * 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__5 = PyTuple_Pack(1, __pyx_kp_s_DracoPy_only_supports_meshes_wit); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 236, __pyx_L1_error) + __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_DracoPy_only_supports_meshes_wit); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 212, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__5); __Pyx_GIVEREF(__pyx_tuple__5); @@ -11362,65 +11370,77 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { */ __pyx_codeobj__41 = (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, 83, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 83, __pyx_L1_error) - /* "DracoPy.pyx":90 - * + /* "DracoPy.pyx":89 + * } * * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< * quantization_bits=14, * compression_level=1, */ - __pyx_tuple__42 = PyTuple_Pack(13, __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_metadatas, __pyx_n_s_geometry_metadata, __pyx_n_s_quant_origin, __pyx_n_s_num_dims, __pyx_n_s_dim, __pyx_n_s_encoded_mesh); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 90, __pyx_L1_error) + __pyx_tuple__42 = PyTuple_Pack(9, __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_metadatas, __pyx_n_s_geometry_metadata); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__42); __Pyx_GIVEREF(__pyx_tuple__42); - __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(9, 0, 13, 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_encode_mesh_to_buffer, 90, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 90, __pyx_L1_error) + __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(9, 0, 9, 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_encode_mesh_to_buffer, 89, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 89, __pyx_L1_error) - /* "DracoPy.pyx":161 - * raise ValueError("Input invalid") + /* "DracoPy.pyx":103 + * * * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< * quantization_bits=14, * compression_level=1, */ - __pyx_tuple__44 = PyTuple_Pack(12, __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_metadatas, __pyx_n_s_geometry_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__44)) __PYX_ERR(0, 161, __pyx_L1_error) + __pyx_tuple__44 = PyTuple_Pack(8, __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_metadatas, __pyx_n_s_geometry_metadata); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__44); __Pyx_GIVEREF(__pyx_tuple__44); - __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(8, 0, 12, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_encode_point_cloud_to_buffer, 161, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 161, __pyx_L1_error) + __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(8, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_encode_point_cloud_to_buffer, 103, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 103, __pyx_L1_error) + + /* "DracoPy.pyx":117 + * + * + * def encode_to_buffer(points: List[float], # <<<<<<<<<<<<<< + * faces: List[int] = None, + * quantization_bits=14, + */ + __pyx_tuple__46 = PyTuple_Pack(13, __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_metadatas, __pyx_n_s_geometry_metadata, __pyx_n_s_quant_origin, __pyx_n_s_num_dims, __pyx_n_s_dim, __pyx_n_s_draco_encoded); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__46); + __Pyx_GIVEREF(__pyx_tuple__46); + __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(9, 0, 13, 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_to_buffer, 117, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 117, __pyx_L1_error) - /* "DracoPy.pyx":230 + /* "DracoPy.pyx":206 * 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__46 = PyTuple_Pack(1, __pyx_n_s_decoding_status); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 230, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__46); - __Pyx_GIVEREF(__pyx_tuple__46); - __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 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_raise_decoding_error, 230, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 230, __pyx_L1_error) + __pyx_tuple__48 = PyTuple_Pack(1, __pyx_n_s_decoding_status); 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(1, 0, 1, 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_raise_decoding_error, 206, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 206, __pyx_L1_error) - /* "DracoPy.pyx":238 + /* "DracoPy.pyx":214 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer, deduplicate=False): # <<<<<<<<<<<<<< * """ * Decode buffer to mesh */ - __pyx_tuple__48 = PyTuple_Pack(3, __pyx_n_s_buffer, __pyx_n_s_deduplicate, __pyx_n_s_mesh_struct); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 238, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__48); - __Pyx_GIVEREF(__pyx_tuple__48); - __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 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_decode_buffer_to_mesh, 238, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 238, __pyx_L1_error) + __pyx_tuple__50 = PyTuple_Pack(3, __pyx_n_s_buffer, __pyx_n_s_deduplicate, __pyx_n_s_mesh_struct); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 214, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__50); + __Pyx_GIVEREF(__pyx_tuple__50); + __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 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_decode_buffer_to_mesh, 214, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 214, __pyx_L1_error) - /* "DracoPy.pyx":251 + /* "DracoPy.pyx":227 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer, deduplicate=False): # <<<<<<<<<<<<<< * """ * Decode buffer to point cloud */ - __pyx_tuple__50 = PyTuple_Pack(3, __pyx_n_s_buffer, __pyx_n_s_deduplicate, __pyx_n_s_point_cloud_struct); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 251, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__50); - __Pyx_GIVEREF(__pyx_tuple__50); - __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 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_decode_point_cloud_buffer, 251, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 251, __pyx_L1_error) + __pyx_tuple__52 = PyTuple_Pack(3, __pyx_n_s_buffer, __pyx_n_s_deduplicate, __pyx_n_s_point_cloud_struct); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 227, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__52); + __Pyx_GIVEREF(__pyx_tuple__52); + __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 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_decode_point_cloud_buffer, 227, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 227, __pyx_L1_error) /* "EnumBase":28 * class __Pyx_EnumBase(int): @@ -11429,13 +11449,13 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * for v in cls: * if v == value: */ - __pyx_tuple__52 = 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__52)) __PYX_ERR(1, 28, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__52); - __Pyx_GIVEREF(__pyx_tuple__52); - __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_stringsource, __pyx_n_s_new, 28, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(1, 28, __pyx_L1_error) - __pyx_tuple__54 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(1, 28, __pyx_L1_error) + __pyx_tuple__54 = 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__54)) __PYX_ERR(1, 28, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__54); __Pyx_GIVEREF(__pyx_tuple__54); + __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_stringsource, __pyx_n_s_new, 28, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(1, 28, __pyx_L1_error) + __pyx_tuple__56 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(1, 28, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__56); + __Pyx_GIVEREF(__pyx_tuple__56); /* "EnumBase":39 * cls.__members__[name] = res @@ -11444,10 +11464,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return "<%s.%s: %d>" % (self.__class__.__name__, self.name, self) * def __str__(self): */ - __pyx_tuple__55 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__55)) __PYX_ERR(1, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__55); - __Pyx_GIVEREF(__pyx_tuple__55); - __pyx_codeobj__56 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_repr, 39, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__56)) __PYX_ERR(1, 39, __pyx_L1_error) + __pyx_tuple__57 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(1, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__57); + __Pyx_GIVEREF(__pyx_tuple__57); + __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_repr, 39, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) __PYX_ERR(1, 39, __pyx_L1_error) /* "EnumBase":41 * def __repr__(self): @@ -11456,20 +11476,20 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return "%s.%s" % (self.__class__.__name__, self.name) * */ - __pyx_tuple__57 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(1, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__57); - __Pyx_GIVEREF(__pyx_tuple__57); - __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_str, 41, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) __PYX_ERR(1, 41, __pyx_L1_error) + __pyx_tuple__59 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(1, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__59); + __Pyx_GIVEREF(__pyx_tuple__59); + __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_str, 41, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__60)) __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__59 = 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__59)) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__59); - __Pyx_GIVEREF(__pyx_tuple__59); - __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __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__60)) __PYX_ERR(1, 1, __pyx_L1_error) + __pyx_tuple__61 = 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__61)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__61); + __Pyx_GIVEREF(__pyx_tuple__61); + __pyx_codeobj__62 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_pyx_unpickle___Pyx_EnumMeta, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__62)) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -12273,64 +12293,76 @@ if (!__Pyx_RefNanny) { if (PyDict_SetItem(__pyx_d, __pyx_n_s_create_empty_geometry_metadata, __pyx_t_2) < 0) __PYX_ERR(0, 83, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":90 - * + /* "DracoPy.pyx":89 + * } * * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< * quantization_bits=14, * compression_level=1, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_3encode_mesh_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 90, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_3encode_mesh_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __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, 90, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_mesh_to_buffer, __pyx_t_2) < 0) __PYX_ERR(0, 89, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":161 - * raise ValueError("Input invalid") + /* "DracoPy.pyx":103 + * * * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< * quantization_bits=14, * compression_level=1, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_5encode_point_cloud_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 161, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_5encode_point_cloud_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 103, __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, 161, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_point_cloud_to_buffer, __pyx_t_2) < 0) __PYX_ERR(0, 103, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":230 + /* "DracoPy.pyx":117 + * + * + * def encode_to_buffer(points: List[float], # <<<<<<<<<<<<<< + * faces: List[int] = None, + * quantization_bits=14, + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_7encode_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_to_buffer, __pyx_t_2) < 0) __PYX_ERR(0, 117, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":206 * 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_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_7raise_decoding_error, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 230, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_9raise_decoding_error, 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_raise_decoding_error, __pyx_t_2) < 0) __PYX_ERR(0, 230, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_raise_decoding_error, __pyx_t_2) < 0) __PYX_ERR(0, 206, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":238 + /* "DracoPy.pyx":214 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer, deduplicate=False): # <<<<<<<<<<<<<< * """ * Decode buffer to mesh */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_9decode_buffer_to_mesh, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 238, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_11decode_buffer_to_mesh, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 214, __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, 238, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode_buffer_to_mesh, __pyx_t_2) < 0) __PYX_ERR(0, 214, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":251 + /* "DracoPy.pyx":227 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer, deduplicate=False): # <<<<<<<<<<<<<< * """ * Decode buffer to point cloud */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_11decode_point_cloud_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 251, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_13decode_point_cloud_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 227, __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, 251, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode_point_cloud_buffer, __pyx_t_2) < 0) __PYX_ERR(0, 227, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "DracoPy.pyx":1 @@ -12435,9 +12467,9 @@ if (!__Pyx_RefNanny) { * 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__53)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 28, __pyx_L1_error) + __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__55)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 28, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__54); + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__56); 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; @@ -12448,7 +12480,7 @@ if (!__Pyx_RefNanny) { * return "<%s.%s: %d>" % (self.__class__.__name__, self.name, self) * def __str__(self): */ - __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__56)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 39, __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__58)); 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; @@ -12460,7 +12492,7 @@ if (!__Pyx_RefNanny) { * return "%s.%s" % (self.__class__.__name__, self.name) * */ - __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__58)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 41, __pyx_L1_error) + __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__60)); 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; diff --git a/src/DracoPy.pyx b/src/DracoPy.pyx index 0524190..835ce20 100644 --- a/src/DracoPy.pyx +++ b/src/DracoPy.pyx @@ -86,7 +86,6 @@ def create_empty_geometry_metadata() -> dict: "generic_attributes": [], } - def encode_mesh_to_buffer(points, faces, quantization_bits=14, compression_level=1, @@ -96,67 +95,10 @@ def encode_mesh_to_buffer(points, faces, metadatas = None, geometry_metadata = None, ): - """ - Encode a list or numpy array of points/vertices (float) to a draco buffer. - :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 - :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 exists in 'metadatas' fields - :return bytes: encoded mesh - """ - 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_mesh = DracoPy.encode_mesh(points, - faces, - metadatas, - geometry_metadata, - 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") + return encode_to_buffer(points, faces, quantization_bits, compression_level, + quantization_range, quantization_origin, + create_metadata, metadatas, geometry_metadata) + def encode_point_cloud_to_buffer(points, quantization_bits=14, @@ -167,9 +109,27 @@ def encode_point_cloud_to_buffer(points, metadatas = None, geometry_metadata = None, ): + return encode_to_buffer(points, None, quantization_bits, compression_level, + quantization_range, quantization_origin, + create_metadata, metadatas, geometry_metadata) + + +def encode_to_buffer(points: List[float], + faces: List[int] = None, + quantization_bits=14, + compression_level=1, + quantization_range=-1, + quantization_origin=None, + create_metadata=False, + metadatas = None, + geometry_metadata = None, + ): """ Encode a list or numpy array of points/vertices (float) to a draco buffer. :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 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 @@ -196,12 +156,14 @@ def encode_point_cloud_to_buffer(points, NOTE: all 'metadata_id' indexes have to exists in 'metadatas' fields :return bytes: encoded mesh """ + if faces is None 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() - if len(geometry_metadata["generic_attributes"]) > 0: - raise RuntimeError("generic attributes encoding/decoding is not supported") cdef float* quant_origin = NULL try: num_dims = 3 @@ -209,19 +171,33 @@ def encode_point_cloud_to_buffer(points, 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, metadatas, geometry_metadata, - quantization_bits, compression_level, - quantization_range, quant_origin, create_metadata, - ) + if isinstance(faces, list): + draco_encoded = DracoPy.encode_mesh(points, + faces, + metadatas, + geometry_metadata, + quantization_bits, + compression_level, + quantization_range, + quant_origin, + create_metadata) + else: + draco_encoded = DracoPy.encode_point_cloud(points, + metadatas, + geometry_metadata, + 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) - 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) From 0d35dca9c690a1608d02c6a3d34e3c79a0eb6250 Mon Sep 17 00:00:00 2001 From: Andrey Romanov Date: Tue, 16 Nov 2021 17:28:53 +0300 Subject: [PATCH 18/21] remove unused code --- src/DracoPy.pyx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/DracoPy.pyx b/src/DracoPy.pyx index 835ce20..14f4857 100644 --- a/src/DracoPy.pyx +++ b/src/DracoPy.pyx @@ -14,7 +14,6 @@ class DracoPointCloud(object): data_struct['quantization_range'], data_struct['quantization_origin']) else: self.encoding_options = None - # self.metadata = decode_metadata(data_struct["binary_metadata"]) def get_encoded_coordinate(self, value, axis): if self.encoding_options is not None: From c946d2277dbd6abfe80fbe44611ae2c853feac6c Mon Sep 17 00:00:00 2001 From: Andrey Romanov Date: Wed, 17 Nov 2021 15:45:38 +0300 Subject: [PATCH 19/21] make one common function 'encode_to_buffer'; add draco::Encoder as an input argument to set up quantization. --- src/DracoPy.cpp | 12620 ++++++++++++++++++++++++++++------------------ src/DracoPy.h | 59 +- src/DracoPy.pxd | 36 +- src/DracoPy.pyx | 195 +- tests.py | 74 +- 5 files changed, 7789 insertions(+), 5195 deletions(-) diff --git a/src/DracoPy.cpp b/src/DracoPy.cpp index b1fddf5..7c185f0 100644 --- a/src/DracoPy.cpp +++ b/src/DracoPy.cpp @@ -864,8 +864,22 @@ static const char *__pyx_f[] = { }; /*--- 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 @@ -956,6 +970,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); @@ -964,6 +981,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) @@ -1061,13 +1124,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); @@ -1121,45 +1177,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); @@ -1192,6 +1209,12 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); #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); @@ -1229,6 +1252,23 @@ static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); #endif +/* ListCompAppend.proto */ +#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS +static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len)) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + __Pyx_SET_SIZE(list, len + 1); + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) +#endif + /* IterFinish.proto */ static CYTHON_INLINE int __Pyx_IterFinish(void); @@ -1279,23 +1319,6 @@ static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tsta #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) #endif -/* ListCompAppend.proto */ -#if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS -static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { - PyListObject* L = (PyListObject*) list; - Py_ssize_t len = Py_SIZE(list); - if (likely(L->allocated > len)) { - Py_INCREF(x); - PyList_SET_ITEM(list, len, x); - __Pyx_SET_SIZE(list, len + 1); - return 0; - } - return PyList_Append(list, x); -} -#else -#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) -#endif - /* GetAttr.proto */ static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); @@ -1443,6 +1466,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 @@ -1490,47 +1516,53 @@ 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_MetadataObject(struct DracoFunctions::MetadataObject 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 uint32_t __Pyx_PyInt_As_uint32_t(PyObject *); +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 enum draco::DataType __Pyx_PyInt_As_enum__draco_3a__3a_DataType(PyObject *); +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_uint32_t(uint32_t value); +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value); -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__draco_3a__3a_DataType(enum draco::DataType 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 *); -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); - /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); @@ -1555,35 +1587,38 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'cpython.mem' */ /* 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::vector __pyx_convert_vector_from_py_uint32_t(PyObject *); /*proto*/ static std::string __pyx_convert_string_from_py_std__in_string(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_struct__DracoFunctions_3a__3a_MetadataObject(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 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 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_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 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_unpickle___Pyx_EnumMeta__set_state(struct __pyx_obj___Pyx_EnumMeta *, PyObject *); /*proto*/ #define __Pyx_MODULE_NAME "DracoPy" extern int __pyx_module_is_main_DracoPy; @@ -1592,15 +1627,17 @@ 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_RuntimeError; -static PyObject *__pyx_builtin_TypeError; 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_dim[] = "dim"; +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"; @@ -1616,9 +1653,11 @@ 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_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"; @@ -1626,6 +1665,7 @@ 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__"; @@ -1635,13 +1675,18 @@ 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_members[] = "__members__"; static const char __pyx_k_normals[] = "normals"; @@ -1656,10 +1701,10 @@ 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__"; @@ -1668,7 +1713,9 @@ 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__"; @@ -1700,9 +1747,12 @@ 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"; @@ -1729,21 +1779,25 @@ 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_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"; @@ -1753,15 +1807,18 @@ static const char __pyx_k_EncodingOptions_get_encoded_coor[] = "EncodingOptions. 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 'entries'"; +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_value_specified_for_struct_at_2[] = "No value specified for struct attribute 'sub_metadata_ids'"; -static const char __pyx_k_No_value_specified_for_struct_at_3[] = "No value specified for struct attribute 'data'"; -static const char __pyx_k_No_value_specified_for_struct_at_4[] = "No value specified for struct attribute 'datatype'"; -static const char __pyx_k_No_value_specified_for_struct_at_5[] = "No value specified for struct attribute 'dimension'"; -static const char __pyx_k_No_value_specified_for_struct_at_6[] = "No value specified for struct attribute 'metadata_id'"; -static const char __pyx_k_No_value_specified_for_struct_at_7[] = "No value specified for struct attribute 'generic_attributes'"; +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; @@ -1790,6 +1847,7 @@ 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_s_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; @@ -1800,6 +1858,9 @@ static PyObject *__pyx_n_s_EnumBase; static PyObject *__pyx_n_s_EnumType; static PyObject *__pyx_kp_s_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_s_Input_invalid; static PyObject *__pyx_kp_s_Input_mesh_is_not_draco_encoded; @@ -1807,6 +1868,8 @@ static PyObject *__pyx_n_s_IntEnum; static PyObject *__pyx_kp_s_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; @@ -1816,16 +1879,22 @@ 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_s_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; @@ -1834,19 +1903,22 @@ 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_s_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_s_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; @@ -1854,8 +1926,10 @@ static PyObject *__pyx_n_s_encode_mesh_to_buffer; static PyObject *__pyx_n_s_encode_point_cloud_to_buffer; static PyObject *__pyx_n_s_encode_to_buffer; static PyObject *__pyx_n_s_encoded_point; +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_s_encoding_speed; static PyObject *__pyx_n_s_entries; static PyObject *__pyx_n_s_enum; static PyObject *__pyx_n_s_faces; @@ -1866,6 +1940,7 @@ static PyObject *__pyx_n_s_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_s_i; static PyObject *__pyx_n_s_import; static PyObject *__pyx_n_s_init; static PyObject *__pyx_n_s_inverse_alpha; @@ -1881,10 +1956,11 @@ 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_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; @@ -1900,8 +1976,11 @@ 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_b_quantization_origin; static PyObject *__pyx_n_s_quantization_origin; +static PyObject *__pyx_n_b_quantization_range; static PyObject *__pyx_n_s_quantization_range; static PyObject *__pyx_n_s_quantized_index; static PyObject *__pyx_n_s_raise_decoding_error; @@ -1920,6 +1999,7 @@ 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_s_test; static PyObject *__pyx_n_s_typing; @@ -1927,6 +2007,12 @@ 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 */ @@ -1940,13 +2026,14 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions___init__(CYTHON_UNUSED PyOb 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_create_empty_geometry_metadata(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ -static PyObject *__pyx_pf_7DracoPy_2encode_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, PyObject *__pyx_v_metadatas, PyObject *__pyx_v_geometry_metadata); /* proto */ -static PyObject *__pyx_pf_7DracoPy_4encode_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, PyObject *__pyx_v_metadatas, PyObject *__pyx_v_geometry_metadata); /* proto */ -static PyObject *__pyx_pf_7DracoPy_6encode_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, PyObject *__pyx_v_metadatas, PyObject *__pyx_v_geometry_metadata); /* proto */ -static PyObject *__pyx_pf_7DracoPy_8raise_decoding_error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_decoding_status); /* proto */ -static PyObject *__pyx_pf_7DracoPy_10decode_buffer_to_mesh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer, PyObject *__pyx_v_deduplicate); /* proto */ -static PyObject *__pyx_pf_7DracoPy_12decode_point_cloud_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer, PyObject *__pyx_v_deduplicate); /* 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 */ @@ -1956,6 +2043,7 @@ static PyObject *__pyx_pf_8EnumBase_14__Pyx_EnumBase___new__(CYTHON_UNUSED PyObj 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; @@ -1965,10 +2053,10 @@ 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; @@ -1979,78 +2067,148 @@ 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__22; -static PyObject *__pyx_tuple__24; -static PyObject *__pyx_tuple__26; -static PyObject *__pyx_tuple__28; -static PyObject *__pyx_tuple__30; -static PyObject *__pyx_tuple__32; +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; +static PyObject *__pyx_tuple__27; +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_tuple__39; +static PyObject *__pyx_tuple__36; +static PyObject *__pyx_tuple__38; +static PyObject *__pyx_tuple__40; static PyObject *__pyx_tuple__42; -static PyObject *__pyx_tuple__44; 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__57; -static PyObject *__pyx_tuple__59; +static PyObject *__pyx_tuple__58; +static PyObject *__pyx_tuple__60; static PyObject *__pyx_tuple__61; -static PyObject *__pyx_codeobj__15; -static PyObject *__pyx_codeobj__17; -static PyObject *__pyx_codeobj__19; -static PyObject *__pyx_codeobj__21; -static PyObject *__pyx_codeobj__23; -static PyObject *__pyx_codeobj__25; -static PyObject *__pyx_codeobj__27; -static PyObject *__pyx_codeobj__29; -static PyObject *__pyx_codeobj__31; +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; +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__40; +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__58; -static PyObject *__pyx_codeobj__60; +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; @@ -2066,17 +2224,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; @@ -2084,193 +2242,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_s_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_s_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_s_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_s_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 # <<<<<<<<<<<<<< - * # self.metadata = decode_metadata(data_struct["binary_metadata"]) + /* "DracoPy.pyx":27 + * attr_type: GeometryAttributeType, + * quantization_bits: int): + * self.this_encoder.SetAttributeQuantization(attr_type, quantization_bits) # <<<<<<<<<<<<<< * + * 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); @@ -2278,34 +2422,36 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyOb return __pyx_r; } -/* "DracoPy.pyx":19 - * # self.metadata = decode_metadata(data_struct["binary_metadata"]) +/* "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); @@ -2318,167 +2464,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, 19, __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, 19, __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, 19, __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, 19, __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":20 - * - * 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, 20, __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":21 - * 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, 21, __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, 21, __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, 21, __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, 21, __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, 21, __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, 21, __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":20 - * - * 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":19 - * # self.metadata = decode_metadata(data_struct["binary_metadata"]) + /* "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); @@ -2486,28 +2568,141 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_2get_encoded_coordinate(CYT return __pyx_r; } -/* "DracoPy.pyx":23 - * 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; @@ -2527,13 +2722,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, 23, __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, 23, __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; @@ -2542,97 +2737,1140 @@ 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, 23, __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":24 - * - * 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, 24, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data_struct, __pyx_n_s_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":25 - * 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, 25, __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_s_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, 25, __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_s_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_s_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, 25, __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; + #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":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; + + /* "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":46 + * data_struct['quantization_range'], data_struct['quantization_origin']) + * else: + * self.encoding_options = None # <<<<<<<<<<<<<< + * + * def get_encoded_coordinate(self, value, axis): + */ + /*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":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":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_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("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_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; + 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("get_encoded_coordinate", 0); + + /* "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) + * + */ + __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_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":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; + + /* "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) + * + */ + } + + /* "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) + */ + + /* 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_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "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) + */ + +/* 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) { + 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; + } + 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, 52, __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, 52, __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, 52, __pyx_L3_error) + __pyx_L3_error:; + __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_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_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; + 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("get_encoded_point", 0); + + /* "DracoPy.pyx":53 + * + * def get_encoded_point(self, point): + * if self.encoding_options is not None: # <<<<<<<<<<<<<< + * return self.encoding_options.get_encoded_point(point) + * + */ + __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":54 + * def get_encoded_point(self, point): + * if self.encoding_options is not None: + * return self.encoding_options.get_encoded_point(point) # <<<<<<<<<<<<<< + * + * @property + */ + __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":53 + * + * 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 */ + __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; +} + +/* "DracoPy.pyx":57 + * + * @property + * def num_axes(self): # <<<<<<<<<<<<<< + * return 3 + * + */ + +/* 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":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; +} + +/* "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 + 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("points", 0); + + /* "DracoPy.pyx":62 + * @property + * def points(self) -> List[float]: + * return self.data_struct['points'] # <<<<<<<<<<<<<< + * + * @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, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_points); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __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":61 + * + * @property + * def points(self) -> List[float]: # <<<<<<<<<<<<<< + * 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; +} + +/* "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_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_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; + 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_s_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":65 + * + * @property + * def geometry_metadata(self) -> Optional[Dict]: # <<<<<<<<<<<<<< + * return self.data_struct['geometry_metadata'] if self.metadatas else None + * + */ + + /* 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'] # <<<<<<<<<<<<<< + * + * + */ + __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, 70, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_metadatas); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __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":69 + * + * @property + * def metadatas(self) -> List[Dict]: # <<<<<<<<<<<<<< + * return self.data_struct['metadatas'] + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("DracoPy.DracoPointCloud.metadatas", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "DracoPy.pyx":75 + * class DracoMesh(DracoPointCloud): + * @property + * def faces(self) -> List[int]: # <<<<<<<<<<<<<< + * return self.data_struct['faces'] + * + */ + +/* 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":76 + * @property + * def faces(self) -> List[int]: + * return self.data_struct['faces'] # <<<<<<<<<<<<<< + * + * @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, 76, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_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; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "DracoPy.pyx":75 + * class DracoMesh(DracoPointCloud): + * @property + * def faces(self) -> List[int]: # <<<<<<<<<<<<<< + * return self.data_struct['faces'] + * + */ + + /* 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":79 + * + * @property + * def normals(self): # <<<<<<<<<<<<<< + * return self.data_struct['normals'] + * + */ + +/* 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":80 + * @property + * def normals(self): + * return self.data_struct['normals'] # <<<<<<<<<<<<<< + * + * + */ + __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, 80, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_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":79 + * + * @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_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "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 + */ + +/* 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) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_quantization_bits = 0; + PyObject *__pyx_v_quantization_range = 0; + PyObject *__pyx_v_quantization_origin = 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); + { + 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 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_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_quantization_bits)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); __PYX_ERR(0, 84, __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, 84, __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("__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, "__init__") < 0)) __PYX_ERR(0, 84, __pyx_L3_error) + } + } 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_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("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 84, __pyx_L3_error) + __pyx_L3_error:; + __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_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_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; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "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 + */ + 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":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) + */ + 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":24 + /* "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) * - * 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, 87, __pyx_L1_error) + + /* "DracoPy.pyx":88 + * 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): */ - } + __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":23 - * return self.encoding_options.get_encoded_coordinate(value, axis) + /* "DracoPy.pyx":84 * - * def get_encoded_point(self, point): # <<<<<<<<<<<<<< - * if self.encoding_options is not None: - * return self.encoding_options.get_encoded_point(point) + * 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 */ @@ -2640,9 +3878,8 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_4get_encoded_point(CYTHON_U 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_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("DracoPy.EncodingOptions.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2650,515 +3887,618 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_4get_encoded_point(CYTHON_U return __pyx_r; } -/* "DracoPy.pyx":28 - * - * @property - * def num_axes(self): # <<<<<<<<<<<<<< - * return 3 +/* "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') */ /* 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) { +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("num_axes (wrapper)", 0); - __pyx_r = __pyx_pf_7DracoPy_15DracoPointCloud_6num_axes(__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, 90, __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, 90, __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, 90, __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, 90, __pyx_L3_error) + __pyx_L3_error:; + __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_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_15DracoPointCloud_6num_axes(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) { +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 - __Pyx_RefNannySetupContext("num_axes", 0); + int __pyx_t_1; + 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); - /* "DracoPy.pyx":29 - * @property - * def num_axes(self): - * return 3 # <<<<<<<<<<<<<< + /* "DracoPy.pyx":91 * - * @property + * 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_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_int_3); - __pyx_r = __pyx_int_3; - goto __pyx_L0; + __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":28 - * - * @property - * def num_axes(self): # <<<<<<<<<<<<<< - * return 3 - * + /* "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_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) - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "DracoPy.pyx":32 - * - * @property - * def points(self) -> List[float]: # <<<<<<<<<<<<<< - * return self.data_struct['points'] + /* "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] */ + } -/* 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; -} + /* "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_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; -static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_8points(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("points", 0); + /* "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_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":33 - * @property - * def points(self) -> List[float]: - * return self.data_struct['points'] # <<<<<<<<<<<<<< + /* "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) # <<<<<<<<<<<<<< * - * @property + * def get_encoded_point(self, point): */ __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, 33, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_points); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 33, __pyx_L1_error) + __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_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __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":32 - * - * @property - * def points(self) -> List[float]: # <<<<<<<<<<<<<< - * return self.data_struct['points'] + /* "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') */ /* 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_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":36 - * - * @property - * def geometry_metadata(self) -> Optional[Dict]: # <<<<<<<<<<<<<< - * return self.data_struct['geometry_metadata'] if self.metadatas else None +/* "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): */ /* 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; +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; - __Pyx_RefNannySetupContext("geometry_metadata", 0); - - /* "DracoPy.pyx":37 - * @property - * def geometry_metadata(self) -> Optional[Dict]: - * return self.data_struct['geometry_metadata'] if self.metadatas else None # <<<<<<<<<<<<<< - * - * @property - */ - __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, 37, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 37, __pyx_L1_error) - __Pyx_DECREF(__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, 37, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_t_2, __pyx_n_s_geometry_metadata); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 37, __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":36 - * - * @property - * def geometry_metadata(self) -> Optional[Dict]: # <<<<<<<<<<<<<< - * return self.data_struct['geometry_metadata'] if self.metadatas else None - * - */ - - /* 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":40 - * - * @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)); + __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, 97, __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, 97, __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, 97, __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); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_12metadatas(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { +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; + 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("metadatas", 0); + __Pyx_RefNannySetupContext("get_encoded_point", 0); - /* "DracoPy.pyx":41 - * @property - * def metadatas(self) -> List[Dict]: - * return self.data_struct['metadatas'] # <<<<<<<<<<<<<< - * + /* "DracoPy.pyx":98 * + * 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_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_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 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_metadatas); 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; - goto __pyx_L0; + __pyx_v_encoded_point = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "DracoPy.pyx":40 - * - * @property - * def metadatas(self) -> List[Dict]: # <<<<<<<<<<<<<< - * return self.data_struct['metadatas'] - * + /* "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_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; + } 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_XDECREF_SET(__pyx_v_axis, __pyx_t_2); + __pyx_t_2 = 0; - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("DracoPy.DracoPointCloud.metadatas", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "DracoPy.pyx":46 - * class DracoMesh(DracoPointCloud): - * @property - * def faces(self) -> List[int]: # <<<<<<<<<<<<<< - * return self.data_struct['faces'] + /* "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; -/* 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":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_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":47 - * @property - * def faces(self) -> List[int]: - * return self.data_struct['faces'] # <<<<<<<<<<<<<< + /* "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_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, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_faces); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __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_INCREF(__pyx_v_encoded_point); + __pyx_r = __pyx_v_encoded_point; goto __pyx_L0; - /* "DracoPy.pyx":46 - * class DracoMesh(DracoPointCloud): - * @property - * def faces(self) -> List[int]: # <<<<<<<<<<<<<< - * return self.data_struct['faces'] + /* "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): */ /* 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_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":50 +/* "DracoPy.pyx":104 * * @property - * def normals(self): # <<<<<<<<<<<<<< - * return self.data_struct['normals'] + * def num_axes(self): # <<<<<<<<<<<<<< + * return 3 * */ /* 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) { +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("normals (wrapper)", 0); - __pyx_r = __pyx_pf_7DracoPy_9DracoMesh_2normals(__pyx_self, ((PyObject *)__pyx_v_self)); + __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_9DracoMesh_2normals(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { +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 - 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); + __Pyx_RefNannySetupContext("num_axes", 0); - /* "DracoPy.pyx":51 + /* "DracoPy.pyx":105 * @property - * def normals(self): - * return self.data_struct['normals'] # <<<<<<<<<<<<<< + * def num_axes(self): + * return 3 # <<<<<<<<<<<<<< + * * - * 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, 51, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_normals); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __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_INCREF(__pyx_int_3); + __pyx_r = __pyx_int_3; goto __pyx_L0; - /* "DracoPy.pyx":50 + /* "DracoPy.pyx":104 * * @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_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "DracoPy.pyx":54 + * def num_axes(self): # <<<<<<<<<<<<<< + * return 3 * - * 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_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_quantization_range = 0; - PyObject *__pyx_v_quantization_origin = 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); - { - 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 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_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_quantization_bits)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); __PYX_ERR(0, 54, __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, 54, __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("__init__", 1, 4, 4, 3); __PYX_ERR(0, 54, __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, 54, __pyx_L3_error) - } - } 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_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("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 54, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("DracoPy.EncodingOptions.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + */ + + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __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); + return __pyx_r; +} + +/* "DracoPy.pyx":116 + * + * + * 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_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__create_empty_geometry_metadata(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3166,68 +4506,56 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions___init__(CYTHON_UNUSED PyOb int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); - - /* "DracoPy.pyx":55 - * 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, 55, __pyx_L1_error) + __Pyx_RefNannySetupContext("_create_empty_geometry_metadata", 0); - /* "DracoPy.pyx":56 - * 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) + /* "DracoPy.pyx":117 + * + * def _create_empty_geometry_metadata() -> GeometryMetadataObject: + * return { # <<<<<<<<<<<<<< + * "metadata_id": 0, + * "generic_attributes": [], */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_quantization_range, __pyx_v_quantization_range) < 0) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); - /* "DracoPy.pyx":57 - * 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":118 + * def _create_empty_geometry_metadata() -> GeometryMetadataObject: + * return { + * "metadata_id": 0, # <<<<<<<<<<<<<< + * "generic_attributes": [], + * } */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin, __pyx_v_quantization_origin) < 0) __PYX_ERR(0, 57, __pyx_L1_error) + __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_s_metadata_id, __pyx_int_0) < 0) __PYX_ERR(0, 118, __pyx_L1_error) - /* "DracoPy.pyx":58 - * self.quantization_range = quantization_range - * self.quantization_origin = quantization_origin - * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) # <<<<<<<<<<<<<< + /* "DracoPy.pyx":119 + * return { + * "metadata_id": 0, + * "generic_attributes": [], # <<<<<<<<<<<<<< + * } * - * def get_encoded_coordinate(self, value, axis): */ - __pyx_t_1 = __Pyx_PyNumber_PowerOf2(__pyx_int_2, __pyx_v_quantization_bits, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 58, __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, 58, __pyx_L1_error) + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 119, __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, 58, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_generic_attributes, __pyx_t_2) < 0) __PYX_ERR(0, 118, __pyx_L1_error) __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, 58, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "DracoPy.pyx":54 + /* "DracoPy.pyx":116 * - * class EncodingOptions(object): - * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< - * self.quantization_bits = quantization_bits - * self.quantization_range = quantization_range + * + * def _create_empty_geometry_metadata() -> GeometryMetadataObject: # <<<<<<<<<<<<<< + * return { + * "metadata_id": 0, */ /* 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_AddTraceback("DracoPy.EncodingOptions.__init__", __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); @@ -3235,684 +4563,793 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions___init__(CYTHON_UNUSED PyOb return __pyx_r; } -/* "DracoPy.pyx":60 - * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) +/* "DracoPy.pyx":123 * - * 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') + * + * def _create_empty_metadata() -> MetadataObject: # <<<<<<<<<<<<<< + * return { + * "entries": {}, */ /* 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_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("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, 60, __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, 60, __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, 60, __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, 60, __pyx_L3_error) - __pyx_L3_error:; - __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_15EncodingOptions_2get_encoded_coordinate(__pyx_self, __pyx_v_self, __pyx_v_value, __pyx_v_axis); + __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_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; +static PyObject *__pyx_pf_7DracoPy_2_create_empty_metadata(CYTHON_UNUSED PyObject *__pyx_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); - - /* "DracoPy.pyx":61 - * - * 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_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 61, __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, 61, __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, 61, __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, 61, __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, 61, __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, 61, __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, 61, __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, 61, __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, 61, __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, 61, __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":62 - * 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, 62, __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, 62, __pyx_L1_error) - - /* "DracoPy.pyx":61 - * - * 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":63 - * 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_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 63, __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, 63, __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, 63, __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":64 - * 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_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_floor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 64, __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, 64, __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, 64, __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, 64, __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, 64, __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":65 - * 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) # <<<<<<<<<<<<<< + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_create_empty_metadata", 0); + + /* "DracoPy.pyx":124 * - * def get_encoded_point(self, point): + * def _create_empty_metadata() -> MetadataObject: + * return { # <<<<<<<<<<<<<< + * "entries": {}, + * "sub_metadata_ids": {} */ __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, 65, __pyx_L1_error) + + /* "DracoPy.pyx":125 + * def _create_empty_metadata() -> MetadataObject: + * return { + * "entries": {}, # <<<<<<<<<<<<<< + * "sub_metadata_ids": {} + * } + */ + __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); - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_axis); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_entries, __pyx_t_2) < 0) __PYX_ERR(0, 125, __pyx_L1_error) __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, 65, __pyx_L1_error) + + /* "DracoPy.pyx":126 + * return { + * "entries": {}, + * "sub_metadata_ids": {} # <<<<<<<<<<<<<< + * } + * + */ + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 126, __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, 65, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_sub_metadata_ids, __pyx_t_2) < 0) __PYX_ERR(0, 125, __pyx_L1_error) __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, 65, __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; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; - /* "DracoPy.pyx":60 - * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) + /* "DracoPy.pyx":123 * - * 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') + * + * def _create_empty_metadata() -> MetadataObject: # <<<<<<<<<<<<<< + * return { + * "entries": {}, */ /* 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._create_empty_metadata", __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":67 - * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) +/* "DracoPy.pyx":130 * - * def get_encoded_point(self, point): # <<<<<<<<<<<<<< - * encoded_point = [] - * for axis in range(self.num_axes): + * + * cdef Encoder _generate_encoder_and_update_metadata( # <<<<<<<<<<<<<< + * int quantization_bits, + * int compression_level, */ -/* 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; - } - 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, 67, __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, 67, __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, 67, __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); - - /* 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; - 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 PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - PyObject *(*__pyx_t_4)(PyObject *); + 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; int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - int __pyx_t_10; + 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("get_encoded_point", 0); + __Pyx_RefNannySetupContext("_generate_encoder_and_update_metadata", 0); - /* "DracoPy.pyx":68 - * - * 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)) + /* "DracoPy.pyx":137 + * vector[MetadataObject]& metadatas, + * GeometryMetadataObject& geometry_metadata): + * encoder = Encoder() # <<<<<<<<<<<<<< + * speed = 10 - compression_level + * encoder.SetSpeedOptions(speed, speed) */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 68, __pyx_L1_error) + __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_encoded_point = ((PyObject*)__pyx_t_1); + __pyx_v_encoder = ((struct __pyx_obj_7DracoPy_Encoder *)__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":69 - * 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 + /* "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_GetAttrStr(__pyx_v_self, __pyx_n_s_num_axes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 69, __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, 69, __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_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, 69, __pyx_L1_error) + __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; + } + } + #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_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; } __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, 69, __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, 69, __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, 69, __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, 69, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "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_v_to_create_quantization_metadata = (!(__pyx_v_metadatas.empty() != 0)); + + /* "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_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["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["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["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_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":145 + * metadata = &metadatas[geometry_metadata.metadata_id] + * metadata.entries["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_7, function); + __pyx_t_6 = 1; } - } 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, 69, __pyx_L1_error) - } - break; + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_7)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_s_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_s_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_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_kp_s_i); + __Pyx_GIVEREF(__pyx_kp_s_i); + PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_kp_s_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_XDECREF_SET(__pyx_v_axis, __pyx_t_2); - __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "DracoPy.pyx":70 - * encoded_point = [] - * for axis in range(self.num_axes): - * encoded_point.append(self.get_encoded_coordinate(point[axis], axis)) # <<<<<<<<<<<<<< - * return encoded_point - * + /* "DracoPy.pyx":144 + * if to_create_quantization_metadata: + * metadata = &metadatas[geometry_metadata.metadata_id] + * metadata.entries["quantization_bits"] = struct.pack( # <<<<<<<<<<<<<< + * "=i", quantization_bits) + * if quantization_origin.empty() or quantization_range == -1: */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_encoded_coordinate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 70, __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, 70, __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_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["quantization_bits"] = struct.pack( + */ + } + + /* "DracoPy.pyx":146 + * metadata.entries["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: + */ + __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); + + /* "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_5, function); - __pyx_t_8 = 1; + __Pyx_DECREF_SET(__pyx_t_7, function); + __pyx_t_6 = 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, 70, __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; + 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_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, 70, __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; + 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_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 70, __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_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_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, 70, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __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_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, 70, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":69 - * 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 + /* "DracoPy.pyx":146 + * metadata.entries["quantization_bits"] = struct.pack( + * "=i", quantization_bits) + * if quantization_origin.empty() or quantization_range == -1: # <<<<<<<<<<<<<< + * encoder.SetAttributeQuantization( + * GeometryAttributeType.POSITION, quantization_bits) */ + goto __pyx_L4; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":71 - * for axis in range(self.num_axes): - * encoded_point.append(self.get_encoded_coordinate(point[axis], axis)) - * return encoded_point # <<<<<<<<<<<<<< - * - * @property + /* "DracoPy.pyx":150 + * GeometryAttributeType.POSITION, quantization_bits) + * else: + * encoder.SetAttributeExplicitQuantization( # <<<<<<<<<<<<<< + * GeometryAttributeType.POSITION, quantization_bits, + * quantization_range, quantization_origin) */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_encoded_point); - __pyx_r = __pyx_v_encoded_point; - goto __pyx_L0; + /*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); - /* "DracoPy.pyx":67 - * 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":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); - /* 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":74 - * - * @property - * def num_axes(self): # <<<<<<<<<<<<<< - * return 3 - * + /* "DracoPy.pyx":152 + * encoder.SetAttributeExplicitQuantization( + * GeometryAttributeType.POSITION, quantization_bits, + * quantization_range, quantization_origin) # <<<<<<<<<<<<<< + * if to_create_quantization_metadata: + * metadata.entries["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; -/* 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":153 + * GeometryAttributeType.POSITION, quantization_bits, + * quantization_range, quantization_origin) + * if to_create_quantization_metadata: # <<<<<<<<<<<<<< + * metadata.entries["quantization_range"] = struct.pack( + * "=d", quantization_range) + */ + __pyx_t_8 = (__pyx_v_to_create_quantization_metadata != 0); + if (__pyx_t_8) { - /* "DracoPy.pyx":75 - * @property - * def num_axes(self): - * return 3 # <<<<<<<<<<<<<< - * - * class FileTypeException(Exception): + /* "DracoPy.pyx":154 + * quantization_range, quantization_origin) + * if to_create_quantization_metadata: + * metadata.entries["quantization_range"] = struct.pack( # <<<<<<<<<<<<<< + * "=d", quantization_range) + * metadata.entries["quantization_origin"] = struct.pack( */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_int_3); - __pyx_r = __pyx_int_3; - goto __pyx_L0; + __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; - /* "DracoPy.pyx":74 - * - * @property - * def num_axes(self): # <<<<<<<<<<<<<< - * return 3 - * + /* "DracoPy.pyx":155 + * if to_create_quantization_metadata: + * metadata.entries["quantization_range"] = struct.pack( + * "=d", quantization_range) # <<<<<<<<<<<<<< + * metadata.entries["quantization_origin"] = struct.pack( + * "=ddd", */ + __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; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_13)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_s_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_s_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; + } + __Pyx_INCREF(__pyx_kp_s_d); + __Pyx_GIVEREF(__pyx_kp_s_d); + PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_kp_s_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_DECREF(__pyx_t_13); __pyx_t_13 = 0; - /* function exit code */ - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "DracoPy.pyx":154 + * quantization_range, quantization_origin) + * if to_create_quantization_metadata: + * metadata.entries["quantization_range"] = struct.pack( # <<<<<<<<<<<<<< + * "=d", quantization_range) + * metadata.entries["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["quantization_range"] = struct.pack( + * "=d", quantization_range) + * metadata.entries["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["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); -/* "DracoPy.pyx":83 - * pass + /* "DracoPy.pyx":160 + * quantization_origin[0], + * quantization_origin[1], + * quantization_origin[2]) # <<<<<<<<<<<<<< + * return encoder * - * def create_empty_geometry_metadata() -> dict: # <<<<<<<<<<<<<< - * return { - * "metadata_id": 0, */ + __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_s_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_s_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_s_ddd); + __Pyx_GIVEREF(__pyx_kp_s_ddd); + PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_kp_s_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; -/* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_1create_empty_geometry_metadata(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_1create_empty_geometry_metadata = {"create_empty_geometry_metadata", (PyCFunction)__pyx_pw_7DracoPy_1create_empty_geometry_metadata, METH_NOARGS, 0}; -static PyObject *__pyx_pw_7DracoPy_1create_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_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":84 - * - * def create_empty_geometry_metadata() -> dict: - * return { # <<<<<<<<<<<<<< - * "metadata_id": 0, - * "generic_attributes": [], + /* "DracoPy.pyx":156 + * metadata.entries["quantization_range"] = struct.pack( + * "=d", quantization_range) + * metadata.entries["quantization_origin"] = struct.pack( # <<<<<<<<<<<<<< + * "=ddd", + * quantization_origin[0], */ - __Pyx_XDECREF(__pyx_r); + __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":85 - * def create_empty_geometry_metadata() -> dict: - * return { - * "metadata_id": 0, # <<<<<<<<<<<<<< - * "generic_attributes": [], - * } + /* "DracoPy.pyx":153 + * GeometryAttributeType.POSITION, quantization_bits, + * quantization_range, quantization_origin) + * if to_create_quantization_metadata: # <<<<<<<<<<<<<< + * metadata.entries["quantization_range"] = struct.pack( + * "=d", quantization_range) */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_metadata_id, __pyx_int_0) < 0) __PYX_ERR(0, 85, __pyx_L1_error) + } + } + __pyx_L4:; - /* "DracoPy.pyx":86 - * return { - * "metadata_id": 0, - * "generic_attributes": [], # <<<<<<<<<<<<<< - * } + /* "DracoPy.pyx":161 + * quantization_origin[1], + * quantization_origin[2]) + * return encoder # <<<<<<<<<<<<<< * + * def encode_mesh_to_buffer(points, faces, */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 86, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_generic_attributes, __pyx_t_2) < 0) __PYX_ERR(0, 85, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_encoder)); + __pyx_r = __pyx_v_encoder; goto __pyx_L0; - /* "DracoPy.pyx":83 - * pass + /* "DracoPy.pyx":130 * - * def create_empty_geometry_metadata() -> dict: # <<<<<<<<<<<<<< - * return { - * "metadata_id": 0, + * + * 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_AddTraceback("DracoPy.create_empty_geometry_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __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_XGIVEREF(__pyx_r); + __Pyx_XDECREF((PyObject *)__pyx_v_encoder); + __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "DracoPy.pyx":89 - * } +/* "DracoPy.pyx":163 + * return encoder * * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< * quantization_bits=14, @@ -3920,9 +5357,10 @@ static PyObject *__pyx_pf_7DracoPy_create_empty_geometry_metadata(CYTHON_UNUSED */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_3encode_mesh_to_buffer = {"encode_mesh_to_buffer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_3encode_mesh_to_buffer, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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; @@ -3930,8 +5368,6 @@ static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, PyObject *__pyx_v_quantization_range = 0; PyObject *__pyx_v_quantization_origin = 0; PyObject *__pyx_v_create_metadata = 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; @@ -3939,55 +5375,33 @@ static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, __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,&__pyx_n_s_metadatas,&__pyx_n_s_geometry_metadata,0}; - PyObject* values[9] = {0,0,0,0,0,0,0,0,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); - /* "DracoPy.pyx":93 + /* "DracoPy.pyx":167 * compression_level=1, * quantization_range=-1, * quantization_origin=None, # <<<<<<<<<<<<<< * create_metadata=False, - * metadatas = None, + * ): */ values[5] = ((PyObject *)Py_None); - /* "DracoPy.pyx":94 + /* "DracoPy.pyx":168 * quantization_range=-1, * quantization_origin=None, * create_metadata=False, # <<<<<<<<<<<<<< - * metadatas = None, - * geometry_metadata = None, - */ - values[6] = ((PyObject *)Py_False); - - /* "DracoPy.pyx":95 - * quantization_origin=None, - * create_metadata=False, - * metadatas = None, # <<<<<<<<<<<<<< - * geometry_metadata = None, - * ): - */ - values[7] = ((PyObject *)Py_None); - - /* "DracoPy.pyx":96 - * create_metadata=False, - * metadatas = None, - * geometry_metadata = None, # <<<<<<<<<<<<<< * ): - * return encode_to_buffer(points, faces, quantization_bits, compression_level, + * """ */ - values[8] = ((PyObject *)Py_None); + 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 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); @@ -4014,7 +5428,7 @@ static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, 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, 9, 1); __PYX_ERR(0, 89, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 2, 7, 1); __PYX_ERR(0, 163, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -4046,28 +5460,12 @@ static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_create_metadata); if (value) { values[6] = value; kw_args--; } } - CYTHON_FALLTHROUGH; - case 7: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_metadatas); - if (value) { values[7] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 8: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geometry_metadata); - if (value) { values[8] = 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, 89, __pyx_L3_error) + 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 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); CYTHON_FALLTHROUGH; case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); @@ -4091,21 +5489,19 @@ static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, __pyx_v_quantization_range = values[4]; __pyx_v_quantization_origin = values[5]; __pyx_v_create_metadata = values[6]; - __pyx_v_metadatas = values[7]; - __pyx_v_geometry_metadata = values[8]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 2, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 89, __pyx_L3_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_2encode_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_v_metadatas, __pyx_v_geometry_metadata); + __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); - /* "DracoPy.pyx":89 - * } + /* "DracoPy.pyx":163 + * return encoder * * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< * quantization_bits=14, @@ -4117,39 +5513,41 @@ static PyObject *__pyx_pw_7DracoPy_3encode_mesh_to_buffer(PyObject *__pyx_self, return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_2encode_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, PyObject *__pyx_v_metadatas, PyObject *__pyx_v_geometry_metadata) { +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; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = 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("encode_mesh_to_buffer", 0); - /* "DracoPy.pyx":98 - * geometry_metadata = None, - * ): - * return encode_to_buffer(points, faces, quantization_bits, compression_level, # <<<<<<<<<<<<<< - * quantization_range, quantization_origin, - * create_metadata, metadatas, geometry_metadata) + /* "DracoPy.pyx":191 + * :return bytes: encoded mesh + * """ + * cdef GeometryMetadataObject geometry_metadata = _create_empty_geometry_metadata() # <<<<<<<<<<<<<< + * cdef vector[MetadataObject] metadatas + * if create_metadata: */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode_to_buffer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 98, __pyx_L1_error) + __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); - - /* "DracoPy.pyx":100 - * return encode_to_buffer(points, faces, quantization_bits, compression_level, - * quantization_range, quantization_origin, - * create_metadata, metadatas, geometry_metadata) # <<<<<<<<<<<<<< - * - * - */ __pyx_t_3 = NULL; - __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { @@ -4157,69 +5555,205 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_4 = 1; + } + } + __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_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[10] = {__pyx_t_3, __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_v_metadatas, __pyx_v_geometry_metadata}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 9+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + 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[10] = {__pyx_t_3, __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_v_metadatas, __pyx_v_geometry_metadata}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 9+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + 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_5 = PyTuple_New(9+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 98, __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_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_5, 0+__pyx_t_4, __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_5, 1+__pyx_t_4, __pyx_v_faces); - __Pyx_INCREF(__pyx_v_quantization_bits); - __Pyx_GIVEREF(__pyx_v_quantization_bits); - PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_quantization_bits); - __Pyx_INCREF(__pyx_v_compression_level); - __Pyx_GIVEREF(__pyx_v_compression_level); - PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_v_compression_level); - __Pyx_INCREF(__pyx_v_quantization_range); - __Pyx_GIVEREF(__pyx_v_quantization_range); - PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_4, __pyx_v_quantization_range); - __Pyx_INCREF(__pyx_v_quantization_origin); - __Pyx_GIVEREF(__pyx_v_quantization_origin); - PyTuple_SET_ITEM(__pyx_t_5, 5+__pyx_t_4, __pyx_v_quantization_origin); - __Pyx_INCREF(__pyx_v_create_metadata); - __Pyx_GIVEREF(__pyx_v_create_metadata); - PyTuple_SET_ITEM(__pyx_t_5, 6+__pyx_t_4, __pyx_v_create_metadata); - __Pyx_INCREF(__pyx_v_metadatas); - __Pyx_GIVEREF(__pyx_v_metadatas); - PyTuple_SET_ITEM(__pyx_t_5, 7+__pyx_t_4, __pyx_v_metadatas); - __Pyx_INCREF(__pyx_v_geometry_metadata); - __Pyx_GIVEREF(__pyx_v_geometry_metadata); - PyTuple_SET_ITEM(__pyx_t_5, 8+__pyx_t_4, __pyx_v_geometry_metadata); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) + 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_5); __pyx_t_5 = 0; + __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; - /* "DracoPy.pyx":89 - * } + /* "DracoPy.pyx":163 + * return encoder * * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< * quantization_bits=14, @@ -4231,16 +5765,19 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); + __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; } -/* "DracoPy.pyx":103 +/* "DracoPy.pyx":206 * * * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< @@ -4249,17 +5786,16 @@ static PyObject *__pyx_pf_7DracoPy_2encode_mesh_to_buffer(CYTHON_UNUSED PyObject */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_5encode_point_cloud_to_buffer = {"encode_point_cloud_to_buffer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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; - PyObject *__pyx_v_metadatas = 0; - PyObject *__pyx_v_geometry_metadata = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -4267,55 +5803,33 @@ static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx __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,&__pyx_n_s_metadatas,&__pyx_n_s_geometry_metadata,0}; - PyObject* values[8] = {0,0,0,0,0,0,0,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":107 + /* "DracoPy.pyx":210 * compression_level=1, * quantization_range=-1, * quantization_origin=None, # <<<<<<<<<<<<<< - * create_metadata=False, - * metadatas = None, + * create_metadata=False + * ): */ values[4] = ((PyObject *)Py_None); - /* "DracoPy.pyx":108 + /* "DracoPy.pyx":211 * quantization_range=-1, * quantization_origin=None, - * create_metadata=False, # <<<<<<<<<<<<<< - * metadatas = None, - * geometry_metadata = None, - */ - values[5] = ((PyObject *)Py_False); - - /* "DracoPy.pyx":109 - * quantization_origin=None, - * create_metadata=False, - * metadatas = None, # <<<<<<<<<<<<<< - * geometry_metadata = None, - * ): - */ - values[6] = ((PyObject *)Py_None); - - /* "DracoPy.pyx":110 - * create_metadata=False, - * metadatas = None, - * geometry_metadata = None, # <<<<<<<<<<<<<< + * create_metadata=False # <<<<<<<<<<<<<< * ): - * return encode_to_buffer(points, None, quantization_bits, compression_level, + * """ */ - values[7] = ((PyObject *)Py_None); + 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 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - 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); @@ -4366,28 +5880,12 @@ static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_create_metadata); 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_metadatas); - if (value) { values[6] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 7: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geometry_metadata); - if (value) { values[7] = 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, 103, __pyx_L3_error) + 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 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - 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); @@ -4409,20 +5907,18 @@ static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx __pyx_v_quantization_range = values[3]; __pyx_v_quantization_origin = values[4]; __pyx_v_create_metadata = values[5]; - __pyx_v_metadatas = values[6]; - __pyx_v_geometry_metadata = values[7]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("encode_point_cloud_to_buffer", 0, 1, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 103, __pyx_L3_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_4encode_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_v_metadatas, __pyx_v_geometry_metadata); + __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":103 + /* "DracoPy.pyx":206 * * * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< @@ -4435,39 +5931,41 @@ static PyObject *__pyx_pw_7DracoPy_5encode_point_cloud_to_buffer(PyObject *__pyx return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_4encode_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, PyObject *__pyx_v_metadatas, PyObject *__pyx_v_geometry_metadata) { +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; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = 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("encode_point_cloud_to_buffer", 0); - /* "DracoPy.pyx":112 - * geometry_metadata = None, - * ): - * return encode_to_buffer(points, None, quantization_bits, compression_level, # <<<<<<<<<<<<<< - * quantization_range, quantization_origin, - * create_metadata, metadatas, geometry_metadata) + /* "DracoPy.pyx":232 + * :return bytes: encoded point cloud + * """ + * cdef GeometryMetadataObject geometry_metadata = _create_empty_geometry_metadata() # <<<<<<<<<<<<<< + * cdef vector[MetadataObject] metadatas + * if create_metadata: */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode_to_buffer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error) + __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); - - /* "DracoPy.pyx":114 - * return encode_to_buffer(points, None, quantization_bits, compression_level, - * quantization_range, quantization_origin, - * create_metadata, metadatas, geometry_metadata) # <<<<<<<<<<<<<< - * - * - */ __pyx_t_3 = NULL; - __pyx_t_4 = 0; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); if (likely(__pyx_t_3)) { @@ -4475,68 +5973,204 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_4 = 1; + } + } + __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_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[10] = {__pyx_t_3, __pyx_v_points, Py_None, __pyx_v_quantization_bits, __pyx_v_compression_level, __pyx_v_quantization_range, __pyx_v_quantization_origin, __pyx_v_create_metadata, __pyx_v_metadatas, __pyx_v_geometry_metadata}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 9+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + 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[10] = {__pyx_t_3, __pyx_v_points, Py_None, __pyx_v_quantization_bits, __pyx_v_compression_level, __pyx_v_quantization_range, __pyx_v_quantization_origin, __pyx_v_create_metadata, __pyx_v_metadatas, __pyx_v_geometry_metadata}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 9+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + 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_5 = PyTuple_New(9+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 112, __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_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_5, 0+__pyx_t_4, __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_5, 1+__pyx_t_4, Py_None); - __Pyx_INCREF(__pyx_v_quantization_bits); - __Pyx_GIVEREF(__pyx_v_quantization_bits); - PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_quantization_bits); - __Pyx_INCREF(__pyx_v_compression_level); - __Pyx_GIVEREF(__pyx_v_compression_level); - PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_v_compression_level); - __Pyx_INCREF(__pyx_v_quantization_range); - __Pyx_GIVEREF(__pyx_v_quantization_range); - PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_4, __pyx_v_quantization_range); - __Pyx_INCREF(__pyx_v_quantization_origin); - __Pyx_GIVEREF(__pyx_v_quantization_origin); - PyTuple_SET_ITEM(__pyx_t_5, 5+__pyx_t_4, __pyx_v_quantization_origin); - __Pyx_INCREF(__pyx_v_create_metadata); - __Pyx_GIVEREF(__pyx_v_create_metadata); - PyTuple_SET_ITEM(__pyx_t_5, 6+__pyx_t_4, __pyx_v_create_metadata); - __Pyx_INCREF(__pyx_v_metadatas); - __Pyx_GIVEREF(__pyx_v_metadatas); - PyTuple_SET_ITEM(__pyx_t_5, 7+__pyx_t_4, __pyx_v_metadatas); - __Pyx_INCREF(__pyx_v_geometry_metadata); - __Pyx_GIVEREF(__pyx_v_geometry_metadata); - PyTuple_SET_ITEM(__pyx_t_5, 8+__pyx_t_4, __pyx_v_geometry_metadata); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) + 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_5); __pyx_t_5 = 0; + __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; - /* "DracoPy.pyx":103 + /* "DracoPy.pyx":206 * * * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< @@ -4549,35 +6183,34 @@ static PyObject *__pyx_pf_7DracoPy_4encode_point_cloud_to_buffer(CYTHON_UNUSED P __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); + __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; } -/* "DracoPy.pyx":117 +/* "DracoPy.pyx":247 * * * def encode_to_buffer(points: List[float], # <<<<<<<<<<<<<< * faces: List[int] = None, - * quantization_bits=14, + * encoder: Encoder = Encoder(), */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_7encode_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7DracoPy_6encode_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 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 :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 exists in 'metadatas' fields\n :return bytes: en""coded mesh\n "; -static PyMethodDef __pyx_mdef_7DracoPy_7encode_to_buffer = {"encode_to_buffer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_7encode_to_buffer, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7DracoPy_6encode_to_buffer}; -static PyObject *__pyx_pw_7DracoPy_7encode_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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 exists in 'metadatas' fields\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; - 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; + struct __pyx_obj_7DracoPy_Encoder *__pyx_v_encoder = 0; PyObject *__pyx_v_metadatas = 0; PyObject *__pyx_v_geometry_metadata = 0; int __pyx_lineno = 0; @@ -4587,68 +6220,40 @@ static PyObject *__pyx_pw_7DracoPy_7encode_to_buffer(PyObject *__pyx_self, PyObj __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("encode_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,&__pyx_n_s_metadatas,&__pyx_n_s_geometry_metadata,0}; - PyObject* values[9] = {0,0,0,0,0,0,0,0,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}; - /* "DracoPy.pyx":118 + /* "DracoPy.pyx":248 * * def encode_to_buffer(points: List[float], * faces: List[int] = None, # <<<<<<<<<<<<<< - * quantization_bits=14, - * compression_level=1, - */ - values[1] = ((PyObject *)Py_None); - values[2] = ((PyObject *)__pyx_int_14); - values[3] = ((PyObject *)__pyx_int_1); - values[4] = ((PyObject *)__pyx_int_neg_1); - - /* "DracoPy.pyx":122 - * compression_level=1, - * quantization_range=-1, - * quantization_origin=None, # <<<<<<<<<<<<<< - * create_metadata=False, - * metadatas = None, - */ - values[5] = ((PyObject *)Py_None); - - /* "DracoPy.pyx":123 - * quantization_range=-1, - * quantization_origin=None, - * create_metadata=False, # <<<<<<<<<<<<<< + * encoder: Encoder = Encoder(), * metadatas = None, - * geometry_metadata = None, */ - values[6] = ((PyObject *)Py_False); + values[1] = ((PyObject *)Py_None); + values[2] = (PyObject *)__pyx_k__4; - /* "DracoPy.pyx":124 - * quantization_origin=None, - * create_metadata=False, + /* "DracoPy.pyx":250 + * faces: List[int] = None, + * encoder: Encoder = Encoder(), * metadatas = None, # <<<<<<<<<<<<<< * geometry_metadata = None, * ): */ - values[7] = ((PyObject *)Py_None); + values[3] = ((PyObject *)Py_None); - /* "DracoPy.pyx":125 - * create_metadata=False, + /* "DracoPy.pyx":251 + * encoder: Encoder = Encoder(), * metadatas = None, * geometry_metadata = None, # <<<<<<<<<<<<<< * ): * """ */ - values[8] = ((PyObject *)Py_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 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - 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); @@ -4676,59 +6281,27 @@ static PyObject *__pyx_pw_7DracoPy_7encode_to_buffer(PyObject *__pyx_self, PyObj CYTHON_FALLTHROUGH; case 2: if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_bits); + 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_compression_level); + 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_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--; } - } - CYTHON_FALLTHROUGH; - case 7: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_metadatas); - if (value) { values[7] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 8: if (kw_args > 0) { PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geometry_metadata); - if (value) { values[8] = value; kw_args--; } + 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, 117, __pyx_L3_error) + 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 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - CYTHON_FALLTHROUGH; - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - CYTHON_FALLTHROUGH; - 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); @@ -4744,41 +6317,40 @@ static PyObject *__pyx_pw_7DracoPy_7encode_to_buffer(PyObject *__pyx_self, PyObj } __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_metadatas = values[7]; - __pyx_v_geometry_metadata = values[8]; + __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, 9, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 117, __pyx_L3_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:; - __pyx_r = __pyx_pf_7DracoPy_6encode_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_v_metadatas, __pyx_v_geometry_metadata); + 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":117 + /* "DracoPy.pyx":247 * * * def encode_to_buffer(points: List[float], # <<<<<<<<<<<<<< * faces: List[int] = None, - * quantization_bits=14, + * encoder: Encoder = Encoder(), */ /* function exit code */ + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_6encode_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, PyObject *__pyx_v_metadatas, PyObject *__pyx_v_geometry_metadata) { +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) { float *__pyx_v_quant_origin; - PyObject *__pyx_v_num_dims = NULL; - PyObject *__pyx_v_dim = NULL; struct DracoFunctions::EncodedObject __pyx_v_draco_encoded; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -4792,21 +6364,15 @@ static PyObject *__pyx_pf_7DracoPy_6encode_to_buffer(CYTHON_UNUSED PyObject *__p PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; - size_t __pyx_t_11; - PyObject *(*__pyx_t_12)(PyObject *); - float __pyx_t_13; - Py_ssize_t __pyx_t_14; - std::vector __pyx_t_15; - std::vector __pyx_t_16; - std::vector __pyx_t_17; - struct DracoFunctions::GeometryMetadataObject __pyx_t_18; - int __pyx_t_19; - int __pyx_t_20; - bool __pyx_t_21; - struct DracoFunctions::EncodedObject __pyx_t_22; - PyObject *__pyx_t_23 = NULL; - PyObject *__pyx_t_24 = NULL; - PyObject *__pyx_t_25 = 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; @@ -4814,7 +6380,7 @@ static PyObject *__pyx_pf_7DracoPy_6encode_to_buffer(CYTHON_UNUSED PyObject *__p __Pyx_INCREF(__pyx_v_metadatas); __Pyx_INCREF(__pyx_v_geometry_metadata); - /* "DracoPy.pyx":159 + /* "DracoPy.pyx":276 * :return bytes: encoded mesh * """ * if faces is None and isinstance(geometry_metadata, dict) and \ # <<<<<<<<<<<<<< @@ -4836,22 +6402,22 @@ static PyObject *__pyx_pf_7DracoPy_6encode_to_buffer(CYTHON_UNUSED PyObject *__p goto __pyx_L4_bool_binop_done; } - /* "DracoPy.pyx":160 + /* "DracoPy.pyx":277 * """ * if faces is None 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_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_geometry_metadata, __pyx_n_s_generic_attributes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 160, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_geometry_metadata, __pyx_n_s_generic_attributes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 277, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 160, __pyx_L1_error) + __pyx_t_5 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 277, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_2 = ((__pyx_t_5 > 0) != 0); __pyx_t_1 = __pyx_t_2; __pyx_L4_bool_binop_done:; - /* "DracoPy.pyx":159 + /* "DracoPy.pyx":276 * :return bytes: encoded mesh * """ * if faces is None and isinstance(geometry_metadata, dict) and \ # <<<<<<<<<<<<<< @@ -4860,20 +6426,20 @@ static PyObject *__pyx_pf_7DracoPy_6encode_to_buffer(CYTHON_UNUSED PyObject *__p */ if (unlikely(__pyx_t_1)) { - /* "DracoPy.pyx":161 + /* "DracoPy.pyx":278 * if faces is None 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_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 161, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 278, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 161, __pyx_L1_error) + __PYX_ERR(0, 278, __pyx_L1_error) - /* "DracoPy.pyx":159 + /* "DracoPy.pyx":276 * :return bytes: encoded mesh * """ * if faces is None and isinstance(geometry_metadata, dict) and \ # <<<<<<<<<<<<<< @@ -4882,7 +6448,7 @@ static PyObject *__pyx_pf_7DracoPy_6encode_to_buffer(CYTHON_UNUSED PyObject *__p */ } - /* "DracoPy.pyx":163 + /* "DracoPy.pyx":280 * raise RuntimeError("generic attributes encoding/decoding " * "is not supported for point cloud") * if metadatas is None: # <<<<<<<<<<<<<< @@ -4893,19 +6459,19 @@ static PyObject *__pyx_pf_7DracoPy_6encode_to_buffer(CYTHON_UNUSED PyObject *__p __pyx_t_2 = (__pyx_t_1 != 0); if (__pyx_t_2) { - /* "DracoPy.pyx":164 + /* "DracoPy.pyx":281 * "is not supported for point cloud") * if metadatas is None: * metadatas = [] # <<<<<<<<<<<<<< * if geometry_metadata is None: - * geometry_metadata = create_empty_geometry_metadata() + * geometry_metadata = _create_empty_geometry_metadata() */ - __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 164, __pyx_L1_error) + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 281, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF_SET(__pyx_v_metadatas, __pyx_t_4); __pyx_t_4 = 0; - /* "DracoPy.pyx":163 + /* "DracoPy.pyx":280 * raise RuntimeError("generic attributes encoding/decoding " * "is not supported for point cloud") * if metadatas is None: # <<<<<<<<<<<<<< @@ -4914,25 +6480,25 @@ static PyObject *__pyx_pf_7DracoPy_6encode_to_buffer(CYTHON_UNUSED PyObject *__p */ } - /* "DracoPy.pyx":165 + /* "DracoPy.pyx":282 * if metadatas is None: * metadatas = [] * if geometry_metadata is None: # <<<<<<<<<<<<<< - * geometry_metadata = create_empty_geometry_metadata() + * geometry_metadata = _create_empty_geometry_metadata() * cdef float* quant_origin = NULL */ __pyx_t_2 = (__pyx_v_geometry_metadata == Py_None); __pyx_t_1 = (__pyx_t_2 != 0); if (__pyx_t_1) { - /* "DracoPy.pyx":166 + /* "DracoPy.pyx":283 * metadatas = [] * if geometry_metadata is None: - * geometry_metadata = create_empty_geometry_metadata() # <<<<<<<<<<<<<< + * 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, 166, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_create_empty_geometry_metadata); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 283, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { @@ -4946,36 +6512,36 @@ static PyObject *__pyx_pf_7DracoPy_6encode_to_buffer(CYTHON_UNUSED PyObject *__p } __pyx_t_4 = (__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_4)) __PYX_ERR(0, 166, __pyx_L1_error) + if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 283, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF_SET(__pyx_v_geometry_metadata, __pyx_t_4); __pyx_t_4 = 0; - /* "DracoPy.pyx":165 + /* "DracoPy.pyx":282 * if metadatas is None: * metadatas = [] * if geometry_metadata is None: # <<<<<<<<<<<<<< - * geometry_metadata = create_empty_geometry_metadata() + * geometry_metadata = _create_empty_geometry_metadata() * cdef float* quant_origin = NULL */ } - /* "DracoPy.pyx":167 + /* "DracoPy.pyx":284 * if geometry_metadata is None: - * geometry_metadata = create_empty_geometry_metadata() + * geometry_metadata = _create_empty_geometry_metadata() * cdef float* quant_origin = NULL # <<<<<<<<<<<<<< * try: - * num_dims = 3 + * if isinstance(faces, list): */ __pyx_v_quant_origin = NULL; - /* "DracoPy.pyx":168 - * geometry_metadata = create_empty_geometry_metadata() + /* "DracoPy.pyx":285 + * geometry_metadata = _create_empty_geometry_metadata() * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< - * num_dims = 3 - * if quantization_origin is not None: + * if isinstance(faces, list): + * draco_encoded = DracoPy.encode_mesh(points, */ { __Pyx_PyThreadState_declare @@ -4986,329 +6552,135 @@ static PyObject *__pyx_pf_7DracoPy_6encode_to_buffer(CYTHON_UNUSED PyObject *__p __Pyx_XGOTREF(__pyx_t_10); /*try:*/ { - /* "DracoPy.pyx":169 + /* "DracoPy.pyx":286 * 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":170 - * 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_1 = (__pyx_v_quantization_origin != Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { - - /* "DracoPy.pyx":171 - * 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_4 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 171, __pyx_L9_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyNumber_Multiply(__pyx_t_4, __pyx_v_num_dims); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 171, __pyx_L9_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_11 = __Pyx_PyInt_As_size_t(__pyx_t_6); if (unlikely((__pyx_t_11 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 171, __pyx_L9_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_v_quant_origin = ((float *)PyMem_Malloc(__pyx_t_11)); - - /* "DracoPy.pyx":172 - * 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] - * if isinstance(faces, list): - */ - __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 172, __pyx_L9_error) - __Pyx_GOTREF(__pyx_t_6); - if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) { - __pyx_t_4 = __pyx_t_6; __Pyx_INCREF(__pyx_t_4); __pyx_t_5 = 0; - __pyx_t_12 = NULL; - } else { - __pyx_t_5 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 172, __pyx_L9_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_12 = Py_TYPE(__pyx_t_4)->tp_iternext; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 172, __pyx_L9_error) - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - for (;;) { - if (likely(!__pyx_t_12)) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_6); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 172, __pyx_L9_error) - #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 172, __pyx_L9_error) - __Pyx_GOTREF(__pyx_t_6); - #endif - } else { - if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_5); __Pyx_INCREF(__pyx_t_6); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 172, __pyx_L9_error) - #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 172, __pyx_L9_error) - __Pyx_GOTREF(__pyx_t_6); - #endif - } - } else { - __pyx_t_6 = __pyx_t_12(__pyx_t_4); - if (unlikely(!__pyx_t_6)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 172, __pyx_L9_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_6); - } - __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_6); - __pyx_t_6 = 0; - - /* "DracoPy.pyx":173 - * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) - * for dim in range(num_dims): - * quant_origin[dim] = quantization_origin[dim] # <<<<<<<<<<<<<< - * if isinstance(faces, list): - * draco_encoded = DracoPy.encode_mesh(points, - */ - __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 173, __pyx_L9_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_13 = __pyx_PyFloat_AsFloat(__pyx_t_6); if (unlikely((__pyx_t_13 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 173, __pyx_L9_error) - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_14 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_14 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 173, __pyx_L9_error) - (__pyx_v_quant_origin[__pyx_t_14]) = __pyx_t_13; - - /* "DracoPy.pyx":172 - * 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] - * if isinstance(faces, list): - */ - } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - - /* "DracoPy.pyx":170 - * 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":174 - * for dim in range(num_dims): - * quant_origin[dim] = quantization_origin[dim] * if isinstance(faces, list): # <<<<<<<<<<<<<< * draco_encoded = DracoPy.encode_mesh(points, * faces, */ - __pyx_t_2 = PyList_Check(__pyx_v_faces); - __pyx_t_1 = (__pyx_t_2 != 0); - if (__pyx_t_1) { + __pyx_t_1 = PyList_Check(__pyx_v_faces); + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { - /* "DracoPy.pyx":175 - * quant_origin[dim] = quantization_origin[dim] + /* "DracoPy.pyx":287 + * try: * if isinstance(faces, list): * draco_encoded = DracoPy.encode_mesh(points, # <<<<<<<<<<<<<< * faces, - * metadatas, + * encoder.this_encoder, */ - __pyx_t_15 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 175, __pyx_L9_error) + __pyx_t_11 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 287, __pyx_L9_error) - /* "DracoPy.pyx":176 + /* "DracoPy.pyx":288 * if isinstance(faces, list): * draco_encoded = DracoPy.encode_mesh(points, * faces, # <<<<<<<<<<<<<< + * encoder.this_encoder, * metadatas, - * geometry_metadata, */ - __pyx_t_16 = __pyx_convert_vector_from_py_uint32_t(__pyx_v_faces); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 176, __pyx_L9_error) + __pyx_t_12 = __pyx_convert_vector_from_py_uint32_t(__pyx_v_faces); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 288, __pyx_L9_error) - /* "DracoPy.pyx":177 - * draco_encoded = DracoPy.encode_mesh(points, + /* "DracoPy.pyx":290 * faces, + * encoder.this_encoder, * metadatas, # <<<<<<<<<<<<<< - * geometry_metadata, - * quantization_bits, - */ - __pyx_t_17 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_metadatas); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 177, __pyx_L9_error) - - /* "DracoPy.pyx":178 - * faces, - * metadatas, - * geometry_metadata, # <<<<<<<<<<<<<< - * quantization_bits, - * compression_level, + * geometry_metadata) + * else: */ - __pyx_t_18 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_geometry_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 178, __pyx_L9_error) + __pyx_t_13 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_metadatas); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 290, __pyx_L9_error) - /* "DracoPy.pyx":179 + /* "DracoPy.pyx":291 + * encoder.this_encoder, * metadatas, - * geometry_metadata, - * quantization_bits, # <<<<<<<<<<<<<< - * compression_level, - * quantization_range, - */ - __pyx_t_19 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_19 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 179, __pyx_L9_error) - - /* "DracoPy.pyx":180 - * geometry_metadata, - * quantization_bits, - * compression_level, # <<<<<<<<<<<<<< - * quantization_range, - * quant_origin, - */ - __pyx_t_20 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 180, __pyx_L9_error) - - /* "DracoPy.pyx":181 - * quantization_bits, - * compression_level, - * quantization_range, # <<<<<<<<<<<<<< - * quant_origin, - * create_metadata) - */ - __pyx_t_13 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_13 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 181, __pyx_L9_error) - - /* "DracoPy.pyx":183 - * quantization_range, - * quant_origin, - * create_metadata) # <<<<<<<<<<<<<< + * geometry_metadata) # <<<<<<<<<<<<<< * else: * draco_encoded = DracoPy.encode_point_cloud(points, */ - __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_21 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 183, __pyx_L9_error) + __pyx_t_14 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_geometry_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 291, __pyx_L9_error) - /* "DracoPy.pyx":175 - * quant_origin[dim] = quantization_origin[dim] + /* "DracoPy.pyx":287 + * try: * if isinstance(faces, list): * draco_encoded = DracoPy.encode_mesh(points, # <<<<<<<<<<<<<< * faces, - * metadatas, + * encoder.this_encoder, */ try { - __pyx_t_22 = DracoFunctions::encode_mesh(__pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_13, __pyx_v_quant_origin, __pyx_t_21); + __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, 175, __pyx_L9_error) + __PYX_ERR(0, 287, __pyx_L9_error) } - __pyx_v_draco_encoded = __pyx_t_22; + __pyx_v_draco_encoded = __pyx_t_15; - /* "DracoPy.pyx":174 - * for dim in range(num_dims): - * quant_origin[dim] = quantization_origin[dim] + /* "DracoPy.pyx":286 + * cdef float* quant_origin = NULL + * try: * if isinstance(faces, list): # <<<<<<<<<<<<<< * draco_encoded = DracoPy.encode_mesh(points, * faces, */ - goto __pyx_L18; + goto __pyx_L15; } - /* "DracoPy.pyx":185 - * create_metadata) + /* "DracoPy.pyx":293 + * geometry_metadata) * else: * draco_encoded = DracoPy.encode_point_cloud(points, # <<<<<<<<<<<<<< + * encoder.this_encoder, * metadatas, - * geometry_metadata, */ /*else*/ { - __pyx_t_15 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 185, __pyx_L9_error) + __pyx_t_11 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 293, __pyx_L9_error) - /* "DracoPy.pyx":186 - * else: + /* "DracoPy.pyx":295 * draco_encoded = DracoPy.encode_point_cloud(points, + * encoder.this_encoder, * metadatas, # <<<<<<<<<<<<<< - * geometry_metadata, - * quantization_bits, - */ - __pyx_t_17 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_metadatas); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 186, __pyx_L9_error) - - /* "DracoPy.pyx":187 - * draco_encoded = DracoPy.encode_point_cloud(points, - * metadatas, - * geometry_metadata, # <<<<<<<<<<<<<< - * quantization_bits, - * compression_level, + * geometry_metadata) + * if quant_origin != NULL: */ - __pyx_t_18 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_geometry_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 187, __pyx_L9_error) + __pyx_t_13 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_metadatas); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 295, __pyx_L9_error) - /* "DracoPy.pyx":188 + /* "DracoPy.pyx":296 + * encoder.this_encoder, * metadatas, - * geometry_metadata, - * quantization_bits, # <<<<<<<<<<<<<< - * compression_level, - * quantization_range, - */ - __pyx_t_20 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_20 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 188, __pyx_L9_error) - - /* "DracoPy.pyx":189 - * geometry_metadata, - * quantization_bits, - * compression_level, # <<<<<<<<<<<<<< - * quantization_range, - * quant_origin, - */ - __pyx_t_19 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_19 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 189, __pyx_L9_error) - - /* "DracoPy.pyx":190 - * quantization_bits, - * compression_level, - * quantization_range, # <<<<<<<<<<<<<< - * quant_origin, - * create_metadata) - */ - __pyx_t_13 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_13 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 190, __pyx_L9_error) - - /* "DracoPy.pyx":192 - * quantization_range, - * quant_origin, - * create_metadata) # <<<<<<<<<<<<<< + * geometry_metadata) # <<<<<<<<<<<<<< * if quant_origin != NULL: * PyMem_Free(quant_origin) */ - __pyx_t_21 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_21 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 192, __pyx_L9_error) + __pyx_t_14 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_geometry_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 296, __pyx_L9_error) - /* "DracoPy.pyx":185 - * create_metadata) + /* "DracoPy.pyx":293 + * geometry_metadata) * else: * draco_encoded = DracoPy.encode_point_cloud(points, # <<<<<<<<<<<<<< + * encoder.this_encoder, * metadatas, - * geometry_metadata, */ try { - __pyx_t_22 = DracoFunctions::encode_point_cloud(__pyx_t_15, __pyx_t_17, __pyx_t_18, __pyx_t_20, __pyx_t_19, __pyx_t_13, __pyx_v_quant_origin, __pyx_t_21); + __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, 185, __pyx_L9_error) + __PYX_ERR(0, 293, __pyx_L9_error) } - __pyx_v_draco_encoded = __pyx_t_22; + __pyx_v_draco_encoded = __pyx_t_15; } - __pyx_L18:; + __pyx_L15:; - /* "DracoPy.pyx":193 - * quant_origin, - * create_metadata) + /* "DracoPy.pyx":297 + * 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) { + __pyx_t_2 = ((__pyx_v_quant_origin != NULL) != 0); + if (__pyx_t_2) { - /* "DracoPy.pyx":194 - * create_metadata) + /* "DracoPy.pyx":298 + * geometry_metadata) * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< * if draco_encoded.encode_status == DracoPy.encoding_status.successful_encoding: @@ -5316,16 +6688,16 @@ static PyObject *__pyx_pf_7DracoPy_6encode_to_buffer(CYTHON_UNUSED PyObject *__p */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":193 - * quant_origin, - * create_metadata) + /* "DracoPy.pyx":297 + * metadatas, + * geometry_metadata) * if quant_origin != NULL: # <<<<<<<<<<<<<< * PyMem_Free(quant_origin) * if draco_encoded.encode_status == DracoPy.encoding_status.successful_encoding: */ } - /* "DracoPy.pyx":195 + /* "DracoPy.pyx":299 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if draco_encoded.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -5335,7 +6707,7 @@ static PyObject *__pyx_pf_7DracoPy_6encode_to_buffer(CYTHON_UNUSED PyObject *__p switch (__pyx_v_draco_encoded.encode_status) { case DracoFunctions::successful_encoding: - /* "DracoPy.pyx":196 + /* "DracoPy.pyx":300 * PyMem_Free(quant_origin) * if draco_encoded.encode_status == DracoPy.encoding_status.successful_encoding: * return bytes(draco_encoded.buffer) # <<<<<<<<<<<<<< @@ -5343,16 +6715,16 @@ static PyObject *__pyx_pf_7DracoPy_6encode_to_buffer(CYTHON_UNUSED PyObject *__p * raise EncodingFailedException('Invalid draco structure') */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_draco_encoded.buffer); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 196, __pyx_L9_error) + __pyx_t_4 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_draco_encoded.buffer); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 300, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 196, __pyx_L9_error) + __pyx_t_6 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 300, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_6; __pyx_t_6 = 0; goto __pyx_L13_try_return; - /* "DracoPy.pyx":195 + /* "DracoPy.pyx":299 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if draco_encoded.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -5362,14 +6734,14 @@ static PyObject *__pyx_pf_7DracoPy_6encode_to_buffer(CYTHON_UNUSED PyObject *__p break; case DracoFunctions::failed_during_encoding: - /* "DracoPy.pyx":198 + /* "DracoPy.pyx":302 * 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_4, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 198, __pyx_L9_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 302, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_4))) { @@ -5383,14 +6755,14 @@ static PyObject *__pyx_pf_7DracoPy_6encode_to_buffer(CYTHON_UNUSED PyObject *__p } __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_7, __pyx_kp_s_Invalid_draco_structure) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_Invalid_draco_structure); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 198, __pyx_L9_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 302, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_6, 0, 0, 0); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __PYX_ERR(0, 198, __pyx_L9_error) + __PYX_ERR(0, 302, __pyx_L9_error) - /* "DracoPy.pyx":197 + /* "DracoPy.pyx":301 * 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: # <<<<<<<<<<<<<< @@ -5401,12 +6773,12 @@ static PyObject *__pyx_pf_7DracoPy_6encode_to_buffer(CYTHON_UNUSED PyObject *__p default: break; } - /* "DracoPy.pyx":168 - * geometry_metadata = create_empty_geometry_metadata() + /* "DracoPy.pyx":285 + * geometry_metadata = _create_empty_geometry_metadata() * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< - * num_dims = 3 - * if quantization_origin is not None: + * if isinstance(faces, list): + * draco_encoded = DracoPy.encode_mesh(points, */ } __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; @@ -5418,7 +6790,7 @@ static PyObject *__pyx_pf_7DracoPy_6encode_to_buffer(CYTHON_UNUSED PyObject *__p __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "DracoPy.pyx":199 + /* "DracoPy.pyx":303 * elif draco_encoded.encode_status == DracoPy.encoding_status.failed_during_encoding: * raise EncodingFailedException('Invalid draco structure') * except EncodingFailedException: # <<<<<<<<<<<<<< @@ -5426,49 +6798,49 @@ static PyObject *__pyx_pf_7DracoPy_6encode_to_buffer(CYTHON_UNUSED PyObject *__p * except: */ __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_4, &__pyx_t_7); - __Pyx_GetModuleGlobalName(__pyx_t_23, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 199, __pyx_L11_except_error) - __Pyx_GOTREF(__pyx_t_23); - __pyx_t_19 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_6, __pyx_t_23); - __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 303, __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_4, __pyx_t_7); __pyx_t_6 = 0; __pyx_t_4 = 0; __pyx_t_7 = 0; - if (__pyx_t_19) { + if (__pyx_t_17) { __Pyx_AddTraceback("DracoPy.encode_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_4, &__pyx_t_6) < 0) __PYX_ERR(0, 199, __pyx_L11_except_error) + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_4, &__pyx_t_6) < 0) __PYX_ERR(0, 303, __pyx_L11_except_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_6); - /* "DracoPy.pyx":200 + /* "DracoPy.pyx":304 * raise EncodingFailedException('Invalid draco structure') * except EncodingFailedException: * raise EncodingFailedException('Invalid draco structure') # <<<<<<<<<<<<<< * except: * if quant_origin != NULL: */ - __Pyx_GetModuleGlobalName(__pyx_t_24, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_24)) __PYX_ERR(0, 200, __pyx_L11_except_error) - __Pyx_GOTREF(__pyx_t_24); - __pyx_t_25 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_24))) { - __pyx_t_25 = PyMethod_GET_SELF(__pyx_t_24); - if (likely(__pyx_t_25)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_24); - __Pyx_INCREF(__pyx_t_25); + __Pyx_GetModuleGlobalName(__pyx_t_18, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 304, __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_24, function); + __Pyx_DECREF_SET(__pyx_t_18, function); } } - __pyx_t_23 = (__pyx_t_25) ? __Pyx_PyObject_Call2Args(__pyx_t_24, __pyx_t_25, __pyx_kp_s_Invalid_draco_structure) : __Pyx_PyObject_CallOneArg(__pyx_t_24, __pyx_kp_s_Invalid_draco_structure); - __Pyx_XDECREF(__pyx_t_25); __pyx_t_25 = 0; - if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 200, __pyx_L11_except_error) - __Pyx_GOTREF(__pyx_t_23); - __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; - __Pyx_Raise(__pyx_t_23, 0, 0, 0); - __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - __PYX_ERR(0, 200, __pyx_L11_except_error) + __pyx_t_16 = (__pyx_t_19) ? __Pyx_PyObject_Call2Args(__pyx_t_18, __pyx_t_19, __pyx_kp_s_Invalid_draco_structure) : __Pyx_PyObject_CallOneArg(__pyx_t_18, __pyx_kp_s_Invalid_draco_structure); + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 304, __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, 304, __pyx_L11_except_error) } - /* "DracoPy.pyx":201 + /* "DracoPy.pyx":305 * except EncodingFailedException: * raise EncodingFailedException('Invalid draco structure') * except: # <<<<<<<<<<<<<< @@ -5477,22 +6849,22 @@ static PyObject *__pyx_pf_7DracoPy_6encode_to_buffer(CYTHON_UNUSED PyObject *__p */ /*except:*/ { __Pyx_AddTraceback("DracoPy.encode_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_4, &__pyx_t_7) < 0) __PYX_ERR(0, 201, __pyx_L11_except_error) + if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_4, &__pyx_t_7) < 0) __PYX_ERR(0, 305, __pyx_L11_except_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_7); - /* "DracoPy.pyx":202 + /* "DracoPy.pyx":306 * 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) { + __pyx_t_2 = ((__pyx_v_quant_origin != NULL) != 0); + if (__pyx_t_2) { - /* "DracoPy.pyx":203 + /* "DracoPy.pyx":307 * except: * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -5501,7 +6873,7 @@ static PyObject *__pyx_pf_7DracoPy_6encode_to_buffer(CYTHON_UNUSED PyObject *__p */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":202 + /* "DracoPy.pyx":306 * raise EncodingFailedException('Invalid draco structure') * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -5510,27 +6882,27 @@ static PyObject *__pyx_pf_7DracoPy_6encode_to_buffer(CYTHON_UNUSED PyObject *__p */ } - /* "DracoPy.pyx":204 + /* "DracoPy.pyx":308 * if quant_origin != NULL: * PyMem_Free(quant_origin) * raise ValueError("Input invalid") # <<<<<<<<<<<<<< * * def raise_decoding_error(decoding_status): */ - __pyx_t_23 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_23)) __PYX_ERR(0, 204, __pyx_L11_except_error) - __Pyx_GOTREF(__pyx_t_23); - __Pyx_Raise(__pyx_t_23, 0, 0, 0); - __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - __PYX_ERR(0, 204, __pyx_L11_except_error) + __pyx_t_16 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 308, __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, 308, __pyx_L11_except_error) } __pyx_L11_except_error:; - /* "DracoPy.pyx":168 - * geometry_metadata = create_empty_geometry_metadata() + /* "DracoPy.pyx":285 + * geometry_metadata = _create_empty_geometry_metadata() * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< - * num_dims = 3 - * if quantization_origin is not None: + * if isinstance(faces, list): + * draco_encoded = DracoPy.encode_mesh(points, */ __Pyx_XGIVEREF(__pyx_t_8); __Pyx_XGIVEREF(__pyx_t_9); @@ -5546,12 +6918,12 @@ static PyObject *__pyx_pf_7DracoPy_6encode_to_buffer(CYTHON_UNUSED PyObject *__p __pyx_L14_try_end:; } - /* "DracoPy.pyx":117 + /* "DracoPy.pyx":247 * * * def encode_to_buffer(points: List[float], # <<<<<<<<<<<<<< * faces: List[int] = None, - * quantization_bits=14, + * encoder: Encoder = Encoder(), */ /* function exit code */ @@ -5561,14 +6933,12 @@ static PyObject *__pyx_pf_7DracoPy_6encode_to_buffer(CYTHON_UNUSED PyObject *__p __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_23); - __Pyx_XDECREF(__pyx_t_24); - __Pyx_XDECREF(__pyx_t_25); + __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_num_dims); - __Pyx_XDECREF(__pyx_v_dim); __Pyx_XDECREF(__pyx_v_metadatas); __Pyx_XDECREF(__pyx_v_geometry_metadata); __Pyx_XGIVEREF(__pyx_r); @@ -5576,7 +6946,7 @@ static PyObject *__pyx_pf_7DracoPy_6encode_to_buffer(CYTHON_UNUSED PyObject *__p return __pyx_r; } -/* "DracoPy.pyx":206 +/* "DracoPy.pyx":310 * raise ValueError("Input invalid") * * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< @@ -5585,20 +6955,20 @@ static PyObject *__pyx_pf_7DracoPy_6encode_to_buffer(CYTHON_UNUSED PyObject *__p */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_9raise_decoding_error(PyObject *__pyx_self, PyObject *__pyx_v_decoding_status); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_9raise_decoding_error = {"raise_decoding_error", (PyCFunction)__pyx_pw_7DracoPy_9raise_decoding_error, METH_O, 0}; -static PyObject *__pyx_pw_7DracoPy_9raise_decoding_error(PyObject *__pyx_self, PyObject *__pyx_v_decoding_status) { +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_8raise_decoding_error(__pyx_self, ((PyObject *)__pyx_v_decoding_status)); + __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_8raise_decoding_error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_decoding_status) { +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; @@ -5610,29 +6980,29 @@ static PyObject *__pyx_pf_7DracoPy_8raise_decoding_error(CYTHON_UNUSED PyObject int __pyx_clineno = 0; __Pyx_RefNannySetupContext("raise_decoding_error", 0); - /* "DracoPy.pyx":207 + /* "DracoPy.pyx":311 * * 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, 207, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::not_draco_encoded); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 311, __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, 207, __pyx_L1_error) + __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, 311, __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, 207, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 311, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":208 + /* "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: * 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, 208, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FileTypeException); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 312, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { @@ -5646,14 +7016,14 @@ static PyObject *__pyx_pf_7DracoPy_8raise_decoding_error(CYTHON_UNUSED PyObject } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_kp_s_Input_mesh_is_not_draco_encoded) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_s_Input_mesh_is_not_draco_encoded); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 208, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 312, __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, 208, __pyx_L1_error) + __PYX_ERR(0, 312, __pyx_L1_error) - /* "DracoPy.pyx":207 + /* "DracoPy.pyx":311 * * def raise_decoding_error(decoding_status): * if decoding_status == DracoPy.decoding_status.not_draco_encoded: # <<<<<<<<<<<<<< @@ -5662,35 +7032,35 @@ static PyObject *__pyx_pf_7DracoPy_8raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":209 + /* "DracoPy.pyx":313 * 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, 209, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::failed_during_decoding); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 313, __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, 209, __pyx_L1_error) + __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, 313, __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, 209, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 313, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":210 + /* "DracoPy.pyx":314 * 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__4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 210, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 314, __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, 210, __pyx_L1_error) + __PYX_ERR(0, 314, __pyx_L1_error) - /* "DracoPy.pyx":209 + /* "DracoPy.pyx":313 * 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: # <<<<<<<<<<<<<< @@ -5699,35 +7069,35 @@ static PyObject *__pyx_pf_7DracoPy_8raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":211 + /* "DracoPy.pyx":315 * 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, 211, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::no_position_attribute); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 315, __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, 211, __pyx_L1_error) + __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, 315, __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, 211, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 315, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":212 + /* "DracoPy.pyx":316 * 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__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 212, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 316, __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, 212, __pyx_L1_error) + __PYX_ERR(0, 316, __pyx_L1_error) - /* "DracoPy.pyx":211 + /* "DracoPy.pyx":315 * 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: # <<<<<<<<<<<<<< @@ -5736,7 +7106,7 @@ static PyObject *__pyx_pf_7DracoPy_8raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":206 + /* "DracoPy.pyx":310 * raise ValueError("Input invalid") * * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< @@ -5759,7 +7129,7 @@ static PyObject *__pyx_pf_7DracoPy_8raise_decoding_error(CYTHON_UNUSED PyObject return __pyx_r; } -/* "DracoPy.pyx":214 +/* "DracoPy.pyx":318 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer, deduplicate=False): # <<<<<<<<<<<<<< @@ -5768,10 +7138,10 @@ static PyObject *__pyx_pf_7DracoPy_8raise_decoding_error(CYTHON_UNUSED PyObject */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_11decode_buffer_to_mesh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7DracoPy_10decode_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_11decode_buffer_to_mesh = {"decode_buffer_to_mesh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_11decode_buffer_to_mesh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7DracoPy_10decode_buffer_to_mesh}; -static PyObject *__pyx_pw_7DracoPy_11decode_buffer_to_mesh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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; @@ -5808,7 +7178,7 @@ static PyObject *__pyx_pw_7DracoPy_11decode_buffer_to_mesh(PyObject *__pyx_self, } } 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, 214, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode_buffer_to_mesh") < 0)) __PYX_ERR(0, 318, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -5824,20 +7194,20 @@ static PyObject *__pyx_pw_7DracoPy_11decode_buffer_to_mesh(PyObject *__pyx_self, } 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, 214, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decode_buffer_to_mesh", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 318, __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_10decode_buffer_to_mesh(__pyx_self, __pyx_v_buffer, __pyx_v_deduplicate); + __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_10decode_buffer_to_mesh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer, PyObject *__pyx_v_deduplicate) { +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 @@ -5855,25 +7225,25 @@ static PyObject *__pyx_pf_7DracoPy_10decode_buffer_to_mesh(CYTHON_UNUSED PyObjec int __pyx_clineno = 0; __Pyx_RefNannySetupContext("decode_buffer_to_mesh", 0); - /* "DracoPy.pyx":221 + /* "DracoPy.pyx":325 * :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, 221, __pyx_L1_error) - __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 221, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_deduplicate); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 221, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 325, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 325, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_deduplicate); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 325, __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, 221, __pyx_L1_error) + __PYX_ERR(0, 325, __pyx_L1_error) } __pyx_v_mesh_struct = __pyx_t_4; - /* "DracoPy.pyx":222 + /* "DracoPy.pyx":326 * """ * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< @@ -5883,7 +7253,7 @@ static PyObject *__pyx_pf_7DracoPy_10decode_buffer_to_mesh(CYTHON_UNUSED PyObjec __pyx_t_5 = ((__pyx_v_mesh_struct.decode_status == DracoFunctions::successful) != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":223 + /* "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) # <<<<<<<<<<<<<< @@ -5891,9 +7261,9 @@ static PyObject *__pyx_pf_7DracoPy_10decode_buffer_to_mesh(CYTHON_UNUSED PyObjec * 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, 223, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_DracoMesh); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 327, __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, 223, __pyx_L1_error) + __pyx_t_8 = __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(__pyx_v_mesh_struct); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 327, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { @@ -5908,14 +7278,14 @@ static PyObject *__pyx_pf_7DracoPy_10decode_buffer_to_mesh(CYTHON_UNUSED PyObjec __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, 223, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 327, __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":222 + /* "DracoPy.pyx":326 * """ * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< @@ -5924,7 +7294,7 @@ static PyObject *__pyx_pf_7DracoPy_10decode_buffer_to_mesh(CYTHON_UNUSED PyObjec */ } - /* "DracoPy.pyx":225 + /* "DracoPy.pyx":329 * return DracoMesh(mesh_struct) * else: * raise_decoding_error(mesh_struct.decode_status) # <<<<<<<<<<<<<< @@ -5932,9 +7302,9 @@ static PyObject *__pyx_pf_7DracoPy_10decode_buffer_to_mesh(CYTHON_UNUSED PyObjec * 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, 225, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_raise_decoding_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 329, __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, 225, __pyx_L1_error) + __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, 329, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { @@ -5949,13 +7319,13 @@ static PyObject *__pyx_pf_7DracoPy_10decode_buffer_to_mesh(CYTHON_UNUSED PyObjec __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, 225, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 329, __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":214 + /* "DracoPy.pyx":318 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer, deduplicate=False): # <<<<<<<<<<<<<< @@ -5979,7 +7349,7 @@ static PyObject *__pyx_pf_7DracoPy_10decode_buffer_to_mesh(CYTHON_UNUSED PyObjec return __pyx_r; } -/* "DracoPy.pyx":227 +/* "DracoPy.pyx":331 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer, deduplicate=False): # <<<<<<<<<<<<<< @@ -5988,10 +7358,10 @@ static PyObject *__pyx_pf_7DracoPy_10decode_buffer_to_mesh(CYTHON_UNUSED PyObjec */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_13decode_point_cloud_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7DracoPy_12decode_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_13decode_point_cloud_buffer = {"decode_point_cloud_buffer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_13decode_point_cloud_buffer, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7DracoPy_12decode_point_cloud_buffer}; -static PyObject *__pyx_pw_7DracoPy_13decode_point_cloud_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +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; @@ -6028,7 +7398,7 @@ static PyObject *__pyx_pw_7DracoPy_13decode_point_cloud_buffer(PyObject *__pyx_s } } 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, 227, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode_point_cloud_buffer") < 0)) __PYX_ERR(0, 331, __pyx_L3_error) } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -6044,20 +7414,20 @@ static PyObject *__pyx_pw_7DracoPy_13decode_point_cloud_buffer(PyObject *__pyx_s } 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, 227, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("decode_point_cloud_buffer", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 331, __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_12decode_point_cloud_buffer(__pyx_self, __pyx_v_buffer, __pyx_v_deduplicate); + __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_12decode_point_cloud_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer, PyObject *__pyx_v_deduplicate) { +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 @@ -6075,25 +7445,25 @@ static PyObject *__pyx_pf_7DracoPy_12decode_point_cloud_buffer(CYTHON_UNUSED PyO int __pyx_clineno = 0; __Pyx_RefNannySetupContext("decode_point_cloud_buffer", 0); - /* "DracoPy.pyx":234 + /* "DracoPy.pyx":338 * :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, 234, __pyx_L1_error) - __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 234, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_deduplicate); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 338, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 338, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_deduplicate); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 338, __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, 234, __pyx_L1_error) + __PYX_ERR(0, 338, __pyx_L1_error) } __pyx_v_point_cloud_struct = __pyx_t_4; - /* "DracoPy.pyx":235 + /* "DracoPy.pyx":339 * """ * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer), deduplicate) * if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< @@ -6103,7 +7473,7 @@ static PyObject *__pyx_pf_7DracoPy_12decode_point_cloud_buffer(CYTHON_UNUSED PyO __pyx_t_5 = ((__pyx_v_point_cloud_struct.decode_status == DracoFunctions::successful) != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":236 + /* "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) # <<<<<<<<<<<<<< @@ -6111,9 +7481,9 @@ static PyObject *__pyx_pf_7DracoPy_12decode_point_cloud_buffer(CYTHON_UNUSED PyO * 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, 236, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 340, __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, 236, __pyx_L1_error) + __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, 340, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = NULL; if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { @@ -6128,178 +7498,76 @@ static PyObject *__pyx_pf_7DracoPy_12decode_point_cloud_buffer(CYTHON_UNUSED PyO __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, 236, __pyx_L1_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 340, __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":235 - * """ - * 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":238 - * 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, 238, __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, 238, __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, 238, __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":227 - * 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 - * + /* "DracoPy.pyx":339 + * """ + * 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_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 + /* "DracoPy.pyx":342 + * 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, 342, __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, 342, __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, 342, __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; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "vector.from_py":49 - * for item in o: - * v.push_back(item) - * return v # <<<<<<<<<<<<<< - * + /* "DracoPy.pyx":331 + * raise_decoding_error(mesh_struct.decode_status) * + * def decode_point_cloud_buffer(buffer, deduplicate=False): # <<<<<<<<<<<<<< + * """ + * Decode buffer to point cloud */ - __pyx_r = __pyx_v_v; + + /* 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 +/* "vector.from_py":45 * * @cname("__pyx_convert_vector_from_py_float") * cdef vector[X] __pyx_convert_vector_from_py_float(object o) except *: # <<<<<<<<<<<<<< @@ -6307,35 +7575,23 @@ static std::vector __pyx_convert_vector_from_py_float(PyObject *__pyx_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; -} - -static std::vector __pyx_convert_vector_from_py_uint32_t(PyObject *__pyx_v_o) { - std::vector __pyx_v_v; +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; + 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; + float __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); + __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_float", 0); /* "vector.from_py":47 - * cdef vector[X] __pyx_convert_vector_from_py_uint32_t(object o) except *: + * cdef vector[X] __pyx_convert_vector_from_py_float(object o) except *: * cdef vector[X] v * for item in o: # <<<<<<<<<<<<<< * v.push_back(item) @@ -6390,11 +7646,11 @@ static std::vector __pyx_convert_vector_from_py_uint32_t(PyObject *__ * 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)); + __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_uint32_t(object o) except *: + * cdef vector[X] __pyx_convert_vector_from_py_float(object o) except *: * cdef vector[X] v * for item in o: # <<<<<<<<<<<<<< * v.push_back(item) @@ -6415,8 +7671,8 @@ static std::vector __pyx_convert_vector_from_py_uint32_t(PyObject *__ /* "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 *: # <<<<<<<<<<<<<< + * @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: */ @@ -6425,7 +7681,7 @@ static std::vector __pyx_convert_vector_from_py_uint32_t(PyObject *__ __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_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); @@ -6498,128 +7754,85 @@ static std::string __pyx_convert_string_from_py_std__in_string(PyObject *__pyx_v return __pyx_r; } -/* "map.from_py":174 +/* "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())] * - * @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; +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; - Py_ssize_t __pyx_t_2; - Py_ssize_t __pyx_t_3; - int __pyx_t_4; + size_t __pyx_t_2; + size_t __pyx_t_3; + size_t __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; + __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_double", 0); - /* "map.from_py":179 - * for key, value in d.iteritems(): - * m.insert(pair[X,Y](key, value)) - * return m # <<<<<<<<<<<<<< + /* "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_r = __pyx_v_m; + __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; - /* "map.from_py":174 + /* "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())] * - * @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_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_double", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_d); - __Pyx_XDECREF(__pyx_v_key); - __Pyx_XDECREF(__pyx_v_value); + __Pyx_XGIVEREF(__pyx_r); __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) { +/* "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; + std::unordered_map __pyx_v_m; PyObject *__pyx_v_key = NULL; PyObject *__pyx_v_value = NULL; - std::unordered_map __pyx_r; + std::unordered_map __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; @@ -6628,16 +7841,16 @@ static std::unordered_map __pyx_convert_unordered_map_fro PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; int __pyx_t_7; - std::string __pyx_t_8; - uint32_t __pyx_t_9; + 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_std_3a__3a_string__and_uint32_t", 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_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 *: + /* "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(): @@ -6683,9 +7896,9 @@ static std::unordered_map __pyx_convert_unordered_map_fro * 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_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; @@ -6701,8 +7914,8 @@ static std::unordered_map __pyx_convert_unordered_map_fro /* "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 *: # <<<<<<<<<<<<<< + * @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 */ @@ -6712,7 +7925,7 @@ static std::unordered_map __pyx_convert_unordered_map_fro __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_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); @@ -6724,16 +7937,16 @@ static std::unordered_map __pyx_convert_unordered_map_fro /* "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 *: # <<<<<<<<<<<<<< + * @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::MetadataObject __pyx_convert__from_py_struct__DracoFunctions_3a__3a_MetadataObject(PyObject *__pyx_v_obj) { - struct DracoFunctions::MetadataObject __pyx_v_result; +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::MetadataObject __pyx_r; + struct DracoFunctions::PointAttributeObject __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; @@ -6744,15 +7957,16 @@ static struct DracoFunctions::MetadataObject __pyx_convert__from_py_struct__Drac 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; + 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_MetadataObject", 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_MetadataObject(obj) except *: + * 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) @@ -6773,7 +7987,7 @@ static struct DracoFunctions::MetadataObject __pyx_convert__from_py_struct__Drac __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 __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) @@ -6785,7 +7999,7 @@ static struct DracoFunctions::MetadataObject __pyx_convert__from_py_struct__Drac * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) * * try: # <<<<<<<<<<<<<< - * value = obj['entries'] + * value = obj['data'] * except KeyError: */ { @@ -6800,11 +8014,11 @@ static struct DracoFunctions::MetadataObject __pyx_convert__from_py_struct__Drac /* "FromPyStructUtility":17 * * try: - * value = obj['entries'] # <<<<<<<<<<<<<< + * value = obj['data'] # <<<<<<<<<<<<<< * except KeyError: - * raise ValueError("No value specified for struct attribute 'entries'") + * raise ValueError("No value specified for struct attribute 'data'") */ - __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_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; @@ -6813,7 +8027,7 @@ static struct DracoFunctions::MetadataObject __pyx_convert__from_py_struct__Drac * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) * * try: # <<<<<<<<<<<<<< - * value = obj['entries'] + * value = obj['data'] * except KeyError: */ } @@ -6826,40 +8040,244 @@ static struct DracoFunctions::MetadataObject __pyx_convert__from_py_struct__Drac /* "FromPyStructUtility":18 * try: - * value = obj['entries'] + * value = obj['data'] * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'entries'") - * result.entries = value + * 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_MetadataObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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['entries'] + /* "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 'entries'") # <<<<<<<<<<<<<< - * result.entries = value + * raise ValueError("No value specified for struct attribute 'dimension'") # <<<<<<<<<<<<<< + * result.dimension = value * try: */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 19, __pyx_L6_except_error) + __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, 19, __pyx_L6_except_error) + __PYX_ERR(1, 29, __pyx_L22_except_error) } - goto __pyx_L6_except_error; - __pyx_L6_except_error:; + goto __pyx_L22_except_error; + __pyx_L22_except_error:; - /* "FromPyStructUtility":16 - * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) - * + /* "FromPyStructUtility":26 + * raise ValueError("No value specified for struct attribute 'datatype'") + * result.datatype = value * try: # <<<<<<<<<<<<<< - * value = obj['entries'] + * value = obj['dimension'] * except KeyError: */ __Pyx_XGIVEREF(__pyx_t_3); @@ -6867,24 +8285,24 @@ static struct DracoFunctions::MetadataObject __pyx_convert__from_py_struct__Drac __Pyx_XGIVEREF(__pyx_t_5); __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); goto __pyx_L1_error; - __pyx_L9_try_end:; + __pyx_L25_try_end:; } - /* "FromPyStructUtility":20 + /* "FromPyStructUtility":30 * except KeyError: - * raise ValueError("No value specified for struct attribute 'entries'") - * result.entries = value # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'dimension'") + * result.dimension = value # <<<<<<<<<<<<<< * try: - * value = obj['sub_metadata_ids'] + * value = obj['metadata_id'] */ - __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; + __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":21 - * raise ValueError("No value specified for struct attribute 'entries'") - * result.entries = value + /* "FromPyStructUtility":31 + * raise ValueError("No value specified for struct attribute 'dimension'") + * result.dimension = value * try: # <<<<<<<<<<<<<< - * value = obj['sub_metadata_ids'] + * value = obj['metadata_id'] * except KeyError: */ { @@ -6896,72 +8314,72 @@ static struct DracoFunctions::MetadataObject __pyx_convert__from_py_struct__Drac __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { - /* "FromPyStructUtility":22 - * result.entries = value + /* "FromPyStructUtility":32 + * result.dimension = value * try: - * value = obj['sub_metadata_ids'] # <<<<<<<<<<<<<< + * value = obj['metadata_id'] # <<<<<<<<<<<<<< * except KeyError: - * raise ValueError("No value specified for struct attribute 'sub_metadata_ids'") + * raise ValueError("No value specified for struct attribute 'metadata_id'") */ - __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_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":21 - * raise ValueError("No value specified for struct attribute 'entries'") - * result.entries = value + /* "FromPyStructUtility":31 + * raise ValueError("No value specified for struct attribute 'dimension'") + * result.dimension = value * try: # <<<<<<<<<<<<<< - * value = obj['sub_metadata_ids'] + * 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_L17_try_end; - __pyx_L12_error:; + 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":23 + /* "FromPyStructUtility":33 * try: - * value = obj['sub_metadata_ids'] + * value = obj['metadata_id'] * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'sub_metadata_ids'") - * result.sub_metadata_ids = value + * 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_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_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":24 - * value = obj['sub_metadata_ids'] + /* "FromPyStructUtility":34 + * value = obj['metadata_id'] * except KeyError: - * raise ValueError("No value specified for struct attribute 'sub_metadata_ids'") # <<<<<<<<<<<<<< - * result.sub_metadata_ids = value + * 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__7, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 24, __pyx_L14_except_error) + __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, 24, __pyx_L14_except_error) + __PYX_ERR(1, 34, __pyx_L30_except_error) } - goto __pyx_L14_except_error; - __pyx_L14_except_error:; + goto __pyx_L30_except_error; + __pyx_L30_except_error:; - /* "FromPyStructUtility":21 - * raise ValueError("No value specified for struct attribute 'entries'") - * result.entries = value + /* "FromPyStructUtility":31 + * raise ValueError("No value specified for struct attribute 'dimension'") + * result.dimension = value * try: # <<<<<<<<<<<<<< - * value = obj['sub_metadata_ids'] + * value = obj['metadata_id'] * except KeyError: */ __Pyx_XGIVEREF(__pyx_t_5); @@ -6969,22 +8387,22 @@ static struct DracoFunctions::MetadataObject __pyx_convert__from_py_struct__Drac __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3); goto __pyx_L1_error; - __pyx_L17_try_end:; + __pyx_L33_try_end:; } - /* "FromPyStructUtility":25 + /* "FromPyStructUtility":35 * except KeyError: - * raise ValueError("No value specified for struct attribute 'sub_metadata_ids'") - * result.sub_metadata_ids = value # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'metadata_id'") + * result.metadata_id = 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; + __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":26 - * raise ValueError("No value specified for struct attribute 'sub_metadata_ids'") - * result.sub_metadata_ids = value + /* "FromPyStructUtility":36 + * raise ValueError("No value specified for struct attribute 'metadata_id'") + * result.metadata_id = value * return result # <<<<<<<<<<<<<< * * @@ -6994,8 +8412,8 @@ static struct DracoFunctions::MetadataObject __pyx_convert__from_py_struct__Drac /* "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 *: # <<<<<<<<<<<<<< + * @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): */ @@ -7006,7 +8424,7 @@ static struct DracoFunctions::MetadataObject __pyx_convert__from_py_struct__Drac __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_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); @@ -7016,29 +8434,29 @@ static struct DracoFunctions::MetadataObject __pyx_convert__from_py_struct__Drac /* "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 *: # <<<<<<<<<<<<<< + * @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_MetadataObject(PyObject *__pyx_v_o) { - std::vector __pyx_v_v; +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; + 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; + 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_MetadataObject", 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_MetadataObject(object o) except *: + * 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) @@ -7093,177 +8511,61 @@ static std::vector __pyx_convert_vector_ * 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_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_MetadataObject(object o) except *: + * 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_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; -} - -/* "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 - * + * v.push_back(item) + * return v */ - __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 # <<<<<<<<<<<<<< + /* "vector.from_py":49 + * for item in o: + * v.push_back(item) + * return v # <<<<<<<<<<<<<< * * */ - __pyx_r = __pyx_v_m; + __pyx_r = __pyx_v_v; goto __pyx_L0; - /* "map.from_py":174 + /* "vector.from_py":45 * - * @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 + * @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_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_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_d); - __Pyx_XDECREF(__pyx_v_key); - __Pyx_XDECREF(__pyx_v_value); + __Pyx_XDECREF(__pyx_v_item); __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 *: # <<<<<<<<<<<<<< + * @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::PointAttributeObject __pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointAttributeObject(PyObject *__pyx_v_obj) { - struct DracoFunctions::PointAttributeObject __pyx_v_result; +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::PointAttributeObject __pyx_r; + struct DracoFunctions::GeometryMetadataObject __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; @@ -7274,16 +8576,15 @@ static struct DracoFunctions::PointAttributeObject __pyx_convert__from_py_struct 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; + 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_PointAttributeObject", 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_PointAttributeObject(obj) except *: + * 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) @@ -7304,7 +8605,7 @@ static struct DracoFunctions::PointAttributeObject __pyx_convert__from_py_struct __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 __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) @@ -7316,208 +8617,7 @@ static struct DracoFunctions::PointAttributeObject __pyx_convert__from_py_struct * 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__8, 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__9, 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'] + * value = obj['metadata_id'] * except KeyError: */ { @@ -7529,72 +8629,69 @@ static struct DracoFunctions::PointAttributeObject __pyx_convert__from_py_struct __Pyx_XGOTREF(__pyx_t_5); /*try:*/ { - /* "FromPyStructUtility":27 - * result.datatype = value + /* "FromPyStructUtility":17 + * * try: - * value = obj['dimension'] # <<<<<<<<<<<<<< + * value = obj['metadata_id'] # <<<<<<<<<<<<<< * except KeyError: - * raise ValueError("No value specified for struct attribute 'dimension'") + * raise ValueError("No value specified for struct attribute 'metadata_id'") */ - __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_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_DECREF_SET(__pyx_v_value, __pyx_t_2); + __pyx_v_value = __pyx_t_2; __pyx_t_2 = 0; - /* "FromPyStructUtility":26 - * raise ValueError("No value specified for struct attribute 'datatype'") - * result.datatype = value + /* "FromPyStructUtility":16 + * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) + * * try: # <<<<<<<<<<<<<< - * value = obj['dimension'] + * 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_L25_try_end; - __pyx_L20_error:; + goto __pyx_L9_try_end; + __pyx_L4_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 + /* "FromPyStructUtility":18 * try: - * value = obj['dimension'] + * value = obj['metadata_id'] * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'dimension'") - * result.dimension = value + * 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_2, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 28, __pyx_L22_except_error) + __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":29 - * value = obj['dimension'] + /* "FromPyStructUtility":19 + * value = obj['metadata_id'] * except KeyError: - * raise ValueError("No value specified for struct attribute 'dimension'") # <<<<<<<<<<<<<< - * result.dimension = value + * 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__10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 29, __pyx_L22_except_error) + __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, 29, __pyx_L22_except_error) + __PYX_ERR(1, 19, __pyx_L6_except_error) } - goto __pyx_L22_except_error; - __pyx_L22_except_error:; + goto __pyx_L6_except_error; + __pyx_L6_except_error:; - /* "FromPyStructUtility":26 - * raise ValueError("No value specified for struct attribute 'datatype'") - * result.datatype = value + /* "FromPyStructUtility":16 + * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) + * * try: # <<<<<<<<<<<<<< - * value = obj['dimension'] + * value = obj['metadata_id'] * except KeyError: */ __Pyx_XGIVEREF(__pyx_t_3); @@ -7602,24 +8699,24 @@ static struct DracoFunctions::PointAttributeObject __pyx_convert__from_py_struct __Pyx_XGIVEREF(__pyx_t_5); __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); goto __pyx_L1_error; - __pyx_L25_try_end:; + __pyx_L9_try_end:; } - /* "FromPyStructUtility":30 + /* "FromPyStructUtility":20 * except KeyError: - * raise ValueError("No value specified for struct attribute 'dimension'") - * result.dimension = value # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'metadata_id'") + * result.metadata_id = value # <<<<<<<<<<<<<< * try: - * value = obj['metadata_id'] + * value = obj['generic_attributes'] */ - __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; + __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":31 - * raise ValueError("No value specified for struct attribute 'dimension'") - * result.dimension = value + /* "FromPyStructUtility":21 + * raise ValueError("No value specified for struct attribute 'metadata_id'") + * result.metadata_id = value * try: # <<<<<<<<<<<<<< - * value = obj['metadata_id'] + * value = obj['generic_attributes'] * except KeyError: */ { @@ -7631,72 +8728,72 @@ static struct DracoFunctions::PointAttributeObject __pyx_convert__from_py_struct __Pyx_XGOTREF(__pyx_t_3); /*try:*/ { - /* "FromPyStructUtility":32 - * result.dimension = value + /* "FromPyStructUtility":22 + * result.metadata_id = value * try: - * value = obj['metadata_id'] # <<<<<<<<<<<<<< + * value = obj['generic_attributes'] # <<<<<<<<<<<<<< * except KeyError: - * raise ValueError("No value specified for struct attribute 'metadata_id'") + * raise ValueError("No value specified for struct attribute 'generic_attributes'") */ - __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_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":31 - * raise ValueError("No value specified for struct attribute 'dimension'") - * result.dimension = value + /* "FromPyStructUtility":21 + * raise ValueError("No value specified for struct attribute 'metadata_id'") + * result.metadata_id = value * try: # <<<<<<<<<<<<<< - * value = obj['metadata_id'] + * 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_L33_try_end; - __pyx_L28_error:; + 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":33 + /* "FromPyStructUtility":23 * try: - * value = obj['metadata_id'] + * value = obj['generic_attributes'] * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'metadata_id'") - * result.metadata_id = value + * 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_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_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":34 - * value = obj['metadata_id'] + /* "FromPyStructUtility":24 + * value = obj['generic_attributes'] * except KeyError: - * raise ValueError("No value specified for struct attribute 'metadata_id'") # <<<<<<<<<<<<<< - * result.metadata_id = value + * 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__11, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 34, __pyx_L30_except_error) + __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, 34, __pyx_L30_except_error) + __PYX_ERR(1, 24, __pyx_L14_except_error) } - goto __pyx_L30_except_error; - __pyx_L30_except_error:; + goto __pyx_L14_except_error; + __pyx_L14_except_error:; - /* "FromPyStructUtility":31 - * raise ValueError("No value specified for struct attribute 'dimension'") - * result.dimension = value + /* "FromPyStructUtility":21 + * raise ValueError("No value specified for struct attribute 'metadata_id'") + * result.metadata_id = value * try: # <<<<<<<<<<<<<< - * value = obj['metadata_id'] + * value = obj['generic_attributes'] * except KeyError: */ __Pyx_XGIVEREF(__pyx_t_5); @@ -7704,185 +8801,287 @@ static struct DracoFunctions::PointAttributeObject __pyx_convert__from_py_struct __Pyx_XGIVEREF(__pyx_t_3); __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3); goto __pyx_L1_error; - __pyx_L33_try_end:; + __pyx_L17_try_end:; } - /* "FromPyStructUtility":35 + /* "FromPyStructUtility":25 * except KeyError: - * raise ValueError("No value specified for struct attribute 'metadata_id'") - * result.metadata_id = value # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'generic_attributes'") + * result.generic_attributes = 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; + __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; - /* "FromPyStructUtility":36 - * raise ValueError("No value specified for struct attribute 'metadata_id'") - * result.metadata_id = value - * return result # <<<<<<<<<<<<<< + /* "map.from_py":179 + * for key, value in d.iteritems(): + * m.insert(pair[X,Y](key, value)) + * return m # <<<<<<<<<<<<<< * * */ - __pyx_r = __pyx_v_result; + __pyx_r = __pyx_v_m; goto __pyx_L0; - /* "FromPyStructUtility":11 + /* "map.from_py":174 * - * @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): + * @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_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_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; } -/* "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; +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; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - struct DracoFunctions::PointAttributeObject __pyx_t_5; + 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_vector_from_py_struct__DracoFunctions_3a__3a_PointAttributeObject", 0); + __Pyx_RefNannySetupContext("__pyx_convert_unordered_map_from_py_std_3a__3a_string__and_uint32_t", 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 + /* "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(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; + 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; - /* "vector.from_py":48 - * cdef vector[X] v - * for item in o: - * v.push_back(item) # <<<<<<<<<<<<<< - * return v - * + /* "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_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); + __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; - /* "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 + /* "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; - /* "vector.from_py":49 - * for item in o: - * v.push_back(item) - * return v # <<<<<<<<<<<<<< + /* "map.from_py":179 + * for key, value in d.iteritems(): + * m.insert(pair[X,Y](key, value)) + * return m # <<<<<<<<<<<<<< * * */ - __pyx_r = __pyx_v_v; + __pyx_r = __pyx_v_m; goto __pyx_L0; - /* "vector.from_py":45 + /* "map.from_py":174 * - * @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: + * @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_4); - __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_PointAttributeObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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_item); + __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_GeometryMetadataObject") - * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(obj) except *: # <<<<<<<<<<<<<< + * @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::GeometryMetadataObject __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(PyObject *__pyx_v_obj) { - struct DracoFunctions::GeometryMetadataObject __pyx_v_result; +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::GeometryMetadataObject __pyx_r; + struct DracoFunctions::MetadataObject __pyx_r; __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; @@ -7893,15 +9092,15 @@ static struct DracoFunctions::GeometryMetadataObject __pyx_convert__from_py_stru 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; + 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_GeometryMetadataObject", 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_GeometryMetadataObject(obj) except *: + * 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) @@ -7922,7 +9121,7 @@ static struct DracoFunctions::GeometryMetadataObject __pyx_convert__from_py_stru __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 __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) @@ -7934,7 +9133,7 @@ static struct DracoFunctions::GeometryMetadataObject __pyx_convert__from_py_stru * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) * * try: # <<<<<<<<<<<<<< - * value = obj['metadata_id'] + * value = obj['entries'] * except KeyError: */ { @@ -7949,11 +9148,11 @@ static struct DracoFunctions::GeometryMetadataObject __pyx_convert__from_py_stru /* "FromPyStructUtility":17 * * try: - * value = obj['metadata_id'] # <<<<<<<<<<<<<< + * value = obj['entries'] # <<<<<<<<<<<<<< * except KeyError: - * raise ValueError("No value specified for struct attribute 'metadata_id'") + * raise ValueError("No value specified for struct attribute 'entries'") */ - __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_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; @@ -7962,7 +9161,7 @@ static struct DracoFunctions::GeometryMetadataObject __pyx_convert__from_py_stru * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) * * try: # <<<<<<<<<<<<<< - * value = obj['metadata_id'] + * value = obj['entries'] * except KeyError: */ } @@ -7975,27 +9174,27 @@ static struct DracoFunctions::GeometryMetadataObject __pyx_convert__from_py_stru /* "FromPyStructUtility":18 * try: - * value = obj['metadata_id'] + * value = obj['entries'] * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'metadata_id'") - * result.metadata_id = value + * 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_GeometryMetadataObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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['metadata_id'] + * value = obj['entries'] * except KeyError: - * raise ValueError("No value specified for struct attribute 'metadata_id'") # <<<<<<<<<<<<<< - * result.metadata_id = value + * raise ValueError("No value specified for struct attribute 'entries'") # <<<<<<<<<<<<<< + * result.entries = value * try: */ - __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 19, __pyx_L6_except_error) + __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; @@ -8008,7 +9207,7 @@ static struct DracoFunctions::GeometryMetadataObject __pyx_convert__from_py_stru * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) * * try: # <<<<<<<<<<<<<< - * value = obj['metadata_id'] + * value = obj['entries'] * except KeyError: */ __Pyx_XGIVEREF(__pyx_t_3); @@ -8021,19 +9220,19 @@ static struct DracoFunctions::GeometryMetadataObject __pyx_convert__from_py_stru /* "FromPyStructUtility":20 * except KeyError: - * raise ValueError("No value specified for struct attribute 'metadata_id'") - * result.metadata_id = value # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'entries'") + * result.entries = value # <<<<<<<<<<<<<< * try: - * value = obj['generic_attributes'] + * value = obj['sub_metadata_ids'] */ - __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; + __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 'metadata_id'") - * result.metadata_id = value + * raise ValueError("No value specified for struct attribute 'entries'") + * result.entries = value * try: # <<<<<<<<<<<<<< - * value = obj['generic_attributes'] + * value = obj['sub_metadata_ids'] * except KeyError: */ { @@ -8046,22 +9245,22 @@ static struct DracoFunctions::GeometryMetadataObject __pyx_convert__from_py_stru /*try:*/ { /* "FromPyStructUtility":22 - * result.metadata_id = value + * result.entries = value * try: - * value = obj['generic_attributes'] # <<<<<<<<<<<<<< + * value = obj['sub_metadata_ids'] # <<<<<<<<<<<<<< * except KeyError: - * raise ValueError("No value specified for struct attribute 'generic_attributes'") + * raise ValueError("No value specified for struct attribute 'sub_metadata_ids'") */ - __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_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 'metadata_id'") - * result.metadata_id = value + * raise ValueError("No value specified for struct attribute 'entries'") + * result.entries = value * try: # <<<<<<<<<<<<<< - * value = obj['generic_attributes'] + * value = obj['sub_metadata_ids'] * except KeyError: */ } @@ -8077,27 +9276,27 @@ static struct DracoFunctions::GeometryMetadataObject __pyx_convert__from_py_stru /* "FromPyStructUtility":23 * try: - * value = obj['generic_attributes'] + * value = obj['sub_metadata_ids'] * except KeyError: # <<<<<<<<<<<<<< - * raise ValueError("No value specified for struct attribute 'generic_attributes'") - * result.generic_attributes = value + * 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_GeometryMetadataObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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['generic_attributes'] + * value = obj['sub_metadata_ids'] * except KeyError: - * raise ValueError("No value specified for struct attribute 'generic_attributes'") # <<<<<<<<<<<<<< - * result.generic_attributes = value + * 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__12, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 24, __pyx_L14_except_error) + __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; @@ -8107,10 +9306,10 @@ static struct DracoFunctions::GeometryMetadataObject __pyx_convert__from_py_stru __pyx_L14_except_error:; /* "FromPyStructUtility":21 - * raise ValueError("No value specified for struct attribute 'metadata_id'") - * result.metadata_id = value + * raise ValueError("No value specified for struct attribute 'entries'") + * result.entries = value * try: # <<<<<<<<<<<<<< - * value = obj['generic_attributes'] + * value = obj['sub_metadata_ids'] * except KeyError: */ __Pyx_XGIVEREF(__pyx_t_5); @@ -8123,17 +9322,17 @@ static struct DracoFunctions::GeometryMetadataObject __pyx_convert__from_py_stru /* "FromPyStructUtility":25 * except KeyError: - * raise ValueError("No value specified for struct attribute 'generic_attributes'") - * result.generic_attributes = value # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'sub_metadata_ids'") + * result.sub_metadata_ids = 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; + __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 'generic_attributes'") - * result.generic_attributes = value + * raise ValueError("No value specified for struct attribute 'sub_metadata_ids'") + * result.sub_metadata_ids = value * return result # <<<<<<<<<<<<<< * * @@ -8143,8 +9342,8 @@ static struct DracoFunctions::GeometryMetadataObject __pyx_convert__from_py_stru /* "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 *: # <<<<<<<<<<<<<< + * @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): */ @@ -8155,7 +9354,7 @@ static struct DracoFunctions::GeometryMetadataObject __pyx_convert__from_py_stru __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_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); @@ -8163,64 +9362,221 @@ static struct DracoFunctions::GeometryMetadataObject __pyx_convert__from_py_stru 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())] +/* "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 PyObject *__pyx_convert_vector_to_py_unsigned_char(const std::vector &__pyx_v_v) { - size_t __pyx_v_i; - PyObject *__pyx_r = NULL; +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; - size_t __pyx_t_2; - size_t __pyx_t_3; - size_t __pyx_t_4; - PyObject *__pyx_t_5 = 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_to_py_unsigned_char", 0); + __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_double", 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())] # <<<<<<<<<<<<<< + /* "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 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L1_error) + __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_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())] + /* "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_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_unsigned_char", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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); @@ -8228,56 +9584,49 @@ static PyObject *__pyx_convert_vector_to_py_unsigned_char(const std::vector &__pyx_v_v) { - size_t __pyx_v_i; +/* "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; - 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); + __Pyx_RefNannySetupContext("__pyx_convert_PyStr_string_to_py_std__in_string", 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())] # <<<<<<<<<<<<<< - * - * + /* "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 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L1_error) + __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_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())] + /* "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_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_float", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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); @@ -8285,56 +9634,49 @@ static PyObject *__pyx_convert_vector_to_py_float(const std::vector &__p return __pyx_r; } -static PyObject *__pyx_convert_vector_to_py_unsigned_int(const std::vector &__pyx_v_v) { - size_t __pyx_v_i; +/* "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; - 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); + __Pyx_RefNannySetupContext("__pyx_convert_PyBytes_string_to_py_std__in_string", 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())] # <<<<<<<<<<<<<< - * - * + /* "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 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L1_error) + __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_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())] + /* "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_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_unsigned_int", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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); @@ -8342,56 +9684,48 @@ static PyObject *__pyx_convert_vector_to_py_unsigned_int(const std::vector &__pyx_v_v) { - size_t __pyx_v_i; +/* "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; - 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); + __Pyx_RefNannySetupContext("__pyx_convert_PyByteArray_string_to_py_std__in_string", 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())] # <<<<<<<<<<<<<< - * + /* "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 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L1_error) + __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_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 + /* "string.to_py":55 * - * @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())] + * @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_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_double", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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); @@ -8399,248 +9733,298 @@ static PyObject *__pyx_convert_vector_to_py_double(const std::vector &_ return __pyx_r; } -/* "string.to_py":31 +/* "map.to_py":201 * - * @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 *: + * @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 CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &__pyx_v_s) { +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_PyObject_string_to_py_std__in_string", 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)); + } - /* "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) + /* "map.to_py":209 + * o[key_value.first] = key_value.second + * cython.operator.preincrement(iter) + * return o # <<<<<<<<<<<<<< + * + * */ __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; + __Pyx_INCREF(__pyx_v_o); + __pyx_r = __pyx_v_o; goto __pyx_L0; - /* "string.to_py":31 + /* "map.to_py":201 * - * @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 *: + * @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_AddTraceback("string.to_py.__pyx_convert_PyObject_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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; } -/* "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) { +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_PyUnicode_string_to_py_std__in_string", 0); + __Pyx_RefNannySetupContext("__pyx_convert_unordered_map_to_py_std_3a__3a_string____uint32_t", 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) + /* "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_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_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 202, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_r = __pyx_t_1; + __pyx_v_o = ((PyObject*)__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 *: + /* "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(); - /* 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 *: + /* "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; -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) + /* "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_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; + __pyx_v_key_value = (&(*__pyx_v_iter)); - /* "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 *: + /* "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; - /* 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 + /* "map.to_py":208 + * key_value = &cython.operator.dereference(iter) + * o[key_value.first] = key_value.second + * cython.operator.preincrement(iter) # <<<<<<<<<<<<<< + * return o * - * @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 *: */ + (void)((++__pyx_v_iter)); + } -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) + /* "map.to_py":209 + * o[key_value.first] = key_value.second + * cython.operator.preincrement(iter) + * return o # <<<<<<<<<<<<<< + * + * */ __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; + __Pyx_INCREF(__pyx_v_o); + __pyx_r = __pyx_v_o; goto __pyx_L0; - /* "string.to_py":49 + /* "map.to_py":201 * - * @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 *: + * @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_AddTraceback("string.to_py.__pyx_convert_PyBytes_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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; } -/* "string.to_py":55 +/* "vector.to_py":60 * - * @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()) + * @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 CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &__pyx_v_s) { +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_PyByteArray_string_to_py_std__in_string", 0); + __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_MetadataObject", 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()) # <<<<<<<<<<<<<< + /* "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 = __Pyx_PyByteArray_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 56, __pyx_L1_error) + __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; - /* "string.to_py":55 + /* "vector.to_py":60 * - * @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()) + * @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_AddTraceback("string.to_py.__pyx_convert_PyByteArray_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __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); @@ -8834,249 +10218,365 @@ static PyObject *__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_PointA return __pyx_r; } -/* "map.to_py":201 +/* "vector.from_py":45 * - * @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 + * @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 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; +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; - int __pyx_t_2; - PyObject *__pyx_t_3 = 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_unordered_map_to_py_std_3a__3a_string____std_3a__3a_string", 0); + __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_uint32_t", 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() + /* "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_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; + 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; - /* "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) + /* "vector.from_py":48 + * cdef vector[X] v + * for item in o: + * v.push_back(item) # <<<<<<<<<<<<<< + * return v + * */ - __pyx_v_iter = __pyx_v_s.begin(); + __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)); - /* "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 + /* "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 */ - while (1) { - __pyx_t_2 = ((__pyx_v_iter != __pyx_v_s.end()) != 0); - if (!__pyx_t_2) break; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "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) + /* "vector.from_py":49 + * for item in o: + * v.push_back(item) + * return v # <<<<<<<<<<<<<< + * + * */ - __pyx_v_key_value = (&(*__pyx_v_iter)); + __pyx_r = __pyx_v_v; + goto __pyx_L0; - /* "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 + /* "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: */ - __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) + + /* 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 = __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; + __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; - /* "map.to_py":208 - * key_value = &cython.operator.dereference(iter) - * o[key_value.first] = key_value.second - * cython.operator.preincrement(iter) # <<<<<<<<<<<<<< - * return o + /* "vector.from_py":48 + * cdef vector[X] v + * for item in o: + * v.push_back(item) # <<<<<<<<<<<<<< + * return v * */ - (void)((++__pyx_v_iter)); + __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; - /* "map.to_py":209 - * o[key_value.first] = key_value.second - * cython.operator.preincrement(iter) - * return o # <<<<<<<<<<<<<< + /* "vector.from_py":49 + * for item in o: + * v.push_back(item) + * return v # <<<<<<<<<<<<<< * * */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_o); - __pyx_r = __pyx_v_o; + __pyx_r = __pyx_v_v; goto __pyx_L0; - /* "map.to_py":201 + /* "vector.from_py":45 * - * @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 + * @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_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_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_o); - __Pyx_XGIVEREF(__pyx_r); + __Pyx_XDECREF(__pyx_v_item); __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; +/* "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; - int __pyx_t_2; - PyObject *__pyx_t_3 = 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_unordered_map_to_py_std_3a__3a_string____uint32_t", 0); + __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_unsigned_char", 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() + /* "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_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 202, __pyx_L1_error) + __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_v_o = ((PyObject*)__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; - /* "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) + /* "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())] + * */ - __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; + /* 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; +} - /* "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)); - } +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); - /* "map.to_py":209 - * o[key_value.first] = key_value.second - * cython.operator.preincrement(iter) - * return o # <<<<<<<<<<<<<< + /* "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_INCREF(__pyx_v_o); - __pyx_r = __pyx_v_o; + __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; - /* "map.to_py":201 + /* "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())] * - * @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_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_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) { +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 @@ -9088,11 +10588,11 @@ static PyObject *__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_Metada 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); + __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_unsigned_int", 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): + * @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())] # <<<<<<<<<<<<<< * * @@ -9104,7 +10604,7 @@ static PyObject *__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_Metada __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_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; @@ -9115,8 +10615,8 @@ static PyObject *__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_Metada /* "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): # <<<<<<<<<<<<<< + * @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())] * */ @@ -9125,7 +10625,7 @@ static PyObject *__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_Metada __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_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); @@ -10692,6 +12192,113 @@ static PyObject *__pyx_unpickle___Pyx_EnumMeta__set_state(struct __pyx_obj___Pyx 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 +}; + 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; @@ -10867,6 +12474,7 @@ static struct PyModuleDef __pyx_moduledef = { #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}, @@ -10895,6 +12503,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_s_DracoPy_only_supports_meshes_wit, __pyx_k_DracoPy_only_supports_meshes_wit, sizeof(__pyx_k_DracoPy_only_supports_meshes_wit), 0, 0, 1, 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}, @@ -10905,6 +12514,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_EnumType, __pyx_k_EnumType, sizeof(__pyx_k_EnumType), 0, 0, 1, 1}, {&__pyx_kp_s_Failed_to_decode_input_mesh_Data, __pyx_k_Failed_to_decode_input_mesh_Data, sizeof(__pyx_k_Failed_to_decode_input_mesh_Data), 0, 0, 1, 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_s_Input_invalid, __pyx_k_Input_invalid, sizeof(__pyx_k_Input_invalid), 0, 0, 1, 0}, {&__pyx_kp_s_Input_mesh_is_not_draco_encoded, __pyx_k_Input_mesh_is_not_draco_encoded, sizeof(__pyx_k_Input_mesh_is_not_draco_encoded), 0, 0, 1, 0}, @@ -10912,6 +12524,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_Invalid_draco_structure, __pyx_k_Invalid_draco_structure, sizeof(__pyx_k_Invalid_draco_structure), 0, 0, 1, 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}, @@ -10921,16 +12535,22 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_s_Specified_value_out_of_encoded_r, __pyx_k_Specified_value_out_of_encoded_r, sizeof(__pyx_k_Specified_value_out_of_encoded_r), 0, 0, 1, 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}, @@ -10939,19 +12559,22 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 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_s_ddd, __pyx_k_ddd, sizeof(__pyx_k_ddd), 0, 0, 1, 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_dim, __pyx_k_dim, sizeof(__pyx_k_dim), 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}, @@ -10959,8 +12582,10 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_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_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}, @@ -10971,6 +12596,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 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}, @@ -10986,10 +12612,11 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_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_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}, @@ -11005,8 +12632,11 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_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_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_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}, @@ -11025,6 +12655,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_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}, @@ -11035,12 +12666,12 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {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, 27, __pyx_L1_error) - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 62, __pyx_L1_error) - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 69, __pyx_L1_error) - __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 161, __pyx_L1_error) - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 210, __pyx_L1_error) + __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, 278, __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:; @@ -11051,82 +12682,79 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "DracoPy.pyx":62 + /* "(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_ = PyTuple_Pack(1, __pyx_kp_s_Specified_value_out_of_encoded_r); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 62, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple_); - __Pyx_GIVEREF(__pyx_tuple_); + __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_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":161 + /* "DracoPy.pyx":278 * if faces is None 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__2 = PyTuple_Pack(1, __pyx_kp_s_generic_attributes_encoding_deco); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 161, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__2); - __Pyx_GIVEREF(__pyx_tuple__2); + __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_generic_attributes_encoding_deco); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 278, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__5); + __Pyx_GIVEREF(__pyx_tuple__5); - /* "DracoPy.pyx":204 + /* "DracoPy.pyx":308 * if quant_origin != NULL: * PyMem_Free(quant_origin) * raise ValueError("Input invalid") # <<<<<<<<<<<<<< * * def raise_decoding_error(decoding_status): */ - __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_Input_invalid); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 204, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__3); - __Pyx_GIVEREF(__pyx_tuple__3); + __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_Input_invalid); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 308, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__6); + __Pyx_GIVEREF(__pyx_tuple__6); - /* "DracoPy.pyx":210 + /* "DracoPy.pyx":314 * 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__4 = PyTuple_Pack(1, __pyx_kp_s_Failed_to_decode_input_mesh_Data); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 210, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__4); - __Pyx_GIVEREF(__pyx_tuple__4); + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_Failed_to_decode_input_mesh_Data); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__7); + __Pyx_GIVEREF(__pyx_tuple__7); - /* "DracoPy.pyx":212 + /* "DracoPy.pyx":316 * 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__5 = PyTuple_Pack(1, __pyx_kp_s_DracoPy_only_supports_meshes_wit); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 212, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); - - /* "FromPyStructUtility":19 - * value = obj['entries'] - * except KeyError: - * raise ValueError("No value specified for struct attribute 'entries'") # <<<<<<<<<<<<<< - * result.entries = value - * try: - */ - __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(1, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__6); - __Pyx_GIVEREF(__pyx_tuple__6); - - /* "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__7 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_2); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(1, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__7); - __Pyx_GIVEREF(__pyx_tuple__7); + __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_DracoPy_only_supports_meshes_wit); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 316, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__8); /* "FromPyStructUtility":19 * value = obj['data'] @@ -11135,9 +12763,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * result.data = value * try: */ - __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_3); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(1, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); + __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'] @@ -11146,9 +12774,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * result.datatype = value * try: */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_4); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__9); - __Pyx_GIVEREF(__pyx_tuple__9); + __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'] @@ -11157,9 +12785,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * result.dimension = value * try: */ - __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_5); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 29, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__10); - __Pyx_GIVEREF(__pyx_tuple__10); + __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'] @@ -11168,9 +12796,9 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * result.metadata_id = value * return result */ - __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_6); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__11); - __Pyx_GIVEREF(__pyx_tuple__11); + __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'] @@ -11179,268 +12807,299 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * result.generic_attributes = value * return result */ - __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_7); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__12); - __Pyx_GIVEREF(__pyx_tuple__12); + __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":9 + /* "DracoPy.pyx":39 * * * class DracoPointCloud(object): # <<<<<<<<<<<<<< * def __init__(self, data_struct): * self.data_struct = data_struct */ - __pyx_tuple__13 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__13); - __Pyx_GIVEREF(__pyx_tuple__13); + __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":10 + /* "DracoPy.pyx":40 * * class DracoPointCloud(object): * def __init__(self, data_struct): # <<<<<<<<<<<<<< * self.data_struct = data_struct * if data_struct['encoding_options_set']: */ - __pyx_tuple__14 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_data_struct); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 10, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__14); - __Pyx_GIVEREF(__pyx_tuple__14); - __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 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_init, 10, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 10, __pyx_L1_error) + __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":19 - * # self.metadata = decode_metadata(data_struct["binary_metadata"]) + /* "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__16 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_value, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__16); - __Pyx_GIVEREF(__pyx_tuple__16); - __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 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_get_encoded_coordinate, 19, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 19, __pyx_L1_error) + __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":23 + /* "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__18 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_point); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 23, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__18); - __Pyx_GIVEREF(__pyx_tuple__18); - __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 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_get_encoded_point, 23, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 23, __pyx_L1_error) + __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":28 + /* "DracoPy.pyx":57 * * @property * def num_axes(self): # <<<<<<<<<<<<<< * return 3 * */ - __pyx_tuple__20 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 28, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__20); - __Pyx_GIVEREF(__pyx_tuple__20); - __pyx_codeobj__21 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__20, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_num_axes, 28, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__21)) __PYX_ERR(0, 28, __pyx_L1_error) + __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":32 + /* "DracoPy.pyx":61 * * @property * def points(self) -> List[float]: # <<<<<<<<<<<<<< * return self.data_struct['points'] * */ - __pyx_tuple__22 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__22); - __Pyx_GIVEREF(__pyx_tuple__22); - __pyx_codeobj__23 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_points, 32, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__23)) __PYX_ERR(0, 32, __pyx_L1_error) + __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":36 + /* "DracoPy.pyx":65 * * @property * def geometry_metadata(self) -> Optional[Dict]: # <<<<<<<<<<<<<< * return self.data_struct['geometry_metadata'] if self.metadatas else None * */ - __pyx_tuple__24 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__24); - __Pyx_GIVEREF(__pyx_tuple__24); - __pyx_codeobj__25 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__24, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_geometry_metadata, 36, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__25)) __PYX_ERR(0, 36, __pyx_L1_error) + __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":40 + /* "DracoPy.pyx":69 * * @property * def metadatas(self) -> List[Dict]: # <<<<<<<<<<<<<< * return self.data_struct['metadatas'] * */ - __pyx_tuple__26 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__26); - __Pyx_GIVEREF(__pyx_tuple__26); - __pyx_codeobj__27 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_metadatas, 40, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__27)) __PYX_ERR(0, 40, __pyx_L1_error) + __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":46 + /* "DracoPy.pyx":75 * class DracoMesh(DracoPointCloud): * @property * def faces(self) -> List[int]: # <<<<<<<<<<<<<< * return self.data_struct['faces'] * */ - __pyx_tuple__28 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 46, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__28); - __Pyx_GIVEREF(__pyx_tuple__28); - __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_faces, 46, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 46, __pyx_L1_error) + __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":50 + /* "DracoPy.pyx":79 * * @property * def normals(self): # <<<<<<<<<<<<<< * return self.data_struct['normals'] * */ - __pyx_tuple__30 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__30); - __Pyx_GIVEREF(__pyx_tuple__30); - __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_normals, 50, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 50, __pyx_L1_error) + __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":53 - * return self.data_struct['normals'] + /* "DracoPy.pyx":83 + * * * class EncodingOptions(object): # <<<<<<<<<<<<<< * def __init__(self, quantization_bits, quantization_range, quantization_origin): * self.quantization_bits = quantization_bits */ - __pyx_tuple__32 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__32); - __Pyx_GIVEREF(__pyx_tuple__32); + __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":54 + /* "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__33 = 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__33)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__33); - __Pyx_GIVEREF(__pyx_tuple__33); - __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 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_init, 54, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 54, __pyx_L1_error) + __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":60 + /* "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__35 = 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__35)) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__35); - __Pyx_GIVEREF(__pyx_tuple__35); - __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_get_encoded_coordinate, 60, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 60, __pyx_L1_error) + __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":67 + /* "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__37 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_point, __pyx_n_s_encoded_point, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 67, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__37); - __Pyx_GIVEREF(__pyx_tuple__37); - __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 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_get_encoded_point, 67, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 67, __pyx_L1_error) + __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":74 + /* "DracoPy.pyx":104 * * @property * def num_axes(self): # <<<<<<<<<<<<<< * return 3 * */ - __pyx_tuple__39 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__39)) __PYX_ERR(0, 74, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__39); - __Pyx_GIVEREF(__pyx_tuple__39); - __pyx_codeobj__40 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_num_axes, 74, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__40)) __PYX_ERR(0, 74, __pyx_L1_error) + __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":83 - * pass + /* "DracoPy.pyx":116 * - * def create_empty_geometry_metadata() -> dict: # <<<<<<<<<<<<<< + * + * def _create_empty_geometry_metadata() -> GeometryMetadataObject: # <<<<<<<<<<<<<< * return { * "metadata_id": 0, */ - __pyx_codeobj__41 = (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, 83, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 83, __pyx_L1_error) + __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":89 - * } + /* "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__42 = PyTuple_Pack(9, __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_metadatas, __pyx_n_s_geometry_metadata); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 89, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__42); - __Pyx_GIVEREF(__pyx_tuple__42); - __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(9, 0, 9, 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_encode_mesh_to_buffer, 89, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 89, __pyx_L1_error) + __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":103 + /* "DracoPy.pyx":206 * * * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< * quantization_bits=14, * compression_level=1, */ - __pyx_tuple__44 = PyTuple_Pack(8, __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_metadatas, __pyx_n_s_geometry_metadata); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 103, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__44); - __Pyx_GIVEREF(__pyx_tuple__44); - __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(8, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_encode_point_cloud_to_buffer, 103, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 103, __pyx_L1_error) + __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":117 + /* "DracoPy.pyx":247 * * * def encode_to_buffer(points: List[float], # <<<<<<<<<<<<<< * faces: List[int] = None, - * quantization_bits=14, + * encoder: Encoder = Encoder(), */ - __pyx_tuple__46 = PyTuple_Pack(13, __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_metadatas, __pyx_n_s_geometry_metadata, __pyx_n_s_quant_origin, __pyx_n_s_num_dims, __pyx_n_s_dim, __pyx_n_s_draco_encoded); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 117, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__46); - __Pyx_GIVEREF(__pyx_tuple__46); - __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(9, 0, 13, 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_to_buffer, 117, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 117, __pyx_L1_error) + __pyx_tuple__50 = PyTuple_Pack(7, __pyx_n_s_points, __pyx_n_s_faces, __pyx_n_s_encoder, __pyx_n_s_metadatas, __pyx_n_s_geometry_metadata, __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, 7, 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":206 + /* "DracoPy.pyx":310 * 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__48 = PyTuple_Pack(1, __pyx_n_s_decoding_status); 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(1, 0, 1, 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_raise_decoding_error, 206, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 206, __pyx_L1_error) + __pyx_tuple__52 = PyTuple_Pack(1, __pyx_n_s_decoding_status); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 310, __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, 310, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 310, __pyx_L1_error) - /* "DracoPy.pyx":214 + /* "DracoPy.pyx":318 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer, deduplicate=False): # <<<<<<<<<<<<<< * """ * Decode buffer to mesh */ - __pyx_tuple__50 = PyTuple_Pack(3, __pyx_n_s_buffer, __pyx_n_s_deduplicate, __pyx_n_s_mesh_struct); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 214, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__50); - __Pyx_GIVEREF(__pyx_tuple__50); - __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 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_decode_buffer_to_mesh, 214, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 214, __pyx_L1_error) + __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, 318, __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, 318, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 318, __pyx_L1_error) - /* "DracoPy.pyx":227 + /* "DracoPy.pyx":331 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer, deduplicate=False): # <<<<<<<<<<<<<< * """ * Decode buffer to point cloud */ - __pyx_tuple__52 = PyTuple_Pack(3, __pyx_n_s_buffer, __pyx_n_s_deduplicate, __pyx_n_s_point_cloud_struct); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 227, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__52); - __Pyx_GIVEREF(__pyx_tuple__52); - __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 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_decode_point_cloud_buffer, 227, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 227, __pyx_L1_error) + __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, 331, __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, 331, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 331, __pyx_L1_error) /* "EnumBase":28 * class __Pyx_EnumBase(int): @@ -11449,13 +13108,13 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * for v in cls: * if v == value: */ - __pyx_tuple__54 = 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__54)) __PYX_ERR(1, 28, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__54); - __Pyx_GIVEREF(__pyx_tuple__54); - __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_stringsource, __pyx_n_s_new, 28, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(1, 28, __pyx_L1_error) - __pyx_tuple__56 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(1, 28, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__56); - __Pyx_GIVEREF(__pyx_tuple__56); + __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 @@ -11464,10 +13123,10 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return "<%s.%s: %d>" % (self.__class__.__name__, self.name, self) * def __str__(self): */ - __pyx_tuple__57 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__57)) __PYX_ERR(1, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__57); - __Pyx_GIVEREF(__pyx_tuple__57); - __pyx_codeobj__58 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_repr, 39, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__58)) __PYX_ERR(1, 39, __pyx_L1_error) + __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): @@ -11476,20 +13135,20 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * return "%s.%s" % (self.__class__.__name__, self.name) * */ - __pyx_tuple__59 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__59)) __PYX_ERR(1, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__59); - __Pyx_GIVEREF(__pyx_tuple__59); - __pyx_codeobj__60 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_str, 41, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__60)) __PYX_ERR(1, 41, __pyx_L1_error) + __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__61 = 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__61)) __PYX_ERR(1, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__61); - __Pyx_GIVEREF(__pyx_tuple__61); - __pyx_codeobj__62 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 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_pyx_unpickle___Pyx_EnumMeta, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__62)) __PYX_ERR(1, 1, __pyx_L1_error) + __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:; @@ -11554,6 +13213,16 @@ static int __Pyx_modinit_type_init_code(void) { 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 @@ -11811,11 +13480,23 @@ if (!__Pyx_RefNanny) { /* "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, -1); 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, 2, __pyx_L1_error) + __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); @@ -11826,549 +13507,574 @@ if (!__Pyx_RefNanny) { __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, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error) + __pyx_t_2 = __Pyx_Import(__pyx_n_s_typing, __pyx_t_1, -1); 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, 2, __pyx_L1_error) + __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, 2, __pyx_L1_error) + 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, 2, __pyx_L1_error) + __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, 2, __pyx_L1_error) + 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, 2, __pyx_L1_error) + __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, 2, __pyx_L1_error) + 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":6 + /* "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, 6, __pyx_L1_error) + __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, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error) + __pyx_t_1 = __Pyx_Import(__pyx_n_s_math, __pyx_t_2, -1); 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, 6, __pyx_L1_error) + __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, 6, __pyx_L1_error) + 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":9 + /* "DracoPy.pyx":39 * * * class DracoPointCloud(object): # <<<<<<<<<<<<<< * def __init__(self, data_struct): * self.data_struct = data_struct */ - __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__13); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) + __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__13, __pyx_n_s_DracoPointCloud, __pyx_n_s_DracoPointCloud, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error) + __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":10 + /* "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__15)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 10, __pyx_L1_error) + __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, 10, __pyx_L1_error) + 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":19 - * # self.metadata = decode_metadata(data_struct["binary_metadata"]) + /* "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__17)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 19, __pyx_L1_error) + __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, 19, __pyx_L1_error) + 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":23 + /* "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__19)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 23, __pyx_L1_error) + __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, 23, __pyx_L1_error) + 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":28 + /* "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__21)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error) + __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":27 + /* "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, 27, __pyx_L1_error) + __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, 28, __pyx_L1_error) + 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":32 + /* "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, 32, __pyx_L1_error) + __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, 32, __pyx_L1_error) + __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, 32, __pyx_L1_error) + __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, 32, __pyx_L1_error) + 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__23)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 32, __pyx_L1_error) + __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":31 + /* "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, 31, __pyx_L1_error) + __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, 32, __pyx_L1_error) + 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":36 + /* "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, 36, __pyx_L1_error) + __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, 36, __pyx_L1_error) + __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, 36, __pyx_L1_error) + __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, 36, __pyx_L1_error) + __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, 36, __pyx_L1_error) + 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__25)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 36, __pyx_L1_error) + __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":35 + /* "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, 35, __pyx_L1_error) + __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, 36, __pyx_L1_error) + 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":40 + /* "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, 40, __pyx_L1_error) + __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, 40, __pyx_L1_error) + __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, 40, __pyx_L1_error) + __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, 40, __pyx_L1_error) + __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, 40, __pyx_L1_error) + 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__27)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 40, __pyx_L1_error) + __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":39 + /* "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, 39, __pyx_L1_error) + __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, 40, __pyx_L1_error) + 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":9 + /* "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__13, __pyx_t_2, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 9, __pyx_L1_error) + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoPointCloud, __pyx_tuple__16, __pyx_t_2, NULL, 0, 1); 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, 9, __pyx_L1_error) + 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":44 + /* "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, 44, __pyx_L1_error) + __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, 44, __pyx_L1_error) + __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, 44, __pyx_L1_error) + __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, 44, __pyx_L1_error) + __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":46 + /* "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, 46, __pyx_L1_error) + __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, 46, __pyx_L1_error) + __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, 46, __pyx_L1_error) + __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, 46, __pyx_L1_error) + 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__29)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 46, __pyx_L1_error) + __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":45 + /* "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, 45, __pyx_L1_error) + __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, 46, __pyx_L1_error) + 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":50 + /* "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__31)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 50, __pyx_L1_error) + __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":49 + /* "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, 49, __pyx_L1_error) + __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, 50, __pyx_L1_error) + 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":44 + /* "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, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_6 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoMesh, __pyx_t_2, __pyx_t_4, NULL, 0, 1); 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, 44, __pyx_L1_error) + 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":53 - * return self.data_struct['normals'] + /* "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__32); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error) + __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__32, __pyx_n_s_EncodingOptions, __pyx_n_s_EncodingOptions, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error) + __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":54 + /* "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__34)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error) + __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, 54, __pyx_L1_error) + 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":60 + /* "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__36)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 60, __pyx_L1_error) + __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, 60, __pyx_L1_error) + 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":67 + /* "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__38)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 67, __pyx_L1_error) + __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, 67, __pyx_L1_error) + 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":74 + /* "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__40)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 74, __pyx_L1_error) + __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":73 + /* "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, 73, __pyx_L1_error) + __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, 74, __pyx_L1_error) + 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":53 - * return self.data_struct['normals'] + /* "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__32, __pyx_t_1, NULL, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 53, __pyx_L1_error) + __pyx_t_6 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_EncodingOptions, __pyx_tuple__35, __pyx_t_1, NULL, 0, 1); 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, 53, __pyx_L1_error) + 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":77 - * return 3 + /* "DracoPy.pyx":108 + * * * class FileTypeException(Exception): # <<<<<<<<<<<<<< * pass * */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 77, __pyx_L1_error) + __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, 77, __pyx_L1_error) + __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, 77, __pyx_L1_error) + __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, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 77, __pyx_L1_error) + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_FileTypeException, __pyx_t_2, __pyx_t_6, NULL, 0, 1); 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, 77, __pyx_L1_error) + 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":80 - * pass + /* "DracoPy.pyx":112 + * * * class EncodingFailedException(Exception): # <<<<<<<<<<<<<< * pass * */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error) + __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, 80, __pyx_L1_error) + __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, 80, __pyx_L1_error) + __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, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 80, __pyx_L1_error) + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_EncodingFailedException, __pyx_t_2, __pyx_t_6, NULL, 0, 1); 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, 80, __pyx_L1_error) + 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":83 - * pass + /* "DracoPy.pyx":116 * - * def create_empty_geometry_metadata() -> dict: # <<<<<<<<<<<<<< + * + * def _create_empty_geometry_metadata() -> GeometryMetadataObject: # <<<<<<<<<<<<<< * return { * "metadata_id": 0, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_1create_empty_geometry_metadata, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error) + __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, 83, __pyx_L1_error) + 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":89 - * } + /* "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_3encode_mesh_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 89, __pyx_L1_error) + __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, 89, __pyx_L1_error) + 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":103 + /* "DracoPy.pyx":206 * * * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< * quantization_bits=14, * compression_level=1, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_5encode_point_cloud_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 103, __pyx_L1_error) + __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, 103, __pyx_L1_error) + 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":117 + /* "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, - * quantization_bits=14, + * encoder: Encoder = Encoder(), */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_7encode_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 117, __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); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_to_buffer, __pyx_t_2) < 0) __PYX_ERR(0, 117, __pyx_L1_error) + 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":206 + /* "DracoPy.pyx":310 * 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_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_9raise_decoding_error, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 206, __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, 310, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_raise_decoding_error, __pyx_t_2) < 0) __PYX_ERR(0, 206, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_raise_decoding_error, __pyx_t_2) < 0) __PYX_ERR(0, 310, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":214 + /* "DracoPy.pyx":318 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer, deduplicate=False): # <<<<<<<<<<<<<< * """ * Decode buffer to mesh */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_11decode_buffer_to_mesh, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 214, __pyx_L1_error) + __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, 318, __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, 214, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode_buffer_to_mesh, __pyx_t_2) < 0) __PYX_ERR(0, 318, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":227 + /* "DracoPy.pyx":331 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer, deduplicate=False): # <<<<<<<<<<<<<< * """ * Decode buffer to point cloud */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_13decode_point_cloud_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 227, __pyx_L1_error) + __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, 331, __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, 227, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode_point_cloud_buffer, __pyx_t_2) < 0) __PYX_ERR(0, 331, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "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); @@ -12467,9 +14173,9 @@ if (!__Pyx_RefNanny) { * 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__55)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 28, __pyx_L1_error) + __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_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__56); + __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; @@ -12480,7 +14186,7 @@ if (!__Pyx_RefNanny) { * return "<%s.%s: %d>" % (self.__class__.__name__, self.name, self) * def __str__(self): */ - __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__58)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 39, __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; @@ -12492,7 +14198,7 @@ if (!__Pyx_RefNanny) { * return "%s.%s" % (self.__class__.__name__, self.name) * */ - __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__60)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 41, __pyx_L1_error) + __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; @@ -12999,569 +14705,1146 @@ if (!__Pyx_RefNanny) { __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) + __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_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; + + /* "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_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; + + /* "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_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; + + /* "EnumType":51 + * + * cdef dict __Pyx_globals = globals() + * if PY_VERSION_HEX >= 0x03040000: # <<<<<<<<<<<<<< + * + * DataType = __Pyx_EnumBase('DataType', __Pyx_OrderedDict([ + */ + goto __pyx_L4; + } + + /* "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') + */ + /*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; + + /* "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_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_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_INT32, __pyx_t_15) < 0)) __PYX_ERR(1, 73, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + 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":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 + /* "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_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_DataType); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 74, __pyx_L1_error) + __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_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_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, 74, __pyx_L1_error) + __PYX_ERR(1, 86, __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) + 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; - /* "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 + /* "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_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DataType); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 75, __pyx_L1_error) + __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_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_DT_INT64); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 75, __pyx_L1_error) + __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, 75, __pyx_L1_error) + __PYX_ERR(1, 87, __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) + 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":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 + /* "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_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_DataType); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 76, __pyx_L1_error) + __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_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_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; - 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; - - /* "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_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) + __PYX_ERR(1, 88, __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; + 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":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 + /* "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_15, __pyx_n_s_DataType); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 78, __pyx_L1_error) + __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_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_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, 78, __pyx_L1_error) + __PYX_ERR(1, 89, __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) + 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; - /* "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: + /* "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_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DataType); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 79, __pyx_L1_error) + __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_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_DT_BOOL); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 79, __pyx_L1_error) + __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, 79, __pyx_L1_error) + __PYX_ERR(1, 90, __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) + 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":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): + /* "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, 80, __pyx_L1_error) + __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_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_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, 80, __pyx_L1_error) + __PYX_ERR(1, 91, __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; - - /* "EnumType":51 - * - * cdef dict __Pyx_globals = globals() - * if PY_VERSION_HEX >= 0x03040000: # <<<<<<<<<<<<<< - * - * DataType = __Pyx_EnumBase('DataType', __Pyx_OrderedDict([ - */ - goto __pyx_L4; - } + 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":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') + /* "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') */ - /*else*/ { - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 82, __pyx_L1_error) + __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_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_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 92, __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_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; - /* "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') + /* "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, 84, __pyx_L1_error) + __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_INVALID); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 84, __pyx_L1_error) + __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, 84, __pyx_L1_error) + __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_INVALID); - __Pyx_GIVEREF(__pyx_n_s_DT_INVALID); - PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_n_s_DT_INVALID); + __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, 84, __pyx_L1_error) + __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, 84, __pyx_L1_error) + __PYX_ERR(1, 93, __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) + 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":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') + /* "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, 85, __pyx_L1_error) + __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_INT8); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 85, __pyx_L1_error) + __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, 85, __pyx_L1_error) + __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_INT8); - __Pyx_GIVEREF(__pyx_n_s_DT_INT8); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_DT_INT8); + __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, 85, __pyx_L1_error) + __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, 85, __pyx_L1_error) + __PYX_ERR(1, 94, __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) + 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":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') + /* "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') + * */ - __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_DataType); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 86, __pyx_L1_error) + __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_UINT8); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 86, __pyx_L1_error) + __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, 86, __pyx_L1_error) + __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_UINT8); - __Pyx_GIVEREF(__pyx_n_s_DT_UINT8); - PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_n_s_DT_UINT8); + __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, 86, __pyx_L1_error) + __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, 86, __pyx_L1_error) + __PYX_ERR(1, 95, __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) + 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; - /* "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') + /* "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') # <<<<<<<<<<<<<< + * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DataType); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 87, __pyx_L1_error) + __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_INT16); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 87, __pyx_L1_error) + __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, 87, __pyx_L1_error) + __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_INT16); - __Pyx_GIVEREF(__pyx_n_s_DT_INT16); - PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_n_s_DT_INT16); + __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, 87, __pyx_L1_error) + __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:; + + /* "EnumType":50 + * + * + * cdef dict __Pyx_globals = globals() # <<<<<<<<<<<<<< + * if PY_VERSION_HEX >= 0x03040000: + * + */ + __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 + * + * cdef dict __Pyx_globals = globals() + * if PY_VERSION_HEX >= 0x03040000: # <<<<<<<<<<<<<< + * + * GeometryAttributeType = __Pyx_EnumBase('GeometryAttributeType', __Pyx_OrderedDict([ + */ + __pyx_t_7 = ((PY_VERSION_HEX >= 0x03040000) != 0); + if (__pyx_t_7) { + + /* "EnumType":54 + * + * GeometryAttributeType = __Pyx_EnumBase('GeometryAttributeType', __Pyx_OrderedDict([ + * ('INVALID', INVALID), # <<<<<<<<<<<<<< + * ('POSITION', POSITION), + * ('NORMAL', NORMAL), + */ + __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: + * + * GeometryAttributeType = __Pyx_EnumBase('GeometryAttributeType', __Pyx_OrderedDict([ # <<<<<<<<<<<<<< + * ('INVALID', INVALID), + * ('POSITION', POSITION), + */ + __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_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 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, 87, __pyx_L1_error) + __PYX_ERR(1, 64, __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) + 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":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') + /* "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_DataType); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 88, __pyx_L1_error) + __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_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_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; - __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) + __PYX_ERR(1, 65, __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; + 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":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') + /* "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_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_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_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; + __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, 89, __pyx_L1_error) + __PYX_ERR(1, 66, __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; + 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":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') + /* "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_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_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_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_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_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 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, 90, __pyx_L1_error) + __PYX_ERR(1, 68, __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) + 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; - /* "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') + /* "EnumType":51 + * + * cdef dict __Pyx_globals = globals() + * if PY_VERSION_HEX >= 0x03040000: # <<<<<<<<<<<<<< + * + * GeometryAttributeType = __Pyx_EnumBase('GeometryAttributeType', __Pyx_OrderedDict([ */ - __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_DataType); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 91, __pyx_L1_error) + goto __pyx_L5; + } + + /* "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_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_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; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 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, 91, __pyx_L1_error) + __PYX_ERR(1, 72, __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; + 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":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') + /* "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_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_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_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_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, 92, __pyx_L1_error) + __PYX_ERR(1, 73, __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; + 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":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') + /* "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_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_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_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 93, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); + __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_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); + 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_2, __pyx_t_14, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 93, __pyx_L1_error) + __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_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __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, 93, __pyx_L1_error) + __PYX_ERR(1, 74, __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) + 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":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') + /* "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_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_DataType); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 94, __pyx_L1_error) + __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_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_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_2); __pyx_t_2 = 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, 94, __pyx_L1_error) + __PYX_ERR(1, 75, __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; + 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":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') - * + /* "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_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_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_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_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, 95, __pyx_L1_error) + __PYX_ERR(1, 76, __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; + 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":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') # <<<<<<<<<<<<<< + /* "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') * */ - __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_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_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 96, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_14); + __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_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); + 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_2, __pyx_t_14, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 96, __pyx_L1_error) + __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_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __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, 96, __pyx_L1_error) + __PYX_ERR(1, 77, __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) + 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; + + /* "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_L4:; + __pyx_L5:; /*--- Wrapped vars code ---*/ @@ -13672,6 +15955,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, @@ -13759,34 +16082,237 @@ static int __Pyx_ParseOptionalKeywords( argname++; } } - } else - goto invalid_keyword_type; - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + 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 +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 { - goto invalid_keyword; + 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 } - 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; + Py_XDECREF(owned_instance); + return; } +#endif /* PyObjectSetAttrStr */ #if CYTHON_USE_TYPE_SLOTS @@ -14029,26 +16555,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 = 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 - /* PyObjectCall2Args */ static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { PyObject *args, *result = NULL; @@ -14375,240 +16881,57 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *r = PyTuple_GET_ITEM(o, n); Py_INCREF(r); return r; - } - } else { - PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; - if (likely(m && m->sq_item)) { - if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { - Py_ssize_t l = m->sq_length(o); - if (likely(l >= 0)) { - i += l; - } else { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return NULL; - PyErr_Clear(); - } - } - return m->sq_item(o, i); - } - } -#else - if (is_list || PySequence_Check(o)) { - return PySequence_GetItem(o, i); - } -#endif - return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); -} - -/* ObjectGetItem */ -#if CYTHON_USE_TYPE_SLOTS -static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { - PyObject *runerr; - Py_ssize_t key_value; - PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence; - if (unlikely(!(m && m->sq_item))) { - PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name); - return NULL; - } - key_value = __Pyx_PyIndex_AsSsize_t(index); - if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { - return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); - } - if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { - PyErr_Clear(); - PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name); - } - return NULL; -} -static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { - PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping; - if (likely(m && m->mp_subscript)) { - return m->mp_subscript(obj, key); - } - return __Pyx_PyObject_GetIndex(obj, 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 { + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (likely(l >= 0)) { + i += l; } else { - type = instance_class; + if (!PyErr_ExceptionMatches(PyExc_OverflowError)) + return NULL; + PyErr_Clear(); } } + return m->sq_item(o, i); } - 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); - } + if (is_list || PySequence_Check(o)) { + return PySequence_GetItem(o, i); + } #endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +/* ObjectGetItem */ +#if CYTHON_USE_TYPE_SLOTS +static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject* index) { + PyObject *runerr; + Py_ssize_t key_value; + PySequenceMethods *m = Py_TYPE(obj)->tp_as_sequence; + if (unlikely(!(m && m->sq_item))) { + PyErr_Format(PyExc_TypeError, "'%.200s' object is not subscriptable", Py_TYPE(obj)->tp_name); + return NULL; } -bad: - Py_XDECREF(owned_instance); - return; + key_value = __Pyx_PyIndex_AsSsize_t(index); + if (likely(key_value != -1 || !(runerr = PyErr_Occurred()))) { + return __Pyx_GetItemInt_Fast(obj, key_value, 0, 1, 1); + } + if (PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) { + PyErr_Clear(); + PyErr_Format(PyExc_IndexError, "cannot fit '%.200s' into an index-sized integer", Py_TYPE(index)->tp_name); + } + return NULL; +} +static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { + PyMappingMethods *m = Py_TYPE(obj)->tp_as_mapping; + if (likely(m && m->mp_subscript)) { + return m->mp_subscript(obj, key); + } + return __Pyx_PyObject_GetIndex(obj, key); } #endif @@ -14711,6 +17034,27 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { } #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 static _PyErr_StackItem * @@ -16637,7 +18981,23 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, return (target_type) value;\ } -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_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(4); if (unlikely(!res)) return NULL; @@ -16675,22 +19035,6 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu Py_DECREF(res); return NULL; } - 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_MeshObject(struct DracoFunctions::MeshObject s) { PyObject* res; PyObject* member; @@ -16766,26 +19110,26 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu 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 @@ -16794,32 +19138,32 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu #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; @@ -16833,86 +19177,86 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu { 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(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) - 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(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(size_t) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x)) + 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(size_t) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } 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 } } @@ -16921,7 +19265,7 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else - size_t val; + enum draco::GeometryAttribute::Type val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { @@ -16941,47 +19285,47 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu return val; } #endif - return (size_t) -1; + return (enum draco::GeometryAttribute::Type) -1; } } else { - size_t val; + enum draco::GeometryAttribute::Type val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (size_t) -1; - val = __Pyx_PyInt_As_size_t(tmp); + 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 size_t"); - return (size_t) -1; + "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 size_t"); - return (size_t) -1; + "can't convert negative value to enum draco::GeometryAttribute::Type"); + return (enum draco::GeometryAttribute::Type) -1; } /* CIntFromPy */ - static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) { + 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 uint32_t neg_one = (uint32_t) -1, const_zero = (uint32_t) 0; + 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(uint32_t) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(uint32_t, long, PyInt_AS_LONG(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 (uint32_t) val; + return (int) val; } } else #endif @@ -16990,32 +19334,32 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return (uint32_t) 0; - case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, digits[0]) + case 0: return (int) 0; + case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) case 2: - if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(int) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) >= 2 * PyLong_SHIFT) { - return (uint32_t) (((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); + __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(uint32_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(int) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) >= 3 * PyLong_SHIFT) { - return (uint32_t) (((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); + __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(uint32_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(int) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_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(uint32_t) >= 4 * PyLong_SHIFT) { - return (uint32_t) (((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_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) >= 4 * PyLong_SHIFT) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); } } break; @@ -17029,86 +19373,86 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) - return (uint32_t) -1; + return (int) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif - if (sizeof(uint32_t) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned long, PyLong_AsUnsignedLong(x)) + if (sizeof(int) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } 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 (uint32_t) 0; - case -1: __PYX_VERIFY_RETURN_INT(uint32_t, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, +digits[0]) + 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(uint32_t) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { - return (uint32_t) (((uint32_t)-1)*(((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + __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(uint32_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(int) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { - return (uint32_t) ((((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + __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(uint32_t) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { - return (uint32_t) (((uint32_t)-1)*(((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + __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(uint32_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(int) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { - return (uint32_t) ((((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + __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(uint32_t) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_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(uint32_t) - 1 > 4 * PyLong_SHIFT) { - return (uint32_t) (((uint32_t)-1)*(((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); + __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(uint32_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(int) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(uint32_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(uint32_t) - 1 > 4 * PyLong_SHIFT) { - return (uint32_t) ((((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_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(uint32_t) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(uint32_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(uint32_t) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(uint32_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 } } @@ -17117,7 +19461,7 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else - uint32_t val; + int val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { @@ -17137,47 +19481,161 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu return val; } #endif - return (uint32_t) -1; + return (int) -1; } } else { - uint32_t val; + int val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (uint32_t) -1; - val = __Pyx_PyInt_As_uint32_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 uint32_t"); - return (uint32_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 uint32_t"); - return (uint32_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 */ - static CYTHON_INLINE enum draco::DataType __Pyx_PyInt_As_enum__draco_3a__3a_DataType(PyObject *x) { + static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) { #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; + 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 PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(enum draco::DataType) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(enum draco::DataType, long, PyInt_AS_LONG(x)) + if (sizeof(uint32_t) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(uint32_t, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } - return (enum draco::DataType) val; + return (uint32_t) val; } } else #endif @@ -17186,32 +19644,32 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return (enum draco::DataType) 0; - case 1: __PYX_VERIFY_RETURN_INT(enum draco::DataType, digit, digits[0]) + case 0: return (uint32_t) 0; + case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, digits[0]) case 2: - if (8 * sizeof(enum draco::DataType) > 1 * PyLong_SHIFT) { + if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __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])); + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) >= 2 * PyLong_SHIFT) { + return (uint32_t) (((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); } } break; case 3: - if (8 * sizeof(enum draco::DataType) > 2 * PyLong_SHIFT) { + if (8 * sizeof(uint32_t) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __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])); + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) >= 3 * PyLong_SHIFT) { + return (uint32_t) (((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); } } break; case 4: - if (8 * sizeof(enum draco::DataType) > 3 * PyLong_SHIFT) { + if (8 * sizeof(uint32_t) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __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])); + __PYX_VERIFY_RETURN_INT(uint32_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(uint32_t) >= 4 * PyLong_SHIFT) { + return (uint32_t) (((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0])); } } break; @@ -17225,86 +19683,86 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) - return (enum draco::DataType) -1; + return (uint32_t) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif - if (sizeof(enum draco::DataType) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(enum draco::DataType, unsigned long, PyLong_AsUnsignedLong(x)) + if (sizeof(uint32_t) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } 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)) + } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, 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 (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 0: return (uint32_t) 0; + case -1: __PYX_VERIFY_RETURN_INT(uint32_t, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, +digits[0]) case -2: - if (8 * sizeof(enum draco::DataType) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(uint32_t) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __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]))); + __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { + return (uint32_t) (((uint32_t)-1)*(((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); } } break; case 2: - if (8 * sizeof(enum draco::DataType) > 1 * PyLong_SHIFT) { + if (8 * sizeof(uint32_t) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __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]))); + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { + return (uint32_t) ((((((uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); } } break; case -3: - if (8 * sizeof(enum draco::DataType) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(uint32_t) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __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]))); + __PYX_VERIFY_RETURN_INT(uint32_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { + return (uint32_t) (((uint32_t)-1)*(((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); } } break; case 3: - if (8 * sizeof(enum draco::DataType) > 2 * PyLong_SHIFT) { + if (8 * sizeof(uint32_t) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __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]))); + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { + return (uint32_t) ((((((((uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); } } break; case -4: - if (8 * sizeof(enum draco::DataType) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(uint32_t) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __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]))); + __PYX_VERIFY_RETURN_INT(uint32_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(uint32_t) - 1 > 4 * PyLong_SHIFT) { + return (uint32_t) (((uint32_t)-1)*(((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); } } break; case 4: - if (8 * sizeof(enum draco::DataType) > 3 * PyLong_SHIFT) { + if (8 * sizeof(uint32_t) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __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]))); + __PYX_VERIFY_RETURN_INT(uint32_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(uint32_t) - 1 > 4 * PyLong_SHIFT) { + return (uint32_t) ((((((((((uint32_t)digits[3]) << PyLong_SHIFT) | (uint32_t)digits[2]) << PyLong_SHIFT) | (uint32_t)digits[1]) << PyLong_SHIFT) | (uint32_t)digits[0]))); } } break; } #endif - if (sizeof(enum draco::DataType) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(enum draco::DataType, long, PyLong_AsLong(x)) + if (sizeof(uint32_t) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(enum draco::DataType) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(enum draco::DataType, PY_LONG_LONG, PyLong_AsLongLong(x)) + } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(uint32_t, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } @@ -17313,7 +19771,7 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else - enum draco::DataType val; + uint32_t val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { @@ -17333,47 +19791,47 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu return val; } #endif - return (enum draco::DataType) -1; + return (uint32_t) -1; } } else { - enum draco::DataType val; + uint32_t val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (enum draco::DataType) -1; - val = __Pyx_PyInt_As_enum__draco_3a__3a_DataType(tmp); + if (!tmp) return (uint32_t) -1; + val = __Pyx_PyInt_As_uint32_t(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, - "value too large to convert to enum draco::DataType"); - return (enum draco::DataType) -1; + "value too large to convert to uint32_t"); + return (uint32_t) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to enum draco::DataType"); - return (enum draco::DataType) -1; + "can't convert negative value to uint32_t"); + return (uint32_t) -1; } /* 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 @@ -17382,32 +19840,32 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu #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; @@ -17421,86 +19879,86 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu { 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 } } @@ -17509,7 +19967,7 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu 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)) { @@ -17529,52 +19987,52 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu 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; + "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 int"); - return (int) -1; + "can't convert negative value to enum draco::DataType"); + return (enum draco::DataType) -1; } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_char(unsigned char value) { + 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 unsigned char neg_one = (unsigned char) -1, const_zero = (unsigned char) 0; + 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(unsigned char) < sizeof(long)) { + if (sizeof(uint32_t) < sizeof(long)) { return PyInt_FromLong((long) value); - } else if (sizeof(unsigned char) <= sizeof(unsigned long)) { + } else if (sizeof(uint32_t) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(unsigned char) <= sizeof(unsigned PY_LONG_LONG)) { + } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { - if (sizeof(unsigned char) <= sizeof(long)) { + if (sizeof(uint32_t) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(unsigned char) <= sizeof(PY_LONG_LONG)) { + } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } @@ -17582,37 +20040,37 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(unsigned char), + return _PyLong_FromByteArray(bytes, sizeof(uint32_t), little, !is_unsigned); } } /* CIntToPy */ - 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) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif - const enum DracoFunctions::decoding_status neg_one = (enum DracoFunctions::decoding_status) -1, const_zero = (enum DracoFunctions::decoding_status) 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 (is_unsigned) { - if (sizeof(enum DracoFunctions::decoding_status) < sizeof(long)) { + if (sizeof(enum draco::DataType) < sizeof(long)) { return PyInt_FromLong((long) value); - } else if (sizeof(enum DracoFunctions::decoding_status) <= sizeof(unsigned long)) { + } else if (sizeof(enum draco::DataType) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(enum DracoFunctions::decoding_status) <= sizeof(unsigned PY_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 DracoFunctions::decoding_status) <= sizeof(long)) { + if (sizeof(enum draco::DataType) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(enum DracoFunctions::decoding_status) <= sizeof(PY_LONG_LONG)) { + } else if (sizeof(enum draco::DataType) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } @@ -17620,37 +20078,37 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(enum DracoFunctions::decoding_status), + return _PyLong_FromByteArray(bytes, sizeof(enum draco::DataType), little, !is_unsigned); } } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_char(unsigned char value) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif - const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned int) 0; + const unsigned char neg_one = (unsigned char) -1, const_zero = (unsigned char) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; if (is_unsigned) { - if (sizeof(unsigned int) < sizeof(long)) { + if (sizeof(unsigned char) < sizeof(long)) { return PyInt_FromLong((long) value); - } else if (sizeof(unsigned int) <= sizeof(unsigned long)) { + } else if (sizeof(unsigned char) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) { + } else if (sizeof(unsigned char) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { - if (sizeof(unsigned int) <= sizeof(long)) { + if (sizeof(unsigned char) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) { + } else if (sizeof(unsigned char) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } @@ -17658,37 +20116,37 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(unsigned int), + return _PyLong_FromByteArray(bytes, sizeof(unsigned char), little, !is_unsigned); } } /* CIntToPy */ - 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) { #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 DracoFunctions::decoding_status neg_one = (enum DracoFunctions::decoding_status) -1, const_zero = (enum DracoFunctions::decoding_status) 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)) { + if (sizeof(enum DracoFunctions::decoding_status) < sizeof(long)) { return PyInt_FromLong((long) value); - } else if (sizeof(int) <= sizeof(unsigned long)) { + } else if (sizeof(enum DracoFunctions::decoding_status) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + } else if (sizeof(enum DracoFunctions::decoding_status) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { - if (sizeof(int) <= sizeof(long)) { + if (sizeof(enum DracoFunctions::decoding_status) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + } else if (sizeof(enum DracoFunctions::decoding_status) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } @@ -17696,37 +20154,37 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(int), + return _PyLong_FromByteArray(bytes, sizeof(enum DracoFunctions::decoding_status), little, !is_unsigned); } } /* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value) { + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int 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; + const unsigned int neg_one = (unsigned int) -1, const_zero = (unsigned 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(uint32_t) < sizeof(long)) { + if (sizeof(unsigned int) < sizeof(long)) { return PyInt_FromLong((long) value); - } else if (sizeof(uint32_t) <= sizeof(unsigned long)) { + } else if (sizeof(unsigned int) <= sizeof(unsigned long)) { return PyLong_FromUnsignedLong((unsigned long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) { + } else if (sizeof(unsigned int) <= sizeof(unsigned PY_LONG_LONG)) { return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); #endif } } else { - if (sizeof(uint32_t) <= sizeof(long)) { + if (sizeof(unsigned int) <= sizeof(long)) { return PyInt_FromLong((long) value); #ifdef HAVE_LONG_LONG - } else if (sizeof(uint32_t) <= sizeof(PY_LONG_LONG)) { + } else if (sizeof(unsigned int) <= sizeof(PY_LONG_LONG)) { return PyLong_FromLongLong((PY_LONG_LONG) value); #endif } @@ -17734,47 +20192,205 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(uint32_t), + return _PyLong_FromByteArray(bytes, sizeof(unsigned int), little, !is_unsigned); } } -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__draco_3a__3a_DataType(enum draco::DataType 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 enum draco::DataType neg_one = (enum draco::DataType) -1, const_zero = (enum draco::DataType) 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(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); +#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 +#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 (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 +#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 + 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(enum draco::DataType) <= 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(enum draco::DataType) <= 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(enum draco::DataType) <= 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(enum draco::DataType), - 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 */ @@ -17973,44 +20589,6 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttribu return (long) -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); - } -} - /* CheckBinaryVersion */ static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; diff --git a/src/DracoPy.h b/src/DracoPy.h index 4419acc..e17a4b3 100644 --- a/src/DracoPy.h +++ b/src/DracoPy.h @@ -357,45 +357,11 @@ namespace DracoFunctions { 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, - const std::vector& metadatas, - const GeometryMetadataObject& geometry_metadata_object) { - int speed = 10 - compression_level; - encoder.SetSpeedOptions(speed, speed); - draco::GeometryMetadata* metadata = nullptr; - if (create_metadata) { - metadata = &encode_geometry_metadata(*point_cloud_or_mesh, metadatas, geometry_metadata_object); - metadata->AddEntryInt("quantization_bits", quantization_bits); - } - 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); - } - } - } - EncodedObject encode_mesh(const std::vector &points, const std::vector &faces, + draco::Encoder& encoder, const std::vector& metadatas, - const GeometryMetadataObject& geometry_metadata_object, - - int quantization_bits, int compression_level, float quantization_range, - const float *quantization_origin, bool create_metadata) { + const GeometryMetadataObject& geometry_metadata_object) { draco::TriangleSoupMeshBuilder mb; mb.Start(faces.size()); const int pos_att_id = @@ -412,10 +378,8 @@ namespace DracoFunctions { 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, - metadatas, geometry_metadata_object); + if (!metadatas.empty()) + encode_geometry_metadata(*mesh, metadatas, geometry_metadata_object); draco::EncoderBuffer buffer; const draco::Status status = encoder.EncodeMeshToBuffer(*mesh, &buffer); EncodedObject encodedMeshObject; @@ -430,13 +394,9 @@ namespace DracoFunctions { } EncodedObject encode_point_cloud(const std::vector &points, + draco::Encoder& encoder, const std::vector& metadatas, - const GeometryMetadataObject& geometry_metadata_object, - int quantization_bits, - int compression_level, - float quantization_range, - const float *quantization_origin, - bool create_metadata) { + const GeometryMetadataObject& geometry_metadata_object) { int num_points = points.size() / 3; draco::PointCloudBuilder pcb; pcb.Start(num_points); @@ -449,10 +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, - metadatas, geometry_metadata_object); + 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; @@ -465,5 +423,4 @@ namespace DracoFunctions { } return encodedPointCloudObject; } - } diff --git a/src/DracoPy.pxd b/src/DracoPy.pxd index 01e5b46..7fa5def 100644 --- a/src/DracoPy.pxd +++ b/src/DracoPy.pxd @@ -4,6 +4,18 @@ 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", @@ -20,6 +32,14 @@ cdef extern from "DracoPy.h" namespace "draco": 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": @@ -89,22 +109,14 @@ cdef extern from "DracoPy.h" namespace "DracoFunctions": EncodedObject encode_mesh( vector[float] points, vector[uint32_t] faces, + CppEncoder encoder, vector[MetadataObject] metadatas, - GeometryMetadataObject geometry_metadata, - int quantization_bits, - int compression_level, - float quantization_range, - const float *quantization_origin, - bool create_metadata + GeometryMetadataObject geometry_metadata ) except + EncodedObject encode_point_cloud( vector[float] points, + CppEncoder encoder, vector[MetadataObject] metadatas, - GeometryMetadataObject geometry_metadata_object, - int quantization_bits, - int compression_level, - float quantization_range, - const float *quantization_origin, - bool create_metadata + GeometryMetadataObject geometry_metadata_object ) except + diff --git a/src/DracoPy.pyx b/src/DracoPy.pyx index 14f4857..6e2a453 100644 --- a/src/DracoPy.pyx +++ b/src/DracoPy.pyx @@ -1,11 +1,41 @@ # 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 from math import floor +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): self.data_struct = data_struct @@ -49,6 +79,7 @@ class DracoMesh(DracoPointCloud): 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 @@ -73,30 +104,103 @@ class EncodingOptions(object): def num_axes(self): return 3 + class FileTypeException(Exception): pass + class EncodingFailedException(Exception): pass -def create_empty_geometry_metadata() -> dict: + +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["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["quantization_range"] = struct.pack( + "=d", quantization_range) + metadata.entries["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, - metadatas = None, - geometry_metadata = None, ): - return encode_to_buffer(points, faces, quantization_bits, compression_level, - quantization_range, quantization_origin, - create_metadata, metadatas, geometry_metadata) + """ + 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 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, @@ -104,22 +208,45 @@ def encode_point_cloud_to_buffer(points, compression_level=1, quantization_range=-1, quantization_origin=None, - create_metadata=False, - metadatas = None, - geometry_metadata = None, + create_metadata=False ): - return encode_to_buffer(points, None, quantization_bits, compression_level, - quantization_range, quantization_origin, - create_metadata, metadatas, geometry_metadata) + """ + 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, - quantization_bits=14, - compression_level=1, - quantization_range=-1, - quantization_origin=None, - create_metadata=False, + encoder: Encoder = Encoder(), metadatas = None, geometry_metadata = None, ): @@ -129,15 +256,6 @@ def encode_to_buffer(points: List[float], :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 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 :param List[dict] metadatas: list of metadatas each of them containing "entries" - dictionary with strings (entry name) and binary data related to that entry @@ -162,33 +280,20 @@ def encode_to_buffer(points: List[float], if metadatas is None: metadatas = [] if geometry_metadata is None: - geometry_metadata = create_empty_geometry_metadata() + 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] if isinstance(faces, list): draco_encoded = DracoPy.encode_mesh(points, faces, + encoder.this_encoder, metadatas, - geometry_metadata, - quantization_bits, - compression_level, - quantization_range, - quant_origin, - create_metadata) + geometry_metadata) else: draco_encoded = DracoPy.encode_point_cloud(points, + encoder.this_encoder, metadatas, - geometry_metadata, - quantization_bits, - compression_level, - quantization_range, - quant_origin, - create_metadata) + geometry_metadata) if quant_origin != NULL: PyMem_Free(quant_origin) if draco_encoded.encode_status == DracoPy.encoding_status.successful_encoding: diff --git a/tests.py b/tests.py index ba56bc9..e12d254 100644 --- a/tests.py +++ b/tests.py @@ -166,7 +166,7 @@ def test_decoding_and_encoding_point_cloud_file(): def test_encode_decode_tetrahedron_mesh(): points, faces = create_tetrahedron() - buffer = DracoPy.encode_mesh_to_buffer(points, faces) + 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) @@ -186,7 +186,7 @@ def test_encode_decode_tetrahedron_mesh(): def test_encode_decode_tetrahedron_point_cloud(): points, _ = create_tetrahedron() - buffer = DracoPy.encode_point_cloud_to_buffer(points) + 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) @@ -197,7 +197,7 @@ def test_encode_decode_tetrahedron_point_cloud(): def test_encode_decode_tetrahedron_with_deduplication_mesh(): points, faces = create_tetrahedron() - buffer = DracoPy.encode_mesh_to_buffer(points, faces) + 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) @@ -217,7 +217,7 @@ def test_encode_decode_tetrahedron_with_deduplication_mesh(): def test_encode_decode_tetrahedron_with_deduplication_point_cloud(): points, _ = create_tetrahedron() - buffer = DracoPy.encode_point_cloud_to_buffer(points) + 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 @@ -250,9 +250,8 @@ def test_encode_decode_geometry_attributes_mesh(): "generic_attributes": [attribute], } # encode - decode - buffer = DracoPy.encode_mesh_to_buffer( + buffer = DracoPy.encode_to_buffer( points, faces, - create_metadata=True, metadatas=metadatas, geometry_metadata=geometry_metadata, ) @@ -297,9 +296,8 @@ def test_encode_decode_geometry_attributes_point_cloud(): } # encode - decode with pytest.raises(RuntimeError): - DracoPy.encode_point_cloud_to_buffer( + DracoPy.encode_to_buffer( points, - create_metadata=True, metadatas=metadatas, geometry_metadata=geometry_metadata) @@ -324,15 +322,11 @@ def test_encode_decode_submetadata_entries_mesh(): "generic_attributes": [], } # encode - decode - buffer = DracoPy.encode_mesh_to_buffer( + buffer = DracoPy.encode_to_buffer( points, faces, - create_metadata=True, metadatas=metadatas, geometry_metadata=geometry_metadata_specific) mesh = DracoPy.decode_buffer_to_mesh(buffer) - # add default value for quantization_bits - geometry_metadata["entries"][b"quantization_bits"] = int.to_bytes( - 14, 4, sys.byteorder) # validate results out_metadatas = mesh.metadatas assert len(out_metadatas) == len(metadatas) @@ -367,15 +361,11 @@ def test_encode_decode_submetadata_entries_point_cloud(): "generic_attributes": [], } # encode - decode - buffer = DracoPy.encode_point_cloud_to_buffer( + buffer = DracoPy.encode_to_buffer( points, - create_metadata=True, metadatas=metadatas, geometry_metadata=geometry_metadata_specific) point_cloud = DracoPy.decode_point_cloud_buffer(buffer) - # add default value for quantization_bits - geometry_metadata["entries"][b"quantization_bits"] = int.to_bytes( - 14, 4, sys.byteorder) # validate results out_metadatas = point_cloud.metadatas assert len(out_metadatas) == len(metadatas) @@ -390,54 +380,6 @@ def test_encode_decode_submetadata_entries_point_cloud(): assert custom_metadata == metadatas[1] -def test_no_metadata_exists_if_create_metadata_false_mesh(): - points, faces = create_tetrahedron() - metadatas = [ - { - "entries": {}, - "sub_metadata_ids": {}, - } - ] - geometry_metadata_specific = { - "metadata_id": 0, - "generic_attributes": [], - } - # encode - decode - buffer = DracoPy.encode_mesh_to_buffer( - points, faces, - create_metadata=False, - metadatas=metadatas, - geometry_metadata=geometry_metadata_specific) - mesh = DracoPy.decode_buffer_to_mesh(buffer) - # validate results - assert len(mesh.metadatas) == 0 - assert mesh.geometry_metadata is None - - -def test_no_metadata_exists_if_create_metadata_false_point_cloud(): - points, _ = create_tetrahedron() - metadatas = [ - { - "entries": {}, - "sub_metadata_ids": {}, - } - ] - geometry_metadata_specific = { - "metadata_id": 0, - "generic_attributes": [], - } - # encode - decode - buffer = DracoPy.encode_point_cloud_to_buffer( - points, - create_metadata=False, - metadatas=metadatas, - geometry_metadata=geometry_metadata_specific) - point_cloud = DracoPy.decode_point_cloud_buffer(buffer) - # validate results - assert len(point_cloud.metadatas) == 0 - assert point_cloud.geometry_metadata is None - - def test_data_type_enum(): assert int(DracoPy.DataType.DT_INVALID) == 0 assert int(DracoPy.DataType.DT_TYPES_COUNT) == len(DracoPy.DataType) - 1 From a02383e2f229d86797703b6dc98b190592bdb8a1 Mon Sep 17 00:00:00 2001 From: Andrey Romanov Date: Fri, 19 Nov 2021 12:34:38 +0300 Subject: [PATCH 20/21] support faces as list and numpy array --- src/DracoPy.cpp | 481 +++++++++++++++++++++++++----------------------- src/DracoPy.pyx | 7 +- 2 files changed, 253 insertions(+), 235 deletions(-) diff --git a/src/DracoPy.cpp b/src/DracoPy.cpp index 7c185f0..64e075f 100644 --- a/src/DracoPy.cpp +++ b/src/DracoPy.cpp @@ -1688,6 +1688,7 @@ 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"; @@ -1944,6 +1945,7 @@ static PyObject *__pyx_kp_s_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; @@ -6350,14 +6352,15 @@ static PyObject *__pyx_pw_7DracoPy_9encode_to_buffer(PyObject *__pyx_self, PyObj } 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 int __pyx_t_1; - int __pyx_t_2; + PyObject *__pyx_t_2 = NULL; int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; + int __pyx_t_4; Py_ssize_t __pyx_t_5; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; @@ -6383,72 +6386,85 @@ static PyObject *__pyx_pf_7DracoPy_8encode_to_buffer(CYTHON_UNUSED PyObject *__p /* "DracoPy.pyx":276 * :return bytes: encoded mesh * """ - * if faces is None and isinstance(geometry_metadata, dict) and \ # <<<<<<<<<<<<<< + * is_mesh = faces is not None # <<<<<<<<<<<<<< + * if not is_mesh and isinstance(geometry_metadata, dict) and \ + * len(geometry_metadata["generic_attributes"]) > 0: + */ + __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":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_t_2 = (__pyx_v_faces == Py_None); - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_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_3; + __pyx_t_1 = __pyx_t_4; goto __pyx_L4_bool_binop_done; } - __pyx_t_3 = PyDict_Check(__pyx_v_geometry_metadata); - __pyx_t_2 = (__pyx_t_3 != 0); - if (__pyx_t_2) { + __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_2; + __pyx_t_1 = __pyx_t_3; goto __pyx_L4_bool_binop_done; } - /* "DracoPy.pyx":277 - * """ - * if faces is None and isinstance(geometry_metadata, dict) and \ + /* "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_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_geometry_metadata, __pyx_n_s_generic_attributes); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 277, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 277, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_2 = ((__pyx_t_5 > 0) != 0); - __pyx_t_1 = __pyx_t_2; + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_geometry_metadata, __pyx_n_s_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":276 - * :return bytes: encoded mesh + /* "DracoPy.pyx":277 * """ - * if faces is None and isinstance(geometry_metadata, dict) and \ # <<<<<<<<<<<<<< + * 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 " */ if (unlikely(__pyx_t_1)) { - /* "DracoPy.pyx":278 - * if faces is None and isinstance(geometry_metadata, dict) and \ + /* "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_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 278, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_Raise(__pyx_t_4, 0, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __PYX_ERR(0, 278, __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":276 - * :return bytes: encoded mesh + /* "DracoPy.pyx":277 * """ - * if faces is None and isinstance(geometry_metadata, dict) and \ # <<<<<<<<<<<<<< + * 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 " */ } - /* "DracoPy.pyx":280 + /* "DracoPy.pyx":281 * raise RuntimeError("generic attributes encoding/decoding " * "is not supported for point cloud") * if metadatas is None: # <<<<<<<<<<<<<< @@ -6456,22 +6472,22 @@ static PyObject *__pyx_pf_7DracoPy_8encode_to_buffer(CYTHON_UNUSED PyObject *__p * if geometry_metadata is None: */ __pyx_t_1 = (__pyx_v_metadatas == Py_None); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __pyx_t_3 = (__pyx_t_1 != 0); + if (__pyx_t_3) { - /* "DracoPy.pyx":281 + /* "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_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 281, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF_SET(__pyx_v_metadatas, __pyx_t_4); - __pyx_t_4 = 0; + __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":280 + /* "DracoPy.pyx":281 * raise RuntimeError("generic attributes encoding/decoding " * "is not supported for point cloud") * if metadatas is None: # <<<<<<<<<<<<<< @@ -6480,25 +6496,25 @@ static PyObject *__pyx_pf_7DracoPy_8encode_to_buffer(CYTHON_UNUSED PyObject *__p */ } - /* "DracoPy.pyx":282 + /* "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_t_2 = (__pyx_v_geometry_metadata == Py_None); - __pyx_t_1 = (__pyx_t_2 != 0); + __pyx_t_3 = (__pyx_v_geometry_metadata == Py_None); + __pyx_t_1 = (__pyx_t_3 != 0); if (__pyx_t_1) { - /* "DracoPy.pyx":283 + /* "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, 283, __pyx_L1_error) + __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))) { @@ -6510,15 +6526,15 @@ static PyObject *__pyx_pf_7DracoPy_8encode_to_buffer(CYTHON_UNUSED PyObject *__p __Pyx_DECREF_SET(__pyx_t_6, function); } } - __pyx_t_4 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6); + __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_4)) __PYX_ERR(0, 283, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + 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_4); - __pyx_t_4 = 0; + __Pyx_DECREF_SET(__pyx_v_geometry_metadata, __pyx_t_2); + __pyx_t_2 = 0; - /* "DracoPy.pyx":282 + /* "DracoPy.pyx":283 * if metadatas is None: * metadatas = [] * if geometry_metadata is None: # <<<<<<<<<<<<<< @@ -6527,20 +6543,20 @@ static PyObject *__pyx_pf_7DracoPy_8encode_to_buffer(CYTHON_UNUSED PyObject *__p */ } - /* "DracoPy.pyx":284 + /* "DracoPy.pyx":285 * if geometry_metadata is None: * geometry_metadata = _create_empty_geometry_metadata() * cdef float* quant_origin = NULL # <<<<<<<<<<<<<< * try: - * if isinstance(faces, list): + * if is_mesh: */ __pyx_v_quant_origin = NULL; - /* "DracoPy.pyx":285 + /* "DracoPy.pyx":286 * geometry_metadata = _create_empty_geometry_metadata() * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< - * if isinstance(faces, list): + * if is_mesh: * draco_encoded = DracoPy.encode_mesh(points, */ { @@ -6552,56 +6568,55 @@ static PyObject *__pyx_pf_7DracoPy_8encode_to_buffer(CYTHON_UNUSED PyObject *__p __Pyx_XGOTREF(__pyx_t_10); /*try:*/ { - /* "DracoPy.pyx":286 + /* "DracoPy.pyx":287 * cdef float* quant_origin = NULL * try: - * if isinstance(faces, list): # <<<<<<<<<<<<<< + * if is_mesh: # <<<<<<<<<<<<<< * draco_encoded = DracoPy.encode_mesh(points, * faces, */ - __pyx_t_1 = PyList_Check(__pyx_v_faces); - __pyx_t_2 = (__pyx_t_1 != 0); - if (__pyx_t_2) { + __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":287 + /* "DracoPy.pyx":288 * try: - * if isinstance(faces, list): + * if is_mesh: * draco_encoded = DracoPy.encode_mesh(points, # <<<<<<<<<<<<<< * faces, * encoder.this_encoder, */ - __pyx_t_11 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 287, __pyx_L9_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":288 - * if isinstance(faces, list): + /* "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, 288, __pyx_L9_error) + __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":290 + /* "DracoPy.pyx":291 * faces, * encoder.this_encoder, * metadatas, # <<<<<<<<<<<<<< * geometry_metadata) * else: */ - __pyx_t_13 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_metadatas); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 290, __pyx_L9_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":291 + /* "DracoPy.pyx":292 * encoder.this_encoder, * metadatas, * geometry_metadata) # <<<<<<<<<<<<<< * else: * draco_encoded = DracoPy.encode_point_cloud(points, */ - __pyx_t_14 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_geometry_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 291, __pyx_L9_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":287 + /* "DracoPy.pyx":288 * try: - * if isinstance(faces, list): + * if is_mesh: * draco_encoded = DracoPy.encode_mesh(points, # <<<<<<<<<<<<<< * faces, * encoder.this_encoder, @@ -6610,21 +6625,21 @@ static PyObject *__pyx_pf_7DracoPy_8encode_to_buffer(CYTHON_UNUSED PyObject *__p __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, 287, __pyx_L9_error) + __PYX_ERR(0, 288, __pyx_L9_error) } __pyx_v_draco_encoded = __pyx_t_15; - /* "DracoPy.pyx":286 + /* "DracoPy.pyx":287 * cdef float* quant_origin = NULL * try: - * if isinstance(faces, list): # <<<<<<<<<<<<<< + * if is_mesh: # <<<<<<<<<<<<<< * draco_encoded = DracoPy.encode_mesh(points, * faces, */ goto __pyx_L15; } - /* "DracoPy.pyx":293 + /* "DracoPy.pyx":294 * geometry_metadata) * else: * draco_encoded = DracoPy.encode_point_cloud(points, # <<<<<<<<<<<<<< @@ -6632,27 +6647,27 @@ static PyObject *__pyx_pf_7DracoPy_8encode_to_buffer(CYTHON_UNUSED PyObject *__p * metadatas, */ /*else*/ { - __pyx_t_11 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 293, __pyx_L9_error) + __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":295 + /* "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, 295, __pyx_L9_error) + __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":296 + /* "DracoPy.pyx":297 * encoder.this_encoder, * metadatas, * geometry_metadata) # <<<<<<<<<<<<<< * if quant_origin != NULL: * PyMem_Free(quant_origin) */ - __pyx_t_14 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_geometry_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 296, __pyx_L9_error) + __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) - /* "DracoPy.pyx":293 + /* "DracoPy.pyx":294 * geometry_metadata) * else: * draco_encoded = DracoPy.encode_point_cloud(points, # <<<<<<<<<<<<<< @@ -6663,23 +6678,23 @@ static PyObject *__pyx_pf_7DracoPy_8encode_to_buffer(CYTHON_UNUSED PyObject *__p __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, 293, __pyx_L9_error) + __PYX_ERR(0, 294, __pyx_L9_error) } __pyx_v_draco_encoded = __pyx_t_15; } __pyx_L15:; - /* "DracoPy.pyx":297 + /* "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_2 = ((__pyx_v_quant_origin != NULL) != 0); - if (__pyx_t_2) { + __pyx_t_1 = ((__pyx_v_quant_origin != NULL) != 0); + if (__pyx_t_1) { - /* "DracoPy.pyx":298 + /* "DracoPy.pyx":299 * geometry_metadata) * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -6688,7 +6703,7 @@ static PyObject *__pyx_pf_7DracoPy_8encode_to_buffer(CYTHON_UNUSED PyObject *__p */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":297 + /* "DracoPy.pyx":298 * metadatas, * geometry_metadata) * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -6697,7 +6712,7 @@ static PyObject *__pyx_pf_7DracoPy_8encode_to_buffer(CYTHON_UNUSED PyObject *__p */ } - /* "DracoPy.pyx":299 + /* "DracoPy.pyx":300 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if draco_encoded.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -6707,7 +6722,7 @@ static PyObject *__pyx_pf_7DracoPy_8encode_to_buffer(CYTHON_UNUSED PyObject *__p switch (__pyx_v_draco_encoded.encode_status) { case DracoFunctions::successful_encoding: - /* "DracoPy.pyx":300 + /* "DracoPy.pyx":301 * PyMem_Free(quant_origin) * if draco_encoded.encode_status == DracoPy.encoding_status.successful_encoding: * return bytes(draco_encoded.buffer) # <<<<<<<<<<<<<< @@ -6715,16 +6730,16 @@ static PyObject *__pyx_pf_7DracoPy_8encode_to_buffer(CYTHON_UNUSED PyObject *__p * raise EncodingFailedException('Invalid draco structure') */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_draco_encoded.buffer); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 300, __pyx_L9_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 300, __pyx_L9_error) + __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_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_6; __pyx_t_6 = 0; goto __pyx_L13_try_return; - /* "DracoPy.pyx":299 + /* "DracoPy.pyx":300 * if quant_origin != NULL: * PyMem_Free(quant_origin) * if draco_encoded.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< @@ -6734,35 +6749,35 @@ static PyObject *__pyx_pf_7DracoPy_8encode_to_buffer(CYTHON_UNUSED PyObject *__p break; case DracoFunctions::failed_during_encoding: - /* "DracoPy.pyx":302 + /* "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_4, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 302, __pyx_L9_error) - __Pyx_GOTREF(__pyx_t_4); + __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_4))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4); + 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_4); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); + __Pyx_DECREF_SET(__pyx_t_2, function); } } - __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_4, __pyx_t_7, __pyx_kp_s_Invalid_draco_structure) : __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_kp_s_Invalid_draco_structure); + __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_7, __pyx_kp_s_Invalid_draco_structure) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_Invalid_draco_structure); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 302, __pyx_L9_error) + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 303, __pyx_L9_error) __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __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, 302, __pyx_L9_error) + __PYX_ERR(0, 303, __pyx_L9_error) - /* "DracoPy.pyx":301 + /* "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: # <<<<<<<<<<<<<< @@ -6773,11 +6788,11 @@ static PyObject *__pyx_pf_7DracoPy_8encode_to_buffer(CYTHON_UNUSED PyObject *__p default: break; } - /* "DracoPy.pyx":285 + /* "DracoPy.pyx":286 * geometry_metadata = _create_empty_geometry_metadata() * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< - * if isinstance(faces, list): + * if is_mesh: * draco_encoded = DracoPy.encode_mesh(points, */ } @@ -6786,39 +6801,39 @@ static PyObject *__pyx_pf_7DracoPy_8encode_to_buffer(CYTHON_UNUSED PyObject *__p __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; goto __pyx_L14_try_end; __pyx_L9_error:; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __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":303 + /* "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_4, &__pyx_t_7); - __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 303, __pyx_L11_except_error) + __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_4, __pyx_t_7); - __pyx_t_6 = 0; __pyx_t_4 = 0; __pyx_t_7 = 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_4, &__pyx_t_6) < 0) __PYX_ERR(0, 303, __pyx_L11_except_error) + 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_4); + __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_6); - /* "DracoPy.pyx":304 + /* "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, 304, __pyx_L11_except_error) + __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))) { @@ -6832,15 +6847,15 @@ static PyObject *__pyx_pf_7DracoPy_8encode_to_buffer(CYTHON_UNUSED PyObject *__p } __pyx_t_16 = (__pyx_t_19) ? __Pyx_PyObject_Call2Args(__pyx_t_18, __pyx_t_19, __pyx_kp_s_Invalid_draco_structure) : __Pyx_PyObject_CallOneArg(__pyx_t_18, __pyx_kp_s_Invalid_draco_structure); __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 304, __pyx_L11_except_error) + 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, 304, __pyx_L11_except_error) + __PYX_ERR(0, 305, __pyx_L11_except_error) } - /* "DracoPy.pyx":305 + /* "DracoPy.pyx":306 * except EncodingFailedException: * raise EncodingFailedException('Invalid draco structure') * except: # <<<<<<<<<<<<<< @@ -6849,22 +6864,22 @@ static PyObject *__pyx_pf_7DracoPy_8encode_to_buffer(CYTHON_UNUSED PyObject *__p */ /*except:*/ { __Pyx_AddTraceback("DracoPy.encode_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_4, &__pyx_t_7) < 0) __PYX_ERR(0, 305, __pyx_L11_except_error) + 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_4); + __Pyx_GOTREF(__pyx_t_2); __Pyx_GOTREF(__pyx_t_7); - /* "DracoPy.pyx":306 + /* "DracoPy.pyx":307 * raise EncodingFailedException('Invalid draco structure') * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< * PyMem_Free(quant_origin) * raise ValueError("Input invalid") */ - __pyx_t_2 = ((__pyx_v_quant_origin != NULL) != 0); - if (__pyx_t_2) { + __pyx_t_1 = ((__pyx_v_quant_origin != NULL) != 0); + if (__pyx_t_1) { - /* "DracoPy.pyx":307 + /* "DracoPy.pyx":308 * except: * if quant_origin != NULL: * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< @@ -6873,7 +6888,7 @@ static PyObject *__pyx_pf_7DracoPy_8encode_to_buffer(CYTHON_UNUSED PyObject *__p */ PyMem_Free(__pyx_v_quant_origin); - /* "DracoPy.pyx":306 + /* "DracoPy.pyx":307 * raise EncodingFailedException('Invalid draco structure') * except: * if quant_origin != NULL: # <<<<<<<<<<<<<< @@ -6882,26 +6897,26 @@ static PyObject *__pyx_pf_7DracoPy_8encode_to_buffer(CYTHON_UNUSED PyObject *__p */ } - /* "DracoPy.pyx":308 + /* "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, 308, __pyx_L11_except_error) + __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, 308, __pyx_L11_except_error) + __PYX_ERR(0, 309, __pyx_L11_except_error) } __pyx_L11_except_error:; - /* "DracoPy.pyx":285 + /* "DracoPy.pyx":286 * geometry_metadata = _create_empty_geometry_metadata() * cdef float* quant_origin = NULL * try: # <<<<<<<<<<<<<< - * if isinstance(faces, list): + * if is_mesh: * draco_encoded = DracoPy.encode_mesh(points, */ __Pyx_XGIVEREF(__pyx_t_8); @@ -6930,7 +6945,7 @@ static PyObject *__pyx_pf_7DracoPy_8encode_to_buffer(CYTHON_UNUSED PyObject *__p __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_16); @@ -6939,6 +6954,7 @@ static PyObject *__pyx_pf_7DracoPy_8encode_to_buffer(CYTHON_UNUSED PyObject *__p __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); @@ -6946,7 +6962,7 @@ static PyObject *__pyx_pf_7DracoPy_8encode_to_buffer(CYTHON_UNUSED PyObject *__p return __pyx_r; } -/* "DracoPy.pyx":310 +/* "DracoPy.pyx":311 * raise ValueError("Input invalid") * * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< @@ -6980,29 +6996,29 @@ static PyObject *__pyx_pf_7DracoPy_10raise_decoding_error(CYTHON_UNUSED PyObject int __pyx_clineno = 0; __Pyx_RefNannySetupContext("raise_decoding_error", 0); - /* "DracoPy.pyx":311 + /* "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, 311, __pyx_L1_error) + __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, 311, __pyx_L1_error) + __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, 311, __pyx_L1_error) + __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":312 + /* "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, 312, __pyx_L1_error) + __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))) { @@ -7016,14 +7032,14 @@ static PyObject *__pyx_pf_7DracoPy_10raise_decoding_error(CYTHON_UNUSED PyObject } __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_kp_s_Input_mesh_is_not_draco_encoded) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_s_Input_mesh_is_not_draco_encoded); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 312, __pyx_L1_error) + 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, 312, __pyx_L1_error) + __PYX_ERR(0, 313, __pyx_L1_error) - /* "DracoPy.pyx":311 + /* "DracoPy.pyx":312 * * def raise_decoding_error(decoding_status): * if decoding_status == DracoPy.decoding_status.not_draco_encoded: # <<<<<<<<<<<<<< @@ -7032,35 +7048,35 @@ static PyObject *__pyx_pf_7DracoPy_10raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":313 + /* "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, 313, __pyx_L1_error) + __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, 313, __pyx_L1_error) + __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, 313, __pyx_L1_error) + __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":314 + /* "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, 314, __pyx_L1_error) + __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, 314, __pyx_L1_error) + __PYX_ERR(0, 315, __pyx_L1_error) - /* "DracoPy.pyx":313 + /* "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: # <<<<<<<<<<<<<< @@ -7069,35 +7085,35 @@ static PyObject *__pyx_pf_7DracoPy_10raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":315 + /* "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, 315, __pyx_L1_error) + __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, 315, __pyx_L1_error) + __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, 315, __pyx_L1_error) + __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":316 + /* "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, 316, __pyx_L1_error) + __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, 316, __pyx_L1_error) + __PYX_ERR(0, 317, __pyx_L1_error) - /* "DracoPy.pyx":315 + /* "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: # <<<<<<<<<<<<<< @@ -7106,7 +7122,7 @@ static PyObject *__pyx_pf_7DracoPy_10raise_decoding_error(CYTHON_UNUSED PyObject */ } - /* "DracoPy.pyx":310 + /* "DracoPy.pyx":311 * raise ValueError("Input invalid") * * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< @@ -7129,7 +7145,7 @@ static PyObject *__pyx_pf_7DracoPy_10raise_decoding_error(CYTHON_UNUSED PyObject return __pyx_r; } -/* "DracoPy.pyx":318 +/* "DracoPy.pyx":319 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer, deduplicate=False): # <<<<<<<<<<<<<< @@ -7178,7 +7194,7 @@ static PyObject *__pyx_pw_7DracoPy_13decode_buffer_to_mesh(PyObject *__pyx_self, } } 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, 318, __pyx_L3_error) + 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)) { @@ -7194,7 +7210,7 @@ static PyObject *__pyx_pw_7DracoPy_13decode_buffer_to_mesh(PyObject *__pyx_self, } 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, 318, __pyx_L3_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(); @@ -7225,25 +7241,25 @@ static PyObject *__pyx_pf_7DracoPy_12decode_buffer_to_mesh(CYTHON_UNUSED PyObjec int __pyx_clineno = 0; __Pyx_RefNannySetupContext("decode_buffer_to_mesh", 0); - /* "DracoPy.pyx":325 + /* "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, 325, __pyx_L1_error) - __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 325, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_deduplicate); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 325, __pyx_L1_error) + __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, 325, __pyx_L1_error) + __PYX_ERR(0, 326, __pyx_L1_error) } __pyx_v_mesh_struct = __pyx_t_4; - /* "DracoPy.pyx":326 + /* "DracoPy.pyx":327 * """ * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< @@ -7253,7 +7269,7 @@ static PyObject *__pyx_pf_7DracoPy_12decode_buffer_to_mesh(CYTHON_UNUSED PyObjec __pyx_t_5 = ((__pyx_v_mesh_struct.decode_status == DracoFunctions::successful) != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":327 + /* "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) # <<<<<<<<<<<<<< @@ -7261,9 +7277,9 @@ static PyObject *__pyx_pf_7DracoPy_12decode_buffer_to_mesh(CYTHON_UNUSED PyObjec * 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, 327, __pyx_L1_error) + __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, 327, __pyx_L1_error) + __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))) { @@ -7278,14 +7294,14 @@ static PyObject *__pyx_pf_7DracoPy_12decode_buffer_to_mesh(CYTHON_UNUSED PyObjec __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, 327, __pyx_L1_error) + 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":326 + /* "DracoPy.pyx":327 * """ * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) * if mesh_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< @@ -7294,7 +7310,7 @@ static PyObject *__pyx_pf_7DracoPy_12decode_buffer_to_mesh(CYTHON_UNUSED PyObjec */ } - /* "DracoPy.pyx":329 + /* "DracoPy.pyx":330 * return DracoMesh(mesh_struct) * else: * raise_decoding_error(mesh_struct.decode_status) # <<<<<<<<<<<<<< @@ -7302,9 +7318,9 @@ static PyObject *__pyx_pf_7DracoPy_12decode_buffer_to_mesh(CYTHON_UNUSED PyObjec * 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, 329, __pyx_L1_error) + __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, 329, __pyx_L1_error) + __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))) { @@ -7319,13 +7335,13 @@ static PyObject *__pyx_pf_7DracoPy_12decode_buffer_to_mesh(CYTHON_UNUSED PyObjec __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, 329, __pyx_L1_error) + 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":318 + /* "DracoPy.pyx":319 * raise ValueError('DracoPy only supports meshes with position attributes') * * def decode_buffer_to_mesh(buffer, deduplicate=False): # <<<<<<<<<<<<<< @@ -7349,7 +7365,7 @@ static PyObject *__pyx_pf_7DracoPy_12decode_buffer_to_mesh(CYTHON_UNUSED PyObjec return __pyx_r; } -/* "DracoPy.pyx":331 +/* "DracoPy.pyx":332 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer, deduplicate=False): # <<<<<<<<<<<<<< @@ -7398,7 +7414,7 @@ static PyObject *__pyx_pw_7DracoPy_15decode_point_cloud_buffer(PyObject *__pyx_s } } 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, 331, __pyx_L3_error) + 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)) { @@ -7414,7 +7430,7 @@ static PyObject *__pyx_pw_7DracoPy_15decode_point_cloud_buffer(PyObject *__pyx_s } 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, 331, __pyx_L3_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(); @@ -7445,25 +7461,25 @@ static PyObject *__pyx_pf_7DracoPy_14decode_point_cloud_buffer(CYTHON_UNUSED PyO int __pyx_clineno = 0; __Pyx_RefNannySetupContext("decode_point_cloud_buffer", 0); - /* "DracoPy.pyx":338 + /* "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, 338, __pyx_L1_error) - __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 338, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_deduplicate); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 338, __pyx_L1_error) + __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, 338, __pyx_L1_error) + __PYX_ERR(0, 339, __pyx_L1_error) } __pyx_v_point_cloud_struct = __pyx_t_4; - /* "DracoPy.pyx":339 + /* "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: # <<<<<<<<<<<<<< @@ -7473,7 +7489,7 @@ static PyObject *__pyx_pf_7DracoPy_14decode_point_cloud_buffer(CYTHON_UNUSED PyO __pyx_t_5 = ((__pyx_v_point_cloud_struct.decode_status == DracoFunctions::successful) != 0); if (__pyx_t_5) { - /* "DracoPy.pyx":340 + /* "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) # <<<<<<<<<<<<<< @@ -7481,9 +7497,9 @@ static PyObject *__pyx_pf_7DracoPy_14decode_point_cloud_buffer(CYTHON_UNUSED PyO * 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, 340, __pyx_L1_error) + __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, 340, __pyx_L1_error) + __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))) { @@ -7498,14 +7514,14 @@ static PyObject *__pyx_pf_7DracoPy_14decode_point_cloud_buffer(CYTHON_UNUSED PyO __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, 340, __pyx_L1_error) + 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":339 + /* "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: # <<<<<<<<<<<<<< @@ -7514,15 +7530,15 @@ static PyObject *__pyx_pf_7DracoPy_14decode_point_cloud_buffer(CYTHON_UNUSED PyO */ } - /* "DracoPy.pyx":342 + /* "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, 342, __pyx_L1_error) + __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, 342, __pyx_L1_error) + __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))) { @@ -7537,13 +7553,13 @@ static PyObject *__pyx_pf_7DracoPy_14decode_point_cloud_buffer(CYTHON_UNUSED PyO __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, 342, __pyx_L1_error) + 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":331 + /* "DracoPy.pyx":332 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer, deduplicate=False): # <<<<<<<<<<<<<< @@ -12600,6 +12616,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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}, @@ -12671,7 +12688,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { __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, 278, __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:; @@ -12712,47 +12729,47 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_tuple__3); __Pyx_GIVEREF(__pyx_tuple__3); - /* "DracoPy.pyx":278 - * if faces is None and isinstance(geometry_metadata, dict) and \ + /* "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_s_generic_attributes_encoding_deco); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 278, __pyx_L1_error) + __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_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":308 + /* "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_s_Input_invalid); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 308, __pyx_L1_error) + __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_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":314 + /* "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_s_Failed_to_decode_input_mesh_Data); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 314, __pyx_L1_error) + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_s_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":316 + /* "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_s_DracoPy_only_supports_meshes_wit); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 316, __pyx_L1_error) + __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_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); @@ -13060,46 +13077,46 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * faces: List[int] = None, * encoder: Encoder = Encoder(), */ - __pyx_tuple__50 = PyTuple_Pack(7, __pyx_n_s_points, __pyx_n_s_faces, __pyx_n_s_encoder, __pyx_n_s_metadatas, __pyx_n_s_geometry_metadata, __pyx_n_s_quant_origin, __pyx_n_s_draco_encoded); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 247, __pyx_L1_error) + __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, 7, 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) + __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":310 + /* "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, 310, __pyx_L1_error) + __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, 310, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 310, __pyx_L1_error) + __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":318 + /* "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, 318, __pyx_L1_error) + __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, 318, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 318, __pyx_L1_error) + __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":331 + /* "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, 331, __pyx_L1_error) + __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, 331, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 331, __pyx_L1_error) + __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): @@ -14035,40 +14052,40 @@ if (!__Pyx_RefNanny) { 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":310 + /* "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_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_11raise_decoding_error, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 310, __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); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_raise_decoding_error, __pyx_t_2) < 0) __PYX_ERR(0, 310, __pyx_L1_error) + 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":318 + /* "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_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_13decode_buffer_to_mesh, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 318, __pyx_L1_error) + __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, 318, __pyx_L1_error) + 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":331 + /* "DracoPy.pyx":332 * raise_decoding_error(mesh_struct.decode_status) * * def decode_point_cloud_buffer(buffer, deduplicate=False): # <<<<<<<<<<<<<< * """ * Decode buffer to point cloud */ - __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, 331, __pyx_L1_error) + __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, 331, __pyx_L1_error) + 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":1 diff --git a/src/DracoPy.pyx b/src/DracoPy.pyx index 6e2a453..96b14e1 100644 --- a/src/DracoPy.pyx +++ b/src/DracoPy.pyx @@ -270,10 +270,11 @@ def encode_to_buffer(points: List[float], "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 exists in 'metadatas' fields + NOTE: all 'metadata_id' indexes have to exist in 'metadatas' :return bytes: encoded mesh """ - if faces is None and isinstance(geometry_metadata, dict) and \ + 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") @@ -283,7 +284,7 @@ def encode_to_buffer(points: List[float], geometry_metadata = _create_empty_geometry_metadata() cdef float* quant_origin = NULL try: - if isinstance(faces, list): + if is_mesh: draco_encoded = DracoPy.encode_mesh(points, faces, encoder.this_encoder, From 908953ac3182f16ff6d5642a1a5d84d92b41f048 Mon Sep 17 00:00:00 2001 From: Andrey Romanov Date: Thu, 9 Dec 2021 16:20:20 +0300 Subject: [PATCH 21/21] fix strings usage --- src/DracoPy.cpp | 349 ++++++++++++++++++++++++++++++++---------------- src/DracoPy.pyx | 6 +- 2 files changed, 239 insertions(+), 116 deletions(-) diff --git a/src/DracoPy.cpp b/src/DracoPy.cpp index 64e075f..a7dfad3 100644 --- a/src/DracoPy.cpp +++ b/src/DracoPy.cpp @@ -1,4 +1,4 @@ -/* Generated by Cython 0.29.24 */ +/* Generated by Cython 0.29.25 */ #ifndef PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN @@ -9,9 +9,9 @@ #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_24" -#define CYTHON_HEX_VERSION 0x001D18F0 -#define CYTHON_FUTURE_DIVISION 0 +#define CYTHON_ABI "0_29_25" +#define CYTHON_HEX_VERSION 0x001D19F0 +#define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) @@ -157,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) @@ -176,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) @@ -195,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 @@ -326,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) @@ -566,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)) @@ -638,7 +699,8 @@ static CYTHON_INLINE float __PYX_NAN() { #include #include - #if __cplusplus > 199711L + #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 { @@ -747,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 @@ -1108,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()\ @@ -1115,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 */ @@ -1847,7 +1912,7 @@ 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_s_DracoPy_only_supports_meshes_wit; +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; @@ -1857,16 +1922,16 @@ 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_s_Failed_to_decode_input_mesh_Data; +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_s_Input_invalid; -static PyObject *__pyx_kp_s_Input_mesh_is_not_draco_encoded; +static PyObject *__pyx_kp_u_Input_invalid; +static PyObject *__pyx_kp_u_Input_mesh_is_not_draco_encoded; static PyObject *__pyx_n_s_IntEnum; -static PyObject *__pyx_kp_s_Invalid_draco_structure; +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; @@ -1890,7 +1955,7 @@ 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_s_Specified_value_out_of_encoded_r; +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; @@ -1906,12 +1971,12 @@ 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_s_d; +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_s_ddd; +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; @@ -1930,18 +1995,23 @@ static PyObject *__pyx_n_s_encoded_point; 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_kp_s_generic_attributes_encoding_deco; +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_s_i; +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; @@ -1953,13 +2023,16 @@ 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_object; static PyObject *__pyx_n_s_pack; @@ -1968,6 +2041,7 @@ 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; @@ -1980,10 +2054,13 @@ 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; @@ -2003,6 +2080,7 @@ 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; @@ -2789,7 +2867,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyOb * self.encoding_options = EncodingOptions(data_struct['quantization_bits'], * data_struct['quantization_range'], data_struct['quantization_origin']) */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data_struct, __pyx_n_s_encoding_options_set); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __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_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; @@ -2804,7 +2882,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyOb */ __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_s_quantization_bits); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 43, __pyx_L1_error) + __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); /* "DracoPy.pyx":44 @@ -2814,9 +2892,9 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyOb * else: * self.encoding_options = None */ - __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data_struct, __pyx_n_s_quantization_range); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 44, __pyx_L1_error) + __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_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data_struct, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 44, __pyx_L1_error) + __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; @@ -3400,7 +3478,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_8points(CYTHON_UNUSED PyObj __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_s_points); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error) + __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_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; @@ -3476,7 +3554,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_10geometry_metadata(CYTHON_ 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_s_geometry_metadata); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 66, __pyx_L1_error) + __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; @@ -3552,7 +3630,7 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_12metadatas(CYTHON_UNUSED P __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, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_metadatas); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error) + __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_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; @@ -3621,7 +3699,7 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_faces(CYTHON_UNUSED PyObject *__py __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_Dict_GetItem(__pyx_t_1, __pyx_n_s_faces); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __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; __pyx_r = __pyx_t_2; @@ -3690,7 +3768,7 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_2normals(CYTHON_UNUSED PyObject *_ __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, 80, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_s_normals); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error) + __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; @@ -4528,7 +4606,7 @@ static PyObject *__pyx_pf_7DracoPy__create_empty_geometry_metadata(CYTHON_UNUSED */ __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_s_metadata_id, __pyx_int_0) < 0) __PYX_ERR(0, 118, __pyx_L1_error) + 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 { @@ -4539,7 +4617,7 @@ static PyObject *__pyx_pf_7DracoPy__create_empty_geometry_metadata(CYTHON_UNUSED */ __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_s_generic_attributes, __pyx_t_2) < 0) __PYX_ERR(0, 118, __pyx_L1_error) + 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; @@ -4617,7 +4695,7 @@ static PyObject *__pyx_pf_7DracoPy_2_create_empty_metadata(CYTHON_UNUSED PyObjec __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_s_entries, __pyx_t_2) < 0) __PYX_ERR(0, 125, __pyx_L1_error) + 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":126 @@ -4629,7 +4707,7 @@ static PyObject *__pyx_pf_7DracoPy_2_create_empty_metadata(CYTHON_UNUSED PyObjec */ __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_s_sub_metadata_ids, __pyx_t_2) < 0) __PYX_ERR(0, 125, __pyx_L1_error) + 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; @@ -4796,7 +4874,7 @@ static struct __pyx_obj_7DracoPy_Encoder *__pyx_f_7DracoPy__generate_encoder_and * cdef MetadataObject *metadata = NULL; * if to_create_quantization_metadata: # <<<<<<<<<<<<<< * metadata = &metadatas[geometry_metadata.metadata_id] - * metadata.entries["quantization_bits"] = struct.pack( + * metadata.entries[b"quantization_bits"] = struct.pack( */ __pyx_t_8 = (__pyx_v_to_create_quantization_metadata != 0); if (__pyx_t_8) { @@ -4805,7 +4883,7 @@ static struct __pyx_obj_7DracoPy_Encoder *__pyx_f_7DracoPy__generate_encoder_and * cdef MetadataObject *metadata = NULL; * if to_create_quantization_metadata: * metadata = &metadatas[geometry_metadata.metadata_id] # <<<<<<<<<<<<<< - * metadata.entries["quantization_bits"] = struct.pack( + * metadata.entries[b"quantization_bits"] = struct.pack( * "=i", quantization_bits) */ __pyx_v_metadata = (&(__pyx_v_metadatas[__pyx_v_geometry_metadata.metadata_id])); @@ -4813,7 +4891,7 @@ static struct __pyx_obj_7DracoPy_Encoder *__pyx_f_7DracoPy__generate_encoder_and /* "DracoPy.pyx":144 * if to_create_quantization_metadata: * metadata = &metadatas[geometry_metadata.metadata_id] - * metadata.entries["quantization_bits"] = struct.pack( # <<<<<<<<<<<<<< + * metadata.entries[b"quantization_bits"] = struct.pack( # <<<<<<<<<<<<<< * "=i", quantization_bits) * if quantization_origin.empty() or quantization_range == -1: */ @@ -4825,7 +4903,7 @@ static struct __pyx_obj_7DracoPy_Encoder *__pyx_f_7DracoPy__generate_encoder_and /* "DracoPy.pyx":145 * metadata = &metadatas[geometry_metadata.metadata_id] - * metadata.entries["quantization_bits"] = struct.pack( + * metadata.entries[b"quantization_bits"] = struct.pack( * "=i", quantization_bits) # <<<<<<<<<<<<<< * if quantization_origin.empty() or quantization_range == -1: * encoder.SetAttributeQuantization( @@ -4846,7 +4924,7 @@ static struct __pyx_obj_7DracoPy_Encoder *__pyx_f_7DracoPy__generate_encoder_and } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_s_i, __pyx_t_2}; + 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); @@ -4855,7 +4933,7 @@ static struct __pyx_obj_7DracoPy_Encoder *__pyx_f_7DracoPy__generate_encoder_and #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_s_i, __pyx_t_2}; + 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); @@ -4868,9 +4946,9 @@ static struct __pyx_obj_7DracoPy_Encoder *__pyx_f_7DracoPy__generate_encoder_and 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_s_i); - __Pyx_GIVEREF(__pyx_kp_s_i); - PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_kp_s_i); + __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; @@ -4883,7 +4961,7 @@ static struct __pyx_obj_7DracoPy_Encoder *__pyx_f_7DracoPy__generate_encoder_and /* "DracoPy.pyx":144 * if to_create_quantization_metadata: * metadata = &metadatas[geometry_metadata.metadata_id] - * metadata.entries["quantization_bits"] = struct.pack( # <<<<<<<<<<<<<< + * metadata.entries[b"quantization_bits"] = struct.pack( # <<<<<<<<<<<<<< * "=i", quantization_bits) * if quantization_origin.empty() or quantization_range == -1: */ @@ -4897,12 +4975,12 @@ static struct __pyx_obj_7DracoPy_Encoder *__pyx_f_7DracoPy__generate_encoder_and * cdef MetadataObject *metadata = NULL; * if to_create_quantization_metadata: # <<<<<<<<<<<<<< * metadata = &metadatas[geometry_metadata.metadata_id] - * metadata.entries["quantization_bits"] = struct.pack( + * metadata.entries[b"quantization_bits"] = struct.pack( */ } /* "DracoPy.pyx":146 - * metadata.entries["quantization_bits"] = struct.pack( + * metadata.entries[b"quantization_bits"] = struct.pack( * "=i", quantization_bits) * if quantization_origin.empty() or quantization_range == -1: # <<<<<<<<<<<<<< * encoder.SetAttributeQuantization( @@ -4992,7 +5070,7 @@ static struct __pyx_obj_7DracoPy_Encoder *__pyx_f_7DracoPy__generate_encoder_and __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "DracoPy.pyx":146 - * metadata.entries["quantization_bits"] = struct.pack( + * metadata.entries[b"quantization_bits"] = struct.pack( * "=i", quantization_bits) * if quantization_origin.empty() or quantization_range == -1: # <<<<<<<<<<<<<< * encoder.SetAttributeQuantization( @@ -5029,7 +5107,7 @@ static struct __pyx_obj_7DracoPy_Encoder *__pyx_f_7DracoPy__generate_encoder_and * GeometryAttributeType.POSITION, quantization_bits, * quantization_range, quantization_origin) # <<<<<<<<<<<<<< * if to_create_quantization_metadata: - * metadata.entries["quantization_range"] = struct.pack( + * 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); @@ -5100,7 +5178,7 @@ static struct __pyx_obj_7DracoPy_Encoder *__pyx_f_7DracoPy__generate_encoder_and * GeometryAttributeType.POSITION, quantization_bits, * quantization_range, quantization_origin) * if to_create_quantization_metadata: # <<<<<<<<<<<<<< - * metadata.entries["quantization_range"] = struct.pack( + * metadata.entries[b"quantization_range"] = struct.pack( * "=d", quantization_range) */ __pyx_t_8 = (__pyx_v_to_create_quantization_metadata != 0); @@ -5109,9 +5187,9 @@ static struct __pyx_obj_7DracoPy_Encoder *__pyx_f_7DracoPy__generate_encoder_and /* "DracoPy.pyx":154 * quantization_range, quantization_origin) * if to_create_quantization_metadata: - * metadata.entries["quantization_range"] = struct.pack( # <<<<<<<<<<<<<< + * metadata.entries[b"quantization_range"] = struct.pack( # <<<<<<<<<<<<<< * "=d", quantization_range) - * metadata.entries["quantization_origin"] = struct.pack( + * 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); @@ -5121,9 +5199,9 @@ static struct __pyx_obj_7DracoPy_Encoder *__pyx_f_7DracoPy__generate_encoder_and /* "DracoPy.pyx":155 * if to_create_quantization_metadata: - * metadata.entries["quantization_range"] = struct.pack( + * metadata.entries[b"quantization_range"] = struct.pack( * "=d", quantization_range) # <<<<<<<<<<<<<< - * metadata.entries["quantization_origin"] = struct.pack( + * metadata.entries[b"quantization_origin"] = struct.pack( * "=ddd", */ __pyx_t_7 = PyFloat_FromDouble(__pyx_v_quantization_range); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 155, __pyx_L1_error) @@ -5142,7 +5220,7 @@ static struct __pyx_obj_7DracoPy_Encoder *__pyx_f_7DracoPy__generate_encoder_and } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_13)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_s_d, __pyx_t_7}; + 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); @@ -5151,7 +5229,7 @@ static struct __pyx_obj_7DracoPy_Encoder *__pyx_f_7DracoPy__generate_encoder_and #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_s_d, __pyx_t_7}; + 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); @@ -5164,9 +5242,9 @@ static struct __pyx_obj_7DracoPy_Encoder *__pyx_f_7DracoPy__generate_encoder_and 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_s_d); - __Pyx_GIVEREF(__pyx_kp_s_d); - PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_kp_s_d); + __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; @@ -5179,9 +5257,9 @@ static struct __pyx_obj_7DracoPy_Encoder *__pyx_f_7DracoPy__generate_encoder_and /* "DracoPy.pyx":154 * quantization_range, quantization_origin) * if to_create_quantization_metadata: - * metadata.entries["quantization_range"] = struct.pack( # <<<<<<<<<<<<<< + * metadata.entries[b"quantization_range"] = struct.pack( # <<<<<<<<<<<<<< * "=d", quantization_range) - * metadata.entries["quantization_origin"] = struct.pack( + * 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; @@ -5189,9 +5267,9 @@ static struct __pyx_obj_7DracoPy_Encoder *__pyx_f_7DracoPy__generate_encoder_and (__pyx_v_metadata->entries[__pyx_t_10]) = __pyx_t_9; /* "DracoPy.pyx":156 - * metadata.entries["quantization_range"] = struct.pack( + * metadata.entries[b"quantization_range"] = struct.pack( * "=d", quantization_range) - * metadata.entries["quantization_origin"] = struct.pack( # <<<<<<<<<<<<<< + * metadata.entries[b"quantization_origin"] = struct.pack( # <<<<<<<<<<<<<< * "=ddd", * quantization_origin[0], */ @@ -5202,7 +5280,7 @@ static struct __pyx_obj_7DracoPy_Encoder *__pyx_f_7DracoPy__generate_encoder_and __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; /* "DracoPy.pyx":158 - * metadata.entries["quantization_origin"] = struct.pack( + * metadata.entries[b"quantization_origin"] = struct.pack( * "=ddd", * quantization_origin[0], # <<<<<<<<<<<<<< * quantization_origin[1], @@ -5244,7 +5322,7 @@ static struct __pyx_obj_7DracoPy_Encoder *__pyx_f_7DracoPy__generate_encoder_and } #if CYTHON_FAST_PYCALL if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_kp_s_ddd, __pyx_t_13, __pyx_t_7, __pyx_t_4}; + 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); @@ -5255,7 +5333,7 @@ static struct __pyx_obj_7DracoPy_Encoder *__pyx_f_7DracoPy__generate_encoder_and #endif #if CYTHON_FAST_PYCCALL if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_kp_s_ddd, __pyx_t_13, __pyx_t_7, __pyx_t_4}; + 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); @@ -5270,9 +5348,9 @@ static struct __pyx_obj_7DracoPy_Encoder *__pyx_f_7DracoPy__generate_encoder_and 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_s_ddd); - __Pyx_GIVEREF(__pyx_kp_s_ddd); - PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_kp_s_ddd); + __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); @@ -5289,9 +5367,9 @@ static struct __pyx_obj_7DracoPy_Encoder *__pyx_f_7DracoPy__generate_encoder_and __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "DracoPy.pyx":156 - * metadata.entries["quantization_range"] = struct.pack( + * metadata.entries[b"quantization_range"] = struct.pack( * "=d", quantization_range) - * metadata.entries["quantization_origin"] = struct.pack( # <<<<<<<<<<<<<< + * metadata.entries[b"quantization_origin"] = struct.pack( # <<<<<<<<<<<<<< * "=ddd", * quantization_origin[0], */ @@ -5304,7 +5382,7 @@ static struct __pyx_obj_7DracoPy_Encoder *__pyx_f_7DracoPy__generate_encoder_and * GeometryAttributeType.POSITION, quantization_bits, * quantization_range, quantization_origin) * if to_create_quantization_metadata: # <<<<<<<<<<<<<< - * metadata.entries["quantization_range"] = struct.pack( + * metadata.entries[b"quantization_range"] = struct.pack( * "=d", quantization_range) */ } @@ -6207,7 +6285,7 @@ static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED P /* 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 exists in 'metadatas' fields\n :return bytes: encoded mesh\n "; +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; @@ -6425,7 +6503,7 @@ static PyObject *__pyx_pf_7DracoPy_8encode_to_buffer(CYTHON_UNUSED PyObject *__p * raise RuntimeError("generic attributes encoding/decoding " * "is not supported for point cloud") */ - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_geometry_metadata, __pyx_n_s_generic_attributes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 278, __pyx_L1_error) + __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; @@ -6768,7 +6846,7 @@ static PyObject *__pyx_pf_7DracoPy_8encode_to_buffer(CYTHON_UNUSED PyObject *__p __Pyx_DECREF_SET(__pyx_t_2, function); } } - __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_7, __pyx_kp_s_Invalid_draco_structure) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_s_Invalid_draco_structure); + __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); @@ -6845,7 +6923,7 @@ static PyObject *__pyx_pf_7DracoPy_8encode_to_buffer(CYTHON_UNUSED PyObject *__p __Pyx_DECREF_SET(__pyx_t_18, function); } } - __pyx_t_16 = (__pyx_t_19) ? __Pyx_PyObject_Call2Args(__pyx_t_18, __pyx_t_19, __pyx_kp_s_Invalid_draco_structure) : __Pyx_PyObject_CallOneArg(__pyx_t_18, __pyx_kp_s_Invalid_draco_structure); + __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); @@ -7030,7 +7108,7 @@ static PyObject *__pyx_pf_7DracoPy_10raise_decoding_error(CYTHON_UNUSED PyObject __Pyx_DECREF_SET(__pyx_t_1, function); } } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_kp_s_Input_mesh_is_not_draco_encoded) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_s_Input_mesh_is_not_draco_encoded); + __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); @@ -12313,6 +12391,9 @@ static PyTypeObject __pyx_type_7DracoPy_Encoder = { #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) { @@ -12442,6 +12523,9 @@ static PyTypeObject __Pyx_EnumMeta = { #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[] = { @@ -12518,7 +12602,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_s_DracoPy_only_supports_meshes_wit, __pyx_k_DracoPy_only_supports_meshes_wit, sizeof(__pyx_k_DracoPy_only_supports_meshes_wit), 0, 0, 1, 0}, + {&__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}, @@ -12528,16 +12612,16 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_s_Failed_to_decode_input_mesh_Data, __pyx_k_Failed_to_decode_input_mesh_Data, sizeof(__pyx_k_Failed_to_decode_input_mesh_Data), 0, 0, 1, 0}, + {&__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_s_Input_invalid, __pyx_k_Input_invalid, sizeof(__pyx_k_Input_invalid), 0, 0, 1, 0}, - {&__pyx_kp_s_Input_mesh_is_not_draco_encoded, __pyx_k_Input_mesh_is_not_draco_encoded, sizeof(__pyx_k_Input_mesh_is_not_draco_encoded), 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_s_Invalid_draco_structure, __pyx_k_Invalid_draco_structure, sizeof(__pyx_k_Invalid_draco_structure), 0, 0, 1, 0}, + {&__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}, @@ -12561,7 +12645,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_s_Specified_value_out_of_encoded_r, __pyx_k_Specified_value_out_of_encoded_r, sizeof(__pyx_k_Specified_value_out_of_encoded_r), 0, 0, 1, 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_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}, @@ -12577,12 +12661,12 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_s_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 0, 1, 0}, + {&__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_s_ddd, __pyx_k_ddd, sizeof(__pyx_k_ddd), 0, 0, 1, 0}, + {&__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}, @@ -12601,18 +12685,23 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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_kp_s_generic_attributes_encoding_deco, __pyx_k_generic_attributes_encoding_deco, sizeof(__pyx_k_generic_attributes_encoding_deco), 0, 0, 1, 0}, + {&__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_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 0}, + {&__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}, @@ -12624,13 +12713,16 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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}, @@ -12639,6 +12731,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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}, @@ -12651,10 +12744,13 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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}, @@ -12674,6 +12770,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__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}, @@ -12725,7 +12822,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * difference = value - self.quantization_origin[axis] * quantized_index = floor((difference / self.inverse_alpha) + 0.5) */ - __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_s_Specified_value_out_of_encoded_r); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 92, __pyx_L1_error) + __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); @@ -12736,7 +12833,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * "is not supported for point cloud") * if metadatas is None: */ - __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_generic_attributes_encoding_deco); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 279, __pyx_L1_error) + __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); @@ -12747,7 +12844,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * * def raise_decoding_error(decoding_status): */ - __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_Input_invalid); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 309, __pyx_L1_error) + __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); @@ -12758,7 +12855,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * 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_s_Failed_to_decode_input_mesh_Data); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 315, __pyx_L1_error) + __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); @@ -12769,7 +12866,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { * * def decode_buffer_to_mesh(buffer, deduplicate=False): */ - __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_s_DracoPy_only_supports_meshes_wit); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 317, __pyx_L1_error) + __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); @@ -13501,7 +13598,7 @@ if (!__Pyx_RefNanny) { * from typing import Dict, List, Optional * from libcpp.vector cimport vector */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error) + __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; @@ -13524,7 +13621,7 @@ if (!__Pyx_RefNanny) { __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, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3, __pyx_L1_error) + __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) @@ -13553,7 +13650,7 @@ if (!__Pyx_RefNanny) { __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, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __pyx_L1_error) + __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) @@ -13748,7 +13845,7 @@ if (!__Pyx_RefNanny) { * 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, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 39, __pyx_L1_error) + __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; @@ -13838,7 +13935,7 @@ if (!__Pyx_RefNanny) { * @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, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 73, __pyx_L1_error) + __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; @@ -13924,7 +14021,7 @@ if (!__Pyx_RefNanny) { * 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, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 83, __pyx_L1_error) + __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; @@ -13947,7 +14044,7 @@ if (!__Pyx_RefNanny) { __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, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 108, __pyx_L1_error) + __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; @@ -13971,7 +14068,7 @@ if (!__Pyx_RefNanny) { __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, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 112, __pyx_L1_error) + __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; @@ -18610,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); @@ -18801,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; @@ -18898,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, @@ -18940,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, @@ -20870,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.pyx b/src/DracoPy.pyx index 96b14e1..a922424 100644 --- a/src/DracoPy.pyx +++ b/src/DracoPy.pyx @@ -141,7 +141,7 @@ cdef Encoder _generate_encoder_and_update_metadata( cdef MetadataObject *metadata = NULL; if to_create_quantization_metadata: metadata = &metadatas[geometry_metadata.metadata_id] - metadata.entries["quantization_bits"] = struct.pack( + metadata.entries[b"quantization_bits"] = struct.pack( "=i", quantization_bits) if quantization_origin.empty() or quantization_range == -1: encoder.SetAttributeQuantization( @@ -151,9 +151,9 @@ cdef Encoder _generate_encoder_and_update_metadata( GeometryAttributeType.POSITION, quantization_bits, quantization_range, quantization_origin) if to_create_quantization_metadata: - metadata.entries["quantization_range"] = struct.pack( + metadata.entries[b"quantization_range"] = struct.pack( "=d", quantization_range) - metadata.entries["quantization_origin"] = struct.pack( + metadata.entries[b"quantization_origin"] = struct.pack( "=ddd", quantization_origin[0], quantization_origin[1],