-
Notifications
You must be signed in to change notification settings - Fork 68
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
Optimistic compression approach #235
Comments
Can you suggest a fix? It's just not my area at all. |
Indeed, this code may produce error/crash if less than 3 keys are found. |
I have a situation where gowin IDE ignores "set_option -bit_compress 1" from bslib import read_bitstream, write_bitstream
bs, hdr, ftr = read_bitstream(sys.argv[1])
write_bitstream(sys.argv[2], bs, hdr, ftr, compress=True) you may expose statistics by following code lst, _ = np.histogram(bs, bins=[i for i in range(256)])
print(np.sort(lst)) Result for 2 different bitstreams:
Last one have no chance to be compressed perhaps it may be solved by following? def write_bitstream(fname, bs, hdr, ftr, compress):
if 256-len(np.unique(bs)) < 3: compress = False or without numpy if you wish: def write_bitstream(fname, bs, hdr, ftr, compress):
if 256-len(set(bs)) < 3: compress = False |
The following code of write_bitstream() will hang on data that has less than three unused values:
The text was updated successfully, but these errors were encountered: