Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace bytes of compressed stream with uint8_t #106

Merged
merged 21 commits into from
Oct 1, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions python/zfpy.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import cython
from libc.stdlib cimport malloc, free
from cython cimport view
from cpython cimport array
from libc.stdint cimport uint8_t
import array

import itertools
Expand Down Expand Up @@ -245,7 +246,7 @@ cdef _validate_4d_list(in_list, list_name):
)

cpdef np.ndarray _decompress(
bytes compressed_data,
const uint8_t[::1] compressed_data,
zfp_type ztype,
shape,
out=None,
Expand All @@ -260,7 +261,7 @@ cpdef np.ndarray _decompress(
raise ValueError("Cannot decompress in-place")
_validate_4d_list(shape, "shape")

cdef char* comp_data_pointer = compressed_data
cdef char* comp_data_pointer = <char*>&compressed_data[0]
halehawk marked this conversation as resolved.
Show resolved Hide resolved
cdef zfp_field* field = zfp_field_alloc()
cdef bitstream* bstream = stream_open(
comp_data_pointer,
Expand Down Expand Up @@ -329,12 +330,12 @@ cpdef np.ndarray _decompress(
return output

cpdef np.ndarray decompress_numpy(
bytes compressed_data,
const uint8_t[::1] compressed_data,
):
if compressed_data is None:
raise TypeError("compressed_data cannot be None")

cdef char* comp_data_pointer = compressed_data
cdef char* comp_data_pointer = <char *>&compressed_data[0]
halehawk marked this conversation as resolved.
Show resolved Hide resolved
cdef zfp_field* field = zfp_field_alloc()
cdef bitstream* bstream = stream_open(
comp_data_pointer,
Expand Down