Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with creating a Huffman code tree
#8
(07-02-2023, 02:12 AM)DSMan195276 Wrote: I haven't closely read all of your code, but it looks like you have the right idea for creating the table of character frequencies. For creating the actual Huffman tree you can just make an array of nodes, and in place of where you'd normally use pointers you just store an index into the array of nodes. Once you do that it's reasonably easy to use the typical algorithm to make the huffman tree. ...
(07-02-2023, 12:01 PM)bplus Wrote: Hi @SagaraS Welcome to the forum!

What's a Hoffman Tree and why in the world would anyone want one? 

Asking such questions is how I got into Pathfinder and an alternate Paint3 code. You never know what rabbit hole leads to buried treasure Smile
Sorry for my late reply.

How the tree is built and how it works on a piece of paper is simple.
But implementing the whole thing is harder for me.
Especially these recursive matters.

After all, the whole thing should automatically generate the code for the respective ASCII characters at the end.
Had found many examples on the net, but didn't really know where to start.

@'DSMan1s276' Thanks for your post with the sample code. Now I have a plan how I can implement it for my purposes. ^^

@'bplus'
On the one hand, I need this for my own interest. Would like to learn that. On the other hand, I would like to use it to reduce the size of small tables or small images.

I have already managed to get a working RLE compression for images. Based on Targa images.

But if the entropy is too big, it doesn't do me much good. Therefore an additional Huffman Compression.

This means that not everyone can manipulate the data immediately.
And the data is smaller in size.
That's my goal at the moment.

Have another QB64 project where I would like to include this for the resources.

Here are some pictures of it:
[Image: pic171i5h.png][Image: pic2a0cs0.png][Image: pic3rgf2x.png][Image: pic4uefxo.png][Image: pic5q0ef9.png]

The helpfile on the last image is a B800 text format. 1 byte char + 1 byte for foreground and background color. So 2 bytes per character.
The helpfile exist 1x in german an 1x in english. The total size for the helpfile is 28 KB. This * 2 is 56 KB.

Then i have 3 images in the ressource file. About 212 KB.

mouse cursor + my own 8x8 font. About 2,2 KB.

I have brought all resources into an archive which is foot-controlled.
I can attach this archive to the EXE file.

Thus, the EXE file with the archive is standalone.

And I also like to apologize for my bad English. Actually, German is my mother tongue. ^^
Reply


Messages In This Thread
RE: Problem with creating a Huffman code tree - by SagaraS - 07-02-2023, 08:50 PM



Users browsing this thread: 13 Guest(s)