summaryrefslogtreecommitdiff
path: root/tools/nitrogfx/huff.h
diff options
context:
space:
mode:
authorPikalaxALT <PikalaxALT@gmail.com>2020-04-15 20:20:40 -0400
committerPikalaxALT <PikalaxALT@gmail.com>2020-04-15 20:20:40 -0400
commit09d866602ecc76fdc5e9be9e3bd1ae0b8547ff13 (patch)
tree312c771cf265503718f3e8c2eb42b92708c55f36 /tools/nitrogfx/huff.h
parentb661c7888c57280a19801b320cf7860e6555f1d3 (diff)
ROM titles
Diffstat (limited to 'tools/nitrogfx/huff.h')
-rw-r--r--tools/nitrogfx/huff.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/tools/nitrogfx/huff.h b/tools/nitrogfx/huff.h
new file mode 100644
index 00000000..6002fe95
--- /dev/null
+++ b/tools/nitrogfx/huff.h
@@ -0,0 +1,38 @@
+#ifndef HUFF_H
+#define HUFF_H
+
+union HuffNode;
+
+struct HuffData {
+ unsigned value:31;
+ unsigned isLeaf:1;
+};
+
+struct HuffLeaf {
+ struct HuffData header;
+ unsigned char key;
+};
+
+struct HuffBranch {
+ struct HuffData header;
+ union HuffNode * left;
+ union HuffNode * right;
+};
+
+union HuffNode {
+ struct HuffData header;
+ struct HuffLeaf leaf;
+ struct HuffBranch branch;
+};
+
+typedef union HuffNode HuffNode_t;
+
+struct BitEncoding {
+ unsigned long long nbits:6;
+ unsigned long long bitstring:58;
+};
+
+unsigned char * HuffCompress(unsigned char * buffer, int srcSize, int * compressedSize_p, int bitDepth);
+unsigned char * HuffDecompress(unsigned char * buffer, int srcSize, int * uncompressedSize_p);
+
+#endif //HUFF_H