Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ else()
include(FetchContent)
FetchContent_Declare(blosc2
GIT_REPOSITORY https://github.com/Blosc/c-blosc2
GIT_TAG 5a2b0ed9c4d801230c118fbc5811817055b5a3f5 # v2.22.0
GIT_TAG 011c9e537f28299c536294d842e1a3d0e41db24f # openzl_plugin + miniexpr
)
FetchContent_MakeAvailable(blosc2)
include_directories("${blosc2_SOURCE_DIR}/include")
Expand Down
2 changes: 2 additions & 0 deletions src/blosc2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ class Codec(Enum):
OPENHTJ2K = 36
#: Needs to be installed with ``pip install blosc2-grok``
GROK = 37
#: Needs to be installed with ``pip install blosc2-openzl``
OPENZL = 38


class Filter(Enum):
Expand Down
9 changes: 6 additions & 3 deletions src/blosc2/blosc2_ext.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ from cpython cimport (
from cpython.pycapsule cimport PyCapsule_GetPointer, PyCapsule_New
from cython.operator cimport dereference
from libc.stdint cimport uintptr_t
from libc.stdlib cimport free, malloc, realloc
from libc.stdlib cimport free, malloc, realloc, calloc
from libc.stdlib cimport abs as c_abs
from libc.string cimport memcpy, strcpy, strdup, strlen
from libcpp cimport bool as c_bool
Expand Down Expand Up @@ -206,6 +206,7 @@ cdef extern from "blosc2.h":
uint8_t* ttmp
size_t ttmp_nbytes
blosc2_context* ctx
c_bool output_is_disposable

ctypedef struct blosc2_postfilter_params:
void *user_data
Expand Down Expand Up @@ -252,6 +253,7 @@ cdef extern from "blosc2.h":
void* schunk
blosc2_postfilter_fn postfilter
blosc2_postfilter_params *postparams
int32_t typesize

cdef const blosc2_dparams BLOSC2_DPARAMS_DEFAULTS

Expand Down Expand Up @@ -888,6 +890,7 @@ cdef create_dparams_from_kwargs(blosc2_dparams *dparams, kwargs, blosc2_cparams*
dparams.postparams = NULL
# TODO: support the next ones in the future
#dparams.schunk = kwargs.get('schunk', blosc2.dparams_dflts['schunk'])
#dparams.typesize = typesize = kwargs.get('typesize', blosc2.dparams_dflts['typesize'])
_check_dparams(dparams, cparams)

def decompress2(src, dst=None, **kwargs):
Expand Down Expand Up @@ -1616,7 +1619,7 @@ cdef class SChunk:
cdef blosc2_cparams* cparams = self.schunk.storage.cparams
cparams.prefilter = <blosc2_prefilter_fn> general_filler

cdef blosc2_prefilter_params* preparams = <blosc2_prefilter_params *> malloc(sizeof(blosc2_prefilter_params))
cdef blosc2_prefilter_params* preparams = <blosc2_prefilter_params *> calloc(1, sizeof(blosc2_prefilter_params))
cdef filler_udata* fill_udata = <filler_udata *> malloc(sizeof(filler_udata))
fill_udata.py_func = <char *> malloc(strlen(func_id) + 1)
strcpy(fill_udata.py_func, func_id)
Expand Down Expand Up @@ -1649,7 +1652,7 @@ cdef class SChunk:

cdef blosc2_cparams* cparams = self.schunk.storage.cparams
cparams.prefilter = <blosc2_prefilter_fn> general_prefilter
cdef blosc2_prefilter_params* preparams = <blosc2_prefilter_params *> malloc(sizeof(blosc2_prefilter_params))
cdef blosc2_prefilter_params* preparams = <blosc2_prefilter_params *> calloc(1, sizeof(blosc2_prefilter_params))
cdef user_filters_udata* pref_udata = <user_filters_udata*> malloc(sizeof(user_filters_udata))
pref_udata.py_func = <char *> malloc(strlen(func_id) + 1)
strcpy(pref_udata.py_func, func_id)
Expand Down
Loading