Skip to content

Commit 03c5ace

Browse files
committed
Add typesize to dparams; remove free for codecs
1 parent 72eb62c commit 03c5ace

File tree

6 files changed

+21
-15
lines changed

6 files changed

+21
-15
lines changed

blosc/blosc2.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,6 +1169,7 @@ int fill_codec(blosc2_codec *codec) {
11691169
return BLOSC2_ERROR_FAILURE;
11701170
}
11711171

1172+
/* If ever add .free function in future for codec params
11721173
codecparams_info *info2 = dlsym(lib, "info2");
11731174
if (info2 != NULL) {
11741175
// New plugin (e.g. openzl) with free function for codec_params defined
@@ -1178,7 +1179,8 @@ int fill_codec(blosc2_codec *codec) {
11781179
else{
11791180
codec->free = NULL;
11801181
}
1181-
1182+
*/
1183+
11821184
return BLOSC2_ERROR_SUCCESS;
11831185
}
11841186

@@ -4630,6 +4632,7 @@ void blosc2_free_ctx(blosc2_context* context) {
46304632
return;
46314633
}
46324634
}
4635+
/* May be needed if codec_params ever contains nested objects
46334636
if (context->codec_params != NULL) {
46344637
int rc;
46354638
for (int i = 0; i < g_ncodecs; ++i) {
@@ -4639,7 +4642,7 @@ void blosc2_free_ctx(blosc2_context* context) {
46394642
if (fill_codec(&g_codecs[i]) < 0) {
46404643
BLOSC_TRACE_ERROR("Could not load codec %d.", g_codecs[i].compcode);
46414644
return BLOSC2_ERROR_CODEC_SUPPORT;
4642-
}
4645+
}
46434646
}
46444647
if (g_codecs[i].free == NULL){
46454648
// no free func, codec_params is simple
@@ -4659,6 +4662,7 @@ void blosc2_free_ctx(blosc2_context* context) {
46594662
return;
46604663
}
46614664
}
4665+
*/
46624666
if (context->prefilter != NULL) {
46634667
my_free(context->preparams);
46644668
}
@@ -4702,6 +4706,7 @@ int blosc2_ctx_get_dparams(blosc2_context *ctx, blosc2_dparams *dparams) {
47024706
dparams->schunk = ctx->schunk;
47034707
dparams->postfilter = ctx->postfilter;
47044708
dparams->postparams = ctx->postparams;
4709+
dparams->typesize = ctx->typesize;
47054710

47064711
return BLOSC2_ERROR_SUCCESS;
47074712
}

doc/reference/plugins.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ Codecs
2222
:members:
2323

2424
.. doxygenfunction:: blosc2_register_codec
25-
.. doxygenfunction:: blosc2_codec_create
2625

2726
Tuners
2827
------

