djshadoworgando@yahoo.com wrote:
im 13 and im trying to understand how a computer decompresses
compressed data on the fly. Do video codecs decompress the video in
ram
on the fly while the video is playing?
Yes, although "on the fly" is a bit misleading. What typically happens
is that, before playback actually begins, the first frame of video and
audio are decompressed and stored. Then, when playback begins, the
video and audio are shown/played while the next frame's video/audio is
being decompressed, etc. So what you are seeing is always one (or
more) frames "behind" where the player is actually at in the video
file.
A more accurate representation of "on the fly" decompression is
something where the decompression method operates in a very small
amount of memory (or no memory) and works like a simple streaming
device: A compressed symbol goes into the decompressor, and the
resulting uncompressed symbol goes out. A good example of this would
be the LZ78 compression method, in which typical implementations only
use about 4K of RAM.
If you'd like to read up more on LZ78 -- or compression/decompression
in general -- here is a good resource:
If you start at the very beginning, it should answer all of your
questions. (Don't jump right to the LZ78 section or you won't
understand it.)