• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Finally, useful programming!

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

Krusty

Insane Overclocking Clown
Joined
Sep 17, 2001
Location
Orange County
Hello all you programming noobs, programming gurus, and wannabe programming gurus!

I just felt like telling all the people out there that have not hit upper division programming courses to hold on a bit. After two years of writing useless code that simply serves as a programming exercise, I have finally reached a programming assignment in which I can actually see a purpose for.

My assignment, due next week, is a practice in huffman coding. Huffman coding is a form of file compression. My assignment basically involves writing my own file compression program.

Sure, programs like winzip and winrar already exist, but now I can have one of my own. Should I call it WinKrusty? I dunno.

Anyways, I just felt like making a useless post to tell everyone in earlier stages of learning to program that you, one day, will have interesting and difficult assignments.
 
Call it Squishy! :D :D :D

Man, I've been wanting to try to find some code on Huffman algorithms to attempt my own compression. Haven't found anything on the net though, and even if there was, I highly doubt it would be written in BASIC :rolleyes:

You know, with the compression, you could technicaly even make your own compressed picture format... Something like a GIF or JPEG... only made by yourself!

JigPu
 
You should be innovative and do a lossy compression algorithm.
 
JigPu said:
Call it Squishy! :D :D :D

Man, I've been wanting to try to find some code on Huffman algorithms to attempt my own compression. Haven't found anything on the net though, and even if there was, I highly doubt it would be written in BASIC :rolleyes:

You know, with the compression, you could technicaly even make your own compressed picture format... Something like a GIF or JPEG... only made by yourself!

JigPu

actually, both JPEG and MP3 use huffman algorithms in their compression. I don't really know basic, but I would suspect it to be very difficult to do since it involves trees. To make a tree, you need to dynamically allocate memory and use pointers (or reference stuff in java).

I have looked into bmp format before when attempting to do some graphics stuff in assembly. I thought I might be able to read the data and find my own way to output it. I guess I could make my own data type, but finding out how to convert it from other images and create the images would be a real pain in the butt at the moment.
 
Krusty said:

Losing data. Actually a lossless would be better. Maybe I have it backwards, its been a while but lossy just means that you cant revert back t the original file/image because some data is lost in the compression. Lossless (which is very rare with any type of good compression) is what you would want, but is extremly hard to achieve and actually compress the data in any worthwhile way.

Josh
 
On the same thread, you would be amazed how much coding you do in college that you find useless can actually be put to a good use. hashing for example is alot of fun to mess with. I actually managed to out do my prof's hashing function for these GPS records so now he uses my code in his examples. Hashing a 80 MB text file is quite a sight, and quite time consuming even on an Xp 1900+

Josh
 
Lossy compression is something like a jpeg, mp3, or divx. Data is lost.

Lossless is something like rar or zip, no data is lost.

It was a joke, really. Lossless compression is a bad idea for meaningful data. Imagine if you stuff a word file into a lossy compression algorithm, the document would be corrupt since is has lost data that can't be recovered.

And once you start discarding the data willfully in the name of compression, you can go just about as far as you want. True compression was master long ago, with delete commands :D
 
Istari1 said:


Losing data. Actually a lossless would be better. Maybe I have it backwards, its been a while but lossy just means that you cant revert back t the original file/image because some data is lost in the compression. Lossless (which is very rare with any type of good compression) is what you would want, but is extremly hard to achieve and actually compress the data in any worthwhile way.

Josh

The huffman algorithm is lossless. Part of my testing is to compress and uncompress a 300MB executable file and a 100MB zip file. They still gotta work when I'm done.
 
Your compression algorithm needs to increase the file size =) Call it an anti-piracy mechanism ;)
 
Not at all! I'm rationalizing that, if somebody is going to have to download a 500MB file, and "ununcompress" it to a 4kb .txt file, I doubt they'd be grabbing larger files ;)
 
I have a book kicking around with some very interesting compression algoithms in it for C. If anyone would like(it would take a bit) I can write up some of the code samples and upload them. Oh WinZip uses Huffman compresion as well. And for the record, at least as of a couple of years ago, someone has the copyright and patent for huffman compression. There is also sliding window compression and a few others. Just let me know if any of you are intrested in the code. Also I did a huffman coding in one of my first programming classes, though it was towards the end. And it was gone over again in a descret math(basically a glorified logic class) class.
 
Krieger said:
I have a book kicking around with some very interesting compression algoithms in it for C. If anyone would like(it would take a bit) I can write up some of the code samples and upload them. Oh WinZip uses Huffman compresion as well. And for the record, at least as of a couple of years ago, someone has the copyright and patent for huffman compression. There is also sliding window compression and a few others. Just let me know if any of you are intrested in the code. Also I did a huffman coding in one of my first programming classes, though it was towards the end. And it was gone over again in a descret math(basically a glorified logic class) class.

Huffman is still alive and teaching at a University somewhere. It would probably be him that would have a copyright for it.

Oh, and discrete math sucks my (__|__)! I just finished 2 quarters of it. I can't stand proofs. Now I'm on to a statistics class. I can't believe how much integration is used in these classes.
 
Back