twansenne @ Sun Nov 05, 2006 12:16 pm wrote:
Jian @ Sun Nov 05, 2006 4:54 am wrote:
<<<SNIPPED>>>
So the question is, will zipping the audio mp3+g further reduce the audio quality of the file?
NO
When a file is zipped, it is compressed, when it it unzipped it is de-compressed. There is a change in the data when it is zipped, but unzipping the files restores it to that original data, as long as no errors happen.
All data on a computer is ONEs and ZEROs. A chunk of a file might look like this....
0010010011101010101000001
Then let say we zip this serries of bits (1s & 0s). The program;s algorithim looks for repeated data, and assigns it a key.
001 is repeated 4 times in the series, and the alogrithim sets key for 3 to equal 001
Thefore the serries becomes 33311010101010003 which is 13 bits less than the original serries.
Now when the program un-zips the file the program replace the 3 with 001, thus giving you back your original file. That is basically how zipping a file works.
Very nice explanation of it, except it's a bit misleading. What they do is pattern recognition, like Twan says. However, they don't replace with the number 3 since it's not a binary number. The binary representation of 3 is 11, where 00 is 0, 01 is 1, 10 is 2 and 11 is 3. So, they replace the pattern like 0001 with 11, thus reducing the number of bits needed to represent a series of string. So, what you look for is a series of similar string, like pattern 010101 becomes 101 for example. When they decompress, they look for the reverse of the string and replace with longer string.
Second way to do it is the actually use algorithm to reduce it mathmatically. You use an equation and put a string of 128 bits in to the equation, the end result is 64 bits of encrypted data. That gets transferred and when you decrypt, it uses reverse of the it and extract 128 bits out from 64 bits.
As to the original question, wether or not you lose quality of the file when you compress, most of the data compression is lossless. Which means that you do not lose a bit of data when compressed and decompressed. You need this or our banking systems will go to hell by losing a bunch of data.
However, most of the media compression scheme is lossy because they believe that you won't notice that much of difference in perception of the media but can create a much smaller file.
There are many different media compression methods, like JPEG and GIF for graphics, MPEG and VCD for video and mpg3 for audio. What they do is optimize best means to compress the data which still keeps most of the origial data but lose "unimportant" data to make the file smaller. For example, JPEG will take n x n pixels (usualy 8 x 8 pixels) and take an average of those 64 pixels and replace it with original 64 pixels. If you look closely, you can see the artifacts, which comes from having the same value of those pixel blocks rather than gradation of those blocks. GIF uses color reduction to make the make the files smaller, i.e. if only 120 colors are present in a file, there is no need to use 256 colors or 16.7 million colors to store the file. This is why JPEG works better with pictures and GIF works better with drawings. Pictures tend to have a lot more colors than drawings.
As for MPEG, what they do is you have what they called reference frame every 8 or 15 frames. All the subsquent frames between the reference frames are the differences between the last frame and current frame. The logic is that most movies, the differences between two consecutive frames are small so you only store that data. That's why when you watch a movie with a lot of action, thus a lot of differences between the frames, the frame rate drops or quality drops. When you watch a landscape with very little movement, you get a very crisp frame and high frame rate. This is concept behind the Variable Data Rate concept of MPEG type of encoding.
I am not as familiar with mp3 but from what I know, they compress the dynamic range thus creating smaller data to use, use lower data rate to make the file smaller or use both.