Add compression threshold
Opened this issue · 7 comments
UnrealPak does not compress files that can't get much smaller by compressing them.
This should also be supported by u4pak, as the compression block overhead inflates the file unnecessarily and extracting compressed resources takes more computation.
Also might reduce the size difference noted in #25.
TODO:
- Figure out default threshold
- Add command line parameter for setting/disabling threshold
- Add check if file should be compressed
Didn't I do this already? (For small files.) Or am I thinking of one of my other game archive programs/scripts?
Ok, I've added an option for the threshold of files under which they shan't be compressed. See --compression-min-size
Also it now checks if the file didn't shrink after compression and writes the uncompressed file instead in that case. This feature needs testing.
Also it now checks if the file didn't shrink after compression and writes the uncompressed file instead in that case. This feature needs testing.
This is actually what I wanted to do in this issue :)
Yeah, I felt like implementing that. 😄 Do you have any tests with files where you know they grow in size when trying to compress them?
The current files should have a jpg, that is not compressed (need to add a png, to test compression with larger files when I think about it).