Skip to content
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

Add compression threshold #26

Open
3 tasks
Xenira opened this issue Feb 11, 2022 · 7 comments
Open
3 tasks

Add compression threshold #26

Xenira opened this issue Feb 11, 2022 · 7 comments

Comments

@Xenira
Copy link
Contributor

Xenira commented Feb 11, 2022

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
@panzi
Copy link
Owner

panzi commented Feb 11, 2022

Didn't I do this already? (For small files.) Or am I thinking of one of my other game archive programs/scripts?

@Xenira
Copy link
Contributor Author

Xenira commented Feb 12, 2022

There is a switch for small files here:

if uncompressed_size <= 100 {

Did not see a threshold

@panzi
Copy link
Owner

panzi commented Feb 13, 2022

Ok, I've added an option for the threshold of files under which they shan't be compressed. See --compression-min-size

@panzi
Copy link
Owner

panzi commented Feb 13, 2022

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.

@Xenira
Copy link
Contributor Author

Xenira commented Feb 13, 2022

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 :)

@panzi
Copy link
Owner

panzi commented Feb 13, 2022

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?

@Xenira
Copy link
Contributor Author

Xenira commented Feb 13, 2022

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants