j1clark@ucsd.edu
Veteran
So in the AAA example, the first two As are discarded and replaced with one digit, so now we discarded information thus reducing size, but then in the decoding process, the remaining A is cloned/copied two times thus we get the AAA again with the same original size and information?
So this example can only be used if there is a consecutive number of absolutely identical data which you can discard all of them but one then be able to bring back by cloning the remaining one? In that case the data has to be 100% identical otherwise they'd be interpolating and loss happening.
Do I get this right?
The one idea of 'lossless' compression is to take advantage of the fact that there is redundancy in the image. The example give is that there is a 3 byte pattern, 'AAA', and that the 3 "A"s are redundant, and by encoding them as 3A, you 'squeeze' out that redundancy. It would be more obvious if the pattern were 'AAAAAAAAA', and clearly 9A would compress nine bytes in to 2 bytes.
If the 'expansion' rule is to take the first byte, a number, then replicate the second byte by that number, so to expand a compressed sequence, one would take "9A", and using first byte to replicate the second byte, one has a lossless transform.
The various compression algorithms are more complex, but Run Length Encoding, is one of the most obvious.
In most text files, for a Latin based alphabet say for English, putting aside punctuation, there are only 26 letters, add to that another 26 for 'capital' letters, that is only 52 letters, but the usual text file has a binary representation of 8 bits, and so over 200 values are 'wasted', and can be 'squeezed' out, and still be expanded losslessly.
Again that's sort of a gross simplification, but that's the idea.
I don't recall the exact numbers of these days one can get down to 30-40% lossless compression with 'text' files.
In 'lossy' compression say one were to drop all 'vowels' from the language... most trained 'readers' in a language can adapt to no vowels, and so, one hs lssy cmprsn bt stll 'ndrstndbl... srt 'f... may need some diacritical marks...