UnityPy icon indicating copy to clipboard operation
UnityPy copied to clipboard

Option to specify ASTC encode quality & codec parallelism

Open mos9527 opened this issue 4 months ago • 2 comments

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?

mos9527 avatar Aug 20 '25 07:08 mos9527

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.

K0lb3 avatar Aug 21 '25 21:08 K0lb3

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

mos9527 avatar Aug 22 '25 03:08 mos9527