1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 11:47:46 +00:00

LibCompress: Refactor LZMA model property decoding into a static helper

This commit is contained in:
Tim Schumacher 2023-03-14 02:36:03 +01:00 committed by Andreas Kling
parent 52d9fc92f1
commit 04f69de7f1
2 changed files with 26 additions and 19 deletions

View file

@ -17,6 +17,12 @@ namespace Compress {
// This implementation is mostly based on the LZMA specification contained in the 7-Zip SDK, which has been placed in the public domain.
// LZMA Specification Draft (2015): https://www.7-zip.org/a/lzma-specification.7z
struct LzmaModelProperties {
u8 literal_context_bits;
u8 literal_position_bits;
u8 position_bits;
};
struct LzmaDecompressorOptions {
u8 literal_context_bits { 0 };
u8 literal_position_bits { 0 };
@ -32,10 +38,10 @@ struct [[gnu::packed]] LzmaHeader {
ErrorOr<LzmaDecompressorOptions> as_decompressor_options() const;
private:
ErrorOr<void> decode_model_properties(u8& literal_context_bits, u8& literal_pos_bits, u8& pos_bits) const;
static ErrorOr<LzmaModelProperties> decode_model_properties(u8 input_bits);
u8 m_model_properties;
private:
u8 m_encoded_model_properties;
u32 m_dictionary_size;
u64 m_uncompressed_size;
};