Option to specify ASTC encode quality & codec parallelism
The current implementation hardcodes the quality level to 100 (exhaustive) which can be very slow. An option to somehow change this would be very helpful.
Moreover, it seems like the codec's threads option has never been set by UnityPy and is defaulted to 1. The optional set-to-0 for std::thread::hardware_concurrency is currently undocumented. Maybe this could be chosen as the default instead?
I guess that the quality level, among other settings, could be added to the UnityPy config.
The threads setting is a bit tricky. I set it to 1 on purpose as I would expect heavy users to use mutli-threading or multi-processing with python, multiple threads in astc wouldn't make sense in such cases. But well, this can also simply be added to the config.
I set it to 1 on purpose as I would expect heavy users to use mutli-threading or multi-processing with python, multiple threads in astc wouldn't make sense in such cases.
This will still benefit single, heavy (large texture/block size/encode quality) workloads regardless though. On the other hand for single-threaded scripts, I suppose such 'free performance' coming from by-default parallelism is always a good-to-have without introducing the complexities of manually managing MT/MP workload.
...mutli-threading
On that note, the current codec implementation prevents thread-level concurrency (multiple codecs) as the context-per-block size is always guarded by a single lock despite the codec's MT support. The following PR should address this:
- https://github.com/K0lb3/UnityPy/pull/342