-
Notifications
You must be signed in to change notification settings - Fork 69
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
lzhs_scanner: missing call to lzhs_init_lookup() #13
Comments
Hi, thanks for your contribution. Let's pick the charlen table for example. A match is obtained by looping (incrementing huff_charlen[ctx->i]->len == ctx->len &&
huff_charlen[ctx->i]->code == ctx->code Which means we're looking for an element (inside As such, it shouldn't be necessary to store multiple copies of the same lookup table, because they would be filled with the same data. Multithreading shouldn't be an issue either, because if thread 1 accesses the lookup table while thread 2 writes an index to it (worst case) it will not find a cached index (value -1), and it will do an extra loop. Going a step further, one could fill the lookup table ahead of time, by:
As you can see, this process is not dependant on the input data we're decoding. It was done the way i did to build the lookup table lazily, as-needed |
Sorry, it was just a guess that the lookup table would depend on the input data. I must admit that I don't understand the huffman algorithm. I thought that this lookup table is the tree of symbols or something. |
In the tool lzhs_scanner, function scan_lzhs() is calling lzhs_decode() without calling lzhs_init_lookup() first.
(Probably the lookup tables should become part of the struct lzhs_ctx.)
The text was updated successfully, but these errors were encountered: