81 Commits

Author SHA1 Message Date
Timofey Solomko e3c41ca9a0 [BZip2] Fix grammar in comments 2026-05-22 17:16:29 +08:00
Timofey Solomko 85c8fd60aa [docs] Update BZip2 docs for multiDecompress functionality 2026-05-14 12:42:02 +08:00
Timofey Solomko 75cc406d47 [BZip2] Add multiDecompress public function
This should help with inputs consisting of multiple BZip2 archives concatenated together which were brought up in #59.
2026-05-12 16:06:19 +08:00
Timofey Solomko 93e2eef38d [BZip2] Remove redundant check for zero code lengths
Such code lengths are now filtered out during Huffman code construction.
2026-03-01 20:35:22 +08:00
Timofey Solomko f307a7fb0b [BZip2] Improve handling of truncated inputs during decompression 2026-02-23 18:08:27 +08:00
Timofey Solomko ad73d82367 [BZip2] Slightly rewrite Huffman+RUNA/B+MTF decoding
This piece of the code is now more logical, with less branching, and mirrors encoding counterpart.
2026-02-23 18:08:26 +08:00
Timofey Solomko 609eb29791 [BZip2] Change a couple of guard/if-checks to assertions 2026-02-23 18:08:26 +08:00
Timofey Solomko 1e7154474b [BZip2] Use better versions of bit writer functions
First, write(unsignedNumber:) is better than write(number:) when the argument is already UInt, since it does one fewer precondition check and does not do additional integer conversion. Secondly, using write(number:) to write one bit was very inefficient.
2026-02-23 18:08:25 +08:00
Timofey Solomko 7af76764d7 [BZip2] Use UInt8 arrays instead of Data 2026-02-23 18:08:25 +08:00
Timofey Solomko bff411d511 [BZip2] Improve encoding performance of code lengths deltas 2026-02-23 18:08:25 +08:00
Timofey Solomko 273b6ed9e9 Remove redundant imports 2026-02-18 12:21:57 +08:00
Timofey Solomko 5b5b20f582 [Huffman] Remove codes argument label from EncodingTree.init 2026-02-18 00:12:55 +08:00
Timofey Solomko ce1736a2b0 [Huffman] Add HuffmanCodes typealias for clarity 2026-02-18 00:10:29 +08:00
Timofey Solomko d8c4527c89 [BZip2] Slightly optimize MTF transform of selectors during compression
It can be statically proven that the output of MTF transform lies within a certain range, so a guard check can be replaced with an assertion.
2026-02-11 17:21:52 +08:00
Timofey Solomko e7c4c13543 [BZip2] Code comments clarification 2026-02-11 17:21:48 +08:00
Timofey Solomko ea9aaccfb9 Update copyright year to 2026 2026-01-31 15:30:24 +08:00
Timofey Solomko ed66991cbd Update copyright year to 2024 2024-01-11 16:57:04 +03:00
Timofey Solomko 43132fc39d Update copyright year to 2023 2023-02-07 15:31:45 +02:00
Timofey Solomko b1fe47fdbb [BZip2] Fix incorrect BWT pointer in compression 2022-12-15 23:25:21 +03:00
Timofey Solomko 0c5cd4a9b5 [BZip2] Rework a part of BZip2.decompress for clarity 2022-01-15 20:21:26 +03:00
Timofey Solomko 79295db930 Update copyright year to 2022 2022-01-08 15:02:59 +03:00
Timofey Solomko 7a43328b8e [BZip2] Rename crc32 function for bzip2 2021-10-22 21:55:33 +03:00
Timofey Solomko cac1d635b9 [BZip2] Change BurrowsWheeler and SuffixArray from classes to enums 2021-10-15 20:14:21 +03:00
Timofey Solomko 73dec6720e [BZip2] Combine MTF and RLE steps in compression 2021-05-22 23:35:03 +03:00
Timofey Solomko b5e98b66cd [BZip2] Explain zero RLE in the comments
(cherry picked from commit 1f7a5352a7)
2021-05-13 23:51:52 +03:00
Timofey Solomko f808a8b9b3 [BZip2] Fix a crash on non-standard run length greater than 255 2021-05-01 13:45:02 +03:00
Timofey Solomko 1fca632c2d Update copyright year to 2021 2021-03-26 13:50:20 +02:00
Timofey Solomko 00af5a9319 [BZip2][GZip][LZMA][XZ][Zlib] Fix crashes when opening very small files
Instead errors are now thrown.
2020-10-15 23:35:34 +03:00
Timofey Solomko ab75e0944f [BZip2] Fix compilation warning 2020-10-14 23:45:46 +03:00
Timofey Solomko a844b34436 Update copyright year to 2020 2020-03-20 09:43:42 +03:00
Timofey Solomko 94ab3ba1f5 Replace usage of deprecated index(...) functions with the new ones 2020-03-20 09:41:52 +03:00
Timofey Solomko fafb9cde87 Move public identifier from extension to enum itself (BZip2.BlockSize) 2020-03-20 09:41:38 +03:00
Timofey Solomko f6949a8f66 Replace the usage of the deprecated Data(bytes:) initializer 2020-03-20 09:40:48 +03:00
Timofey Solomko c93a783d21 [docs] Fix grammar issues with regards to a/the/null articles, while/during, and extra commas 2019-03-13 12:27:08 +03:00
Timofey Solomko 04f64bcb72 Rename Encoding/DecodingHuffmanTree to just Encoding/DecodingTree 2019-03-12 22:31:35 +03:00
Timofey Solomko 142fd44dd2 Remove old CodeLength initializer from Encoding(Huffman)Tree 2019-03-12 22:31:24 +03:00
Timofey Solomko 250c9fbd4c Remove old CodeLength initializer from Decoding(Huffman)Tree 2019-03-12 22:31:13 +03:00
Timofey Solomko 7f25dbf6e7 Rename HuffmanLength to CodeLength 2019-03-12 22:28:01 +03:00
Timofey Solomko c4c4063923 [docs] Small improvements to various BZip2 documentation 2019-01-04 14:59:13 +03:00
Timofey Solomko ce47019097 Update copyright year to 2019 2019-01-02 23:15:43 +03:00
Timofey Solomko 1c5ca3bbe5 Swiflinted before 4.4.0 2018-08-07 21:18:39 +03:00
Timofey Solomko d187bd2937 Use new uint64(fromBits) function 2018-04-10 22:37:20 +03:00
Timofey Solomko 1d838c1d7e Slightly simplify and improve certain code 2018-04-07 13:38:00 +03:00
Timofey Solomko cb9d181754 [BZip2] Don't create new Huffman trees if maximum amount of trees possible is already reached 2018-03-03 20:30:49 +03:00
Timofey Solomko 4888f37f0f Revert addition of BBD-related public APIs to Zlib, LZMA and BZip2 2018-03-02 23:32:39 +03:00
Timofey Solomko ba037786b4 [LZMA] Add public decompress(from:) function which uses BBD's ByteReader as its argument 2018-02-23 12:58:24 +03:00
Timofey Solomko 8b4ff5c040 [BZip2] Make decompress(_ bitReader:) function public and add "from" label to its argument 2018-02-23 12:58:24 +03:00
Timofey Solomko e710e37233 [BZip2] Add comments about smaller block size for compression 2018-01-29 19:55:42 +03:00
Timofey Solomko 7d99ab176a [BZip2] Use not-reduced block size for decompression 2018-01-17 12:01:00 +03:00
Timofey Solomko ca41cc3b5f [BZip2] Additionally reduce block sizes by 1.25
This is required, because, apparently, original bzip2 implementation doesn't account for the fact that the initial RLE can cause expansion of the data.
2018-01-16 22:28:35 +03:00