minor formatting

This commit is contained in:
Josh Coalson
2006-11-20 16:45:37 +00:00
parent 7581d121c1
commit 0e6187c49d
8 changed files with 240 additions and 213 deletions

View File

@@ -135,8 +135,8 @@
</ul>
</li>
</ul>
<a name="acknowledgments"><font size="+1"><b><u>Acknowledgments</u></b></font></a>
<br /><br />
<a name="acknowledgments"><font size="+1"><b><u>Acknowledgments</u></b></font></a><br />
<br />
FLAC owes much to the many people who have advanced the audio compression field so freely. For instance:
<ul>
<li>
@@ -152,14 +152,14 @@
And of course, <a href="http://en.wikipedia.org/wiki/Claude_Shannon">Claude Shannon</a>
</li>
</ul>
<a name="scope"><font size="+1"><b><u>Scope</u></b></font></a>
<br /><br />
It is a known fact that no algorithm can losslessly compress all possible input, so most compressors restrict themselves to a useful domain and try to work as well as possible within that domain. FLAC's domain is audio data. Though it can losslessly <b>code</b> any input, only certain kinds of input will get smaller. FLAC exploits the fact that audio data typically has a high degree of sample-to-sample correlation.
<br /><br />
Within the audio domain, there are many possible subdomains. For example: low bitrate speech, high-bitrate multi-channel music, etc. FLAC itself does not target a specific subdomain but many of the default parameters of the reference encoder are tuned to CD-quality music data (i.e. 44.1kHz, 2 channel, 16 bits per sample). The effect of the encoding parameters on different kinds of audio data will be examined later.
<br /><br />
<a name="architecture"><font size="+1"><b><u>Architecture</u></b></font></a>
<br /><br />
<a name="scope"><font size="+1"><b><u>Scope</u></b></font></a><br />
<br />
It is a known fact that no algorithm can losslessly compress all possible input, so most compressors restrict themselves to a useful domain and try to work as well as possible within that domain. FLAC's domain is audio data. Though it can losslessly <b>code</b> any input, only certain kinds of input will get smaller. FLAC exploits the fact that audio data typically has a high degree of sample-to-sample correlation.<br />
<br />
Within the audio domain, there are many possible subdomains. For example: low bitrate speech, high-bitrate multi-channel music, etc. FLAC itself does not target a specific subdomain but many of the default parameters of the reference encoder are tuned to CD-quality music data (i.e. 44.1kHz, 2 channel, 16 bits per sample). The effect of the encoding parameters on different kinds of audio data will be examined later.<br />
<br />
<a name="architecture"><font size="+1"><b><u>Architecture</u></b></font></a><br />
<br />
Similar to many audio coders, a FLAC encoder has the following stages:
<ul>
<li>
@@ -175,10 +175,10 @@
<a href="#residualcoding">Residual coding</a>. If the predictor does not describe the signal exactly, the difference between the original signal and the predicted signal (called the error or residual signal) must be coded losslessy. If the predictor is effective, the residual signal will require fewer bits per sample than the original signal. FLAC currently uses only one method for encoding the residual (see the <a href="#residualcoding">Residual coding</a> section), but the format has reserved space for additional methods. FLAC allows the residual coding method to change from block to block, or even within the channels of a block.
</li>
</ul>
In addition, FLAC specifies a metadata system, which allows arbitrary information about the stream to be included at the beginning of the stream.
<br /><br />
<a name="definitions"><font size="+1"><b><u>Definitions</u></b></font></a>
<br /><br />
In addition, FLAC specifies a metadata system, which allows arbitrary information about the stream to be included at the beginning of the stream.<br />
<br />
<a name="definitions"><font size="+1"><b><u>Definitions</u></b></font></a><br />
<br />
Many terms like "block" and "frame" are used to mean different things in differenct encoding schemes. For example, a frame in MP3 corresponds to many samples across several channels, whereas an S/PDIF frame represents just one sample for each channel. The definitions we use for FLAC follow. Note that when we talk about blocks and subblocks we are refering to the raw unencoded audio data that is the input to the encoder, and when we talk about frames and subframes, we are refering to the FLAC-encoded data.
<ul>
<li>
@@ -197,16 +197,16 @@
<b>Subframe</b>: A subframe header plus one or more encoded samples from a given channel. All subframes within a frame will contain the same number of samples.
</li>
</ul>
<a name="blocking"><font size="+1"><b><u>Blocking</u></b></font></a>
<br /><br />
The size used for blocking the audio data has a direct effect on the compression ratio. If the block size is too small, the resulting large number of frames mean that excess bits will be wasted on frame headers. If the block size is too large, the characteristics of the signal may vary so much that the encoder will be unable to find a good predictor. In order to simplify encoder/decoder design, FLAC imposes a minimum block size of 16 samples, and a maximum block size of 65535 samples. This range covers the optimal size for all of the audio data FLAC supports.
<br /><br />
Currently the reference encoder uses a fixed block size, optimized on the sample rate of the input. Future versions may vary the block size depending on the characteristics of the signal.
<br /><br />
Blocked data is passed to the predictor stage one subblock (channel) at a time. Each subblock is independently coded into a subframe, and the subframes are concatenated into a frame. Because each channel is coded separately, it means that one channel of a stereo frame may be encoded as a constant subframe, and the other an LPC subframe.
<br /><br />
<a name="interchannel"><font size="+1"><b><u>Interchannel Decorrelation</u></b></font></a>
<br /><br />
<a name="blocking"><font size="+1"><b><u>Blocking</u></b></font></a><br />
<br />
The size used for blocking the audio data has a direct effect on the compression ratio. If the block size is too small, the resulting large number of frames mean that excess bits will be wasted on frame headers. If the block size is too large, the characteristics of the signal may vary so much that the encoder will be unable to find a good predictor. In order to simplify encoder/decoder design, FLAC imposes a minimum block size of 16 samples, and a maximum block size of 65535 samples. This range covers the optimal size for all of the audio data FLAC supports.<br />
<br />
Currently the reference encoder uses a fixed block size, optimized on the sample rate of the input. Future versions may vary the block size depending on the characteristics of the signal.<br />
<br />
Blocked data is passed to the predictor stage one subblock (channel) at a time. Each subblock is independently coded into a subframe, and the subframes are concatenated into a frame. Because each channel is coded separately, it means that one channel of a stereo frame may be encoded as a constant subframe, and the other an LPC subframe.<br />
<br />
<a name="interchannel"><font size="+1"><b><u>Interchannel Decorrelation</u></b></font></a><br />
<br />
In stereo streams, in many cases there is an exploitable amount of correlation between the left and right channels. FLAC allows the frames of stereo streams to have different channel assignments, and an encoder may choose to use the best representation on a frame-by-frame basis.
<ul>
<li>
@@ -222,10 +222,10 @@
<b>Right-side</b>. The right channel and side channel are coded
</li>
</ul>
Surprisingly, the left-side and right-side forms can be the most efficient in many frames, even though the raw number of bits per sample needed for the original signal is slightly more than that needed for independent or mid-side coding.
<br /><br />
<a name="prediction"><font size="+1"><b><u>Prediction</u></b></font></a>
<br /><br />
Surprisingly, the left-side and right-side forms can be the most efficient in many frames, even though the raw number of bits per sample needed for the original signal is slightly more than that needed for independent or mid-side coding.<br />
<br />
<a name="prediction"><font size="+1"><b><u>Prediction</u></b></font></a><br />
<br />
FLAC uses four methods for modeling the input signal:
<ul>
<li>
@@ -241,18 +241,18 @@
<b>FIR Linear prediction</b>. For more accurate modeling (at a cost of slower encoding), FLAC supports up to 32nd order FIR linear prediction (again, for info on linear prediction, see <a href="http://www.hpl.hp.com/techreports/1999/HPL-1999-144.pdf">audiopak</a> and <a href="http://svr-www.eng.cam.ac.uk/~ajr/GroupPubs/Robinson94-tr156/index.html">shorten</a>). The reference encoder uses the Levinson-Durbin method for calculating the LPC coefficients from the autocorrelation coefficients, and the coefficients are quantized before computing the residual. Whereas encoders such as Shorten used a fixed quantization for the entire input, FLAC allows the quantized coefficient precision to vary from subframe to subframe. The FLAC reference encoder estimates the optimal precision to use based on the block size and dynamic range of the original signal.
</li>
</ul>
<a name="residualcoding"><font size="+1"><b><u>Residual Coding</u></b></font></a>
<br /><br />
FLAC currently defines two similar methods for the coding of the error signal from the prediction stage. The error signal is coded using Rice codes in one of two ways: 1) the encoder estimates a single rice parameter based on the variance of the residual and Rice codes the entire residual using this parameter; 2) the residual is partitioned into several equal-length regions of contiguous samples, and each region is coded with its own Rice parameter based on the region's mean. (Note that the first method is a special case of the second method with one partition, except the Rice parameter is based on the residual variance instead of the mean.)
<br /><br />
The FLAC format has reserved space for other coding methods. Some possiblities for volunteers would be to explore better context-modeling of the Rice parameter, or Huffman coding. See <a href="http://www.hpl.hp.com/techreports/98/HPL-98-193.html">LOCO-I</a> and <a href="http://www.cs.tut.fi/~albert/Dev/pucrunch/packing.html">pucrunch</a> for descriptions of several universal codes.
<br /><br />
<a name="format_overview"><font size="+1"><b><u>Format</u></b></font></a>
<br /><br />
This section specifies the FLAC bitstream format. FLAC has no format version information, but it does contain reserved space in several places. Future versions of the format may use this reserved space safely without breaking the format of older streams. Older decoders may choose to abort decoding or skip data encoded with newer methods. Apart from reserved patterns, in places the format specifies invalid patterns, meaning that the patterns may never appear in any valid bitstream, in any prior, present, or future versions of the format. These invalid patterns are usually used to make the synchronization mechanism more robust.
<br /><br />
All numbers used in a FLAC bitstream are integers; there are no floating-point representations. All numbers are big-endian coded. All numbers are unsigned unless otherwise specified.
<br /><br />
<a name="residualcoding"><font size="+1"><b><u>Residual Coding</u></b></font></a><br />
<br />
FLAC currently defines two similar methods for the coding of the error signal from the prediction stage. The error signal is coded using Rice codes in one of two ways: 1) the encoder estimates a single rice parameter based on the variance of the residual and Rice codes the entire residual using this parameter; 2) the residual is partitioned into several equal-length regions of contiguous samples, and each region is coded with its own Rice parameter based on the region's mean. (Note that the first method is a special case of the second method with one partition, except the Rice parameter is based on the residual variance instead of the mean.)<br />
<br />
The FLAC format has reserved space for other coding methods. Some possiblities for volunteers would be to explore better context-modeling of the Rice parameter, or Huffman coding. See <a href="http://www.hpl.hp.com/techreports/98/HPL-98-193.html">LOCO-I</a> and <a href="http://www.cs.tut.fi/~albert/Dev/pucrunch/packing.html">pucrunch</a> for descriptions of several universal codes.<br />
<br />
<a name="format_overview"><font size="+1"><b><u>Format</u></b></font></a><br />
<br />
This section specifies the FLAC bitstream format. FLAC has no format version information, but it does contain reserved space in several places. Future versions of the format may use this reserved space safely without breaking the format of older streams. Older decoders may choose to abort decoding or skip data encoded with newer methods. Apart from reserved patterns, in places the format specifies invalid patterns, meaning that the patterns may never appear in any valid bitstream, in any prior, present, or future versions of the format. These invalid patterns are usually used to make the synchronization mechanism more robust.<br />
<br />
All numbers used in a FLAC bitstream are integers; there are no floating-point representations. All numbers are big-endian coded. All numbers are unsigned unless otherwise specified.<br />
<br />
Before the formal description of the stream, an overview might be helpful.
<ul>
<li>