-
Notifications
You must be signed in to change notification settings - Fork 25
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
Updated SZ support #213
Conversation
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.
LGTM
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 | ||
) |
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.
Previous implementation was working because not all options are used depending on the mode, but this better matches the meaning of the compression_opts
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 |
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.
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.
status = hdf5plugin.register() | ||
self.assertTrue(status) | ||
hdf5plugin.register() | ||
for filter_name in BUILD_CONFIG.embedded_filters: |
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.
The assert fails if not all filters are embedded (by using HDF5PLUGIN_STRIP
)
attn @orioltinto |
This PR follows #206 to add and update a few things.