-
Notifications
You must be signed in to change notification settings - Fork 160
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
Add the option for using blosc filter #980
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -347,6 +347,16 @@ inline void Shuffle::apply(const hid_t hid) const { | |
detail::h5p_set_shuffle(hid); | ||
} | ||
|
||
inline Blosc::Blosc(unsigned int level, unsigned int shuffle, unsigned int compressor) { | ||
_cd_values[4] = level; | ||
_cd_values[5] = shuffle; | ||
_cd_values[6] = compressor; | ||
} | ||
|
||
inline void Blosc::apply(const hid_t hid) const { | ||
detail::h5p_set_blosc(hid, _cd_values); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This function likely can't be called twice. Therefore, if two property lists with Blosc are created I suspect a misleading error message will be printed. It's unclear if it'll work, because |
||
} | ||
|
||
inline AllocationTime::AllocationTime(H5D_alloc_time_t alloc_time) | ||
: _alloc_time(alloc_time) {} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -239,6 +239,21 @@ inline herr_t h5p_set_szip(hid_t plist_id, unsigned options_mask, unsigned pixel | |
return err; | ||
} | ||
|
||
#include "blosc_filter.h" | ||
|
||
inline herr_t h5p_set_blosc(hid_t plist_id, const unsigned int *cd_values) { | ||
char *version, *date; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are both leaked, because |
||
if (register_blosc(&version, &date) < 0) { | ||
HDF5ErrMapper::ToException<PropertyException>("Blosc filter unavailable."); | ||
} | ||
|
||
herr_t err = H5Pset_filter(plist_id, FILTER_BLOSC, H5Z_FLAG_OPTIONAL, 7, cd_values); | ||
if (err < 0) { | ||
HDF5ErrMapper::ToException<PropertyException>("Error setting blosc property"); | ||
} | ||
return err; | ||
} | ||
Comment on lines
+244
to
+255
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @1uc I don't think this is how you think how your wrapper, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unlike szip, a built-in filter in hdf5, blosc filter must be registered before use. Perhaps a register wrapper should be added here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here I'd prefer splitting it differently:
Then in
If you want the error message to contain the word "blosc" when |
||
|
||
inline herr_t h5p_set_shuffle(hid_t plist_id) { | ||
herr_t err = H5Pset_shuffle(plist_id); | ||
if (err < 0) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will have to fix that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since blosc is an extra plugin of hdf5, it is necessary to compile and link this external libraries. hdf5-blosc can not be found using find_package macro since it is packaged too simple here. I haven't figured out an elegant way to link this library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I mean is that hard coded path to your system is not the valid way to give access to blosc.