~aldats/the

chore: add `LICENSE`

Despite referring to a "LICENSE" file in the README, I never made such a
file. Oops.
d0273017 — aldats 2 years ago
refactor: `main.zig` require `huffman.zig` only
fa33eb60 — aldats 2 years ago
chore: fix resource link to Wikipedia
e2272f88 — aldats 2 years ago
refactor: `xcoding.zig` imports `huffman.zig` only
f993a475 — aldats 2 years ago
chore: remove depth tracking in tree creation

(1) Did not track depth as one would expect; tracked depth from leaf
instead of root. (2) Information was no longer in use by any code.
a7d39ced — aldats 2 years ago
refactor: modularize tree logic
958b8722 — aldats 2 years ago
refactor: modularize frequency logic
7e6aa5cc — aldats 2 years ago
chore: update README and bump version
dc24967a — aldats 2 years ago
fix: incomplete decoding

File decoded stopped prior to encoded `PsuedoEOF` character such that
the decoded file was shorter than the original. This resulted from how
the record for the `PsuedoEOF` was written into the file header; it was
always appended as the final record even when it was, e.g., the second-
or third-to-last record. This resulted in some records, including the
`PsuedoEOF`, having incorrect lengths and incorrect encodings when the
header was decoded. Sometimes, this resulted in the decoding being cut
short; in other instances, incorrect symbols were rendered.

Solution is to identify the index of the `PsuedoEOF` record in pairs and
encode that in the header and no longer encode the symbol itself in the
header, removing the need to (i) encode it as two bytes and (ii) place
it at the end to handle it specially. When decoding the header, we skip
the byte whose index is that of `PsuedoEOF`, insert into the pairs list
at the index, and continue as normal.
5adb0530 — aldats 2 years ago
chore: document `main.zig:{compress * decompress}`
53d76ee3 — aldats 2 years ago
fix: maximum count of codes assigned to length
3dac1785 — aldats 2 years ago
chore: re-implement decoding test
c4f03f59 — aldats 2 years ago
refactor: extract decoding loop as function
4b97724d — aldats 2 years ago
chore: nuked a surviving test
88a7d1cd — aldats 2 years ago
chore: quick documentation
3474aaed — aldats 2 years ago
refactor: nuke now-dead code
73337ac9 — aldats 2 years ago
feat: achieve canonical encoding and decoding

Bug fixing abound!

* Properly skipped the `PsuedoEOF` bytes in
  `xcoding.zig:readHuffmanPairsFromHeader`. Previously, only skipped the
  first byte (`00000001`), shifting the decoding reading frame to the
  left by one byte. Now we skip the second byte too (`00000000`).
* Make `code` in `xcoding.zig:decodedEncodedStream` a `usize` instead of
  a `u8` because, surprise, Huffman codes can be larger than 8 bits.
  Should encode this in an explicit constant.
* Probably others that have been lost to time in the headache that this
  project was.

Also, add and implement the new `compress` and `decompress` functions.
I should decide on what assumptions I want to make on the passed reader
and writer, if any, i.e. if I should make new buffers or take them as
is. Additionally, the code needs a lot of comments, and a lot of
now-dead code has to be removed.
b9be507e — aldats 2 years ago
fix: account for header offsets when decoding
02ac11ec — aldats 2 years ago
fix: write only non-zero lengths
94be47ae — aldats 2 years ago
backend implementation of huffman codes
Next
Do not follow this link