examples/urcodecs.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ int main(void) {
105105
udcodec.compname = "udcodec";
106106
udcodec.encoder = codec_encoder;
107107
udcodec.decoder = codec_decoder;
108-
udcodec.free = NULL;
109108

110109
int rc = blosc2_register_codec(&udcodec);
111110
if (rc < 0) {

include/blosc2.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,12 +1226,15 @@ typedef struct {
12261226
//!< The postfilter function.
12271227
blosc2_postfilter_params *postparams;
12281228
//!< The postfilter parameters.
1229+
int32_t typesize;
1230+
//!< The type size (8).
12291231
} blosc2_dparams;
12301232

12311233
/**
12321234
* @brief Default struct for decompression params meant for user initialization.
12331235
*/
1234-
static const blosc2_dparams BLOSC2_DPARAMS_DEFAULTS = {1, NULL, NULL, NULL};
1236+
static const blosc2_dparams BLOSC2_DPARAMS_DEFAULTS = {1, NULL, NULL, NULL, 8};
1237+
12351238

12361239
/**
12371240
* @brief Create a context for @a *_ctx() compression functions.
@@ -2408,8 +2411,8 @@ typedef struct {
24082411
//!< The codec encoder that is used during compression.
24092412
blosc2_codec_decoder_cb decoder;
24102413
//!< The codec decoder that is used during decompression.
2411-
int (*free)(void* codec_params);
2412-
//!< Free the codec_params stored in blosc2_context.
2414+
// int (*free)(void* codec_params);
2415+
// //!< Free the codec_params stored in blosc2_context.
24132416
} blosc2_codec;
24142417

24152418
/**

plugins/codecs/codecs-registry.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "blosc2.h"
1212

1313
void register_codecs(void) {
14+
// May add .free func in future
1415

1516
blosc2_codec ndlz;
1617
ndlz.compcode = BLOSC_CODEC_NDLZ;
@@ -19,7 +20,7 @@ void register_codecs(void) {
1920
ndlz.encoder = &ndlz_compress;
2021
ndlz.decoder = &ndlz_decompress;
2122
ndlz.compname = "ndlz";
22-
ndlz.free = NULL;
23+
// ndlz.free = NULL;
2324
register_codec_private(&ndlz);
2425

2526
blosc2_codec zfp_acc;
@@ -28,7 +29,7 @@ void register_codecs(void) {
2829
zfp_acc.complib = BLOSC_CODEC_ZFP_FIXED_ACCURACY;
2930
zfp_acc.encoder = &zfp_acc_compress;
3031
zfp_acc.decoder = &zfp_acc_decompress;
31-
zfp_acc.free = NULL;
32+
// zfp_acc.free = NULL;
3233
zfp_acc.compname = "zfp_acc";
3334
register_codec_private(&zfp_acc);
3435

@@ -38,7 +39,7 @@ void register_codecs(void) {
3839
zfp_prec.complib = BLOSC_CODEC_ZFP_FIXED_PRECISION;
3940
zfp_prec.encoder = &zfp_prec_compress;
4041
zfp_prec.decoder = &zfp_prec_decompress;
41-
zfp_prec.free = NULL;
42+
// zfp_prec.free = NULL;
4243
zfp_prec.compname = "zfp_prec";
4344
register_codec_private(&zfp_prec);
4445

@@ -49,7 +50,7 @@ void register_codecs(void) {
4950
zfp_rate.encoder = &zfp_rate_compress;
5051
zfp_rate.decoder = &zfp_rate_decompress;
5152
zfp_rate.compname = "zfp_rate";
52-
zfp_rate.free = NULL;
53+
// zfp_rate.free = NULL;
5354
register_codec_private(&zfp_rate);
5455

5556
blosc2_codec openhtj2k;
@@ -58,7 +59,7 @@ void register_codecs(void) {
5859
openhtj2k.complib = BLOSC_CODEC_OPENHTJ2K;
5960
openhtj2k.encoder = NULL;
6061
openhtj2k.decoder = NULL;
61-
openhtj2k.free = NULL;
62+
// openhtj2k.free = NULL;
6263
openhtj2k.compname = "openhtj2k";
6364
register_codec_private(&openhtj2k);
6465

@@ -68,7 +69,7 @@ void register_codecs(void) {
6869
grok.complib = BLOSC_CODEC_GROK;
6970
grok.encoder = NULL;
7071
grok.decoder = NULL;
71-
grok.free = NULL;
72+
// grok.free = NULL;
7273
grok.compname = "grok";
7374
register_codec_private(&grok);
7475

@@ -78,7 +79,7 @@ void register_codecs(void) {
7879
openzl.complib = BLOSC_CODEC_OPENZL;
7980
openzl.encoder = NULL;
8081
openzl.decoder = NULL;
81-
openzl.free = NULL;
82+
// openzl.free = NULL;
8283
openzl.compname = "openzl";
8384
register_codec_private(&openzl);
8485
}

tests/test_urcodecs.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ CUTEST_TEST_TEST(urcodecs) {
164164
udcodec.compname = "arange";
165165
udcodec.version = 1;
166166
udcodec.encoder = codec_encoder;
167-
udcodec.free = NULL;
168167
if (correct_backward) {
169168
udcodec.compcode = 250;
170169
udcodec.complib = 250;

0 commit comments

Comments
 (0)