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

Updated SZ support #213

Merged
merged 6 commits into from
Nov 25, 2022
Merged

Updated SZ support #213

merged 6 commits into from
Nov 25, 2022

Conversation

t20100
Copy link
Member

@t20100 t20100 commented Nov 24, 2022

This PR follows #206 to add and update a few things.

@t20100 t20100 added this to the 4.0.0 milestone Nov 24, 2022
Copy link
Member

@vasole vasole left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines -483 to +488
packed_error = self.pack_error(parameter)
compression_opts = (sz_mode, *packed_error, *packed_error, *packed_error, *packed_error)
compression_opts = (
sz_mode,
*self.__pack_float64(absolute or 0.),
*self.__pack_float64(relative or 0.),
*self.__pack_float64(pointwise_relative or 0.),
*self.__pack_float64(0.), # psnr
)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous implementation was working because not all options are used depending on the mode, but this better matches the meaning of the compression_opts

Comment on lines -492 to +500
def pack_error(error: float) -> tuple:
packed = struct.pack('<d', error) # Pack as IEEE 754 double
high = struct.unpack('<I', packed[0:4])[0] # Unpack high bits as unsigned int
low = struct.unpack('<I', packed[4:8])[0]
return low, high
def __pack_float64(error: float) -> tuple:
packed = struct.pack('>d', error) # Pack as big-endian IEEE 754 double
high = struct.unpack('>I', packed[0:4])[0] # Unpack most-significant bits as unsigned int
low = struct.unpack('>I', packed[4:8])[0] # Unpack least-significant bits as unsigned int
return high, low
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here previous implementation was working but the C code state working with big endian, so let's match it too.

BTW, that would be good to check it on a big-endian machine.

Comment on lines -340 to 341
status = hdf5plugin.register()
self.assertTrue(status)
hdf5plugin.register()
for filter_name in BUILD_CONFIG.embedded_filters:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assert fails if not all filters are embedded (by using HDF5PLUGIN_STRIP)

@t20100
Copy link
Member Author

t20100 commented Nov 25, 2022

attn @orioltinto

@t20100 t20100 marked this pull request as ready for review November 25, 2022 08:01
@vasole vasole merged commit 4f01202 into silx-kit:main Nov 25, 2022
@t20100 t20100 deleted the sz branch November 25, 2022 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants