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

No shuffle repeat #589

Merged
merged 2 commits into from
Feb 21, 2024
Merged
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
20 changes: 2 additions & 18 deletions blosc/blosc2.c
Original file line number Diff line number Diff line change
Expand Up @@ -970,13 +970,7 @@ uint8_t* pipeline_forward(struct thread_context* thread_context, const int32_t b
if (filters[i] <= BLOSC2_DEFINED_FILTERS_STOP) {
switch (filters[i]) {
case BLOSC_SHUFFLE:
for (int j = 0; j <= filters_meta[i]; j++) {
shuffle(typesize, bsize, _src, _dest);
// Cycle filters when required
if (j < filters_meta[i]) {
_cycle_buffers(&_src, &_dest, &_tmp);
}
}
shuffle(typesize, bsize, _src, _dest);
break;
case BLOSC_BITSHUFFLE:
if (bitshuffle(typesize, bsize, _src, _dest) < 0) {
Expand Down Expand Up @@ -1345,17 +1339,7 @@ int pipeline_backward(struct thread_context* thread_context, const int32_t bsize
if (filters[i] <= BLOSC2_DEFINED_FILTERS_STOP) {
switch (filters[i]) {
case BLOSC_SHUFFLE:
for (int j = 0; j <= filters_meta[i]; j++) {
unshuffle(typesize, bsize, _src, _dest);
// Cycle filters when required
if (j < filters_meta[i]) {
_cycle_buffers(&_src, &_dest, &_tmp);
}
// Check whether we have to copy the intermediate _dest buffer to final destination
if (last_copy_filter && (filters_meta[i] % 2) == 1 && j == filters_meta[i]) {
memcpy(dest + offset, _dest, (unsigned int) bsize);
}
}
unshuffle(typesize, bsize, _src, _dest);
break;
case BLOSC_BITSHUFFLE:
if (bitunshuffle(typesize, bsize, _src, _dest, context->src[BLOSC2_CHUNK_VERSION]) < 0) {
Expand Down
22 changes: 15 additions & 7 deletions include/blosc2.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,22 @@ enum {
*/
enum {
#ifndef BLOSC_H
BLOSC_NOSHUFFLE = 0, //!< No shuffle (for compatibility with Blosc1).
BLOSC_NOFILTER = 0, //!< No filter.
BLOSC_SHUFFLE = 1, //!< Byte-wise shuffle.
BLOSC_BITSHUFFLE = 2, //!< Bit-wise shuffle.
BLOSC_NOSHUFFLE = 0,
//!< No shuffle (for compatibility with Blosc1).
BLOSC_NOFILTER = 0,
//!< No filter.
BLOSC_SHUFFLE = 1,
//!< Byte-wise shuffle. `filters_meta` does not have any effect here.
BLOSC_BITSHUFFLE = 2,
//!< Bit-wise shuffle. `filters_meta` does not have any effect here.
#endif // BLOSC_H
BLOSC_DELTA = 3, //!< Delta filter.
BLOSC_TRUNC_PREC = 4, //!< Truncate mantissa precision; positive values in `filters_meta` will keep bits; negative values will zero bits.
BLOSC_LAST_FILTER = 5, //!< sentinel
BLOSC_DELTA = 3,
//!< Delta filter. `filters_meta` does not have any effect here.
BLOSC_TRUNC_PREC = 4,
//!< Truncate mantissa precision.
//!< Positive values in `filters_meta` will keep bits; negative values will zero bits.
BLOSC_LAST_FILTER = 5,
//!< sentinel
BLOSC_LAST_REGISTERED_FILTER = BLOSC2_GLOBAL_REGISTERED_FILTERS_START + BLOSC2_GLOBAL_REGISTERED_FILTERS - 1,
//!< Determine the last registered filter. It is used to check if a filter is registered or not.
};
Expand Down