Qbasicnews.com
September 29, 2020, 11:20:56 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Basic Compression Challenge  (Read 4967 times)
aetherfox
Been there, done that
*****
Posts: 1071



WWW
« on: January 07, 2005, 09:44:49 AM »

It's been almost quiet here...so I decided to start this challenge.

Your task is to write a compression alogrithm and a simple test program to showcase the features.

The compression alogrithm must be written entirely without external libraries or links.  You can do it in either freeBASIC or QB.

The sample program can be a simple commandline program that asks for a string and the compression ratio or whatever.

I'm not looking for RAR-level compression, even if you shave of 5% that will be good.

Also, if the code was commented with an explanation of how the compression works, that would be really nice.

To tell you the truth I know almost nothing about compression, and this is a way for me to learn.

Good luck!
Logged

~''i|~thrFx~|i''~-  
avinash.vora - http://www.avinashv.net
shiftLynx
Wandering Guru
***
Posts: 340



WWW
« Reply #1 on: January 07, 2005, 01:40:20 PM »

You say "write an algorithm"... do you mean invent one, or use an existing one?

-shiftLynx
Logged

img]http://www.cdsoft.co.uk/misc/shiftlynx.png[/img]
DrV
Na_th_an
*****
Posts: 1553



WWW
« Reply #2 on: January 08, 2005, 02:12:21 PM »

Does it need to have a decompressor as well, or can we just chop off the last 20 bytes and say "It's 20 bytes smaller! I r0x0rz!"?
Logged
aetherfox
Been there, done that
*****
Posts: 1071



WWW
« Reply #3 on: January 08, 2005, 02:44:39 PM »

By write an alogrithm, I meant you can invent one if you like ( Shocked good luck Cheesy) or implement an existing one.

And yes, obviously it should be able to decompress, I thought that was fairly obvious.
Logged

~''i|~thrFx~|i''~-  
avinash.vora - http://www.avinashv.net
Diroga
Been there, done that
*****
Posts: 1087


« Reply #4 on: January 09, 2005, 12:45:03 AM »

doesnt compression look for patterens in data that it can represent in a smaller way?
Logged
Z!re
*/-\*
*****
Posts: 4599


« Reply #5 on: January 09, 2005, 01:12:51 AM »

When testing the algos, on what files will it be done?

Flat files?
Repeating files?
Random files?

Flat means, for example, 10MB of chr0
Repeating means: ABCABCABCABCABC[...]
Random.. take a wild guess...


One algo might do wonders on flat files (RLE for example) but the same algo might not work at all on random files (RLE can't do shit about random files, and can even result in negative compression...)


So when testing/judging, you should try the algo on all three files, or have it categorized, like:
Best flat compressor by: [Author] [compress %]
Best repeating compressor by: [Author] [compress %]
Best random compressor by: [Author] [compress %]
Logged
aetherfox
Been there, done that
*****
Posts: 1071



WWW
« Reply #6 on: January 09, 2005, 09:32:01 AM »

Oh ok cool, I didn't know there was so much to it.

Revised rules :

Create a small commandline program in either QB or fB that will demonstrate the use of a compression/decompression alogrithm you have coded (invented or implemented) on flat, repeated and random data.  The program should give information about the compression rate for the given files.

Sample output:

Avi's Sample Compression Program
Coded in freeBASIC.

Compressing: Flatfile
Decompressing...Done!

Compressing: Repeated
Decompressing...Done!

Compressing: Random
Decompressing...Done!

Compression Ratios:
Flat: ##%
Repeated: ##%
Random: ##%
Logged

~''i|~thrFx~|i''~-  
avinash.vora - http://www.avinashv.net
Neo
Na_th_an
*****
Posts: 2150



« Reply #7 on: January 14, 2005, 01:52:22 PM »

http://www.qbnz.com/harsoft/NeoCL.zip
Logged
Spotted Cheetah
Ancient QBer
****
Posts: 400



WWW
« Reply #8 on: January 14, 2005, 08:31:08 PM »

I think i will not win, but can i sign in with our QBasic Sprite Editor's PCX compressor? (I know it is not a hard think but i worked a lot on it to optimize everything for x sizes not dividable by 8. Try saving some PCXs with it...) You can download the sprite editor with source on our page, just create some image, or import a 16 color BMP, and test it's compression ratio or compare to some usual commercial programs. It was written almost a half year ago, so i do not know now where is the compressor in the code, but it is somewhere in one piece (not divided into SUBs).
Logged

fter 60 million years a civilization will search for a meteorite destroying most of the living creatures around this age...

There must be a better future for the Cheetahs!

http://rcs.fateback.com/
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!