Skip to content

Commit

Permalink
Fix Huffman encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
mtheall committed Jan 7, 2022
1 parent 70e1ed3 commit 4f5de03
Show file tree
Hide file tree
Showing 4 changed files with 279 additions and 371 deletions.
1 change: 1 addition & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
Expand Down
26 changes: 13 additions & 13 deletions include/compress.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*------------------------------------------------------------------------------
* Copyright (c) 2017-2019
* Copyright (c) 2017-2022
* Michael Theall (mtheall)
*
* This file is part of tex3ds.
Expand Down Expand Up @@ -28,61 +28,61 @@
#include <vector>

/** @brief LZSS/LZ10 compression
* @param[in] src Source buffer
* @param[in] len Source length
* @param[in] src Source buffer
* @param[in] len Source length
* @returns Compressed buffer
*/
std::vector<uint8_t> lzssEncode (const void *src, size_t len);

/** @brief LZSS/LZ10 decompression
* @param[in] src Source buffer
* @param[out] dst Destination buffer
* @param[in] len Source length
* @param[in] len Destination length
* @note The output buffer must be large enough to hold the decompressed data
*/
void lzssDecode (const void *src, void *dst, size_t len);

/** @brief LZ11 compression
* @param[in] src Source buffer
* @param[in] len Source length
* @param[in] src Source buffer
* @param[in] len Source length
* @returns Compressed buffer
*/
std::vector<uint8_t> lz11Encode (const void *src, size_t len);

/** @brief LZ11 decompression
* @param[in] src Source buffer
* @param[out] dst Destination buffer
* @param[in] len Source length
* @param[in] len Destination length
* @note The output buffer must be large enough to hold the decompressed data
*/
void lz11Decode (const void *src, void *dst, size_t len);

/** @brief Run-length encoding compression
* @param[in] src Source buffer
* @param[in] len Source length
* @param[in] src Source buffer
* @param[in] len Source length
* @returns Compressed buffer
*/
std::vector<uint8_t> rleEncode (const void *src, size_t len);

/** @brief Run-length encoding decompression
* @param[in] src Source buffer
* @param[out] dst Destination buffer
* @param[in] len Source length
* @param[in] len Destination length
* @note The output buffer must be large enough to hold the decompressed data
*/
void rleDecode (const void *src, void *dst, size_t len);

/** @brief Huffman compression
* @param[in] src Source buffer
* @param[in] len Source length
* @param[in] src Source buffer
* @param[in] len Source length
* @returns Compressed buffer
*/
std::vector<uint8_t> huffEncode (const void *src, size_t len);

/** @brief Huffman decompression
* @param[in] src Source buffer
* @param[out] dst Destination buffer
* @param[in] len Source length
* @param[in] len Destination length
* @note The output buffer must be large enough to hold the decompressed data
*/
void huffDecode (const void *src, void *dst, size_t len);
Expand Down
Loading

0 comments on commit 4f5de03

Please sign in to comment.