LebaneseChiphead wroteWould U software guys please explain how the compression work excatly? how does the file reduces in size to almost half ? or in other words how does that format of the compressed file differ from the format of uncompressed file? or simply where is the trick in that? why do'nt we always use compressed files?? why not make that an industry standard? what are the disadvantages of a compressed file? is there any?
Thank U
Chips IMR
Ps, Mir. Please notice I am in a good mood Today :)
I'm gonna give you an example.
Consider the following sentence:
"How does compression compress the file and why is the compressed file smaller."
Lets rewrite it using less letters. The first thing we do is revrite is like this:
"How does +ion + the * and why is the +ed * smaller.+=compress, *=file"
See it's already smaller. What we did is find repeated patterns and use a "dictionnary". That is one method of compression.
another example, consider this binary data (for example in a bitmap image file):
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
How do we compress that?
simple: "repeat 0 a 100 time"
That is another method, and I'm sure there ary many other methods, and maybe some complex math involved.
I hope that was clear and instructive enough.
The reason why we dont always use compression is that hard disks are cheap and compression uses CPU and memory resources, as you can see, processing is required to convert between compressed and uncompressed formats.
Yet you have the option in windows to use a compression at the file system level, but i dont recommend it, it's slower then the normal filesystem and the gains are ridiculously low.
Another disadvantage of compression is that they are more sensible to data corruption. If a text file gets corrupted, you will only loose part of the text data that is corrupted. If a compressed file gets corrupted, you are likely to loose access to the whole file altogether.
Compression is used on the web too, many servers serve pages in a compressed format which is read and decompressed by your web browser (without you knowing anything of it)