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

Worst LZMA compression on best compression level #731

Closed
gix opened this issue Sep 22, 2023 · 2 comments · Fixed by #732
Closed

Worst LZMA compression on best compression level #731

gix opened this issue Sep 22, 2023 · 2 comments · Fixed by #732
Labels
bug Bug lzma XZ compression format

Comments

@gix
Copy link
Contributor

gix commented Sep 22, 2023

Taken from mz_stream_lzma_set_prop_int64:

    case MZ_STREAM_PROP_COMPRESS_LEVEL:
        if (value >= 9)
            lzma->preset = LZMA_PRESET_EXTREME;
        else
            lzma->preset = LZMA_PRESET_DEFAULT;
        break;

Reading the xz-utils docs for the presets, and looking through its code, LZMA_PRESET_EXTREME is an extra flag on top of the compression level. Using it on its own is equal to using a compression level of 0, making MZ_COMPRESS_LEVEL_BEST result in the worst compression (and the other levels not doing anything). The level should probably be passed through, without using LZMA_PRESET_EXTREME at all.

@nmoinvaz
Copy link
Member

Please consider making a PR. I don't use it on a regular basis.

gix added a commit to gix/minizip-ng that referenced this issue Sep 25, 2023
LZMA_PRESET_EXTREME is not a preset on its own but a flag which must be
used together with a level. The difference between level 9 with and without
the extreme flag also seems negligible, so this commit just passes through
the level and maps -1 and invalid values to the default preset.
nmoinvaz pushed a commit that referenced this issue Oct 19, 2023
LZMA_PRESET_EXTREME is not a preset on its own but a flag which must be
used together with a level. The difference between level 9 with and without
the extreme flag also seems negligible, so this commit just passes through
the level and maps -1 and invalid values to the default preset.
@nmoinvaz
Copy link
Member

Merged into develop.

@nmoinvaz nmoinvaz added lzma XZ compression format bug Bug labels Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug lzma XZ compression format
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants