diff options
author | Fredrik Svedberg <fredrik.svedberg@arm.com> | 2021-05-11 13:51:47 +0200 |
---|---|---|
committer | Mauricio Briceno <mauricio.briceno@arm.com> | 2021-05-13 18:01:21 +0200 |
commit | 93d5c35feaae8f2fe8e0361ffc19e31d463ca099 (patch) | |
tree | c5179f8e06c5aa3e16513849f4be338393661afb /ethosu/mlw_codec/mlw_codecmodule.c | |
parent | 67e11f7bce40d72e0dda97cf658a3c3ee600c1eb (diff) | |
download | ethos-u-vela-93d5c35feaae8f2fe8e0361ffc19e31d463ca099.tar.gz |
Fix mlw_module
Fixedx size calculation in mlw_reorder_encode.
Fixed build warnings.
Signed-off-by: Fredrik Svedberg <fredrik.svedberg@arm.com>
Change-Id: Iac9408b9972a29b5a3403ba11f80dc4eaaa35453
Diffstat (limited to 'ethosu/mlw_codec/mlw_codecmodule.c')
-rw-r--r-- | ethosu/mlw_codec/mlw_codecmodule.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/ethosu/mlw_codec/mlw_codecmodule.c b/ethosu/mlw_codec/mlw_codecmodule.c index 1e13dd22..75ea8e96 100644 --- a/ethosu/mlw_codec/mlw_codecmodule.c +++ b/ethosu/mlw_codec/mlw_codecmodule.c @@ -40,7 +40,7 @@ * decomp_w, * verbose=0) * - * output: bytearray + * output: (bytearray, int) */ static PyObject * @@ -79,7 +79,7 @@ method_reorder_encode (PyObject *self, PyObject *args) &verbose)) return NULL; - PyArrayObject* input_ndarray_object = PyArray_FROM_OTF( + PyArrayObject* input_ndarray_object = (PyArrayObject*)PyArray_FROM_OTF( input_object, NPY_INT64, NPY_ARRAY_ALIGNED); @@ -111,7 +111,7 @@ method_reorder_encode (PyObject *self, PyObject *args) return NULL; } uint8_t* output_buffer = NULL; - int padded_length; + int64_t padded_length; int output_length = mlw_reorder_encode( ifm_ublock_depth, @@ -132,11 +132,6 @@ method_reorder_encode (PyObject *self, PyObject *args) &padded_length, verbose); - if (output_buffer == NULL) - { - return PyErr_NoMemory(); - } - PyObject *output_byte_array = PyByteArray_FromStringAndSize((char*)output_buffer, output_length); PyObject *padded_length_obj = Py_BuildValue("i", padded_length); @@ -144,6 +139,8 @@ method_reorder_encode (PyObject *self, PyObject *args) mlw_free_outbuf(output_buffer); PyObject* ret = PyTuple_Pack(2, output_byte_array, padded_length_obj); + + Py_DECREF(input_ndarray_object); Py_DECREF(output_byte_array); Py_DECREF(padded_length_obj); return ret; |