Comments (2)
Hi, thanks for your contribution.
Yes that could be a problem, and i'll refactor the lzhs initialization code to fix it (perhaps a quick&dirty singleton initializer guard).
However i am not sure the lookup table should be moved to struct lzhs_ctx
, because the tables are fixed/hardcoded, and the lookup table doesn't depend on the input data.
Let's pick the charlen table for example. A match is obtained by looping (incrementing ctx->i
) until
huff_charlen[ctx->i]->len == ctx->len &&
huff_charlen[ctx->i]->code == ctx->code
Which means we're looking for an element (inside huff_charlen
, which is the hardcoded table) whose len
and code
match the ones we are looking for.
The search will always produce the same index, because there can be only 1 element with given len/code, no duplicates allowed.
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:
- looping for all elements of the table
- converting each element (code/len pairs) to lookup keys
- filling the table with index -> key
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
from epk2extract.
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.
Thanks for fixing it.
from epk2extract.
Related Issues (20)
- DVR decoding does not always work.
- Cannot decompress partition of new LG firmware
- realtek k6lp key is missing HOT 3
- Unable to extract Sony upg file HOT 2
- Mutiple definitions build issue. GCC 10 HOT 2
- Found UNKNOWN Package (Magic: 'Phil') is seen when running epk2extract HOT 4
- Rebuild epk2extract to use Unar in favor of Stuffit HOT 2
- Segmentation fault during .pkg extraction HOT 7
- Getting error while installing discord!
- Extract destination broken (sometimes)
- Build fails on Raspbian 64-bit
- Add support for Samsung Orsay (merge with another script)
- Add support for Jadoo 3, Jadoo 7, and Sony NZT-GT1 firmwares.
- How do I dump AES-128 key from My TV HOT 2
- Hisense 58A78GQ , file video can extract?
- new_pair_TPV_MTK2K14PLF_EU1
- Pack EPK v3 HOT 11
- Add support for m1ap chipset. HOT 2
- How to extract encrypted mpeg-ts
- Unable to compile HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from epk2extract.