summaryrefslogtreecommitdiff
path: root/tools/gbagfx/huff.h
diff options
context:
space:
mode:
authorGriffinR <griffin.g.richards@gmail.com>2020-07-14 22:43:57 -0400
committerGitHub <noreply@github.com>2020-07-14 22:43:57 -0400
commitd3bfb6cfc63f9f64295cbd864f98df9cf4c643b4 (patch)
treecd009525bd32ed093138f061a6131001602f5900 /tools/gbagfx/huff.h
parent59ae1cb346c31d604a540bfe70bf843fa8b6334e (diff)
parentfa83439732677fdf36c0bd78af1fa4ea42b68e7d (diff)
Merge pull request #779 from Sierraffinity/master
gbagfx: Various fixes and improvements
Diffstat (limited to 'tools/gbagfx/huff.h')
-rw-r--r--tools/gbagfx/huff.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/tools/gbagfx/huff.h b/tools/gbagfx/huff.h
new file mode 100644
index 000000000..6002fe954
--- /dev/null
+++ b/tools/gbagfx/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