[xiph-commits] r15748 - trunk/vorbis/doc

giles at svn.xiph.org giles at svn.xiph.org
Fri Mar 6 10:54:17 PST 2009


Author: giles
Date: 2009-03-06 10:54:13 -0800 (Fri, 06 Mar 2009)
New Revision: 15748

Added:
   trunk/vorbis/doc/01-introduction.tex
   trunk/vorbis/doc/02-bitpacking.tex
   trunk/vorbis/doc/03-codebook.tex
   trunk/vorbis/doc/04-codec.tex
   trunk/vorbis/doc/05-comment.tex
   trunk/vorbis/doc/06-floor0.tex
   trunk/vorbis/doc/07-floor1.tex
   trunk/vorbis/doc/08-residue.tex
   trunk/vorbis/doc/09-helper.tex
   trunk/vorbis/doc/10-tables.tex
   trunk/vorbis/doc/Vorbis_I_spec.cfg
   trunk/vorbis/doc/Vorbis_I_spec.css
   trunk/vorbis/doc/Vorbis_I_spec.tex
   trunk/vorbis/doc/a1-encapsulation-ogg.tex
   trunk/vorbis/doc/a2-encapsulation-rtp.tex
   trunk/vorbis/doc/footer.tex
Modified:
   trunk/vorbis/doc/Makefile.am
   trunk/vorbis/doc/Vorbis_I_spec.html
   trunk/vorbis/doc/Vorbis_I_spec.pdf
Log:
Docbook to latex conversion of the spec by Max Horn.

We now build the specification document from latex source instead of the 
older docbook method since may developers have had trouble getting the 
docbook tools to work. It's also faster.

For now, the built documentation is still kept in svn and rebuilt only 
if --enable-docs is passed to configure. We may relax this to rebuilding
only if the tools are available once we're more confident it will work
with common TeX installations.


Added: trunk/vorbis/doc/01-introduction.tex
===================================================================
--- trunk/vorbis/doc/01-introduction.tex	                        (rev 0)
+++ trunk/vorbis/doc/01-introduction.tex	2009-03-06 18:54:13 UTC (rev 15748)
@@ -0,0 +1,529 @@
+% -*- mode: latex; TeX-master: "Vorbis_I_spec"; -*-
+%!TEX root = Vorbis_I_spec.tex
+% $Id$
+\section{Introduction and Description} \label{vorbis:spec:intro}
+
+\subsection{Overview}
+
+This document provides a high level description of the Vorbis codec's
+construction.  A bit-by-bit specification appears beginning in
+\xref{vorbis:spec:codec}.
+The later sections assume a high-level
+understanding of the Vorbis decode process, which is
+provided here.
+
+\subsubsection{Application}
+Vorbis is a general purpose perceptual audio CODEC intended to allow
+maximum encoder flexibility, thus allowing it to scale competitively
+over an exceptionally wide range of bitrates.  At the high
+quality/bitrate end of the scale (CD or DAT rate stereo, 16/24 bits)
+it is in the same league as MPEG-2 and MPC.  Similarly, the 1.0
+encoder can encode high-quality CD and DAT rate stereo at below 48kbps
+without resampling to a lower rate.  Vorbis is also intended for
+lower and higher sample rates (from 8kHz telephony to 192kHz digital
+masters) and a range of channel representations (monaural,
+polyphonic, stereo, quadraphonic, 5.1, ambisonic, or up to 255
+discrete channels).
+
+
+\subsubsection{Classification}
+Vorbis I is a forward-adaptive monolithic transform CODEC based on the
+Modified Discrete Cosine Transform.  The codec is structured to allow
+addition of a hybrid wavelet filterbank in Vorbis II to offer better
+transient response and reproduction using a transform better suited to
+localized time events.
+
+
+\subsubsection{Assumptions}
+
+The Vorbis CODEC design assumes a complex, psychoacoustically-aware
+encoder and simple, low-complexity decoder. Vorbis decode is
+computationally simpler than mp3, although it does require more
+working memory as Vorbis has no static probability model; the vector
+codebooks used in the first stage of decoding from the bitstream are
+packed in their entirety into the Vorbis bitstream headers. In
+packed form, these codebooks occupy only a few kilobytes; the extent
+to which they are pre-decoded into a cache is the dominant factor in
+decoder memory usage.
+
+
+Vorbis provides none of its own framing, synchronization or protection
+against errors; it is solely a method of accepting input audio,
+dividing it into individual frames and compressing these frames into
+raw, unformatted 'packets'. The decoder then accepts these raw
+packets in sequence, decodes them, synthesizes audio frames from
+them, and reassembles the frames into a facsimile of the original
+audio stream. Vorbis is a free-form variable bit rate (VBR) codec and packets have no
+minimum size, maximum size, or fixed/expected size.  Packets
+are designed that they may be truncated (or padded) and remain
+decodable; this is not to be considered an error condition and is used
+extensively in bitrate management in peeling.  Both the transport
+mechanism and decoder must allow that a packet may be any size, or
+end before or after packet decode expects.
+
+Vorbis packets are thus intended to be used with a transport mechanism
+that provides free-form framing, sync, positioning and error correction
+in accordance with these design assumptions, such as Ogg (for file
+transport) or RTP (for network multicast).  For purposes of a few
+examples in this document, we will assume that Vorbis is to be
+embedded in an Ogg stream specifically, although this is by no means a
+requirement or fundamental assumption in the Vorbis design.
+
+The specification for embedding Vorbis into
+an Ogg transport stream is in \xref{vorbis:over:ogg}.
+
+
+
+\subsubsection{Codec Setup and Probability Model}
+
+Vorbis' heritage is as a research CODEC and its current design
+reflects a desire to allow multiple decades of continuous encoder
+improvement before running out of room within the codec specification.
+For these reasons, configurable aspects of codec setup intentionally
+lean toward the extreme of forward adaptive.
+
+The single most controversial design decision in Vorbis (and the most
+unusual for a Vorbis developer to keep in mind) is that the entire
+probability model of the codec, the Huffman and VQ codebooks, is
+packed into the bitstream header along with extensive CODEC setup
+parameters (often several hundred fields).  This makes it impossible,
+as it would be with MPEG audio layers, to embed a simple frame type
+flag in each audio packet, or begin decode at any frame in the stream
+without having previously fetched the codec setup header.
+
+
+\begin{note}
+Vorbis \emph{can} initiate decode at any arbitrary packet within a
+bitstream so long as the codec has been initialized/setup with the
+setup headers.
+\end{note}
+
+Thus, Vorbis headers are both required for decode to begin and
+relatively large as bitstream headers go.  The header size is
+unbounded, although for streaming a rule-of-thumb of 4kB or less is
+recommended (and Xiph.Org's Vorbis encoder follows this suggestion).
+
+Our own design work indicates the primary liability of the
+required header is in mindshare; it is an unusual design and thus
+causes some amount of complaint among engineers as this runs against
+current design trends (and also points out limitations in some
+existing software/interface designs, such as Windows' ACM codec
+framework).  However, we find that it does not fundamentally limit
+Vorbis' suitable application space.
+
+
+\subsubsection{Format Specification}
+The Vorbis format is well-defined by its decode specification; any
+encoder that produces packets that are correctly decoded by the
+reference Vorbis decoder described below may be considered a proper
+Vorbis encoder.  A decoder must faithfully and completely implement
+the specification defined below (except where noted) to be considered
+a proper Vorbis decoder.
+
+\subsubsection{Hardware Profile}
+Although Vorbis decode is computationally simple, it may still run
+into specific limitations of an embedded design.  For this reason,
+embedded designs are allowed to deviate in limited ways from the
+`full' decode specification yet still be certified compliant.  These
+optional omissions are labelled in the spec where relevant.
+
+
+\subsection{Decoder Configuration}
+
+Decoder setup consists of configuration of multiple, self-contained
+component abstractions that perform specific functions in the decode
+pipeline.  Each different component instance of a specific type is
+semantically interchangeable; decoder configuration consists both of
+internal component configuration, as well as arrangement of specific
+instances into a decode pipeline.  Componentry arrangement is roughly
+as follows:
+
+\begin{center}
+\includegraphics[width=\textwidth]{components}
+\captionof{figure}{decoder pipeline configuration}
+\end{center}
+
+\subsubsection{Global Config}
+Global codec configuration consists of a few audio related fields
+(sample rate, channels), Vorbis version (always '0' in Vorbis I),
+bitrate hints, and the lists of component instances.  All other
+configuration is in the context of specific components.
+
+\subsubsection{Mode}
+
+Each Vorbis frame is coded according to a master 'mode'.  A bitstream
+may use one or many modes.
+
+The mode mechanism is used to encode a frame according to one of
+multiple possible methods with the intention of choosing a method best
+suited to that frame.  Different modes are, e.g. how frame size
+is changed from frame to frame. The mode number of a frame serves as a
+top level configuration switch for all other specific aspects of frame
+decode.
+
+A 'mode' configuration consists of a frame size setting, window type
+(always 0, the Vorbis window, in Vorbis I), transform type (always
+type 0, the MDCT, in Vorbis I) and a mapping number.  The mapping
+number specifies which mapping configuration instance to use for
+low-level packet decode and synthesis.
+
+
+\subsubsection{Mapping}
+
+A mapping contains a channel coupling description and a list of
+'submaps' that bundle sets of channel vectors together for grouped
+encoding and decoding. These submaps are not references to external
+components; the submap list is internal and specific to a mapping.
+
+A 'submap' is a configuration/grouping that applies to a subset of
+floor and residue vectors within a mapping.  The submap functions as a
+last layer of indirection such that specific special floor or residue
+settings can be applied not only to all the vectors in a given mode,
+but also specific vectors in a specific mode.  Each submap specifies
+the proper floor and residue instance number to use for decoding that
+submap's spectral floor and spectral residue vectors.
+
+As an example:
+
+Assume a Vorbis stream that contains six channels in the standard 5.1
+format.  The sixth channel, as is normal in 5.1, is bass only.
+Therefore it would be wasteful to encode a full-spectrum version of it
+as with the other channels.  The submapping mechanism can be used to
+apply a full range floor and residue encoding to channels 0 through 4,
+and a bass-only representation to the bass channel, thus saving space.
+In this example, channels 0-4 belong to submap 0 (which indicates use
+of a full-range floor) and channel 5 belongs to submap 1, which uses a
+bass-only representation.
+
+
+\subsubsection{Floor}
+
+Vorbis encodes a spectral 'floor' vector for each PCM channel.  This
+vector is a low-resolution representation of the audio spectrum for
+the given channel in the current frame, generally used akin to a
+whitening filter.  It is named a 'floor' because the Xiph.Org
+reference encoder has historically used it as a unit-baseline for
+spectral resolution.
+
+A floor encoding may be of two types.  Floor 0 uses a packed LSP
+representation on a dB amplitude scale and Bark frequency scale.
+Floor 1 represents the curve as a piecewise linear interpolated
+representation on a dB amplitude scale and linear frequency scale.
+The two floors are semantically interchangeable in
+encoding/decoding. However, floor type 1 provides more stable
+inter-frame behavior, and so is the preferred choice in all
+coupled-stereo and high bitrate modes.  Floor 1 is also considerably
+less expensive to decode than floor 0.
+
+Floor 0 is not to be considered deprecated, but it is of limited
+modern use.  No known Vorbis encoder past Xiph.org's own beta 4 makes
+use of floor 0.
+
+The values coded/decoded by a floor are both compactly formatted and
+make use of entropy coding to save space.  For this reason, a floor
+configuration generally refers to multiple codebooks in the codebook
+component list.  Entropy coding is thus provided as an abstraction,
+and each floor instance may choose from any and all available
+codebooks when coding/decoding.
+
+
+\subsubsection{Residue}
+The spectral residue is the fine structure of the audio spectrum
+once the floor curve has been subtracted out.  In simplest terms, it
+is coded in the bitstream using cascaded (multi-pass) vector
+quantization according to one of three specific packing/coding
+algorithms numbered 0 through 2.  The packing algorithm details are
+configured by residue instance.  As with the floor components, the
+final VQ/entropy encoding is provided by external codebook instances
+and each residue instance may choose from any and all available
+codebooks.
+
+\subsubsection{Codebooks}
+
+Codebooks are a self-contained abstraction that perform entropy
+decoding and, optionally, use the entropy-decoded integer value as an
+offset into an index of output value vectors, returning the indicated
+vector of values.
+
+The entropy coding in a Vorbis I codebook is provided by a standard
+Huffman binary tree representation.  This tree is tightly packed using
+one of several methods, depending on whether codeword lengths are
+ordered or unordered, or the tree is sparse.
+
+The codebook vector index is similarly packed according to index
+characteristic.  Most commonly, the vector index is encoded as a
+single list of values of possible values that are then permuted into
+a list of n-dimensional rows (lattice VQ).
+
+
+
+\subsection{High-level Decode Process}
+
+\subsubsection{Decode Setup}
+
+Before decoding can begin, a decoder must initialize using the
+bitstream headers matching the stream to be decoded.  Vorbis uses
+three header packets; all are required, in-order, by this
+specification. Once set up, decode may begin at any audio packet
+belonging to the Vorbis stream. In Vorbis I, all packets after the
+three initial headers are audio packets.
+
+The header packets are, in order, the identification
+header, the comments header, and the setup header.
+
+\paragraph{Identification Header}
+The identification header identifies the bitstream as Vorbis, Vorbis
+version, and the simple audio characteristics of the stream such as
+sample rate and number of channels.
+
+\paragraph{Comment Header}
+The comment header includes user text comments (``tags'') and a vendor
+string for the application/library that produced the bitstream.  The
+encoding and proper use of the comment header is described in \xref{vorbis:spec:comment}.
+
+\paragraph{Setup Header}
+The setup header includes extensive CODEC setup information as well as
+the complete VQ and Huffman codebooks needed for decode.
+
+
+\subsubsection{Decode Procedure}
+
+The decoding and synthesis procedure for all audio packets is
+fundamentally the same.
+\begin{enumerate}
+\item decode packet type flag
+\item decode mode number
+\item decode window shape (long windows only)
+\item decode floor
+\item decode residue into residue vectors
+\item inverse channel coupling of residue vectors
+\item generate floor curve from decoded floor data
+\item compute dot product of floor and residue, producing audio spectrum vector
+\item inverse monolithic transform of audio spectrum vector, always an MDCT in Vorbis I
+\item overlap/add left-hand output of transform with right-hand output of previous frame
+\item store right hand-data from transform of current frame for future lapping
+\item if not first frame, return results of overlap/add as audio result of current frame
+\end{enumerate}
+
+Note that clever rearrangement of the synthesis arithmetic is
+possible; as an example, one can take advantage of symmetries in the
+MDCT to store the right-hand transform data of a partial MDCT for a
+50\% inter-frame buffer space savings, and then complete the transform
+later before overlap/add with the next frame.  This optimization
+produces entirely equivalent output and is naturally perfectly legal.
+The decoder must be \emph{entirely mathematically equivalent} to the
+specification, it need not be a literal semantic implementation.
+
+\paragraph{Packet type decode}
+
+Vorbis I uses four packet types. The first three packet types mark each
+of the three Vorbis headers described above. The fourth packet type
+marks an audio packet. All other packet types are reserved; packets
+marked with a reserved type should be ignored.
+
+Following the three header packets, all packets in a Vorbis I stream
+are audio.  The first step of audio packet decode is to read and
+verify the packet type; \emph{a non-audio packet when audio is expected
+indicates stream corruption or a non-compliant stream. The decoder
+must ignore the packet and not attempt decoding it to
+audio}.
+
+
+
+
+\paragraph{Mode decode}
+Vorbis allows an encoder to set up multiple, numbered packet 'modes',
+as described earlier, all of which may be used in a given Vorbis
+stream. The mode is encoded as an integer used as a direct offset into
+the mode instance index.
+
+
+\paragraph{Window shape decode (long windows only)} \label{vorbis:spec:window}
+
+Vorbis frames may be one of two PCM sample sizes specified during
+codec setup.  In Vorbis I, legal frame sizes are powers of two from 64
+to 8192 samples.  Aside from coupling, Vorbis handles channels as
+independent vectors and these frame sizes are in samples per channel.
+
+Vorbis uses an overlapping transform, namely the MDCT, to blend one
+frame into the next, avoiding most inter-frame block boundary
+artifacts.  The MDCT output of one frame is windowed according to MDCT
+requirements, overlapped 50\% with the output of the previous frame and
+added.  The window shape assures seamless reconstruction.
+
+This is easy to visualize in the case of equal sized-windows:
+
+\begin{center}
+\includegraphics[width=\textwidth]{window1}
+\captionof{figure}{overlap of two equal-sized windows}
+\end{center}
+
+And slightly more complex in the case of overlapping unequal sized
+windows:
+
+\begin{center}
+\includegraphics[width=\textwidth]{window2}
+\captionof{figure}{overlap of a long and a short window}
+\end{center}
+
+In the unequal-sized window case, the window shape of the long window
+must be modified for seamless lapping as above.  It is possible to
+correctly infer window shape to be applied to the current window from
+knowing the sizes of the current, previous and next window.  It is
+legal for a decoder to use this method. However, in the case of a long
+window (short windows require no modification), Vorbis also codes two
+flag bits to specify pre- and post- window shape.  Although not
+strictly necessary for function, this minor redundancy allows a packet
+to be fully decoded to the point of lapping entirely independently of
+any other packet, allowing easier abstraction of decode layers as well
+as allowing a greater level of easy parallelism in encode and
+decode.
+
+A description of valid window functions for use with an inverse MDCT
+can be found in \cite{Sporer/Brandenburg/Edler}.  Vorbis windows
+all use the slope function
+\[ y = \sin(.5*\pi \, \sin^2((x+.5)/n*\pi)) . \]
+
+
+
+\paragraph{floor decode}
+Each floor is encoded/decoded in channel order, however each floor
+belongs to a 'submap' that specifies which floor configuration to
+use.  All floors are decoded before residue decode begins.
+
+
+\paragraph{residue decode}
+
+Although the number of residue vectors equals the number of channels,
+channel coupling may mean that the raw residue vectors extracted
+during decode do not map directly to specific channels.  When channel
+coupling is in use, some vectors will correspond to coupled magnitude
+or angle.  The coupling relationships are described in the codec setup
+and may differ from frame to frame, due to different mode numbers.
+
+Vorbis codes residue vectors in groups by submap; the coding is done
+in submap order from submap 0 through n-1.  This differs from floors
+which are coded using a configuration provided by submap number, but
+are coded individually in channel order.
+
+
+
+\paragraph{inverse channel coupling}
+
+A detailed discussion of stereo in the Vorbis codec can be found in
+the document \href{stereo.html}{Stereo Channel Coupling in the
+Vorbis CODEC}.  Vorbis is not limited to only stereo coupling, but
+the stereo document also gives a good overview of the generic coupling
+mechanism.
+
+Vorbis coupling applies to pairs of residue vectors at a time;
+decoupling is done in-place a pair at a time in the order and using
+the vectors specified in the current mapping configuration.  The
+decoupling operation is the same for all pairs, converting square
+polar representation (where one vector is magnitude and the second
+angle) back to Cartesian representation.
+
+After decoupling, in order, each pair of vectors on the coupling list,
+the resulting residue vectors represent the fine spectral detail
+of each output channel.
+
+
+
+\paragraph{generate floor curve}
+
+The decoder may choose to generate the floor curve at any appropriate
+time.  It is reasonable to generate the output curve when the floor
+data is decoded from the raw packet, or it can be generated after
+inverse coupling and applied to the spectral residue directly,
+combining generation and the dot product into one step and eliminating
+some working space.
+
+Both floor 0 and floor 1 generate a linear-range, linear-domain output
+vector to be multiplied (dot product) by the linear-range,
+linear-domain spectral residue.
+
+
+
+\paragraph{compute floor/residue dot product}
+
+This step is straightforward; for each output channel, the decoder
+multiplies the floor curve and residue vectors element by element,
+producing the finished audio spectrum of each channel.
+
+% TODO/FIXME: The following two paragraphs have identical twins
+%   in section 4 (under "dot product")
+One point is worth mentioning about this dot product; a common mistake
+in a fixed point implementation might be to assume that a 32 bit
+fixed-point representation for floor and residue and direct
+multiplication of the vectors is sufficient for acceptable spectral
+depth in all cases because it happens to mostly work with the current
+Xiph.Org reference encoder.
+
+However, floor vector values can span \~{}140dB (\~{}24 bits unsigned), and
+the audio spectrum vector should represent a minimum of 120dB (\~{}21
+bits with sign), even when output is to a 16 bit PCM device.  For the
+residue vector to represent full scale if the floor is nailed to
+$-140$dB, it must be able to span 0 to $+140$dB.  For the residue vector
+to reach full scale if the floor is nailed at 0dB, it must be able to
+represent $-140$dB to $+0$dB.  Thus, in order to handle full range
+dynamics, a residue vector may span $-140$dB to $+140$dB entirely within
+spec.  A 280dB range is approximately 48 bits with sign; thus the
+residue vector must be able to represent a 48 bit range and the dot
+product must be able to handle an effective 48 bit times 24 bit
+multiplication.  This range may be achieved using large (64 bit or
+larger) integers, or implementing a movable binary point
+representation.
+
+
+
+\paragraph{inverse monolithic transform (MDCT)}
+
+The audio spectrum is converted back into time domain PCM audio via an
+inverse Modified Discrete Cosine Transform (MDCT).  A detailed
+description of the MDCT is available in \cite{Sporer/Brandenburg/Edler}.
+
+Note that the PCM produced directly from the MDCT is not yet finished
+audio; it must be lapped with surrounding frames using an appropriate
+window (such as the Vorbis window) before the MDCT can be considered
+orthogonal.
+
+
+
+\paragraph{overlap/add data}
+Windowed MDCT output is overlapped and added with the right hand data
+of the previous window such that the 3/4 point of the previous window
+is aligned with the 1/4 point of the current window (as illustrated in
+the window overlap diagram). At this point, the audio data between the
+center of the previous frame and the center of the current frame is
+now finished and ready to be returned.
+
+
+\paragraph{cache right hand data}
+The decoder must cache the right hand portion of the current frame to
+be lapped with the left hand portion of the next frame.
+
+
+
+\paragraph{return finished audio data}
+
+The overlapped portion produced from overlapping the previous and
+current frame data is finished data to be returned by the decoder.
+This data spans from the center of the previous window to the center
+of the current window.  In the case of same-sized windows, the amount
+of data to return is one-half block consisting of and only of the
+overlapped portions. When overlapping a short and long window, much of
+the returned range is not actually overlap.  This does not damage
+transform orthogonality.  Pay attention however to returning the
+correct data range; the amount of data to be returned is:
+
+\begin{Verbatim}[commandchars=\\\{\}]
+window_blocksize(previous_window)/4+window_blocksize(current_window)/4
+\end{Verbatim}
+
+from the center of the previous window to the center of the current
+window.
+
+Data is not returned from the first frame; it must be used to 'prime'
+the decode engine.  The encoder accounts for this priming when
+calculating PCM offsets; after the first frame, the proper PCM output
+offset is '0' (as no data has been returned yet).

Added: trunk/vorbis/doc/02-bitpacking.tex
===================================================================
--- trunk/vorbis/doc/02-bitpacking.tex	                        (rev 0)
+++ trunk/vorbis/doc/02-bitpacking.tex	2009-03-06 18:54:13 UTC (rev 15748)
@@ -0,0 +1,247 @@
+% -*- mode: latex; TeX-master: "Vorbis_I_spec"; -*-
+%!TEX root = Vorbis_I_spec.tex
+% $Id$
+\section{Bitpacking Convention} \label{vorbis:spec:bitpacking}
+
+\subsection{Overview}
+
+The Vorbis codec uses relatively unstructured raw packets containing
+arbitrary-width binary integer fields.  Logically, these packets are a
+bitstream in which bits are coded one-by-one by the encoder and then
+read one-by-one in the same monotonically increasing order by the
+decoder.  Most current binary storage arrangements group bits into a
+native word size of eight bits (octets), sixteen bits, thirty-two bits
+or, less commonly other fixed word sizes.  The Vorbis bitpacking
+convention specifies the correct mapping of the logical packet
+bitstream into an actual representation in fixed-width words.
+
+
+\subsubsection{octets, bytes and words}
+
+In most contemporary architectures, a 'byte' is synonymous with an
+'octet', that is, eight bits.  This has not always been the case;
+seven, ten, eleven and sixteen bit 'bytes' have been used.  For
+purposes of the bitpacking convention, a byte implies the native,
+smallest integer storage representation offered by a platform.  On
+modern platforms, this is generally assumed to be eight bits (not
+necessarily because of the processor but because of the
+filesystem/memory architecture.  Modern filesystems invariably offer
+bytes as the fundamental atom of storage).  A 'word' is an integer
+size that is a grouped multiple of this smallest size.
+
+The most ubiquitous architectures today consider a 'byte' to be an
+octet (eight bits) and a word to be a group of two, four or eight
+bytes (16, 32 or 64 bits).  Note however that the Vorbis bitpacking
+convention is still well defined for any native byte size; Vorbis uses
+the native bit-width of a given storage system. This document assumes
+that a byte is one octet for purposes of example.
+
+\subsubsection{bit order}
+
+A byte has a well-defined 'least significant' bit (LSb), which is the
+only bit set when the byte is storing the two's complement integer
+value +1.  A byte's 'most significant' bit (MSb) is at the opposite
+end of the byte. Bits in a byte are numbered from zero at the LSb to
+$n$ ($n=7$ in an octet) for the
+MSb.
+
+
+
+\subsubsection{byte order}
+
+Words are native groupings of multiple bytes.  Several byte orderings
+are possible in a word; the common ones are 3-2-1-0 ('big endian' or
+'most significant byte first' in which the highest-valued byte comes
+first), 0-1-2-3 ('little endian' or 'least significant byte first' in
+which the lowest value byte comes first) and less commonly 3-1-2-0 and
+0-2-1-3 ('mixed endian').
+
+The Vorbis bitpacking convention specifies storage and bitstream
+manipulation at the byte, not word, level, thus host word ordering is
+of a concern only during optimization when writing high performance
+code that operates on a word of storage at a time rather than by byte.
+Logically, bytes are always coded and decoded in order from byte zero
+through byte $n$.
+
+
+
+\subsubsection{coding bits into byte sequences}
+
+The Vorbis codec has need to code arbitrary bit-width integers, from
+zero to 32 bits wide, into packets.  These integer fields are not
+aligned to the boundaries of the byte representation; the next field
+is written at the bit position at which the previous field ends.
+
+The encoder logically packs integers by writing the LSb of a binary
+integer to the logical bitstream first, followed by next least
+significant bit, etc, until the requested number of bits have been
+coded.  When packing the bits into bytes, the encoder begins by
+placing the LSb of the integer to be written into the least
+significant unused bit position of the destination byte, followed by
+the next-least significant bit of the source integer and so on up to
+the requested number of bits.  When all bits of the destination byte
+have been filled, encoding continues by zeroing all bits of the next
+byte and writing the next bit into the bit position 0 of that byte.
+Decoding follows the same process as encoding, but by reading bits
+from the byte stream and reassembling them into integers.
+
+
+
+\subsubsection{signedness}
+
+The signedness of a specific number resulting from decode is to be
+interpreted by the decoder given decode context.  That is, the three
+bit binary pattern 'b111' can be taken to represent either 'seven' as
+an unsigned integer, or '-1' as a signed, two's complement integer.
+The encoder and decoder are responsible for knowing if fields are to
+be treated as signed or unsigned.
+
+
+
+\subsubsection{coding example}
+
+Code the 4 bit integer value '12' [b1100] into an empty bytestream.
+Bytestream result:
+
+\begin{Verbatim}[commandchars=\\\{\}]
+              |
+              V
+
+        7 6 5 4 3 2 1 0
+byte 0 [0 0 0 0 1 1 0 0]  <-
+byte 1 [               ]
+byte 2 [               ]
+byte 3 [               ]
+             ...
+byte n [               ]  bytestream length == 1 byte
+
+\end{Verbatim}
+
+
+Continue by coding the 3 bit integer value '-1' [b111]:
+
+\begin{Verbatim}[commandchars=\\\{\}]
+        |
+        V
+
+        7 6 5 4 3 2 1 0
+byte 0 [0 1 1 1 1 1 0 0]  <-
+byte 1 [               ]
+byte 2 [               ]
+byte 3 [               ]
+             ...
+byte n [               ]  bytestream length == 1 byte
+\end{Verbatim}
+
+
+Continue by coding the 7 bit integer value '17' [b0010001]:
+
+\begin{Verbatim}[commandchars=\\\{\}]
+          |
+          V
+
+        7 6 5 4 3 2 1 0
+byte 0 [1 1 1 1 1 1 0 0]
+byte 1 [0 0 0 0 1 0 0 0]  <-
+byte 2 [               ]
+byte 3 [               ]
+             ...
+byte n [               ]  bytestream length == 2 bytes
+                          bit cursor == 6
+\end{Verbatim}
+
+
+Continue by coding the 13 bit integer value '6969' [b110 11001110 01]:
+
+\begin{Verbatim}[commandchars=\\\{\}]
+                |
+                V
+
+        7 6 5 4 3 2 1 0
+byte 0 [1 1 1 1 1 1 0 0]
+byte 1 [0 1 0 0 1 0 0 0]
+byte 2 [1 1 0 0 1 1 1 0]
+byte 3 [0 0 0 0 0 1 1 0]  <-
+             ...
+byte n [               ]  bytestream length == 4 bytes
+
+\end{Verbatim}
+
+
+
+
+\subsubsection{decoding example}
+
+Reading from the beginning of the bytestream encoded in the above example:
+
+\begin{Verbatim}[commandchars=\\\{\}]
+                      |
+                      V
+
+        7 6 5 4 3 2 1 0
+byte 0 [1 1 1 1 1 1 0 0]  <-
+byte 1 [0 1 0 0 1 0 0 0]
+byte 2 [1 1 0 0 1 1 1 0]
+byte 3 [0 0 0 0 0 1 1 0]  bytestream length == 4 bytes
+
+\end{Verbatim}
+
+
+We read two, two-bit integer fields, resulting in the returned numbers
+'b00' and 'b11'.  Two things are worth noting here:
+
+\begin{itemize}
+\item Although these four bits were originally written as a single
+four-bit integer, reading some other combination of bit-widths from the
+bitstream is well defined.  There are no artificial alignment
+boundaries maintained in the bitstream.
+
+\item The second value is the
+two-bit-wide integer 'b11'.  This value may be interpreted either as
+the unsigned value '3', or the signed value '-1'.  Signedness is
+dependent on decode context.
+\end{itemize}
+
+
+
+
+\subsubsection{end-of-packet alignment}
+
+The typical use of bitpacking is to produce many independent
+byte-aligned packets which are embedded into a larger byte-aligned
+container structure, such as an Ogg transport bitstream.  Externally,
+each bytestream (encoded bitstream) must begin and end on a byte
+boundary.  Often, the encoded bitstream is not an integer number of
+bytes, and so there is unused (uncoded) space in the last byte of a
+packet.
+
+Unused space in the last byte of a bytestream is always zeroed during
+the coding process.  Thus, should this unused space be read, it will
+return binary zeroes.
+
+Attempting to read past the end of an encoded packet results in an
+'end-of-packet' condition.  End-of-packet is not to be considered an
+error; it is merely a state indicating that there is insufficient
+remaining data to fulfill the desired read size.  Vorbis uses truncated
+packets as a normal mode of operation, and as such, decoders must
+handle reading past the end of a packet as a typical mode of
+operation. Any further read operations after an 'end-of-packet'
+condition shall also return 'end-of-packet'.
+
+
+
+\subsubsection{reading zero bits}
+
+Reading a zero-bit-wide integer returns the value '0' and does not
+increment the stream cursor.  Reading to the end of the packet (but
+not past, such that an 'end-of-packet' condition has not triggered)
+and then reading a zero bit integer shall succeed, returning 0, and
+not trigger an end-of-packet condition.  Reading a zero-bit-wide
+integer after a previous read sets 'end-of-packet' shall also fail
+with 'end-of-packet'.
+
+
+
+
+
+

Added: trunk/vorbis/doc/03-codebook.tex
===================================================================
--- trunk/vorbis/doc/03-codebook.tex	                        (rev 0)
+++ trunk/vorbis/doc/03-codebook.tex	2009-03-06 18:54:13 UTC (rev 15748)
@@ -0,0 +1,403 @@
+% -*- mode: latex; TeX-master: "Vorbis_I_spec"; -*-
+%!TEX root = Vorbis_I_spec.tex
+% $Id$
+\section{Probability Model and Codebooks} \label{vorbis:spec:codebook}
+
+\subsection{Overview}
+
+Unlike practically every other mainstream audio codec, Vorbis has no
+statically configured probability model, instead packing all entropy
+decoding configuration, VQ and Huffman, into the bitstream itself in
+the third header, the codec setup header.  This packed configuration
+consists of multiple 'codebooks', each containing a specific
+Huffman-equivalent representation for decoding compressed codewords as
+well as an optional lookup table of output vector values to which a
+decoded Huffman value is applied as an offset, generating the final
+decoded output corresponding to a given compressed codeword.
+
+\subsubsection{Bitwise operation}
+The codebook mechanism is built on top of the vorbis bitpacker. Both
+the codebooks themselves and the codewords they decode are unrolled
+from a packet as a series of arbitrary-width values read from the
+stream according to \xref{vorbis:spec:bitpacking}.
+
+
+
+
+\subsection{Packed codebook format}
+
+For purposes of the examples below, we assume that the storage
+system's native byte width is eight bits.  This is not universally
+true; see \xref{vorbis:spec:bitpacking} for discussion
+relating to non-eight-bit bytes.
+
+\subsubsection{codebook decode}
+
+A codebook begins with a 24 bit sync pattern, 0x564342:
+
+\begin{Verbatim}[commandchars=\\\{\}]
+byte 0: [ 0 1 0 0 0 0 1 0 ] (0x42)
+byte 1: [ 0 1 0 0 0 0 1 1 ] (0x43)
+byte 2: [ 0 1 0 1 0 1 1 0 ] (0x56)
+\end{Verbatim}
+
+16 bit \varname{[codebook_dimensions]} and 24 bit \varname{[codebook_entries]} fields:
+
+\begin{Verbatim}[commandchars=\\\{\}]
+
+byte 3: [ X X X X X X X X ]
+byte 4: [ X X X X X X X X ] [codebook_dimensions] (16 bit unsigned)
+
+byte 5: [ X X X X X X X X ]
+byte 6: [ X X X X X X X X ]
+byte 7: [ X X X X X X X X ] [codebook_entries] (24 bit unsigned)
+
+\end{Verbatim}
+
+Next is the \varname{[ordered]} bit flag:
+
+\begin{Verbatim}[commandchars=\\\{\}]
+
+byte 8: [               X ] [ordered] (1 bit)
+
+\end{Verbatim}
+
+Each entry, numbering a
+total of \varname{[codebook_entries]}, is assigned a codeword length.
+We now read the list of codeword lengths and store these lengths in
+the array \varname{[codebook_codeword_lengths]}. Decode of lengths is
+according to whether the \varname{[ordered]} flag is set or unset.
+
+\begin{itemize}
+\item
+  If the \varname{[ordered]} flag is unset, the codeword list is not
+  length ordered and the decoder needs to read each codeword length
+  one-by-one.
+
+  The decoder first reads one additional bit flag, the
+  \varname{[sparse]} flag.  This flag determines whether or not the
+  codebook contains unused entries that are not to be included in the
+  codeword decode tree:
+
+\begin{Verbatim}[commandchars=\\\{\}]
+byte 8: [             X 1 ] [sparse] flag (1 bit)
+\end{Verbatim}
+
+  The decoder now performs for each of the \varname{[codebook_entries]}
+  codebook entries:
+
+\begin{Verbatim}[commandchars=\\\{\}]
+
+  1) if([sparse] is set) \{
+
+         2) [flag] = read one bit;
+         3) if([flag] is set) \{
+
+              4) [length] = read a five bit unsigned integer;
+              5) codeword length for this entry is [length]+1;
+
+            \} else \{
+
+              6) this entry is unused.  mark it as such.
+
+            \}
+
+     \} else the sparse flag is not set \{
+
+        7) [length] = read a five bit unsigned integer;
+        8) the codeword length for this entry is [length]+1;
+
+     \}
+
+\end{Verbatim}
+
+\item
+  If the \varname{[ordered]} flag is set, the codeword list for this
+  codebook is encoded in ascending length order.  Rather than reading
+  a length for every codeword, the encoder reads the number of
+  codewords per length.  That is, beginning at entry zero:
+
+\begin{Verbatim}[commandchars=\\\{\}]
+  1) [current_entry] = 0;
+  2) [current_length] = read a five bit unsigned integer and add 1;
+  3) [number] = read \link{vorbis:spec:ilog}{ilog}([codebook_entries] - [current_entry]) bits as an unsigned integer
+  4) set the entries [current_entry] through [current_entry]+[number]-1, inclusive,
+    of the [codebook_codeword_lengths] array to [current_length]
+  5) set [current_entry] to [number] + [current_entry]
+  6) increment [current_length] by 1
+  7) if [current_entry] is greater than [codebook_entries] ERROR CONDITION;
+    the decoder will not be able to read this stream.
+  8) if [current_entry] is less than [codebook_entries], repeat process starting at 3)
+  9) done.
+\end{Verbatim}
+
+\end{itemize}
+
+After all codeword lengths have been decoded, the decoder reads the
+vector lookup table.  Vorbis I supports three lookup types:
+\begin{enumerate}
+\item
+No lookup
+\item
+Implicitly populated value mapping (lattice VQ)
+\item
+Explicitly populated value mapping (tessellated or 'foam'
+VQ)
+\end{enumerate}
+
+
+The lookup table type is read as a four bit unsigned integer:
+\begin{Verbatim}[commandchars=\\\{\}]
+  1) [codebook_lookup_type] = read four bits as an unsigned integer
+\end{Verbatim}
+
+Codebook decode precedes according to \varname{[codebook_lookup_type]}:
+\begin{itemize}
+\item
+Lookup type zero indicates no lookup to be read.  Proceed past
+lookup decode.
+\item
+Lookup types one and two are similar, differing only in the
+number of lookup values to be read.  Lookup type one reads a list of
+values that are permuted in a set pattern to build a list of vectors,
+each vector of order \varname{[codebook_dimensions]} scalars.  Lookup
+type two builds the same vector list, but reads each scalar for each
+vector explicitly, rather than building vectors from a smaller list of
+possible scalar values.  Lookup decode proceeds as follows:
+
+\begin{Verbatim}[commandchars=\\\{\}]
+  1) [codebook_minimum_value] = \link{vorbis:spec:float32:unpack}{float32_unpack}( read 32 bits as an unsigned integer)
+  2) [codebook_delta_value] = \link{vorbis:spec:float32:unpack}{float32_unpack}( read 32 bits as an unsigned integer)
+  3) [codebook_value_bits] = read 4 bits as an unsigned integer and add 1
+  4) [codebook_sequence_p] = read 1 bit as a boolean flag
+
+  if ( [codebook_lookup_type] is 1 ) \{
+
+     5) [codebook_lookup_values] = \link{vorbis:spec:lookup1:values}{lookup1_values}(\varname{[codebook_entries]}, \varname{[codebook_dimensions]} )
+
+  \} else \{
+
+     6) [codebook_lookup_values] = \varname{[codebook_entries]} * \varname{[codebook_dimensions]}
+
+  \}
+
+  7) read a total of [codebook_lookup_values] unsigned integers of [codebook_value_bits] each;
+     store these in order in the array [codebook_multiplicands]
+\end{Verbatim}
+\item
+A \varname{[codebook_lookup_type]} of greater than two is reserved
+and indicates a stream that is not decodable by the specification in this
+document.
+
+\end{itemize}
+
+
+An 'end of packet' during any read operation in the above steps is
+considered an error condition rendering the stream undecodable.
+
+\paragraph{Huffman decision tree representation}
+
+The \varname{[codebook_codeword_lengths]} array and
+\varname{[codebook_entries]} value uniquely define the Huffman decision
+tree used for entropy decoding.
+
+Briefly, each used codebook entry (recall that length-unordered
+codebooks support unused codeword entries) is assigned, in order, the
+lowest valued unused binary Huffman codeword possible.  Assume the
+following codeword length list:
+
+\begin{Verbatim}[commandchars=\\\{\}]
+entry 0: length 2
+entry 1: length 4
+entry 2: length 4
+entry 3: length 4
+entry 4: length 4
+entry 5: length 2
+entry 6: length 3
+entry 7: length 3
+\end{Verbatim}
+
+Assigning codewords in order (lowest possible value of the appropriate
+length to highest) results in the following codeword list:
+
+\begin{Verbatim}[commandchars=\\\{\}]
+entry 0: length 2 codeword 00
+entry 1: length 4 codeword 0100
+entry 2: length 4 codeword 0101
+entry 3: length 4 codeword 0110
+entry 4: length 4 codeword 0111
+entry 5: length 2 codeword 10
+entry 6: length 3 codeword 110
+entry 7: length 3 codeword 111
+\end{Verbatim}
+
+
+\begin{note}
+Unlike most binary numerical values in this document, we
+intend the above codewords to be read and used bit by bit from left to
+right, thus the codeword '001' is the bit string 'zero, zero, one'.
+When determining 'lowest possible value' in the assignment definition
+above, the leftmost bit is the MSb.
+\end{note}
+
+It is clear that the codeword length list represents a Huffman
+decision tree with the entry numbers equivalent to the leaves numbered
+left-to-right:
+
+\begin{center}
+\includegraphics[width=10cm]{hufftree}
+\captionof{figure}{huffman tree illustration}
+\end{center}
+
+
+As we assign codewords in order, we see that each choice constructs a
+new leaf in the leftmost possible position.
+
+Note that it's possible to underspecify or overspecify a Huffman tree
+via the length list.  In the above example, if codeword seven were
+eliminated, it's clear that the tree is unfinished:
+
+\begin{center}
+\includegraphics[width=10cm]{hufftree-under}
+\captionof{figure}{underspecified huffman tree illustration}
+\end{center}
+
+
+Similarly, in the original codebook, it's clear that the tree is fully
+populated and a ninth codeword is impossible.  Both underspecified and
+overspecified trees are an error condition rendering the stream
+undecodable.
+
+Codebook entries marked 'unused' are simply skipped in the assigning
+process.  They have no codeword and do not appear in the decision
+tree, thus it's impossible for any bit pattern read from the stream to
+decode to that entry number.
+
+
+
+\paragraph{VQ lookup table vector representation}
+
+Unpacking the VQ lookup table vectors relies on the following values:
+\begin{programlisting}
+the [codebook_multiplicands] array
+[codebook_minimum_value]
+[codebook_delta_value]
+[codebook_sequence_p]
+[codebook_lookup_type]
+[codebook_entries]
+[codebook_dimensions]
+[codebook_lookup_values]
+\end{programlisting}
+
+\bigskip
+
+Decoding (unpacking) a specific vector in the vector lookup table
+proceeds according to \varname{[codebook_lookup_type]}.  The unpacked
+vector values are what a codebook would return during audio packet
+decode in a VQ context.
+
+\paragraph{Vector value decode: Lookup type 1}
+
+Lookup type one specifies a lattice VQ lookup table built
+algorithmically from a list of scalar values.  Calculate (unpack) the
+final values of a codebook entry vector from the entries in
+\varname{[codebook_multiplicands]} as follows (\varname{[value_vector]}
+is the output vector representing the vector of values for entry number
+\varname{[lookup_offset]} in this codebook):
+
+\begin{Verbatim}[commandchars=\\\{\}]
+  1) [last] = 0;
+  2) [index_divisor] = 1;
+  3) iterate [i] over the range 0 ... [codebook_dimensions]-1 (once for each scalar value in the value vector) \{
+
+       4) [multiplicand_offset] = ( [lookup_offset] divided by [index_divisor] using integer
+          division ) integer modulo [codebook_lookup_values]
+
+       5) vector [value_vector] element [i] =
+            ( [codebook_multiplicands] array element number [multiplicand_offset] ) *
+            [codebook_delta_value] + [codebook_minimum_value] + [last];
+
+       6) if ( [codebook_sequence_p] is set ) then set [last] = vector [value_vector] element [i]
+
+       7) [index_divisor] = [index_divisor] * [codebook_lookup_values]
+
+     \}
+
+  8) vector calculation completed.
+\end{Verbatim}
+
+
+
+\paragraph{Vector value decode: Lookup type 2}
+
+Lookup type two specifies a VQ lookup table in which each scalar in
+each vector is explicitly set by the \varname{[codebook_multiplicands]}
+array in a one-to-one mapping.  Calculate [unpack] the
+final values of a codebook entry vector from the entries in
+\varname{[codebook_multiplicands]} as follows (\varname{[value_vector]}
+is the output vector representing the vector of values for entry number
+\varname{[lookup_offset]} in this codebook):
+
+\begin{Verbatim}[commandchars=\\\{\}]
+  1) [last] = 0;
+  2) [multiplicand_offset] = [lookup_offset] * [codebook_dimensions]
+  3) iterate [i] over the range 0 ... [codebook_dimensions]-1 (once for each scalar value in the value vector) \{
+
+       4) vector [value_vector] element [i] =
+            ( [codebook_multiplicands] array element number [multiplicand_offset] ) *
+            [codebook_delta_value] + [codebook_minimum_value] + [last];
+
+       5) if ( [codebook_sequence_p] is set ) then set [last] = vector [value_vector] element [i]
+
+       6) increment [multiplicand_offset]
+
+     \}
+
+  7) vector calculation completed.
+\end{Verbatim}
+
+
+
+
+
+
+
+
+
+\subsection{Use of the codebook abstraction}
+
+The decoder uses the codebook abstraction much as it does the
+bit-unpacking convention; a specific codebook reads a
+codeword from the bitstream, decoding it into an entry number, and then
+returns that entry number to the decoder (when used in a scalar
+entropy coding context), or uses that entry number as an offset into
+the VQ lookup table, returning a vector of values (when used in a context
+desiring a VQ value). Scalar or VQ context is always explicit; any call
+to the codebook mechanism requests either a scalar entry number or a
+lookup vector.
+
+Note that VQ lookup type zero indicates that there is no lookup table;
+requesting decode using a codebook of lookup type 0 in any context
+expecting a vector return value (even in a case where a vector of
+dimension one) is forbidden.  If decoder setup or decode requests such
+an action, that is an error condition rendering the packet
+undecodable.
+
+Using a codebook to read from the packet bitstream consists first of
+reading and decoding the next codeword in the bitstream. The decoder
+reads bits until the accumulated bits match a codeword in the
+codebook.  This process can be though of as logically walking the
+Huffman decode tree by reading one bit at a time from the bitstream,
+and using the bit as a decision boolean to take the 0 branch (left in
+the above examples) or the 1 branch (right in the above examples).
+Walking the tree finishes when the decode process hits a leaf in the
+decision tree; the result is the entry number corresponding to that
+leaf.  Reading past the end of a packet propagates the 'end-of-stream'
+condition to the decoder.
+
+When used in a scalar context, the resulting codeword entry is the
+desired return value.
+
+When used in a VQ context, the codeword entry number is used as an
+offset into the VQ lookup table.  The value returned to the decoder is
+the vector of scalars corresponding to this offset.

Added: trunk/vorbis/doc/04-codec.tex
===================================================================
--- trunk/vorbis/doc/04-codec.tex	                        (rev 0)
+++ trunk/vorbis/doc/04-codec.tex	2009-03-06 18:54:13 UTC (rev 15748)
@@ -0,0 +1,644 @@
+% -*- mode: latex; TeX-master: "Vorbis_I_spec"; -*-
+%!TEX root = Vorbis_I_spec.tex
+% $Id$
+\section{Codec Setup and Packet Decode} \label{vorbis:spec:codec}
+
+\subsection{Overview}
+
+This document serves as the top-level reference document for the
+bit-by-bit decode specification of Vorbis I.  This document assumes a
+high-level understanding of the Vorbis decode process, which is
+provided in \xref{vorbis:spec:intro}.  \xref{vorbis:spec:bitpacking} covers reading and writing bit fields from
+and to bitstream packets.
+
+
+
+\subsection{Header decode and decode setup}
+
+A Vorbis bitstream begins with three header packets. The header
+packets are, in order, the identification header, the comments header,
+and the setup header. All are required for decode compliance.  An
+end-of-packet condition during decoding the first or third header
+packet renders the stream undecodable.  End-of-packet decoding the
+comment header is a non-fatal error condition.
+
+\subsubsection{Common header decode}
+
+Each header packet begins with the same header fields.
+
+
+\begin{Verbatim}[commandchars=\\\{\}]
+  1) [packet_type] : 8 bit value
+  2) 0x76, 0x6f, 0x72, 0x62, 0x69, 0x73: the characters 'v','o','r','b','i','s' as six octets
+\end{Verbatim}
+
+Decode continues according to packet type; the identification header
+is type 1, the comment header type 3 and the setup header type 5
+(these types are all odd as a packet with a leading single bit of '0'
+is an audio packet).  The packets must occur in the order of
+identification, comment, setup.
+
+
+
+\subsubsection{Identification header}
+
+The identification header is a short header of only a few fields used
+to declare the stream definitively as Vorbis, and provide a few externally
+relevant pieces of information about the audio stream. The
+identification header is coded as follows:
+
+\begin{Verbatim}[commandchars=\\\{\}]
+ 1) [vorbis_version] = read 32 bits as unsigned integer
+ 2) [audio_channels] = read 8 bit integer as unsigned
+ 3) [audio_sample_rate] = read 32 bits as unsigned integer
+ 4) [bitrate_maximum] = read 32 bits as signed integer
+ 5) [bitrate_nominal] = read 32 bits as signed integer
+ 6) [bitrate_minimum] = read 32 bits as signed integer
+ 7) [blocksize_0] = 2 exponent (read 4 bits as unsigned integer)
+ 8) [blocksize_1] = 2 exponent (read 4 bits as unsigned integer)
+ 9) [framing_flag] = read one bit
+\end{Verbatim}
+
+\varname{[vorbis_version]} is to read '0' in order to be compatible
+with this document.  Both \varname{[audio_channels]} and
+\varname{[audio_sample_rate]} must read greater than zero.  Allowed final
+blocksize values are 64, 128, 256, 512, 1024, 2048, 4096 and 8192 in
+Vorbis I.  \varname{[blocksize_0]} must be less than or equal to
+\varname{[blocksize_1]}.  The framing bit must be nonzero.  Failure to
+meet any of these conditions renders a stream undecodable.
+
+The bitrate fields above are used only as hints. The nominal bitrate
+field especially may be considerably off in purely VBR streams.  The
+fields are meaningful only when greater than zero.
+
+\begin{itemize}
+  \item All three fields set to the same value implies a fixed rate, or tightly bounded, nearly fixed-rate bitstream
+  \item Only nominal set implies a VBR or ABR stream that averages the nominal bitrate
+  \item Maximum and or minimum set implies a VBR bitstream that obeys the bitrate limits
+  \item None set indicates the encoder does not care to speculate.
+\end{itemize}
+
+
+
+
+\subsubsection{Comment header}
+Comment header decode and data specification is covered in
+\xref{vorbis:spec:comment}.
+
+
+\subsubsection{Setup header}
+
+Vorbis codec setup is configurable to an extreme degree:
+
+\begin{center}
+\includegraphics[width=\textwidth]{components}
+\captionof{figure}{decoder pipeline configuration}
+\end{center}
+
+
+The setup header contains the bulk of the codec setup information
+needed for decode.  The setup header contains, in order, the lists of
+codebook configurations, time-domain transform configurations
+(placeholders in Vorbis I), floor configurations, residue
+configurations, channel mapping configurations and mode
+configurations. It finishes with a framing bit of '1'.  Header decode
+proceeds in the following order:
+
+\paragraph{Codebooks}
+
+\begin{enumerate}
+\item \varname{[vorbis_codebook_count]} = read eight bits as unsigned integer and add one
+\item Decode \varname{[vorbis_codebook_count]} codebooks in order as defined
+in \xref{vorbis:spec:codebook}.  Save each configuration, in
+order, in an array of
+codebook configurations \varname{[vorbis_codebook_configurations]}.
+\end{enumerate}
+
+
+
+\paragraph{Time domain transforms}
+
+These hooks are placeholders in Vorbis I.  Nevertheless, the
+configuration placeholder values must be read to maintain bitstream
+sync.
+
+\begin{enumerate}
+\item \varname{[vorbis_time_count]} = read 6 bits as unsigned integer and add one
+\item read \varname{[vorbis_time_count]} 16 bit values; each value should be zero.  If any value is nonzero, this is an error condition and the stream is undecodable.
+\end{enumerate}
+
+
+
+\paragraph{Floors}
+
+Vorbis uses two floor types; header decode is handed to the decode
+abstraction of the appropriate type.
+
+\begin{enumerate}
+ \item \varname{[vorbis_floor_count]} = read 6 bits as unsigned integer and add one
+ \item For each \varname{[i]} of \varname{[vorbis_floor_count]} floor numbers:
+  \begin{enumerate}
+   \item read the floor type: vector \varname{[vorbis_floor_types]} element \varname{[i]} =
+read 16 bits as unsigned integer
+   \item If the floor type is zero, decode the floor
+configuration as defined in \xref{vorbis:spec:floor0}; save
+this
+configuration in slot \varname{[i]} of the floor configuration array \varname{[vorbis_floor_configurations]}.
+   \item If the floor type is one,
+decode the floor configuration as defined in \xref{vorbis:spec:floor1}; save this configuration in slot \varname{[i]} of the floor configuration array \varname{[vorbis_floor_configurations]}.
+   \item If the the floor type is greater than one, this stream is undecodable; ERROR CONDITION
+  \end{enumerate}
+
+\end{enumerate}
+
+
+
+\paragraph{Residues}
+
+Vorbis uses three residue types; header decode of each type is identical.
+
+
+\begin{enumerate}
+\item \varname{[vorbis_residue_count]} = read 6 bits as unsigned integer and add one
+
+\item For each of \varname{[vorbis_residue_count]} residue numbers:
+ \begin{enumerate}
+  \item read the residue type; vector \varname{[vorbis_residue_types]} element \varname{[i]} = read 16 bits as unsigned integer
+  \item If the residue type is zero,
+one or two, decode the residue configuration as defined in \xref{vorbis:spec:residue}; save this configuration in slot \varname{[i]} of the residue configuration array \varname{[vorbis_residue_configurations]}.
+  \item If the the residue type is greater than two, this stream is undecodable; ERROR CONDITION
+ \end{enumerate}
+
+\end{enumerate}
+
+
+
+\paragraph{Mappings}
+
+Mappings are used to set up specific pipelines for encoding
+multichannel audio with varying channel mapping applications. Vorbis I
+uses a single mapping type (0), with implicit PCM channel mappings.
+
+% FIXME/TODO: LaTeX cannot nest enumerate that deeply, so I have to use
+% itemize at the innermost level. However, it would be much better to 
+% rewrite this pseudocode using listings or algoritmicx or some other
+% package geared towards this.
+\begin{enumerate}
+ \item \varname{[vorbis_mapping_count]} = read 6 bits as unsigned integer and add one
+ \item For each \varname{[i]} of \varname{[vorbis_mapping_count]} mapping numbers:
+  \begin{enumerate}
+   \item read the mapping type: 16 bits as unsigned integer.  There's no reason to save the mapping type in Vorbis I.
+   \item If the mapping type is nonzero, the stream is undecodable
+   \item If the mapping type is zero:
+    \begin{enumerate}
+     \item read 1 bit as a boolean flag
+      \begin{enumerate}
+       \item if set, \varname{[vorbis_mapping_submaps]} = read 4 bits as unsigned integer and add one
+       \item if unset, \varname{[vorbis_mapping_submaps]} = 1
+      \end{enumerate}
+
+
+     \item read 1 bit as a boolean flag
+       \begin{enumerate}
+         \item if set, square polar channel mapping is in use:
+           \begin{itemize}
+             \item \varname{[vorbis_mapping_coupling_steps]} = read 8 bits as unsigned integer and add one
+             \item for \varname{[j]} each of \varname{[vorbis_mapping_coupling_steps]} steps:
+               \begin{itemize}
+                 \item vector \varname{[vorbis_mapping_magnitude]} element \varname{[j]}= read \link{vorbis:spec:ilog}{ilog}(\varname{[audio_channels]} - 1) bits as unsigned integer
+                 \item vector \varname{[vorbis_mapping_angle]} element \varname{[j]}= read \link{vorbis:spec:ilog}{ilog}(\varname{[audio_channels]} - 1) bits as unsigned integer
+                 \item the numbers read in the above two steps are channel numbers representing the channel to treat as magnitude and the channel to treat as angle, respectively.  If for any coupling step the angle channel number equals the magnitude channel number, the magnitude channel number is greater than \varname{[audio_channels]}-1, or the angle channel is greater than \varname{[audio_channels]}-1, the stream is undecodable.
+               \end{itemize}
+
+
+           \end{itemize}
+
+
+         \item if unset, \varname{[vorbis_mapping_coupling_steps]} = 0
+       \end{enumerate}
+
+
+     \item read 2 bits (reserved field); if the value is nonzero, the stream is undecodable
+     \item if \varname{[vorbis_mapping_submaps]} is greater than one, we read channel multiplex settings. For each \varname{[j]} of \varname{[audio_channels]} channels:
+      \begin{enumerate}
+       \item vector \varname{[vorbis_mapping_mux]} element \varname{[j]} = read 4 bits as unsigned integer
+       \item if the value is greater than the highest numbered submap (\varname{[vorbis_mapping_submaps]} - 1), this in an error condition rendering the stream undecodable
+      \end{enumerate}
+
+     \item for each submap \varname{[j]} of \varname{[vorbis_mapping_submaps]} submaps, read the floor and residue numbers for use in decoding that submap:
+      \begin{enumerate}
+       \item read and discard 8 bits (the unused time configuration placeholder)
+       \item read 8 bits as unsigned integer for the floor number; save in vector \varname{[vorbis_mapping_submap_floor]} element \varname{[j]}
+       \item verify the floor number is not greater than the highest number floor configured for the bitstream. If it is, the bitstream is undecodable
+       \item read 8 bits as unsigned integer for the residue number; save in vector \varname{[vorbis_mapping_submap_residue]} element \varname{[j]}
+       \item verify the residue number is not greater than the highest number residue configured for the bitstream.  If it is, the bitstream is undecodable
+      \end{enumerate}
+
+     \item save this mapping configuration in slot \varname{[i]} of the mapping configuration array \varname{[vorbis_mapping_configurations]}.
+    \end{enumerate}
+
+  \end{enumerate}
+
+\end{enumerate}
+
+
+
+\paragraph{Modes}
+
+\begin{enumerate}
+ \item \varname{[vorbis_mode_count]} = read 6 bits as unsigned integer and add one
+ \item For each of \varname{[vorbis_mode_count]} mode numbers:
+  \begin{enumerate}
+  \item \varname{[vorbis_mode_blockflag]} = read 1 bit
+  \item \varname{[vorbis_mode_windowtype]} = read 16 bits as unsigned integer
+  \item \varname{[vorbis_mode_transformtype]} = read 16 bits as unsigned integer
+  \item \varname{[vorbis_mode_mapping]} = read 8 bits as unsigned integer
+  \item verify ranges; zero is the only legal value in Vorbis I for
+\varname{[vorbis_mode_windowtype]}
+and \varname{[vorbis_mode_transformtype]}.  \varname{[vorbis_mode_mapping]} must not be greater than the highest number mapping in use.  Any illegal values render the stream undecodable.
+  \item save this mode configuration in slot \varname{[i]} of the mode configuration array
+\varname{[vorbis_mode_configurations]}.
+ \end{enumerate}
+
+\item read 1 bit as a framing flag.  If unset, a framing error occurred and the stream is not
+decodable.
+\end{enumerate}
+
+After reading mode descriptions, setup header decode is complete.
+
+
+
+
+
+
+
+
+\subsection{Audio packet decode and synthesis}
+
+Following the three header packets, all packets in a Vorbis I stream
+are audio.  The first step of audio packet decode is to read and
+verify the packet type. \emph{A non-audio packet when audio is expected
+indicates stream corruption or a non-compliant stream. The decoder
+must ignore the packet and not attempt decoding it to audio}.
+
+
+\subsubsection{packet type, mode and window decode}
+
+\begin{enumerate}
+ \item read 1 bit \varname{[packet_type]}; check that packet type is 0 (audio)
+ \item read \link{vorbis:spec:ilog}{ilog}([vorbis_mode_count]-1) bits
+\varname{[mode_number]}
+ \item decode blocksize \varname{[n]} is equal to \varname{[blocksize_0]} if
+\varname{[vorbis_mode_blockflag]} is 0, else \varname{[n]} is equal to \varname{[blocksize_1]}.
+ \item perform window selection and setup; this window is used later by the inverse MDCT:
+  \begin{enumerate}
+   \item if this is a long window (the \varname{[vorbis_mode_blockflag]} flag of this mode is
+set):
+    \begin{enumerate}
+     \item read 1 bit for \varname{[previous_window_flag]}
+     \item read 1 bit for \varname{[next_window_flag]}
+     \item if \varname{[previous_window_flag]} is not set, the left half
+         of the window will be a hybrid window for lapping with a
+         short block.  See \xref{vorbis:spec:window} for an illustration of overlapping
+dissimilar
+         windows. Else, the left half window will have normal long
+         shape.
+     \item if \varname{[next_window_flag]} is not set, the right half of
+         the window will be a hybrid window for lapping with a short
+         block.  See \xref{vorbis:spec:window} for an
+illustration of overlapping dissimilar
+         windows. Else, the left right window will have normal long
+         shape.
+    \end{enumerate}
+
+   \item  if this is a short window, the window is always the same
+       short-window shape.
+  \end{enumerate}
+
+\end{enumerate}
+
+Vorbis windows all use the slope function $y=\sin(\frac{\pi}{2} * \sin^2((x+0.5)/n * \pi))$,
+where $n$ is window size and $x$ ranges $0 \ldots n-1$, but dissimilar
+lapping requirements can affect overall shape.  Window generation
+proceeds as follows:
+
+\begin{enumerate}
+ \item  \varname{[window_center]} = \varname{[n]} / 2
+ \item  if (\varname{[vorbis_mode_blockflag]} is set and \varname{[previous_window_flag]} is
+not set) then
+  \begin{enumerate}
+   \item \varname{[left_window_start]} = \varname{[n]}/4 -
+\varname{[blocksize_0]}/4
+   \item \varname{[left_window_end]} = \varname{[n]}/4 + \varname{[blocksize_0]}/4
+   \item \varname{[left_n]} = \varname{[blocksize_0]}/2
+  \end{enumerate}
+ else
+  \begin{enumerate}
+   \item \varname{[left_window_start]} = 0
+   \item \varname{[left_window_end]} = \varname{[window_center]}
+   \item \varname{[left_n]} = \varname{[n]}/2
+  \end{enumerate}
+
+ \item  if (\varname{[vorbis_mode_blockflag]} is set and \varname{[next_window_flag]} is not
+set) then
+  \begin{enumerate}
+   \item \varname{[right_window_start]} = \varname{[n]*3}/4 -
+\varname{[blocksize_0]}/4
+   \item \varname{[right_window_end]} = \varname{[n]*3}/4 +
+\varname{[blocksize_0]}/4
+   \item \varname{[right_n]} = \varname{[blocksize_0]}/2
+  \end{enumerate}
+ else
+  \begin{enumerate}
+   \item \varname{[right_window_start]} = \varname{[window_center]}
+   \item \varname{[right_window_end]} = \varname{[n]}
+   \item \varname{[right_n]} = \varname{[n]}/2
+  \end{enumerate}
+
+ \item  window from range 0 ... \varname{[left_window_start]}-1 inclusive is zero
+ \item  for \varname{[i]} in range \varname{[left_window_start]} ...
+\varname{[left_window_end]}-1, window(\varname{[i]}) = $\sin(\frac{\pi}{2} * \sin^2($ (\varname{[i]}-\varname{[left_window_start]}+0.5) / \varname{[left_n]} $* \frac{\pi}{2})$ )
+ \item  window from range \varname{[left_window_end]} ... \varname{[right_window_start]}-1
+inclusive is one\item  for \varname{[i]} in range \varname{[right_window_start]} ... \varname{[right_window_end]}-1, window(\varname{[i]}) = $\sin(\frac{\pi}{2} * \sin^2($ (\varname{[i]}-\varname{[right_window_start]}+0.5) / \varname{[right_n]} $ * \frac{\pi}{2} + \frac{\pi}{2})$ )
+\item  window from range \varname{[right_window_start]} ... \varname{[n]}-1 is
+zero
+\end{enumerate}
+
+An end-of-packet condition up to this point should be considered an
+error that discards this packet from the stream.  An end of packet
+condition past this point is to be considered a possible nominal
+occurrence.
+
+
+
+\subsubsection{floor curve decode}
+
+From this point on, we assume out decode context is using mode number
+\varname{[mode_number]} from configuration array
+\varname{[vorbis_mode_configurations]} and the map number
+\varname{[vorbis_mode_mapping]} (specified by the current mode) taken
+from the mapping configuration array
+\varname{[vorbis_mapping_configurations]}.
+
+Floor curves are decoded one-by-one in channel order.
+
+For each floor \varname{[i]} of \varname{[audio_channels]}
+ \begin{enumerate}
+  \item \varname{[submap_number]} = element \varname{[i]} of vector [vorbis_mapping_mux]
+  \item \varname{[floor_number]} = element \varname{[submap_number]} of vector
+[vorbis_submap_floor]
+  \item if the floor type of this
+floor (vector \varname{[vorbis_floor_types]} element
+\varname{[floor_number]}) is zero then decode the floor for
+channel \varname{[i]} according to the
+\xref{vorbis:spec:floor0-decode}
+  \item if the type of this floor
+is one then decode the floor for channel \varname{[i]} according
+to the \xref{vorbis:spec:floor1-decode}
+  \item save the needed decoded floor information for channel for later synthesis
+  \item if the decoded floor returned 'unused', set vector \varname{[no_residue]} element
+\varname{[i]} to true, else set vector \varname{[no_residue]} element \varname{[i]} to
+false
+ \end{enumerate}
+
+
+An end-of-packet condition during floor decode shall result in packet
+decode zeroing all channel output vectors and skipping to the
+add/overlap output stage.
+
+
+
+\subsubsection{nonzero vector propagate}
+
+A possible result of floor decode is that a specific vector is marked
+'unused' which indicates that that final output vector is all-zero
+values (and the floor is zero).  The residue for that vector is not
+coded in the stream, save for one complication.  If some vectors are
+used and some are not, channel coupling could result in mixing a
+zeroed and nonzeroed vector to produce two nonzeroed vectors.
+
+for each \varname{[i]} from 0 ... \varname{[vorbis_mapping_coupling_steps]}-1
+
+\begin{enumerate}
+ \item if either \varname{[no_residue]} entry for channel
+(\varname{[vorbis_mapping_magnitude]} element \varname{[i]})
+or channel
+(\varname{[vorbis_mapping_angle]} element \varname{[i]})
+are set to false, then both must be set to false.  Note that an 'unused'
+floor has no decoded floor information; it is important that this is
+remembered at floor curve synthesis time.
+\end{enumerate}
+
+
+
+
+\subsubsection{residue decode}
+
+Unlike floors, which are decoded in channel order, the residue vectors
+are decoded in submap order.
+
+for each submap \varname{[i]} in order from 0 ... \varname{[vorbis_mapping_submaps]}-1
+
+\begin{enumerate}
+ \item \varname{[ch]} = 0
+ \item for each channel \varname{[j]} in order from 0 ... \varname{[audio_channels]} - 1
+  \begin{enumerate}
+   \item if channel \varname{[j]} in submap \varname{[i]} (vector \varname{[vorbis_mapping_mux]} element \varname{[j]} is equal to \varname{[i]})
+    \begin{enumerate}
+     \item if vector \varname{[no_residue]} element \varname{[j]} is true
+      \begin{enumerate}
+       \item vector \varname{[do_not_decode_flag]} element \varname{[ch]} is set
+      \end{enumerate}
+     else
+      \begin{enumerate}
+       \item vector \varname{[do_not_decode_flag]} element \varname{[ch]} is unset
+      \end{enumerate}
+
+     \item increment \varname{[ch]}
+    \end{enumerate}
+
+  \end{enumerate}
+ \item \varname{[residue_number]} = vector \varname{[vorbis_mapping_submap_residue]} element \varname{[i]}
+ \item \varname{[residue_type]} = vector \varname{[vorbis_residue_types]} element \varname{[residue_number]}
+ \item decode \varname{[ch]} vectors using residue \varname{[residue_number]}, according to type \varname{[residue_type]}, also passing vector \varname{[do_not_decode_flag]} to indicate which vectors in the bundle should not be decoded. Correct per-vector decode length is \varname{[n]}/2.
+ \item \varname{[ch]} = 0
+ \item for each channel \varname{[j]} in order from 0 ... \varname{[audio_channels]}
+  \begin{enumerate}
+   \item if channel \varname{[j]} is in submap \varname{[i]} (vector \varname{[vorbis_mapping_mux]} element \varname{[j]} is equal to \varname{[i]})
+    \begin{enumerate}
+     \item residue vector for channel \varname{[j]} is set to decoded residue vector \varname{[ch]}
+     \item increment \varname{[ch]}
+    \end{enumerate}
+
+  \end{enumerate}
+
+\end{enumerate}
+
+
+
+\subsubsection{inverse coupling}
+
+for each \varname{[i]} from \varname{[vorbis_mapping_coupling_steps]}-1 descending to 0
+
+\begin{enumerate}
+ \item \varname{[magnitude_vector]} = the residue vector for channel
+(vector \varname{[vorbis_mapping_magnitude]} element \varname{[i]})
+ \item \varname{[angle_vector]} = the residue vector for channel (vector
+\varname{[vorbis_mapping_angle]} element \varname{[i]})
+ \item for each scalar value \varname{[M]} in vector \varname{[magnitude_vector]} and the corresponding scalar value \varname{[A]} in vector \varname{[angle_vector]}:
+  \begin{enumerate}
+   \item if (\varname{[M]} is greater than zero)
+    \begin{enumerate}
+     \item if (\varname{[A]} is greater than zero)
+      \begin{enumerate}
+       \item \varname{[new_M]} = \varname{[M]}
+       \item \varname{[new_A]} = \varname{[M]}-\varname{[A]}
+      \end{enumerate}
+     else
+      \begin{enumerate}
+       \item \varname{[new_A]} = \varname{[M]}
+       \item \varname{[new_M]} = \varname{[M]}+\varname{[A]}
+      \end{enumerate}
+
+    \end{enumerate}
+   else
+    \begin{enumerate}
+     \item if (\varname{[A]} is greater than zero)
+      \begin{enumerate}
+       \item \varname{[new_M]} = \varname{[M]}
+       \item \varname{[new_A]} = \varname{[M]}+\varname{[A]}
+      \end{enumerate}
+     else
+      \begin{enumerate}
+       \item \varname{[new_A]} = \varname{[M]}
+       \item \varname{[new_M]} = \varname{[M]}-\varname{[A]}
+      \end{enumerate}
+
+    \end{enumerate}
+
+   \item set scalar value \varname{[M]} in vector \varname{[magnitude_vector]} to \varname{[new_M]}
+   \item set scalar value \varname{[A]} in vector \varname{[angle_vector]} to \varname{[new_A]}
+  \end{enumerate}
+
+\end{enumerate}
+
+
+
+
+\subsubsection{dot product}
+
+For each channel, synthesize the floor curve from the decoded floor
+information, according to packet type. Note that the vector synthesis
+length for floor computation is \varname{[n]}/2.
+
+For each channel, multiply each element of the floor curve by each
+element of that channel's residue vector.  The result is the dot
+product of the floor and residue vectors for each channel; the produced
+vectors are the length \varname{[n]}/2 audio spectrum for each
+channel.
+
+% TODO/FIXME: The following two paragraphs have identical twins
+%   in section 1 (under "compute floor/residue dot product")
+One point is worth mentioning about this dot product; a common mistake
+in a fixed point implementation might be to assume that a 32 bit
+fixed-point representation for floor and residue and direct
+multiplication of the vectors is sufficient for acceptable spectral
+depth in all cases because it happens to mostly work with the current
+Xiph.Org reference encoder.
+
+However, floor vector values can span \~140dB (\~24 bits unsigned), and
+the audio spectrum vector should represent a minimum of 120dB (\~21
+bits with sign), even when output is to a 16 bit PCM device.  For the
+residue vector to represent full scale if the floor is nailed to
+$-140$dB, it must be able to span 0 to $+140$dB.  For the residue vector
+to reach full scale if the floor is nailed at 0dB, it must be able to
+represent $-140$dB to $+0$dB.  Thus, in order to handle full range
+dynamics, a residue vector may span $-140$dB to $+140$dB entirely within
+spec.  A 280dB range is approximately 48 bits with sign; thus the
+residue vector must be able to represent a 48 bit range and the dot
+product must be able to handle an effective 48 bit times 24 bit
+multiplication.  This range may be achieved using large (64 bit or
+larger) integers, or implementing a movable binary point
+representation.
+
+
+
+\subsubsection{inverse MDCT}
+
+Convert the audio spectrum vector of each channel back into time
+domain PCM audio via an inverse Modified Discrete Cosine Transform
+(MDCT).  A detailed description of the MDCT is available in \cite{Sporer/Brandenburg/Edler}.  The window
+function used for the MDCT is the function described earlier.
+
+
+
+\subsubsection{overlap_add}
+
+Windowed MDCT output is overlapped and added with the right hand data
+of the previous window such that the 3/4 point of the previous window
+is aligned with the 1/4 point of the current window (as illustrated in
+\xref{vorbis:spec:window}).  The overlapped portion
+produced from overlapping the previous and current frame data is
+finished data to be returned by the decoder.  This data spans from the
+center of the previous window to the center of the current window.  In
+the case of same-sized windows, the amount of data to return is
+one-half block consisting of and only of the overlapped portions. When
+overlapping a short and long window, much of the returned range does not
+actually overlap.  This does not damage transform orthogonality.  Pay
+attention however to returning the correct data range; the amount of
+data to be returned is:
+
+\begin{programlisting}
+window_blocksize(previous_window)/4+window_blocksize(current_window)/4
+\end{programlisting}
+
+from the center (element windowsize/2) of the previous window to the
+center (element windowsize/2-1, inclusive) of the current window.
+
+Data is not returned from the first frame; it must be used to 'prime'
+the decode engine.  The encoder accounts for this priming when
+calculating PCM offsets; after the first frame, the proper PCM output
+offset is '0' (as no data has been returned yet).
+
+
+
+\subsubsection{output channel order}
+
+Vorbis I specifies only a channel mapping type 0.  In mapping type 0,
+channel mapping is implicitly defined as follows for standard audio
+applications:
+
+\begin{description} %[style=nextline]
+ \item[three channels]
+	the stream is monophonic
+
+\item[two channels]
+	the stream is stereo.  channel order: left, right
+
+\item[three channels]
+	the stream is a 1d-surround encoding.  channel order: left,
+center, right
+
+\item[four channels]
+	the stream is quadraphonic surround.  channel order: front left,
+front right, rear left, rear right
+
+\item[five channels]
+	the stream is five-channel surround.  channel order: front left,
+front center, front right, rear left, rear right
+
+\item[six channels]
+	the stream is 5.1 surround.  channel order: front left, front
+center, front right, rear left, rear right, LFE
+
+\item[greater than six channels]
+	channel use and order is defined by the application
+
+\end{description}
+
+Applications using Vorbis for dedicated purposes may define channel
+mapping as seen fit.  Future channel mappings (such as three and four
+channel \href{http://www.ambisonic.net/}{Ambisonics}) will
+make use of channel mappings other than mapping 0.
+
+

Added: trunk/vorbis/doc/05-comment.tex
===================================================================
--- trunk/vorbis/doc/05-comment.tex	                        (rev 0)
+++ trunk/vorbis/doc/05-comment.tex	2009-03-06 18:54:13 UTC (rev 15748)
@@ -0,0 +1,240 @@
+% -*- mode: latex; TeX-master: "Vorbis_I_spec"; -*-
+%!TEX root = Vorbis_I_spec.tex
+% $Id$
+\section{comment field and header specification} \label{vorbis:spec:comment}
+
+\subsection{Overview}
+
+The Vorbis text comment header is the second (of three) header
+packets that begin a Vorbis bitstream. It is meant for short text
+comments, not arbitrary metadata; arbitrary metadata belongs in a
+separate logical bitstream (usually an XML stream type) that provides
+greater structure and machine parseability.
+
+The comment field is meant to be used much like someone jotting a
+quick note on the bottom of a CDR. It should be a little information to
+remember the disc by and explain it to others; a short, to-the-point
+text note that need not only be a couple words, but isn't going to be
+more than a short paragraph.  The essentials, in other words, whatever
+they turn out to be, eg:
+
+\begin{quote}
+Honest Bob and the Factory-to-Dealer-Incentives, \textit{``I'm Still
+Around''}, opening for Moxy Fr\"{u}vous, 1997.
+\end{quote}
+
+
+
+
+\subsection{Comment encoding}
+
+\subsubsection{Structure}
+
+The comment header is logically a list of eight-bit-clean vectors; the
+number of vectors is bounded to $2^{32}-1$ and the length of each vector
+is limited to $2^{32}-1$ bytes. The vector length is encoded; the vector
+contents themselves are not null terminated. In addition to the vector
+list, there is a single vector for vendor name (also 8 bit clean,
+length encoded in 32 bits). For example, the 1.0 release of libvorbis
+set the vendor string to ``Xiph.Org libVorbis I 20020717''.
+
+The vector lengths and number of vectors are stored lsb first, according
+to the bit packing conventions of the vorbis codec. However, since data
+in the comment header is octet-aligned, they can simply be read as
+unaligned 32 bit little endian unsigned integers.
+
+The comment header is decoded as follows:
+
+\begin{programlisting}
+  1) [vendor_length] = read an unsigned integer of 32 bits
+  2) [vendor_string] = read a UTF-8 vector as [vendor_length] octets
+  3) [user_comment_list_length] = read an unsigned integer of 32 bits
+  4) iterate [user_comment_list_length] times {
+       5) [length] = read an unsigned integer of 32 bits
+       6) this iteration's user comment = read a UTF-8 vector as [length] octets
+     }
+  7) [framing_bit] = read a single bit as boolean
+  8) if ( [framing_bit] unset or end-of-packet ) then ERROR
+  9) done.
+\end{programlisting}
+
+
+
+
+\subsubsection{Content vector format}
+
+The comment vectors are structured similarly to a UNIX environment variable.
+That is, comment fields consist of a field name and a corresponding value and
+look like:
+
+\begin{quote}
+\begin{programlisting}
+comment[0]="ARTIST=me";
+comment[1]="TITLE=the sound of Vorbis";
+\end{programlisting}
+\end{quote}
+
+The field name is case-insensitive and may consist of ASCII 0x20
+through 0x7D, 0x3D ('=') excluded. ASCII 0x41 through 0x5A inclusive
+(characters A-Z) is to be considered equivalent to ASCII 0x61 through
+0x7A inclusive (characters a-z).
+
+
+The field name is immediately followed by ASCII 0x3D ('=');
+this equals sign is used to terminate the field name.
+
+
+0x3D is followed by 8 bit clean UTF-8 encoded value of the
+field contents to the end of the field.
+
+
+\paragraph{Field names}
+
+Below is a proposed, minimal list of standard field names with a
+description of intended use.  No single or group of field names is
+mandatory; a comment header may contain one, all or none of the names
+in this list.
+
+\begin{description} %[style=nextline]
+\item[TITLE]
+	Track/Work name
+
+\item[VERSION]
+	The version field may be used to differentiate multiple
+versions of the same track title in a single collection. (e.g. remix
+info)
+
+\item[ALBUM]
+	The collection name to which this track belongs
+
+\item[TRACKNUMBER]
+	The track number of this piece if part of a specific larger collection or album
+
+\item[ARTIST]
+	The artist generally considered responsible for the work. In popular music this is usually the performing band or singer. For classical music it would be the composer. For an audio book it would be the author of the original text.
+
+\item[PERFORMER]
+	The artist(s) who performed the work. In classical music this would be the conductor, orchestra, soloists. In an audio book it would be the actor who did the reading. In popular music this is typically the same as the ARTIST and is omitted.
+
+\item[COPYRIGHT]
+	Copyright attribution, e.g., '2001 Nobody's Band' or '1999 Jack Moffitt'
+
+\item[LICENSE]
+	License information, eg, 'All Rights Reserved', 'Any
+Use Permitted', a URL to a license such as a Creative Commons license
+("www.creativecommons.org/blahblah/license.html") or the EFF Open
+Audio License ('distributed under the terms of the Open Audio
+License. see http://www.eff.org/IP/Open_licenses/eff_oal.html for
+details'), etc.
+
+\item[ORGANIZATION]
+	Name of the organization producing the track (i.e.
+the 'record label')
+
+\item[DESCRIPTION]
+	A short text description of the contents
+
+\item[GENRE]
+	A short text indication of music genre
+
+\item[DATE]
+	Date the track was recorded
+
+\item[LOCATION]
+	Location where track was recorded
+
+\item[CONTACT]
+	Contact information for the creators or distributors of the track. This could be a URL, an email address, the physical address of the producing label.
+
+\item[ISRC]
+	International Standard Recording Code for the
+track; see \href{http://www.ifpi.org/isrc/}{the ISRC
+intro page} for more information on ISRC numbers.
+
+\end{description}
+
+
+
+\paragraph{Implications}
+
+Field names should not be 'internationalized'; this is a
+concession to simplicity not an attempt to exclude the majority of
+the world that doesn't speak English. Field \emph{contents},
+however, use the UTF-8 character encoding to allow easy representation
+of any language.
+
+We have the length of the entirety of the field and restrictions on
+the field name so that the field name is bounded in a known way. Thus
+we also have the length of the field contents.
+
+Individual 'vendors' may use non-standard field names within
+reason. The proper use of comment fields should be clear through
+context at this point.  Abuse will be discouraged.
+
+There is no vendor-specific prefix to 'nonstandard' field names.
+Vendors should make some effort to avoid arbitrarily polluting the
+common namespace. We will generally collect the more useful tags
+here to help with standardization.
+
+Field names are not required to be unique (occur once) within a
+comment header.  As an example, assume a track was recorded by three
+well know artists; the following is permissible, and encouraged:
+
+\begin{quote}
+\begin{programlisting}
+ARTIST=Dizzy Gillespie
+ARTIST=Sonny Rollins
+ARTIST=Sonny Stitt
+\end{programlisting}
+\end{quote}
+
+
+
+
+
+
+
+\subsubsection{Encoding}
+
+The comment header comprises the entirety of the second bitstream
+header packet.  Unlike the first bitstream header packet, it is not
+generally the only packet on the second page and may not be restricted
+to within the second bitstream page.  The length of the comment header
+packet is (practically) unbounded.  The comment header packet is not
+optional; it must be present in the bitstream even if it is
+effectively empty.
+
+The comment header is encoded as follows (as per Ogg's standard
+bitstream mapping which renders least-significant-bit of the word to be
+coded into the least significant available bit of the current
+bitstream octet first):
+
+\begin{enumerate}
+ \item
+  Vendor string length (32 bit unsigned quantity specifying number of octets)
+
+ \item
+  Vendor string ([vendor string length] octets coded from beginning of string to end of string, not null terminated)
+
+ \item
+  Number of comment fields (32 bit unsigned quantity specifying number of fields)
+
+ \item
+  Comment field 0 length (if [Number of comment fields] $>0$; 32 bit unsigned quantity specifying number of octets)
+
+ \item
+  Comment field 0 ([Comment field 0 length] octets coded from beginning of string to end of string, not null terminated)
+
+ \item
+  Comment field 1 length (if [Number of comment fields] $>1$...)...
+
+\end{enumerate}
+
+
+This is actually somewhat easier to describe in code; implementation of the above can be found in \filename{vorbis/lib/info.c}, \function{_vorbis_pack_comment()} and \function{_vorbis_unpack_comment()}.
+
+
+
+
+
+

Added: trunk/vorbis/doc/06-floor0.tex
===================================================================
--- trunk/vorbis/doc/06-floor0.tex	                        (rev 0)
+++ trunk/vorbis/doc/06-floor0.tex	2009-03-06 18:54:13 UTC (rev 15748)
@@ -0,0 +1,206 @@
+% -*- mode: latex; TeX-master: "Vorbis_I_spec"; -*-
+%!TEX root = Vorbis_I_spec.tex
+% $Id$
+\section{Floor type 0 setup and decode} \label{vorbis:spec:floor0}
+
+\subsection{Overview}
+
+Vorbis floor type zero uses Line Spectral Pair (LSP, also alternately
+known as Line Spectral Frequency or LSF) representation to encode a
+smooth spectral envelope curve as the frequency response of the LSP
+filter.  This representation is equivalent to a traditional all-pole
+infinite impulse response filter as would be used in linear predictive
+coding; LSP representation may be converted to LPC representation and
+vice-versa.
+
+
+
+\subsection{Floor 0 format}
+
+Floor zero configuration consists of six integer fields and a list of
+VQ codebooks for use in coding/decoding the LSP filter coefficient
+values used by each frame.
+
+\subsubsection{header decode}
+
+Configuration information for instances of floor zero decodes from the
+codec setup header (third packet).  configuration decode proceeds as
+follows:
+
+\begin{Verbatim}[commandchars=\\\{\}]
+  1) [floor0_order] = read an unsigned integer of 8 bits
+  2) [floor0_rate] = read an unsigned integer of 16 bits
+  3) [floor0_bark_map_size] = read an unsigned integer of 16 bits
+  4) [floor0_amplitude_bits] = read an unsigned integer of six bits
+  5) [floor0_amplitude_offset] = read an unsigned integer of eight bits
+  6) [floor0_number_of_books] = read an unsigned integer of four bits and add 1
+  7) array [floor0_book_list] = read a list of [floor0_number_of_books] unsigned integers of eight bits each;
+\end{Verbatim}
+
+An end-of-packet condition during any of these bitstream reads renders
+this stream undecodable.  In addition, any element of the array
+\varname{[floor0_book_list]} that is greater than the maximum codebook
+number for this bitstream is an error condition that also renders the
+stream undecodable.
+
+
+
+\subsubsection{packet decode} \label{vorbis:spec:floor0-decode}
+
+Extracting a floor0 curve from an audio packet consists of first
+decoding the curve amplitude and \varname{[floor0_order]} LSP
+coefficient values from the bitstream, and then computing the floor
+curve, which is defined as the frequency response of the decoded LSP
+filter.
+
+Packet decode proceeds as follows:
+\begin{Verbatim}[commandchars=\\\{\}]
+  1) [amplitude] = read an unsigned integer of [floor0_amplitude_bits] bits
+  2) if ( [amplitude] is greater than zero ) \{
+       3) [coefficients] is an empty, zero length vector
+       4) [booknumber] = read an unsigned integer of \link{vorbis:spec:ilog}{ilog}( [floor0_number_of_books] ) bits
+       5) if ( [booknumber] is greater than the highest number decode codebook ) then packet is undecodable
+       6) [last] = zero;
+       7) vector [temp_vector] = read vector from bitstream using codebook number [floor0_book_list] element [booknumber] in VQ context.
+       8) add the scalar value [last] to each scalar in vector [temp_vector]
+       9) [last] = the value of the last scalar in vector [temp_vector]
+      10) concatenate [temp_vector] onto the end of the [coefficients] vector
+      11) if (length of vector [coefficients] is less than [floor0_order], continue at step 6
+
+     \}
+
+ 12) done.
+
+\end{Verbatim}
+
+Take note of the following properties of decode:
+\begin{itemize}
+ \item An \varname{[amplitude]} value of zero must result in a return code that indicates this channel is unused in this frame (the output of the channel will be all-zeroes in synthesis).  Several later stages of decode don't occur for an unused channel.
+ \item An end-of-packet condition during decode should be considered a
+nominal occruence; if end-of-packet is reached during any read
+operation above, floor decode is to return 'unused' status as if the
+\varname{[amplitude]} value had read zero at the beginning of decode.
+
+ \item The book number used for decode
+can, in fact, be stored in the bitstream in \link{vorbis:spec:ilog}{ilog}( \varname{[floor0_number_of_books]} -
+1 ) bits.  Nevertheless, the above specification is correct and values
+greater than the maximum possible book value are reserved.
+
+ \item The number of scalars read into the vector \varname{[coefficients]}
+may be greater than \varname{[floor0_order]}, the number actually
+required for curve computation.  For example, if the VQ codebook used
+for the floor currently being decoded has a
+\varname{[codebook_dimensions]} value of three and
+\varname{[floor0_order]} is ten, the only way to fill all the needed
+scalars in \varname{[coefficients]} is to to read a total of twelve
+scalars as four vectors of three scalars each.  This is not an error
+condition, and care must be taken not to allow a buffer overflow in
+decode. The extra values are not used and may be ignored or discarded.
+\end{itemize}
+
+
+
+
+\subsubsection{curve computation} \label{vorbis:spec:floor0-synth}
+
+Given an \varname{[amplitude]} integer and \varname{[coefficients]}
+vector from packet decode as well as the [floor0_order],
+[floor0_rate], [floor0_bark_map_size], [floor0_amplitude_bits] and
+[floor0_amplitude_offset] values from floor setup, and an output
+vector size \varname{[n]} specified by the decode process, we compute a
+floor output vector.
+
+If the value \varname{[amplitude]} is zero, the return value is a
+length \varname{[n]} vector with all-zero scalars.  Otherwise, begin by
+assuming the following definitions for the given vector to be
+synthesized:
+
+   \begin{displaymath}
+     \mathrm{map}_i = \left\{
+       \begin{array}{ll}
+          \min (
+            \mathtt{floor0\_bark\_map\_size} - 1,
+            foobar
+          ) & \textrm{for } i \in [0,n-1] \\
+          -1 & \textrm{for } i = n
+        \end{array}
+      \right.
+    \end{displaymath}
+
+    where
+
+    \begin{displaymath}
+    foobar =
+      \left\lfloor
+        \mathrm{bark}\left(\frac{\mathtt{floor0\_rate} \cdot i}{2n}\right) \cdot \frac{\mathtt{floor0\_bark\_map\_size}} {\mathrm{bark}(.5 \cdot \mathtt{floor0\_rate})}
+      \right\rfloor
+    \end{displaymath}
+
+    and
+
+    \begin{displaymath}
+      \mathrm{bark}(x) = 13.1 \arctan (.00074x) + 2.24 \arctan (.0000000185x^2 + .0001x)
+    \end{displaymath}
+
+The above is used to synthesize the LSP curve on a Bark-scale frequency
+axis, then map the result to a linear-scale frequency axis.
+Similarly, the below calculation synthesizes the output LSP curve \varname{[output]} on a log
+(dB) amplitude scale, mapping it to linear amplitude in the last step:
+
+\begin{enumerate}
+ \item  \varname{[i]} = 0
+ \item  \varname{[$\omega$]} = $\pi$ * map element \varname{[i]} / \varname{[floor0_bark_map_size]}
+ \item if ( \varname{[floor0_order]} is odd ) {
+  \begin{enumerate}
+   \item calculate \varname{[p]} and \varname{[q]} according to:
+\TODO{the following is generated from the TeX code embedded into the DocBook files:}
+           \begin{eqnarray*}
+             p & = & (1 - \cos^2\omega)\prod_{j=0}^{(\mathtt{order}-3)/2} 4 (\cos c_{2j+1} - \cos \omega)^2 \\
+             q & = & \frac{1}{4} \prod_{j=0}^{(\mathtt{order}-1)/2} 4 (\cos c_{2j+1} - \cos \omega)^2
+           \end{eqnarray*}
+
+\TODO{the following is what oddlsp.png contains:}
+           \begin{eqnarray*}
+             p & = & (1 - \cos^2\omega)\prod_{j=0}^{\frac{\mathtt{floor0\_order}-3}{2}} 4 (\cos([\mathtt{coefficients}]_{2j+1}) - \cos \omega)^2 \\
+             q & = & \frac{1}{4} \prod_{j=0}^{\frac{\mathtt{floor0\_order}-1}{2}} 4 (\cos([\mathtt{coefficients}]_{2j}) - \cos \omega)^2
+           \end{eqnarray*}
+
+  \end{enumerate}
+  } else \varname{[floor0_order]} is even {
+  \begin{enumerate}
+   \item calculate \varname{[p]} and \varname{[q]} according to:
+\TODO{the following is generated from the TeX code embedded into the DocBook files:}
+           \begin{eqnarray*}
+             p & = & \frac{(1 - \cos^2\omega)}{2} \prod_{j=0}^{(\mathtt{order}-2)/2} 4 (\cos c_{2j} - \cos \omega)^2 \\
+             q & = & \frac{(1 + \cos^2\omega)}{2} \prod_{j=0}^{(\mathtt{order}-2)/2} 4 (\cos c_{2j} - \cos \omega)^2
+           \end{eqnarray*}
+
+\TODO{the following is what oddlsp.png contains:}
+           \begin{eqnarray*}
+             p & = & \frac{(1 - \cos^2\omega)}{2} \prod_{j=0}^{\frac{\mathtt{floor0\_order}-2}{2}} 4 (\cos([\mathtt{coefficients}]_{2j+1}) - \cos \omega)^2 \\
+             q & = & \frac{(1 + \cos^2\omega)}{2} \prod_{j=0}^{\frac{\mathtt{floor0\_order}-2}{2}} 4 (\cos([\mathtt{coefficients}]_{2j}) - \cos \omega)^2
+           \end{eqnarray*}
+
+  \end{enumerate}
+  }
+
+ \item calculate \varname{[linear_floor_value]} according to:
+         \begin{displaymath}
+           \exp \left( .11512925 \left(\frac{\mathtt{amplitude} \cdot \mathtt{floor0\_amplitute\_offset}}{(2^{\mathtt{floor0\_amplitude\_bits}}-1)\sqrt{p+q}}
+                  - \mathtt{floor0\_amplitude\_offset} \right) \right)
+         \end{displaymath}
+
+ \item \varname{[iteration_condition]} = map element \varname{[i]}
+ \item \varname{[output]} element \varname{[i]} = \varname{[linear_floor_value]}
+ \item increment \varname{[i]}
+ \item if ( map element \varname{[i]} is equal to \varname{[iteration_condition]} ) continue at step 5
+ \item if ( \varname{[i]} is less than \varname{[n]} ) continue at step 2
+ \item done
+\end{enumerate}
+
+
+
+
+
+
+

Added: trunk/vorbis/doc/07-floor1.tex
===================================================================
--- trunk/vorbis/doc/07-floor1.tex	                        (rev 0)
+++ trunk/vorbis/doc/07-floor1.tex	2009-03-06 18:54:13 UTC (rev 15748)
@@ -0,0 +1,390 @@
+% -*- mode: latex; TeX-master: "Vorbis_I_spec"; -*-
+%!TEX root = Vorbis_I_spec.tex
+% $Id$
+\section{Floor type 1 setup and decode} \label{vorbis:spec:floor1}
+
+\subsection{Overview}
+
+Vorbis floor type one uses a piecewise straight-line representation to
+encode a spectral envelope curve. The representation plots this curve
+mechanically on a linear frequency axis and a logarithmic (dB)
+amplitude axis. The integer plotting algorithm used is similar to
+Bresenham's algorithm.
+
+
+
+\subsection{Floor 1 format}
+
+\subsubsection{model}
+
+Floor type one represents a spectral curve as a series of
+line segments.  Synthesis constructs a floor curve using iterative
+prediction in a process roughly equivalent to the following simplified
+description:
+
+\begin{itemize}
+ \item  the first line segment (base case) is a logical line spanning
+from x_0,y_0 to x_1,y_1 where in the base case x_0=0 and x_1=[n], the
+full range of the spectral floor to be computed.
+
+\item the induction step chooses a point x_new within an existing
+logical line segment and produces a y_new value at that point computed
+from the existing line's y value at x_new (as plotted by the line) and
+a difference value decoded from the bitstream packet.
+
+\item floor computation produces two new line segments, one running from
+x_0,y_0 to x_new,y_new and from x_new,y_new to x_1,y_1. This step is
+performed logically even if y_new represents no change to the
+amplitude value at x_new so that later refinement is additionally
+bounded at x_new.
+
+\item the induction step repeats, using a list of x values specified in
+the codec setup header at floor 1 initialization time.  Computation
+is completed at the end of the x value list.
+
+\end{itemize}
+
+
+Consider the following example, with values chosen for ease of
+understanding rather than representing typical configuration:
+
+For the below example, we assume a floor setup with an [n] of 128.
+The list of selected X values in increasing order is
+0,16,32,48,64,80,96,112 and 128.  In list order, the values interleave
+as 0, 128, 64, 32, 96, 16, 48, 80 and 112.  The corresponding
+list-order Y values as decoded from an example packet are 110, 20, -5,
+-45, 0, -25, -10, 30 and -10.  We compute the floor in the following
+way, beginning with the first line:
+
+\begin{center}
+\includegraphics[width=8cm]{floor1-1}
+\captionof{figure}{graph of example floor}
+\end{center}
+
+We now draw new logical lines to reflect the correction to new_Y, and
+iterate for X positions 32 and 96:
+
+\begin{center}
+\includegraphics[width=8cm]{floor1-2}
+\captionof{figure}{graph of example floor}
+\end{center}
+
+Although the new Y value at X position 96 is unchanged, it is still
+used later as an endpoint for further refinement.  From here on, the
+pattern should be clear; we complete the floor computation as follows:
+
+\begin{center}
+\includegraphics[width=8cm]{floor1-3}
+\captionof{figure}{graph of example floor}
+\end{center}
+
+\begin{center}
+\includegraphics[width=8cm]{floor1-4}
+\captionof{figure}{graph of example floor}
+\end{center}
+
+A more efficient algorithm with carefully defined integer rounding
+behavior is used for actual decode, as described later.  The actual
+algorithm splits Y value computation and line plotting into two steps
+with modifications to the above algorithm to eliminate noise
+accumulation through integer roundoff/truncation.
+
+
+
+\subsubsection{header decode}
+
+A list of floor X values is stored in the packet header in interleaved
+format (used in list order during packet decode and synthesis).  This
+list is split into partitions, and each partition is assigned to a
+partition class.  X positions 0 and [n] are implicit and do not belong
+to an explicit partition or partition class.
+
+A partition class consists of a representation vector width (the
+number of Y values which the partition class encodes at once), a
+'subclass' value representing the number of alternate entropy books
+the partition class may use in representing Y values, the list of
+[subclass] books and a master book used to encode which alternate
+books were chosen for representation in a given packet.  The
+master/subclass mechanism is meant to be used as a flexible
+representation cascade while still using codebooks only in a scalar
+context.
+
+\begin{Verbatim}[commandchars=\\\{\}]
+
+  1) [floor1_partitions] = read 5 bits as unsigned integer
+  2) [maximum_class] = -1
+  3) iterate [i] over the range 0 ... [floor1_partitions]-1 \{
+
+        4) vector [floor1_partition_class_list] element [i] = read 4 bits as unsigned integer
+
+     \}
+
+  5) [maximum_class] = largest integer scalar value in vector [floor1_partition_class_list]
+  6) iterate [i] over the range 0 ... [maximum_class] \{
+
+        7) vector [floor1_class_dimensions] element [i] = read 3 bits as unsigned integer and add 1
+	8) vector [floor1_class_subclasses] element [i] = read 2 bits as unsigned integer
+        9) if ( vector [floor1_class_subclasses] element [i] is nonzero ) \{
+
+             10) vector [floor1_class_masterbooks] element [i] = read 8 bits as unsigned integer
+
+           \}
+
+       11) iterate [j] over the range 0 ... (2 exponent [floor1_class_subclasses] element [i]) - 1 \{
+
+             12) array [floor1_subclass_books] element [i],[j] =
+                 read 8 bits as unsigned integer and subtract one
+           \}
+      \}
+
+ 13) [floor1_multiplier] = read 2 bits as unsigned integer and add one
+ 14) [rangebits] = read 4 bits as unsigned integer
+ 15) vector [floor1_X_list] element [0] = 0
+ 16) vector [floor1_X_list] element [1] = 2 exponent [rangebits];
+ 17) [floor1_values] = 2
+ 18) iterate [i] over the range 0 ... [floor1_partitions]-1 \{
+
+       19) [current_class_number] = vector [floor1_partition_class_list] element [i]
+       20) iterate [j] over the range 0 ... ([floor1_class_dimensions] element [current_class_number])-1 \{
+             21) vector [floor1_X_list] element ([floor1_values]) =
+                 read [rangebits] bits as unsigned integer
+             22) increment [floor1_values] by one
+           \}
+     \}
+
+ 23) done
+\end{Verbatim}
+
+An end-of-packet condition while reading any aspect of a floor 1
+configuration during setup renders a stream undecodable.  In
+addition, a \varname{[floor1_class_masterbooks]} or
+\varname{[floor1_subclass_books]} scalar element greater than the
+highest numbered codebook configured in this stream is an error
+condition that renders the stream undecodable.
+
+\paragraph{packet decode} \label{vorbis:spec:floor1-decode}
+
+Packet decode begins by checking the \varname{[nonzero]} flag:
+
+\begin{Verbatim}[commandchars=\\\{\}]
+  1) [nonzero] = read 1 bit as boolean
+\end{Verbatim}
+
+If \varname{[nonzero]} is unset, that indicates this channel contained
+no audio energy in this frame.  Decode immediately returns a status
+indicating this floor curve (and thus this channel) is unused this
+frame.  (A return status of 'unused' is different from decoding a
+floor that has all points set to minimum representation amplitude,
+which happens to be approximately -140dB).
+
+
+Assuming \varname{[nonzero]} is set, decode proceeds as follows:
+
+\begin{Verbatim}[commandchars=\\\{\}]
+  1) [range] = vector \{ 256, 128, 86, 64 \} element ([floor1_multiplier]-1)
+  2) vector [floor1_Y] element [0] = read \link{vorbis:spec:ilog}{ilog}([range]-1) bits as unsigned integer
+  3) vector [floor1_Y] element [1] = read \link{vorbis:spec:ilog}{ilog}([range]-1) bits as unsigned integer
+  4) [offset] = 2;
+  5) iterate [i] over the range 0 ... [floor1_partitions]-1 \{
+
+       6) [class] = vector [floor1_partition_class]  element [i]
+       7) [cdim]  = vector [floor1_class_dimensions] element [class]
+       8) [cbits] = vector [floor1_class_subclasses] element [class]
+       9) [csub]  = (2 exponent [cbits])-1
+      10) [cval]  = 0
+      11) if ( [cbits] is greater than zero ) \{
+
+             12) [cval] = read from packet using codebook number
+                 (vector [floor1_class_masterbooks] element [class]) in scalar context
+          \}
+
+      13) iterate [j] over the range 0 ... [cdim]-1 \{
+
+             14) [book] = array [floor1_subclass_books] element [class],([cval] bitwise AND [csub])
+             15) [cval] = [cval] right shifted [cbits] bits
+	     16) if ( [book] is not less than zero ) \{
+
+	           17) vector [floor1_Y] element ([j]+[offset]) = read from packet using codebook
+                       [book] in scalar context
+
+                 \} else [book] is less than zero \{
+
+	           18) vector [floor1_Y] element ([j]+[offset]) = 0
+
+                 \}
+          \}
+
+      19) [offset] = [offset] + [cdim]
+
+     \}
+
+ 20) done
+\end{Verbatim}
+
+An end-of-packet condition during curve decode should be considered a
+nominal occurrence; if end-of-packet is reached during any read
+operation above, floor decode is to return 'unused' status as if the
+\varname{[nonzero]} flag had been unset at the beginning of decode.
+
+
+Vector \varname{[floor1_Y]} contains the values from packet decode
+needed for floor 1 synthesis.
+
+
+
+\paragraph{curve computation} \label{vorbis:spec:floor1-synth}
+
+Curve computation is split into two logical steps; the first step
+derives final Y amplitude values from the encoded, wrapped difference
+values taken from the bitstream.  The second step plots the curve
+lines.  Also, although zero-difference values are used in the
+iterative prediction to find final Y values, these points are
+conditionally skipped during final line computation in step two.
+Skipping zero-difference values allows a smoother line fit.
+
+Although some aspects of the below algorithm look like inconsequential
+optimizations, implementors are warned to follow the details closely.
+Deviation from implementing a strictly equivalent algorithm can result
+in serious decoding errors.
+
+\begin{description}
+\item[step 1: amplitude value synthesis]
+
+Unwrap the always-positive-or-zero values read from the packet into
++/- difference values, then apply to line prediction.
+
+\begin{Verbatim}[commandchars=\\\{\}]
+  1) [range] = vector \{ 256, 128, 86, 64 \} element ([floor1_multiplier]-1)
+  2) vector [floor1_step2_flag] element [0] = set
+  3) vector [floor1_step2_flag] element [1] = set
+  4) vector [floor1_final_Y] element [0] = vector [floor1_Y] element [0]
+  5) vector [floor1_final_Y] element [1] = vector [floor1_Y] element [1]
+  6) iterate [i] over the range 2 ... [floor1_values]-1 \{
+
+       7) [low_neighbor_offset] = \link{vorbis:spec:low:neighbor}{low_neighbor}([floor1_X_list],[i])
+       8) [high_neighbor_offset] = \link{vorbis:spec:high:neighbor}{high_neighbor}([floor1_X_list],[i])
+
+       9) [predicted] = \link{vorbis:spec:render:point}{render_point}( vector [floor1_X_list] element [low_neighbor_offset],
+				      vector [floor1_final_Y] element [low_neighbor_offset],
+                                      vector [floor1_X_list] element [high_neighbor_offset],
+				      vector [floor1_final_Y] element [high_neighbor_offset],
+                                      vector [floor1_X_list] element [i] )
+
+      10) [val] = vector [floor1_Y] element [i]
+      11) [highroom] = [range] - [predicted]
+      12) [lowroom]  = [predicted]
+      13) if ( [highroom] is less than [lowroom] ) \{
+
+            14) [room] = [highroom] * 2
+
+          \} else [highroom] is not less than [lowroom] \{
+
+            15) [room] = [lowroom] * 2
+
+          \}
+
+      16) if ( [val] is nonzero ) \{
+
+            17) vector [floor1_step2_flag] element [low_neighbor_offset] = set
+            18) vector [floor1_step2_flag] element [high_neighbor_offset] = set
+            19) vector [floor1_step2_flag] element [i] = set
+            20) if ( [val] is greater than or equal to [room] ) \{
+
+                  21) if ( [highroom] is greater than [lowroom] ) \{
+
+                        22) vector [floor1_final_Y] element [i] = [val] - [lowroom] + [predicted]
+
+		      \} else [highroom] is not greater than [lowroom] \{
+
+                        23) vector [floor1_final_Y] element [i] = [predicted] - [val] + [highroom] - 1
+
+                      \}
+
+                \} else [val] is less than [room] \{
+
+		  24) if ([val] is odd) \{
+
+                        25) vector [floor1_final_Y] element [i] =
+                            [predicted] - (([val] + 1) divided by  2 using integer division)
+
+                      \} else [val] is even \{
+
+                        26) vector [floor1_final_Y] element [i] =
+                            [predicted] + ([val] / 2 using integer division)
+
+                      \}
+
+                \}
+
+          \} else [val] is zero \{
+
+            27) vector [floor1_step2_flag] element [i] = unset
+            28) vector [floor1_final_Y] element [i] = [predicted]
+
+          \}
+
+     \}
+
+ 29) done
+
+\end{Verbatim}
+
+
+
+\item[step 2: curve synthesis]
+
+Curve synthesis generates a return vector \varname{[floor]} of length
+\varname{[n]} (where \varname{[n]} is provided by the decode process
+calling to floor decode).  Floor 1 curve synthesis makes use of the
+\varname{[floor1_X_list]}, \varname{[floor1_final_Y]} and
+\varname{[floor1_step2_flag]} vectors, as well as [floor1_multiplier]
+and [floor1_values] values.
+
+Decode begins by sorting the scalars from vectors
+\varname{[floor1_X_list]}, \varname{[floor1_final_Y]} and
+\varname{[floor1_step2_flag]} together into new vectors
+\varname{[floor1_X_list]'}, \varname{[floor1_final_Y]'} and
+\varname{[floor1_step2_flag]'} according to ascending sort order of the
+values in \varname{[floor1_X_list]}.  That is, sort the values of
+\varname{[floor1_X_list]} and then apply the same permutation to
+elements of the other two vectors so that the X, Y and step2_flag
+values still match.
+
+Then compute the final curve in one pass:
+
+\begin{Verbatim}[commandchars=\\\{\}]
+  1) [hx] = 0
+  2) [lx] = 0
+  3) [ly] = vector [floor1_final_Y]' element [0] * [floor1_multiplier]
+  4) iterate [i] over the range 1 ... [floor1_values]-1 \{
+
+       5) if ( [floor1_step2_flag]' element [i] is set ) \{
+
+             6) [hy] = [floor1_final_Y]' element [i] * [floor1_multiplier]
+ 	     7) [hx] = [floor1_X_list]' element [i]
+             8) \link{vorbis:spec:render:line}{render_line}( [lx], [ly], [hx], [hy], [floor] )
+             9) [lx] = [hx]
+	    10) [ly] = [hy]
+          \}
+     \}
+
+ 11) if ( [hx] is less than [n] ) \{
+
+        12) \link{vorbis:spec:render:line}{render_line}( [hx], [hy], [n], [hy], [floor] )
+
+     \}
+
+ 13) if ( [hx] is greater than [n] ) \{
+
+            14) truncate vector [floor] to [n] elements
+
+     \}
+
+ 15) for each scalar in vector [floor], perform a lookup substitution using
+     the scalar value from [floor] as an offset into the vector \link{vorbis:spec:floor1:inverse:dB_table}{[floor1_inverse_dB_static_table]}
+
+ 16) done
+
+\end{Verbatim}
+
+\end{description}

Added: trunk/vorbis/doc/08-residue.tex
===================================================================
--- trunk/vorbis/doc/08-residue.tex	                        (rev 0)
+++ trunk/vorbis/doc/08-residue.tex	2009-03-06 18:54:13 UTC (rev 15748)
@@ -0,0 +1,449 @@
+% -*- mode: latex; TeX-master: "Vorbis_I_spec"; -*-
+%!TEX root = Vorbis_I_spec.tex
+% $Id$
+\section{Residue setup and decode} \label{vorbis:spec:residue}
+
+\subsection{Overview}
+
+A residue vector represents the fine detail of the audio spectrum of
+one channel in an audio frame after the encoder subtracts the floor
+curve and performs any channel coupling.  A residue vector may
+represent spectral lines, spectral magnitude, spectral phase or
+hybrids as mixed by channel coupling.  The exact semantic content of
+the vector does not matter to the residue abstraction.
+
+Whatever the exact qualities, the Vorbis residue abstraction codes the
+residue vectors into the bitstream packet, and then reconstructs the
+vectors during decode.  Vorbis makes use of three different encoding
+variants (numbered 0, 1 and 2) of the same basic vector encoding
+abstraction.
+
+
+
+\subsection{Residue format}
+
+Residue format partitions each vector in the vector bundle into chunks,
+classifies each chunk, encodes the chunk classifications and finally
+encodes the chunks themselves using the the specific VQ arrangement
+defined for each selected classification.
+The exact interleaving and partitioning vary by residue encoding number,
+however the high-level process used to classify and encode the residue
+vector is the same in all three variants.
+
+A set of coded residue vectors are all of the same length.  High level
+coding structure, ignoring for the moment exactly how a partition is
+encoded and simply trusting that it is, is as follows:
+
+\begin{itemize}
+\item Each vector is partitioned into multiple equal sized chunks
+according to configuration specified.  If we have a vector size of
+\emph{n}, a partition size \emph{residue_partition_size}, and a total
+of \emph{ch} residue vectors, the total number of partitioned chunks
+coded is \emph{n}/\emph{residue_partition_size}*\emph{ch}.  It is
+important to note that the integer division truncates.  In the below
+example, we assume an example \emph{residue_partition_size} of 8.
+
+\item Each partition in each vector has a classification number that
+specifies which of multiple configured VQ codebook setups are used to
+decode that partition.  The classification numbers of each partition
+can be thought of as forming a vector in their own right, as in the
+illustration below.  Just as the residue vectors are coded in grouped
+partitions to increase encoding efficiency, the classification vector
+is also partitioned into chunks.  The integer elements of each scalar
+in a classification chunk are built into a single scalar that
+represents the classification numbers in that chunk.  In the below
+example, the classification codeword encodes two classification
+numbers.
+
+\item The values in a residue vector may be encoded monolithically in a
+single pass through the residue vector, but more often efficient
+codebook design dictates that each vector is encoded as the additive
+sum of several passes through the residue vector using more than one
+VQ codebook.  Thus, each residue value potentially accumulates values
+from multiple decode passes.  The classification value associated with
+a partition is the same in each pass, thus the classification codeword
+is coded only in the first pass.
+
+\end{itemize}
+
+
+\begin{center}
+\includegraphics[width=\textwidth]{residue-pack}
+\captionof{figure}{illustration of residue vector format}
+\end{center}
+
+
+
+\subsection{residue 0}
+
+Residue 0 and 1 differ only in the way the values within a residue
+partition are interleaved during partition encoding (visually treated
+as a black box--or cyan box or brown box--in the above figure).
+
+Residue encoding 0 interleaves VQ encoding according to the
+dimension of the codebook used to encode a partition in a specific
+pass.  The dimension of the codebook need not be the same in multiple
+passes, however the partition size must be an even multiple of the
+codebook dimension.
+
+As an example, assume a partition vector of size eight, to be encoded
+by residue 0 using codebook sizes of 8, 4, 2 and 1:
+
+\begin{programlisting}
+
+            original residue vector: [ 0 1 2 3 4 5 6 7 ]
+
+codebook dimensions = 8  encoded as: [ 0 1 2 3 4 5 6 7 ]
+
+codebook dimensions = 4  encoded as: [ 0 2 4 6 ], [ 1 3 5 7 ]
+
+codebook dimensions = 2  encoded as: [ 0 4 ], [ 1 5 ], [ 2 6 ], [ 3 7 ]
+
+codebook dimensions = 1  encoded as: [ 0 ], [ 1 ], [ 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ]
+
+\end{programlisting}
+
+It is worth mentioning at this point that no configurable value in the
+residue coding setup is restricted to a power of two.
+
+
+
+\subsection{residue 1}
+
+Residue 1 does not interleave VQ encoding.  It represents partition
+vector scalars in order.  As with residue 0, however, partition length
+must be an integer multiple of the codebook dimension, although
+dimension may vary from pass to pass.
+
+As an example, assume a partition vector of size eight, to be encoded
+by residue 0 using codebook sizes of 8, 4, 2 and 1:
+
+\begin{programlisting}
+
+            original residue vector: [ 0 1 2 3 4 5 6 7 ]
+
+codebook dimensions = 8  encoded as: [ 0 1 2 3 4 5 6 7 ]
+
+codebook dimensions = 4  encoded as: [ 0 1 2 3 ], [ 4 5 6 7 ]
+
+codebook dimensions = 2  encoded as: [ 0 1 ], [ 2 3 ], [ 4 5 ], [ 6 7 ]
+
+codebook dimensions = 1  encoded as: [ 0 ], [ 1 ], [ 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ]
+
+\end{programlisting}
+
+
+
+\subsection{residue 2}
+
+Residue type two can be thought of as a variant of residue type 1.
+Rather than encoding multiple passed-in vectors as in residue type 1,
+the \emph{ch} passed in vectors of length \emph{n} are first
+interleaved and flattened into a single vector of length
+\emph{ch}*\emph{n}.  Encoding then proceeds as in type 1. Decoding is
+as in type 1 with decode interleave reversed. If operating on a single
+vector to begin with, residue type 1 and type 2 are equivalent.
+
+\begin{center}
+\includegraphics[width=\textwidth]{residue2}
+\captionof{figure}{illustration of residue type 2}
+\end{center}
+
+
+\subsection{Residue decode}
+
+\subsubsection{header decode}
+
+Header decode for all three residue types is identical.
+\begin{programlisting}
+  1) [residue_begin] = read 24 bits as unsigned integer
+  2) [residue_end] = read 24 bits as unsigned integer
+  3) [residue_partition_size] = read 24 bits as unsigned integer and add one
+  4) [residue_classifications] = read 6 bits as unsigned integer and add one
+  5) [residue_classbook] = read 8 bits as unsigned integer
+\end{programlisting}
+
+\varname{[residue_begin]} and
+\varname{[residue_end]} select the specific sub-portion of
+each vector that is actually coded; it implements akin to a bandpass
+where, for coding purposes, the vector effectively begins at element
+\varname{[residue_begin]} and ends at
+\varname{[residue_end]}.  Preceding and following values in
+the unpacked vectors are zeroed.  Note that for residue type 2, these
+values as well as \varname{[residue_partition_size]}apply to
+the interleaved vector, not the individual vectors before interleave.
+\varname{[residue_partition_size]} is as explained above,
+\varname{[residue_classifications]} is the number of possible
+classification to which a partition can belong and
+\varname{[residue_classbook]} is the codebook number used to
+code classification codewords.  The number of dimensions in book
+\varname{[residue_classbook]} determines how many
+classification values are grouped into a single classification
+codeword.  Note that the number of entries and dimensions in book
+\varname{[residue_classbook]}, along with
+\varname{[residue_classifications]}, overdetermines to
+possible number of classification codewords.  
+If \varname{[residue_classifications]}\^{}\varname{[residue_classbook]}.dimensions
+exceeds \varname{[residue_classbook]}.entries, the
+bitstream should be regarded to be undecodable.
+
+Next we read a bitmap pattern that specifies which partition classes
+code values in which passes.
+
+\begin{programlisting}
+  1) iterate [i] over the range 0 ... [residue_classifications]-1 {
+
+       2) [high_bits] = 0
+       3) [low_bits] = read 3 bits as unsigned integer
+       4) [bitflag] = read one bit as boolean
+       5) if ( [bitflag] is set ) then [high_bits] = read five bits as unsigned integer
+       6) vector [residue_cascade] element [i] = [high_bits] * 8 + [low_bits]
+     }
+  7) done
+\end{programlisting}
+
+Finally, we read in a list of book numbers, each corresponding to
+specific bit set in the cascade bitmap.  We loop over the possible
+codebook classifications and the maximum possible number of encoding
+stages (8 in Vorbis I, as constrained by the elements of the cascade
+bitmap being eight bits):
+
+\begin{programlisting}
+  1) iterate [i] over the range 0 ... [residue_classifications]-1 {
+
+       2) iterate [j] over the range 0 ... 7 {
+
+            3) if ( vector [residue_cascade] element [i] bit [j] is set ) {
+
+                 4) array [residue_books] element [i][j] = read 8 bits as unsigned integer
+
+               } else {
+
+                 5) array [residue_books] element [i][j] = unused
+
+               }
+          }
+      }
+
+  6) done
+\end{programlisting}
+
+An end-of-packet condition at any point in header decode renders the
+stream undecodable.  In addition, any codebook number greater than the
+maximum numbered codebook set up in this stream also renders the
+stream undecodable.
+
+
+
+\subsubsection{packet decode}
+
+Format 0 and 1 packet decode is identical except for specific
+partition interleave.  Format 2 packet decode can be built out of the
+format 1 decode process.  Thus we describe first the decode
+infrastructure identical to all three formats.
+
+In addition to configuration information, the residue decode process
+is passed the number of vectors in the submap bundle and a vector of
+flags indicating if any of the vectors are not to be decoded.  If the
+passed in number of vectors is 3 and vector number 1 is marked 'do not
+decode', decode skips vector 1 during the decode loop.  However, even
+'do not decode' vectors are allocated and zeroed.
+
+Depending on the values of \varname{[residue_begin]} and
+\varname{[residue_end]}, it is obvious that the encoded
+portion of a residue vector may be the entire possible residue vector
+or some other strict subset of the actual residue vector size with
+zero padding at either uncoded end.  However, it is also possible to
+set \varname{[residue_begin]} and
+\varname{[residue_end]} to specify a range partially or
+wholly beyond the maximum vector size.  Before beginning residue
+decode, limit \varname{[residue_begin]} and
+\varname{[residue_end]} to the maximum possible vector size
+as follows.  We assume that the number of vectors being encoded,
+\varname{[ch]} is provided by the higher level decoding
+process.
+
+\begin{programlisting}
+  1) [actual_size] = current blocksize/2;
+  2) if residue encoding is format 2
+       3) [actual_size] = [actual_size] * [ch];
+  4) [limit_residue_begin] = maximum of ([residue_begin],[actual_size]);
+  5) [limit_residue_end] = maximum of ([residue_end],[actual_size]);
+\end{programlisting}
+
+The following convenience values are conceptually useful to clarifying
+the decode process:
+
+\begin{programlisting}
+  1) [classwords_per_codeword] = [codebook_dimensions] value of codebook [residue_classbook]
+  2) [n_to_read] = [limit_residue_end] - [limit_residue_begin]
+  3) [partitions_to_read] = [n_to_read] / [residue_partition_size]
+\end{programlisting}
+
+Packet decode proceeds as follows, matching the description offered earlier in the document.
+\begin{programlisting}
+  1) allocate and zero all vectors that will be returned.
+  2) if ([n_to_read] is zero), stop; there is no residue to decode.
+  3) iterate [pass] over the range 0 ... 7 {
+
+       4) [partition_count] = 0
+
+       5) while [partition_count] is less than [partitions_to_read]
+
+            6) if ([pass] is zero) {
+
+                 7) iterate [j] over the range 0 .. [ch]-1 {
+
+                      8) if vector [j] is not marked 'do not decode' {
+
+                           9) [temp] = read from packet using codebook [residue_classbook] in scalar context
+                          10) iterate [i] descending over the range [classwords_per_codeword]-1 ... 0 {
+
+                               11) array [classifications] element [j],([i]+[partition_count]) =
+                                   [temp] integer modulo [residue_classifications]
+                               12) [temp] = [temp] / [residue_classifications] using integer division
+
+                              }
+
+                         }
+
+                    }
+
+               }
+
+           13) iterate [i] over the range 0 .. ([classwords_per_codeword] - 1) while [partition_count]
+               is also less than [partitions_to_read] {
+
+                 14) iterate [j] over the range 0 .. [ch]-1 {
+
+                      15) if vector [j] is not marked 'do not decode' {
+
+                           16) [vqclass] = array [classifications] element [j],[partition_count]
+                           17) [vqbook] = array [residue_books] element [vqclass],[pass]
+                           18) if ([vqbook] is not 'unused') {
+
+                                19) decode partition into output vector number [j], starting at scalar
+                                    offset [limit_residue_begin]+[partition_count]*[residue_partition_size] using
+                                    codebook number [vqbook] in VQ context
+                          }
+                     }
+
+                 20) increment [partition_count] by one
+
+               }
+          }
+     }
+
+ 21) done
+
+\end{programlisting}
+
+An end-of-packet condition during packet decode is to be considered a
+nominal occurrence.  Decode returns the result of vector decode up to
+that point.
+
+
+
+\subsubsection{format 0 specifics}
+
+Format zero decodes partitions exactly as described earlier in the
+'Residue Format: residue 0' section.  The following pseudocode
+presents the same algorithm. Assume:
+
+\begin{itemize}
+\item  \varname{[n]} is the value in \varname{[residue_partition_size]}
+\item \varname{[v]} is the residue vector
+\item \varname{[offset]} is the beginning read offset in [v]
+\end{itemize}
+
+
+\begin{programlisting}
+ 1) [step] = [n] / [codebook_dimensions]
+ 2) iterate [i] over the range 0 ... [step]-1 {
+
+      3) vector [entry_temp] = read vector from packet using current codebook in VQ context
+      4) iterate [j] over the range 0 ... [codebook_dimensions]-1 {
+
+           5) vector [v] element ([offset]+[i]+[j]*[step]) =
+	        vector [v] element ([offset]+[i]+[j]*[step]) +
+                vector [entry_temp] element [j]
+
+         }
+
+    }
+
+  6) done
+
+\end{programlisting}
+
+
+
+\subsubsection{format 1 specifics}
+
+Format 1 decodes partitions exactly as described earlier in the
+'Residue Format: residue 1' section.  The following pseudocode
+presents the same algorithm. Assume:
+
+\begin{itemize}
+\item  \varname{[n]} is the value in
+\varname{[residue_partition_size]}
+\item \varname{[v]} is the residue vector
+\item \varname{[offset]} is the beginning read offset in [v]
+\end{itemize}
+
+
+\begin{programlisting}
+ 1) [i] = 0
+ 2) vector [entry_temp] = read vector from packet using current codebook in VQ context
+ 3) iterate [j] over the range 0 ... [codebook_dimensions]-1 {
+
+      4) vector [v] element ([offset]+[i]) =
+	  vector [v] element ([offset]+[i]) +
+          vector [entry_temp] element [j]
+      5) increment [i]
+
+    }
+
+  6) if ( [i] is less than [n] ) continue at step 2
+  7) done
+\end{programlisting}
+
+
+
+\subsubsection{format 2 specifics}
+
+Format 2 is reducible to format 1.  It may be implemented as an additional step prior to and an additional post-decode step after a normal format 1 decode.
+
+
+Format 2 handles 'do not decode' vectors differently than residue 0 or
+1; if all vectors are marked 'do not decode', no decode occurrs.
+However, if at least one vector is to be decoded, all the vectors are
+decoded.  We then request normal format 1 to decode a single vector
+representing all output channels, rather than a vector for each
+channel.  After decode, deinterleave the vector into independent vectors, one for each output channel.  That is:
+
+\begin{enumerate}
+ \item If all vectors 0 through \emph{ch}-1 are marked 'do not decode', allocate and clear a single vector \varname{[v]}of length \emph{ch*n} and skip step 2 below; proceed directly to the post-decode step.
+ \item Rather than performing format 1 decode to produce \emph{ch} vectors of length \emph{n} each, call format 1 decode to produce a single vector \varname{[v]} of length \emph{ch*n}.
+ \item Post decode: Deinterleave the single vector \varname{[v]} returned by format 1 decode as described above into \emph{ch} independent vectors, one for each outputchannel, according to:
+  \begin{programlisting}
+  1) iterate [i] over the range 0 ... [n]-1 {
+
+       2) iterate [j] over the range 0 ... [ch]-1 {
+
+            3) output vector number [j] element [i] = vector [v] element ([i] * [ch] + [j])
+
+          }
+     }
+
+  4) done
+  \end{programlisting}
+
+\end{enumerate}
+
+
+
+
+
+
+

Added: trunk/vorbis/doc/09-helper.tex
===================================================================
--- trunk/vorbis/doc/09-helper.tex	                        (rev 0)
+++ trunk/vorbis/doc/09-helper.tex	2009-03-06 18:54:13 UTC (rev 15748)
@@ -0,0 +1,181 @@
+% -*- mode: latex; TeX-master: "Vorbis_I_spec"; -*-
+%!TEX root = Vorbis_I_spec.tex
+% $Id$
+\section{Helper equations} \label{vorbis:spec:helper}
+
+\subsection{Overview}
+
+The equations below are used in multiple places by the Vorbis codec
+specification.  Rather than cluttering up the main specification
+documents, they are defined here and referenced where appropriate.
+
+
+\subsection{Functions}
+
+\subsubsection{ilog} \label{vorbis:spec:ilog}
+
+The "ilog(x)" function returns the position number (1 through n) of the highest set bit in the two's complement integer value
+\varname{[x]}.  Values of \varname{[x]} less than zero are defined to return zero.
+
+\begin{programlisting}
+  1) [return_value] = 0;
+  2) if ( [x] is greater than zero ) {
+
+       3) increment [return_value];
+       4) logical shift [x] one bit to the right, padding the MSb with zero
+       5) repeat at step 2)
+
+     }
+
+   6) done
+\end{programlisting}
+
+Examples:
+
+\begin{itemize}
+ \item ilog(0) = 0;
+ \item ilog(1) = 1;
+ \item ilog(2) = 2;
+ \item ilog(3) = 2;
+ \item ilog(4) = 3;
+ \item ilog(7) = 3;
+ \item ilog(negative number) = 0;
+\end{itemize}
+
+
+
+
+\subsubsection{float32_unpack} \label{vorbis:spec:float32:unpack}
+
+"float32_unpack(x)" is intended to translate the packed binary
+representation of a Vorbis codebook float value into the
+representation used by the decoder for floating point numbers.  For
+purposes of this example, we will unpack a Vorbis float32 into a
+host-native floating point number.
+
+\begin{programlisting}
+  1) [mantissa] = [x] bitwise AND 0x1fffff (unsigned result)
+  2) [sign] = [x] bitwise AND 0x80000000 (unsigned result)
+  3) [exponent] = ( [x] bitwise AND 0x7fe00000) shifted right 21 bits (unsigned result)
+  4) if ( [sign] is nonzero ) then negate [mantissa]
+  5) return [mantissa] * ( 2 ^ ( [exponent] - 788 ) )
+\end{programlisting}
+
+
+
+\subsubsection{lookup1_values} \label{vorbis:spec:lookup1:values}
+
+"lookup1_values(codebook_entries,codebook_dimensions)" is used to
+compute the correct length of the value index for a codebook VQ lookup
+table of lookup type 1.  The values on this list are permuted to
+construct the VQ vector lookup table of size
+\varname{[codebook_entries]}.
+
+The return value for this function is defined to be 'the greatest
+integer value for which \varname{[return_value]} to the power of
+\varname{[codebook_dimensions]} is less than or equal to
+\varname{[codebook_entries]}'.
+
+
+
+\subsubsection{low_neighbor} \label{vorbis:spec:low:neighbor}
+
+"low_neighbor(v,x)" finds the position \varname{n} in vector \varname{[v]} of
+the greatest value scalar element for which \varname{n} is less than
+\varname{[x]} and vector \varname{[v]} element \varname{n} is less
+than vector \varname{[v]} element \varname{[x]}.
+
+\subsubsection{high_neighbor} \label{vorbis:spec:high:neighbor}
+
+"high_neighbor(v,x)" finds the position \varname{n} in vector [v] of
+the lowest value scalar element for which \varname{n} is less than
+\varname{[x]} and vector \varname{[v]} element \varname{n} is greater
+than vector \varname{[v]} element \varname{[x]}.
+
+
+
+\subsubsection{render_point} \label{vorbis:spec:render:point}
+
+"render_point(x0,y0,x1,y1,X)" is used to find the Y value at point X
+along the line specified by x0, x1, y0 and y1.  This function uses an
+integer algorithm to solve for the point directly without calculating
+intervening values along the line.
+
+\begin{programlisting}
+  1)  [dy] = [y1] - [y0]
+  2) [adx] = [x1] - [x0]
+  3) [ady] = absolute value of [dy]
+  4) [err] = [ady] * ([X] - [x0])
+  5) [off] = [err] / [adx] using integer division
+  6) if ( [dy] is less than zero ) {
+
+       7) [Y] = [y0] - [off]
+
+     } else {
+
+       8) [Y] = [y0] + [off]
+
+     }
+
+  9) done
+\end{programlisting}
+
+
+
+\subsubsection{render_line} \label{vorbis:spec:render:line}
+
+Floor decode type one uses the integer line drawing algorithm of
+"render_line(x0, y0, x1, y1, v)" to construct an integer floor
+curve for contiguous piecewise line segments. Note that it has not
+been relevant elsewhere, but here we must define integer division as
+rounding division of both positive and negative numbers toward zero.
+
+
+\begin{programlisting}
+  1)   [dy] = [y1] - [y0]
+  2)  [adx] = [x1] - [x0]
+  3)  [ady] = absolute value of [dy]
+  4) [base] = [dy] / [adx] using integer division
+  5)    [x] = [x0]
+  6)    [y] = [y0]
+  7)  [err] = 0
+
+  8) if ( [dy] is less than 0 ) {
+
+        9) [sy] = [base] - 1
+
+     } else {
+
+       10) [sy] = [base] + 1
+
+     }
+
+ 11) [ady] = [ady] - (absolute value of [base]) * [adx]
+ 12) vector [v] element [x] = [y]
+
+ 13) iterate [x] over the range [x0]+1 ... [x1]-1 {
+
+       14) [err] = [err] + [ady];
+       15) if ( [err] >= [adx] ) {
+
+             16) [err] = [err] - [adx]
+             17)   [y] = [y] + [sy]
+
+           } else {
+
+             18) [y] = [y] + [base]
+
+           }
+
+       19) vector [v] element [x] = [y]
+
+     }
+\end{programlisting}
+
+
+
+
+
+
+
+

Added: trunk/vorbis/doc/10-tables.tex
===================================================================
--- trunk/vorbis/doc/10-tables.tex	                        (rev 0)
+++ trunk/vorbis/doc/10-tables.tex	2009-03-06 18:54:13 UTC (rev 15748)
@@ -0,0 +1,77 @@
+% -*- mode: latex; TeX-master: "Vorbis_I_spec"; -*-
+%!TEX root = Vorbis_I_spec.tex
+% $Id$
+\section{Tables} \label{vorbis:spec:tables}
+
+\subsection{floor1\_inverse\_dB\_table} \label{vorbis:spec:floor1:inverse:dB:table}
+
+The vector \varname{[floor1_inverse_dB_table]} is a 256 element static
+lookup table consiting of the following values (read left to right
+then top to bottom):
+
+\begin{Verbatim}
+  1.0649863e-07, 1.1341951e-07, 1.2079015e-07, 1.2863978e-07,
+  1.3699951e-07, 1.4590251e-07, 1.5538408e-07, 1.6548181e-07,
+  1.7623575e-07, 1.8768855e-07, 1.9988561e-07, 2.1287530e-07,
+  2.2670913e-07, 2.4144197e-07, 2.5713223e-07, 2.7384213e-07,
+  2.9163793e-07, 3.1059021e-07, 3.3077411e-07, 3.5226968e-07,
+  3.7516214e-07, 3.9954229e-07, 4.2550680e-07, 4.5315863e-07,
+  4.8260743e-07, 5.1396998e-07, 5.4737065e-07, 5.8294187e-07,
+  6.2082472e-07, 6.6116941e-07, 7.0413592e-07, 7.4989464e-07,
+  7.9862701e-07, 8.5052630e-07, 9.0579828e-07, 9.6466216e-07,
+  1.0273513e-06, 1.0941144e-06, 1.1652161e-06, 1.2409384e-06,
+  1.3215816e-06, 1.4074654e-06, 1.4989305e-06, 1.5963394e-06,
+  1.7000785e-06, 1.8105592e-06, 1.9282195e-06, 2.0535261e-06,
+  2.1869758e-06, 2.3290978e-06, 2.4804557e-06, 2.6416497e-06,
+  2.8133190e-06, 2.9961443e-06, 3.1908506e-06, 3.3982101e-06,
+  3.6190449e-06, 3.8542308e-06, 4.1047004e-06, 4.3714470e-06,
+  4.6555282e-06, 4.9580707e-06, 5.2802740e-06, 5.6234160e-06,
+  5.9888572e-06, 6.3780469e-06, 6.7925283e-06, 7.2339451e-06,
+  7.7040476e-06, 8.2047000e-06, 8.7378876e-06, 9.3057248e-06,
+  9.9104632e-06, 1.0554501e-05, 1.1240392e-05, 1.1970856e-05,
+  1.2748789e-05, 1.3577278e-05, 1.4459606e-05, 1.5399272e-05,
+  1.6400004e-05, 1.7465768e-05, 1.8600792e-05, 1.9809576e-05,
+  2.1096914e-05, 2.2467911e-05, 2.3928002e-05, 2.5482978e-05,
+  2.7139006e-05, 2.8902651e-05, 3.0780908e-05, 3.2781225e-05,
+  3.4911534e-05, 3.7180282e-05, 3.9596466e-05, 4.2169667e-05,
+  4.4910090e-05, 4.7828601e-05, 5.0936773e-05, 5.4246931e-05,
+  5.7772202e-05, 6.1526565e-05, 6.5524908e-05, 6.9783085e-05,
+  7.4317983e-05, 7.9147585e-05, 8.4291040e-05, 8.9768747e-05,
+  9.5602426e-05, 0.00010181521, 0.00010843174, 0.00011547824,
+  0.00012298267, 0.00013097477, 0.00013948625, 0.00014855085,
+  0.00015820453, 0.00016848555, 0.00017943469, 0.00019109536,
+  0.00020351382, 0.00021673929, 0.00023082423, 0.00024582449,
+  0.00026179955, 0.00027881276, 0.00029693158, 0.00031622787,
+  0.00033677814, 0.00035866388, 0.00038197188, 0.00040679456,
+  0.00043323036, 0.00046138411, 0.00049136745, 0.00052329927,
+  0.00055730621, 0.00059352311, 0.00063209358, 0.00067317058,
+  0.00071691700, 0.00076350630, 0.00081312324, 0.00086596457,
+  0.00092223983, 0.00098217216, 0.0010459992,  0.0011139742,
+  0.0011863665,  0.0012634633,  0.0013455702,  0.0014330129,
+  0.0015261382,  0.0016253153,  0.0017309374,  0.0018434235,
+  0.0019632195,  0.0020908006,  0.0022266726,  0.0023713743,
+  0.0025254795,  0.0026895994,  0.0028643847,  0.0030505286,
+  0.0032487691,  0.0034598925,  0.0036847358,  0.0039241906,
+  0.0041792066,  0.0044507950,  0.0047400328,  0.0050480668,
+  0.0053761186,  0.0057254891,  0.0060975636,  0.0064938176,
+  0.0069158225,  0.0073652516,  0.0078438871,  0.0083536271,
+  0.0088964928,  0.009474637,   0.010090352,   0.010746080,
+  0.011444421,   0.012188144,   0.012980198,   0.013823725,
+  0.014722068,   0.015678791,   0.016697687,   0.017782797,
+  0.018938423,   0.020169149,   0.021479854,   0.022875735,
+  0.024362330,   0.025945531,   0.027631618,   0.029427276,
+  0.031339626,   0.033376252,   0.035545228,   0.037855157,
+  0.040315199,   0.042935108,   0.045725273,   0.048696758,
+  0.051861348,   0.055231591,   0.058820850,   0.062643361,
+  0.066714279,   0.071049749,   0.075666962,   0.080584227,
+  0.085821044,   0.091398179,   0.097337747,   0.10366330,
+  0.11039993,    0.11757434,    0.12521498,    0.13335215,
+  0.14201813,    0.15124727,    0.16107617,    0.17154380,
+  0.18269168,    0.19456402,    0.20720788,    0.22067342,
+  0.23501402,    0.25028656,    0.26655159,    0.28387361,
+  0.30232132,    0.32196786,    0.34289114,    0.36517414,
+  0.38890521,    0.41417847,    0.44109412,    0.46975890,
+  0.50028648,    0.53279791,    0.56742212,    0.60429640,
+  0.64356699,    0.68538959,    0.72993007,    0.77736504,
+  0.82788260,    0.88168307,    0.9389798,     1.
+\end{Verbatim}

Modified: trunk/vorbis/doc/Makefile.am
===================================================================
--- trunk/vorbis/doc/Makefile.am	2009-03-06 08:42:06 UTC (rev 15747)
+++ trunk/vorbis/doc/Makefile.am	2009-03-06 18:54:13 UTC (rev 15748)
@@ -34,7 +34,7 @@
 	white-ogg.png \
 	white-xifish.png
 
-### FIXME: bits needed by the spec which lives in xml
+# bits needed by the spec
 SPEC_PNG = \
 	components.png \
 	floor1-1.png \
@@ -53,77 +53,56 @@
 # FIXME: also needed here
 #	white-xifish.png 
 
-built_docs = Vorbis_I_spec.html Vorbis_I_spec.pdf
+SPEC_TEX = \
+	Vorbis_I_spec.tex \
+	01-introduction.tex \
+	02-bitpacking.tex \
+	03-codebook.tex \
+	04-codec.tex   \
+	05-comment.tex \
+	06-floor0.tex  \
+	07-floor1.tex  \
+	08-residue.tex \
+	09-helper.tex  \
+	10-tables.tex  \
+	a1-encapsulation-ogg.tex \
+	a2-encapsulation-rtp.tex \
+	footer.tex
 
+built_docs = Vorbis_I_spec.pdf Vorbis_I_spec.html Vorbis_I_spec.css
+
 # conditionally make the generated documentation
 if BUILD_DOCS
 doc_DATA = $(static_docs) $(SPEC_PNG) $(built_docs)
 else
-doc_DATA = $(static_docs) $(SPEC_PNG)
+doc_DATA = $(static_docs)
 endif
 
-EXTRA_DIST = $(static_docs) $(doc_sources) \
-	$(SPEC_PNG) $(SPEC_PDF) $(built_docs)
+EXTRA_DIST = $(static_docs) $(built_docs) \
+	$(SPEC_TEX) $(SPEC_PNG) $(SPEC_PDF) Vorbis_I_spec.cfg
 
-doc_sources = xml/Vorbis_I_spec.xml \
-	xml/01-introduction.xml \
-	xml/02-bitpacking.xml \
-	xml/03-codebook.xml \
-	xml/04-codec.xml \
-	xml/05-comment.xml \
-	xml/06-floor0.xml \
-	xml/07-floor1.xml \
-	xml/08-residue.xml \
-	xml/09-helper.xml \
-	xml/10-tables.xml \
-	xml/TODO \
-	xml/a1-encapsulation_ogg.xml \
-	xml/a2-encapsulation_rtp.xml \
-	xml/footer.xml \
-	xml/spec-common.xsl \
-	xml/spec-fo.xsl \
-	xml/spec-html.xsl
-
 # these are expensive; only remove if we have to
-DISTCLEANFILES = $(built_docs)
-CLEANFILES = Vorbis_I_spec.fo spec.aux spec.log spec.out
+MAINTAINERCLEANFILES = $(built_docs)
+CLEANFILES = $(SPEC_TEX:%.tex=%.aux) \
+	     Vorbis_I_spec.4ct Vorbis_I_spec.4tc \
+	     Vorbis_I_spec.dvi Vorbis_I_spec.idv \
+	     Vorbis_I_spec.lg  Vorbis_I_spec.log \
+	     Vorbis_I_spec.out Vorbis_I_spec.tmp \
+	     Vorbis_I_spec.toc Vorbis_I_spec.xref \
+	     Vorbis_I_spec*.png \
+	     zzVorbis_I_spec.ps xifish.png
 
-# rules for temporary build dir for spec
-BUILDDIR = build
-# how to copy images to build dir
-SPEC_PNG_BUILD = $(foreach file, $(SPEC_PNG), $(BUILDDIR)/$(file))
-SPEC_PDF_BUILD = $(foreach file, $(SPEC_PDF), $(BUILDDIR)/$(file))
-$(BUILDDIR)/%: $(srcdir)/%
-	@echo "Copying $< to $@"
-	@mkdir -p $(BUILDDIR)
-	@cp $< $@
-
-# how to copy the xml to build dir; cheat by only targeting the main one
-$(BUILDDIR)/Vorbis_I_spec.xml: $(doc_sources)
-	@mkdir -p $(BUILDDIR)
-	@for file in $(doc_sources); do cp $(srcdir)/$$file $(BUILDDIR); done
-# translate rfc5215.txt to .xml in the BUILDDIR
-$(BUILDDIR)/rfc5215.xml: rfc5215.txt
-	cat $< | sed 's///g' > $@
-# cat $< | sed 's///g' | sed 's/</\&lt;/g' | sed 's/>/\&gt;/g' > $@
-
 # explicit rules for generating docs
 if BUILD_DOCS
-Vorbis_I_spec.html: $(SPEC_PNG_BUILD) $(BUILDDIR)/Vorbis_I_spec.xml
-	cd build; xsltproc --xinclude --output Vorbis_I_spec.html spec-html.xsl Vorbis_I_spec.xml && mv $@ ..
+xifish.png: white-xifish.png
+	cp $< $@
 
-Vorbis_I_spec.fo: $(BUILDDIR)/Vorbis_I_spec.xml
-	cd build; xsltproc --xinclude --output $@ spec-fo.xsl Vorbis_I_spec.xml && mv $@ ..
+Vorbis_I_spec.html Vorbis_I_spec.css: $(SPEC_TEX) $(SPEC_PNG) xifish.png
+	htlatex $<
 
-# we add the two newlines to pdfxmltex because this entire XML
-# toolchain is built from wishful thinking and bonghits and the
-# default supplied passivetex config files are buggy.
-Vorbis_I_spec.pdf: Vorbis_I_spec.fo $(SPEC_PNG_BUILD) $(SPEC_PDF_BUILD)
-	cp $< build/spec.fo # work around a passivetex bug
-	-cd build; echo -e -n "\n\n" | pdfxmltex spec.fo
-	-cd build; echo -e -n "\n\n" | pdfxmltex spec.fo
-	rm build/spec.fo
-	mv build/spec.pdf $@
+Vorbis_I_spec.pdf: $(SPEC_TEX) $(SPEC_PNG) xifish.png
+	pdflatex $<
+	pdflatex $<
 else
 Vorbis_I_spec.html: NO_DOCS_ERROR
 Vorbis_I_spec.pdf: NO_DOCS_ERROR
@@ -133,7 +112,3 @@
 	@echo "Try re-running after passing --enable-docs to configure."
 	@echo
 endif
-
-# clean up build dir
-clean-local:
-	-$(RM) -r $(BUILDDIR)

Added: trunk/vorbis/doc/Vorbis_I_spec.cfg
===================================================================
--- trunk/vorbis/doc/Vorbis_I_spec.cfg	                        (rev 0)
+++ trunk/vorbis/doc/Vorbis_I_spec.cfg	2009-03-06 18:54:13 UTC (rev 15748)
@@ -0,0 +1,4 @@
+\Preamble{html} 
+\begin{document}
+  \DeclareGraphicsExtensions{.png}
+\EndPreamble

Added: trunk/vorbis/doc/Vorbis_I_spec.css
===================================================================
--- trunk/vorbis/doc/Vorbis_I_spec.css	                        (rev 0)
+++ trunk/vorbis/doc/Vorbis_I_spec.css	2009-03-06 18:54:13 UTC (rev 15748)
@@ -0,0 +1,148 @@
+ 
+/* start css.sty */
+.cmex-10{font-size:90%;}
+.cmsy-10{font-size:90%;}
+.cmr-10x-x-109{}
+.cmssbx-10x-x-109{ font-family: sans-serif; font-weight: bold;}
+.cmssbx-10x-x-109{ font-family: sans-serif; font-weight: bold;}
+.cmssbx-10x-x-207{font-size:188%; font-family: sans-serif; font-weight: bold;}
+.cmssbx-10x-x-207{ font-family: sans-serif; font-weight: bold;}
+.cmr-12x-x-120{font-size:130%;}
+.cmtt-10x-x-109{font-family: monospace;}
+.cmtt-10x-x-109{font-family: monospace;}
+.cmtt-10x-x-109{font-family: monospace;}
+.cmtt-10x-x-109{font-family: monospace;}
+.cmbx-10x-x-109{ font-weight: bold;}
+.cmbx-10x-x-109{ font-weight: bold;}
+.cmti-10x-x-109{ font-style: italic;}
+.cmr-8{font-size:72%;}
+.cmr-6{font-size:54%;}
+.cmmi-10x-x-109{font-style: italic;}
+.cmmi-8{font-size:72%;font-style: italic;}
+.cmsy-10x-x-109{}
+.cmsy-8{font-size:72%;}
+.cmsy-6{font-size:54%;}
+.cmtt-10{font-size:90%;font-family: monospace;}
+.cmtt-10{font-family: monospace;}
+.cmtt-10{font-family: monospace;}
+.cmtt-10{font-family: monospace;}
+.cmtt-8{font-size:72%;font-family: monospace;}
+.cmtt-8{font-family: monospace;}
+.cmtt-8{font-family: monospace;}
+.cmtt-8{font-family: monospace;}
+.cmtt-8x-x-75{font-size:54%;font-family: monospace;}
+.cmtt-8x-x-75{font-family: monospace;}
+.cmtt-8x-x-75{font-family: monospace;}
+.cmtt-8x-x-75{font-family: monospace;}
+.cmbx-10{font-size:90%; font-weight: bold;}
+.cmbx-10{ font-weight: bold;}
+p.noindent { text-indent: 0em }
+td p.noindent { text-indent: 0em; margin-top:0em; }
+p.nopar { text-indent: 0em; }
+p.indent{ text-indent: 1.5em }
+ at media print {div.crosslinks {visibility:hidden;}}
+a img { border-top: 0; border-left: 0; border-right: 0; }
+center { margin-top:1em; margin-bottom:1em; }
+td center { margin-top:0em; margin-bottom:0em; }
+.Canvas { position:relative; }
+img.math{vertical-align:middle;}
+li p.indent { text-indent: 0em }
+.enumerate1 {list-style-type:decimal;}
+.enumerate2 {list-style-type:lower-alpha;}
+.enumerate3 {list-style-type:lower-roman;}
+.enumerate4 {list-style-type:upper-alpha;}
+div.newtheorem { margin-bottom: 2em; margin-top: 2em;}
+.obeylines-h,.obeylines-v {white-space: nowrap; }
+div.obeylines-v p { margin-top:0; margin-bottom:0; }
+.overline{ text-decoration:overline; }
+.overline img{ border-top: 1px solid black; }
+td.displaylines {text-align:center; white-space:nowrap;}
+.centerline {text-align:center;}
+.rightline {text-align:right;}
+div.verbatim {font-family: monospace; white-space: nowrap; text-align:left; clear:both; }
+.fbox {padding-left:3.0pt; padding-right:3.0pt; text-indent:0pt; border:solid black 0.4pt; }
+div.fbox {display:table}
+div.center div.fbox {text-align:center; clear:both; padding-left:3.0pt; padding-right:3.0pt; text-indent:0pt; border:solid black 0.4pt; }
+table.minipage{width:100%;}
+div.center, div.center div.center {text-align: center; margin-left:1em; margin-right:1em;}
+div.center div {text-align: left;}
+div.flushright, div.flushright div.flushright {text-align: right;}
+div.flushright div {text-align: left;}
+div.flushleft {text-align: left;}
+.underline{ text-decoration:underline; }
+.underline img{ border-bottom: 1px solid black; margin-bottom:1pt; }
+.framebox-c, .framebox-l, .framebox-r { padding-left:3.0pt; padding-right:3.0pt; text-indent:0pt; border:solid black 0.4pt; }
+.framebox-c {text-align:center;}
+.framebox-l {text-align:left;}
+.framebox-r {text-align:right;}
+span.thank-mark{ vertical-align: super }
+span.footnote-mark sup.textsuperscript, span.footnote-mark a sup.textsuperscript{ font-size:80%; }
+div.tabular, div.center div.tabular {text-align: center; margin-top:0.5em; margin-bottom:0.5em; }
+table.tabular td p{margin-top:0em;}
+table.tabular {margin-left: auto; margin-right: auto;}
+div.td00{ margin-left:0pt; margin-right:0pt; }
+div.td01{ margin-left:0pt; margin-right:5pt; }
+div.td10{ margin-left:5pt; margin-right:0pt; }
+div.td11{ margin-left:5pt; margin-right:5pt; }
+table[rules] {border-left:solid black 0.4pt; border-right:solid black 0.4pt; }
+td.td00{ padding-left:0pt; padding-right:0pt; }
+td.td01{ padding-left:0pt; padding-right:5pt; }
+td.td10{ padding-left:5pt; padding-right:0pt; }
+td.td11{ padding-left:5pt; padding-right:5pt; }
+table[rules] {border-left:solid black 0.4pt; border-right:solid black 0.4pt; }
+.hline hr, .cline hr{ height : 1px; margin:0px; }
+.tabbing-right {text-align:right;}
+span.TEX {letter-spacing: -0.125em; }
+span.TEX span.E{ position:relative;top:0.5ex;left:-0.0417em;}
+a span.TEX span.E {text-decoration: none; }
+span.LATEX span.A{ position:relative; top:-0.5ex; left:-0.4em; font-size:85%;}
+span.LATEX span.TEX{ position:relative; left: -0.4em; }
+div.float img, div.float .caption {text-align:center;}
+div.figure img, div.figure .caption {text-align:center;}
+.marginpar {width:20%; float:right; text-align:left; margin-left:auto; margin-top:0.5em; font-size:85%; text-decoration:underline;}
+.marginpar p{margin-top:0.4em; margin-bottom:0.4em;}
+table.equation {width:100%;}
+.equation td{text-align:center; }
+td.equation { margin-top:1em; margin-bottom:1em; } 
+td.equation-label { width:5%; text-align:center; }
+td.eqnarray4 { width:5%; white-space: normal; }
+td.eqnarray2 { width:5%; }
+table.eqnarray-star, table.eqnarray {width:100%;}
+div.eqnarray{text-align:center;}
+div.array {text-align:center;}
+div.pmatrix {text-align:center;}
+table.pmatrix {width:100%;}
+span.pmatrix img{vertical-align:middle;}
+div.pmatrix {text-align:center;}
+table.pmatrix {width:100%;}
+img.cdots{vertical-align:middle;}
+.partToc a, .partToc, .likepartToc a, .likepartToc {line-height: 200%; font-weight:bold; font-size:110%;}
+.index-item, .index-subitem, .index-subsubitem {display:block}
+.caption td.id{font-weight: bold; white-space: nowrap; }
+table.caption {text-align:center;}
+h1.partHead{text-align: center}
+p.bibitem { text-indent: -2em; margin-left: 2em; margin-top:0.6em; margin-bottom:0.6em; }
+p.bibitem-p { text-indent: 0em; margin-left: 2em; margin-top:0.6em; margin-bottom:0.6em; }
+.paragraphHead, .likeparagraphHead { margin-top:2em; font-weight: bold;}
+.subparagraphHead, .likesubparagraphHead { font-weight: bold;}
+.quote {margin-bottom:0.25em; margin-top:0.25em; margin-left:1em; margin-right:1em; text-align:justify;}
+.verse{white-space:nowrap; margin-left:2em}
+div.maketitle {text-align:center;}
+h2.titleHead{text-align:center;}
+div.maketitle{ margin-bottom: 2em; }
+div.author, div.date {text-align:center;}
+div.thanks{text-align:left; margin-left:10%; font-size:85%; font-style:italic; }
+div.author{white-space: nowrap;}
+.quotation {margin-bottom:0.25em; margin-top:0.25em; margin-left:1em; }
+.abstract p {margin-left:5%; margin-right:5%;}
+table.abstract {width:100%;}
+span.footnote-mark sup.textsuperscript, span.footnote-mark a sup.textsuperscript{ font-size:80%; }
+.figure img.graphics {margin-left:10%;}
+div.verbatiminput {font-family: monospace; white-space: nowrap; }
+P.fancyvrb {white-space: nowrap; margin:0em;}
+span#textcolor1{color:#FF0000}
+span#textcolor2{color:#FF0000}
+span#textcolor3{color:#FF0000}
+span#textcolor4{color:#FF0000}
+/* end css.sty */
+

Modified: trunk/vorbis/doc/Vorbis_I_spec.html
===================================================================
--- trunk/vorbis/doc/Vorbis_I_spec.html	2009-03-06 08:42:06 UTC (rev 15747)
+++ trunk/vorbis/doc/Vorbis_I_spec.html	2009-03-06 18:54:13 UTC (rev 15748)
@@ -1,2307 +1,12968 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Vorbis I specification</title><meta name="generator" content="DocBook XSL Stylesheets V1.72.0"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="article" lang="en"><div class="titlepage"><div><div><h1 class="title"><a name="id209753"></a>Vorbis I specification</h1></div><div><h3 class="corpauthor">Xiph.org Foundation</h3></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#vorbis-spec-intro">1. Introduction and Description</a></span></dt><dd><dl><dt><span class="section"><a href="#id322780">1.1. Overview</a></span></dt><dt><span class="section"><a href="#id256749">1.2. Decoder Configuration</a></span></dt><dt><span class="section"><a href="#id257049">1.3. High-level Decode Process</a></span></dt></dl></dd><dt><span class="section"><a href="#vorbis-spec-bitpacking">2. Bitpacking C
 onvention</a></span></dt><dd><dl><dt><span class="section"><a href="#id316853">2.1. Overview</a></span></dt></dl></dd><dt><span class="section"><a href="#vorbis-spec-codebook">3. Probability Model and Codebooks</a></span></dt><dd><dl><dt><span class="section"><a href="#id326636">3.1. Overview</a></span></dt><dt><span class="section"><a href="#id329366">3.2. Packed codebook format</a></span></dt><dt><span class="section"><a href="#id320654">3.3. Use of the codebook abstraction</a></span></dt></dl></dd><dt><span class="section"><a href="#vorbis-spec-codec">4. Codec Setup and Packet Decode</a></span></dt><dd><dl><dt><span class="section"><a href="#id332455">4.1. Overview</a></span></dt><dt><span class="section"><a href="#id332825">4.2. Header decode and decode setup</a></span></dt><dt><span class="section"><a href="#id341314">4.3. Audio packet decode and synthesis</a></span></dt></dl></dd><dt><span class="section"><a href="#vorbis-spec-comment">5. comment field and header speci
 fication</a></span></dt><dd><dl><dt><span class="section"><a href="#id333629">5.1. Overview</a></span></dt><dt><span class="section"><a href="#id333657">5.2. Comment encoding</a></span></dt></dl></dd><dt><span class="section"><a href="#vorbis-spec-floor0">6. Floor type 0 setup and decode</a></span></dt><dd><dl><dt><span class="section"><a href="#id320318">6.1. Overview</a></span></dt><dt><span class="section"><a href="#id324407">6.2. Floor 0 format</a></span></dt></dl></dd><dt><span class="section"><a href="#vorbis-spec-floor1">7. Floor type 1 setup and decode</a></span></dt><dd><dl><dt><span class="section"><a href="#id321969">7.1. Overview</a></span></dt><dt><span class="section"><a href="#id315653">7.2. Floor 1 format</a></span></dt></dl></dd><dt><span class="section"><a href="#vorbis-spec-residue">8. Residue setup and decode</a></span></dt><dd><dl><dt><span class="section"><a href="#id333002">8.1. Overview</a></span></dt><dt><span class="section"><a href="#id327769">8.2.
  Residue format</a></span></dt><dt><span class="section"><a href="#id318469">8.3. residue 0</a></span></dt><dt><span class="section"><a href="#id343071">8.4. residue 1</a></span></dt><dt><span class="section"><a href="#id343096">8.5. residue 2</a></span></dt><dt><span class="section"><a href="#id343145">8.6. Residue decode</a></span></dt></dl></dd><dt><span class="section"><a href="#vorbis-spec-helper">9. Helper equations</a></span></dt><dd><dl><dt><span class="section"><a href="#id325073">9.1. Overview</a></span></dt><dt><span class="section"><a href="#id306980">9.2. Functions</a></span></dt></dl></dd><dt><span class="section"><a href="#vorbis-spec-tables">10. Tables</a></span></dt><dd><dl><dt><span class="section"><a href="#vorbis-spec-floor1_inverse_dB_table">10.1. floor1_inverse_dB_table</a></span></dt></dl></dd><dt><span class="appendix"><a href="#vorbis-over-ogg">1. Embedding Vorbis into an Ogg stream</a></span></dt><dd><dl><dt><span class="section"><a href="#id312362"
 >1.1. Overview</a></span></dt><dd><dl><dt><span class="section"><a href="#id336032">1.1.1. Restrictions</a></span></dt><dt><span class="section"><a href="#id319459">1.1.2. MIME type</a></span></dt></dl></dd><dt><span class="section"><a href="#id317588">1.2. Encapsulation</a></span></dt></dl></dd><dt><span class="appendix"><a href="#vorbis-over-rtp">2. Vorbis encapsulation in RTP</a></span></dt><dt><span class="appendix"><a href="#footer">3. Colophon</a></span></dt></dl></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="vorbis-spec-intro"></a>1. Introduction and Description</h2></div><div><p class="releaseinfo">
- $Id: 01-introduction.xml 7186 2004-07-20 07:19:25Z xiphmont $
-</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id322780"></a>1.1. Overview</h3></div></div></div><p>
-This document provides a high level description of the Vorbis codec's
-construction.  A bit-by-bit specification appears beginning in 
-<a href="#vorbis-spec-codec" title="4. Codec Setup and Packet Decode">Section 4, &#8220;Codec Setup and Packet Decode&#8221;</a>.
-The later sections assume a high-level
-understanding of the Vorbis decode process, which is 
-provided here.</p><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id315215"></a>1.1.1. Application</h4></div></div></div><p>
-Vorbis is a general purpose perceptual audio CODEC intended to allow
-maximum encoder flexibility, thus allowing it to scale competitively
-over an exceptionally wide range of bitrates.  At the high
-quality/bitrate end of the scale (CD or DAT rate stereo, 16/24 bits)
-it is in the same league as MPEG-2 and MPC.  Similarly, the 1.0
-encoder can encode high-quality CD and DAT rate stereo at below 48kbps
-without resampling to a lower rate.  Vorbis is also intended for
-lower and higher sample rates (from 8kHz telephony to 192kHz digital
-masters) and a range of channel representations (monaural,
-polyphonic, stereo, quadraphonic, 5.1, ambisonic, or up to 255
-discrete channels).
-</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id323065"></a>1.1.2. Classification</h4></div></div></div><p>
-Vorbis I is a forward-adaptive monolithic transform CODEC based on the
-Modified Discrete Cosine Transform.  The codec is structured to allow
-addition of a hybrid wavelet filterbank in Vorbis II to offer better
-transient response and reproduction using a transform better suited to
-localized time events.
-</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id322056"></a>1.1.3. Assumptions</h4></div></div></div><p>
-The Vorbis CODEC design assumes a complex, psychoacoustically-aware
-encoder and simple, low-complexity decoder. Vorbis decode is
-computationally simpler than mp3, although it does require more
-working memory as Vorbis has no static probability model; the vector
-codebooks used in the first stage of decoding from the bitstream are
-packed in their entirety into the Vorbis bitstream headers. In
-packed form, these codebooks occupy only a few kilobytes; the extent
-to which they are pre-decoded into a cache is the dominant factor in
-decoder memory usage.
-</p><p>
-Vorbis provides none of its own framing, synchronization or protection
-against errors; it is solely a method of accepting input audio,
-dividing it into individual frames and compressing these frames into
-raw, unformatted 'packets'. The decoder then accepts these raw
-packets in sequence, decodes them, synthesizes audio frames from
-them, and reassembles the frames into a facsimile of the original
-audio stream. Vorbis is a free-form variable bit rate (VBR) codec and packets have no
-minimum size, maximum size, or fixed/expected size.  Packets
-are designed that they may be truncated (or padded) and remain
-decodable; this is not to be considered an error condition and is used
-extensively in bitrate management in peeling.  Both the transport
-mechanism and decoder must allow that a packet may be any size, or
-end before or after packet decode expects.</p><p>
-Vorbis packets are thus intended to be used with a transport mechanism
-that provides free-form framing, sync, positioning and error correction
-in accordance with these design assumptions, such as Ogg (for file
-transport) or RTP (for network multicast).  For purposes of a few
-examples in this document, we will assume that Vorbis is to be
-embedded in an Ogg stream specifically, although this is by no means a
-requirement or fundamental assumption in the Vorbis design.</p><p>
-The specification for embedding Vorbis into
-an Ogg transport stream is in <a href="#vorbis-over-ogg" title="1. Embedding Vorbis into an Ogg stream">Appendix 1, <i>Embedding Vorbis into an Ogg stream</i></a>.
-</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id337302"></a>1.1.4. Codec Setup and Probability Model</h4></div></div></div><p>
-Vorbis' heritage is as a research CODEC and its current design
-reflects a desire to allow multiple decades of continuous encoder
-improvement before running out of room within the codec specification.
-For these reasons, configurable aspects of codec setup intentionally
-lean toward the extreme of forward adaptive.</p><p>
-The single most controversial design decision in Vorbis (and the most
-unusual for a Vorbis developer to keep in mind) is that the entire
-probability model of the codec, the Huffman and VQ codebooks, is
-packed into the bitstream header along with extensive CODEC setup
-parameters (often several hundred fields).  This makes it impossible,
-as it would be with MPEG audio layers, to embed a simple frame type
-flag in each audio packet, or begin decode at any frame in the stream
-without having previously fetched the codec setup header.
-</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
-Vorbis <span class="emphasis"><em>can</em></span> initiate decode at any arbitrary packet within a
-bitstream so long as the codec has been initialized/setup with the
-setup headers.</p></div><p>
-Thus, Vorbis headers are both required for decode to begin and
-relatively large as bitstream headers go.  The header size is
-unbounded, although for streaming a rule-of-thumb of 4kB or less is
-recommended (and Xiph.Org's Vorbis encoder follows this suggestion).</p><p>
-Our own design work indicates the primary liability of the
-required header is in mindshare; it is an unusual design and thus
-causes some amount of complaint among engineers as this runs against
-current design trends (and also points out limitations in some
-existing software/interface designs, such as Windows' ACM codec
-framework).  However, we find that it does not fundamentally limit
-Vorbis' suitable application space.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id256723"></a>1.1.5. Format Specification</h4></div></div></div><p>
-The Vorbis format is well-defined by its decode specification; any
-encoder that produces packets that are correctly decoded by the
-reference Vorbis decoder described below may be considered a proper
-Vorbis encoder.  A decoder must faithfully and completely implement
-the specification defined below (except where noted) to be considered
-a proper Vorbis decoder.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id256735"></a>1.1.6. Hardware Profile</h4></div></div></div><p>
-Although Vorbis decode is computationally simple, it may still run
-into specific limitations of an embedded design.  For this reason,
-embedded designs are allowed to deviate in limited ways from the
-'full' decode specification yet still be certified compliant.  These
-optional omissions are labelled in the spec where relevant.</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id256749"></a>1.2. Decoder Configuration</h3></div></div></div><p>
-Decoder setup consists of configuration of multiple, self-contained
-component abstractions that perform specific functions in the decode
-pipeline.  Each different component instance of a specific type is
-semantically interchangeable; decoder configuration consists both of
-internal component configuration, as well as arrangement of specific
-instances into a decode pipeline.  Componentry arrangement is roughly
-as follows:</p><div class="mediaobject"><img src="components.png" alt="decoder pipeline configuration"></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id322835"></a>1.2.1. Global Config</h4></div></div></div><p>
-Global codec configuration consists of a few audio related fields
-(sample rate, channels), Vorbis version (always '0' in Vorbis I),
-bitrate hints, and the lists of component instances.  All other
-configuration is in the context of specific components.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id323931"></a>1.2.2. Mode</h4></div></div></div><p>
-Each Vorbis frame is coded according to a master 'mode'.  A bitstream
-may use one or many modes.</p><p>
-The mode mechanism is used to encode a frame according to one of
-multiple possible methods with the intention of choosing a method best
-suited to that frame.  Different modes are, e.g. how frame size
-is changed from frame to frame. The mode number of a frame serves as a
-top level configuration switch for all other specific aspects of frame
-decode.</p><p>
-A 'mode' configuration consists of a frame size setting, window type
-(always 0, the Vorbis window, in Vorbis I), transform type (always
-type 0, the MDCT, in Vorbis I) and a mapping number.  The mapping
-number specifies which mapping configuration instance to use for
-low-level packet decode and synthesis.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id256947"></a>1.2.3. Mapping</h4></div></div></div><p>
-A mapping contains a channel coupling description and a list of
-'submaps' that bundle sets of channel vectors together for grouped
-encoding and decoding. These submaps are not references to external
-components; the submap list is internal and specific to a mapping.</p><p>
-A 'submap' is a configuration/grouping that applies to a subset of
-floor and residue vectors within a mapping.  The submap functions as a
-last layer of indirection such that specific special floor or residue
-settings can be applied not only to all the vectors in a given mode,
-but also specific vectors in a specific mode.  Each submap specifies
-the proper floor and residue instance number to use for decoding that
-submap's spectral floor and spectral residue vectors.</p><p>
-As an example:</p><p>
-Assume a Vorbis stream that contains six channels in the standard 5.1
-format.  The sixth channel, as is normal in 5.1, is bass only.
-Therefore it would be wasteful to encode a full-spectrum version of it
-as with the other channels.  The submapping mechanism can be used to
-apply a full range floor and residue encoding to channels 0 through 4,
-and a bass-only representation to the bass channel, thus saving space.
-In this example, channels 0-4 belong to submap 0 (which indicates use
-of a full-range floor) and channel 5 belongs to submap 1, which uses a
-bass-only representation.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id256978"></a>1.2.4. Floor</h4></div></div></div><p>
-Vorbis encodes a spectral 'floor' vector for each PCM channel.  This
-vector is a low-resolution representation of the audio spectrum for
-the given channel in the current frame, generally used akin to a
-whitening filter.  It is named a 'floor' because the Xiph.Org
-reference encoder has historically used it as a unit-baseline for
-spectral resolution.</p><p>
-A floor encoding may be of two types.  Floor 0 uses a packed LSP
-representation on a dB amplitude scale and Bark frequency scale.
-Floor 1 represents the curve as a piecewise linear interpolated
-representation on a dB amplitude scale and linear frequency scale.
-The two floors are semantically interchangeable in
-encoding/decoding. However, floor type 1 provides more stable
-inter-frame behavior, and so is the preferred choice in all
-coupled-stereo and high bitrate modes.  Floor 1 is also considerably
-less expensive to decode than floor 0.</p><p>
-Floor 0 is not to be considered deprecated, but it is of limited
-modern use.  No known Vorbis encoder past Xiph.org's own beta 4 makes
-use of floor 0.</p><p>
-The values coded/decoded by a floor are both compactly formatted and
-make use of entropy coding to save space.  For this reason, a floor
-configuration generally refers to multiple codebooks in the codebook
-component list.  Entropy coding is thus provided as an abstraction,
-and each floor instance may choose from any and all available
-codebooks when coding/decoding.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id257011"></a>1.2.5. Residue</h4></div></div></div><p>
-The spectral residue is the fine structure of the audio spectrum
-once the floor curve has been subtracted out.  In simplest terms, it
-is coded in the bitstream using cascaded (multi-pass) vector
-quantization according to one of three specific packing/coding
-algorithms numbered 0 through 2.  The packing algorithm details are
-configured by residue instance.  As with the floor components, the
-final VQ/entropy encoding is provided by external codebook instances
-and each residue instance may choose from any and all available
-codebooks.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id257025"></a>1.2.6. Codebooks</h4></div></div></div><p>
-Codebooks are a self-contained abstraction that perform entropy
-decoding and, optionally, use the entropy-decoded integer value as an
-offset into an index of output value vectors, returning the indicated
-vector of values.</p><p>
-The entropy coding in a Vorbis I codebook is provided by a standard
-Huffman binary tree representation.  This tree is tightly packed using
-one of several methods, depending on whether codeword lengths are
-ordered or unordered, or the tree is sparse.</p><p>
-The codebook vector index is similarly packed according to index
-characteristic.  Most commonly, the vector index is encoded as a
-single list of values of possible values that are then permuted into
-a list of n-dimensional rows (lattice VQ).</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id257049"></a>1.3. High-level Decode Process</h3></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id257055"></a>1.3.1. Decode Setup</h4></div></div></div><p>
-Before decoding can begin, a decoder must initialize using the
-bitstream headers matching the stream to be decoded.  Vorbis uses
-three header packets; all are required, in-order, by this
-specification. Once set up, decode may begin at any audio packet
-belonging to the Vorbis stream. In Vorbis I, all packets after the
-three initial headers are audio packets. </p><p>
-The header packets are, in order, the identification
-header, the comments header, and the setup header.</p><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id312627"></a>1.3.1.1. Identification Header</h5></div></div></div><p>
-The identification header identifies the bitstream as Vorbis, Vorbis
-version, and the simple audio characteristics of the stream such as
-sample rate and number of channels.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id312638"></a>1.3.1.2. Comment Header</h5></div></div></div><p>
-The comment header includes user text comments ("tags") and a vendor
-string for the application/library that produced the bitstream.  The
-encoding and proper use of the comment header is described in 
-<a href="#vorbis-spec-comment" title="5. comment field and header specification">Section 5, &#8220;comment field and header specification&#8221;</a>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id312653"></a>1.3.1.3. Setup Header</h5></div></div></div><p>
-The setup header includes extensive CODEC setup information as well as
-the complete VQ and Huffman codebooks needed for decode.</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id312666"></a>1.3.2. Decode Procedure</h4></div></div></div><div class="highlights"><p>
-The decoding and synthesis procedure for all audio packets is
-fundamentally the same.
-</p><div class="orderedlist"><ol type="1"><li>decode packet type flag</li><li>decode mode number</li><li>decode window shape (long windows only)</li><li>decode floor</li><li>decode residue into residue vectors</li><li>inverse channel coupling of residue vectors</li><li>generate floor curve from decoded floor data</li><li>compute dot product of floor and residue, producing audio spectrum vector</li><li>inverse monolithic transform of audio spectrum vector, always an MDCT in Vorbis I</li><li>overlap/add left-hand output of transform with right-hand output of previous frame</li><li>store right hand-data from transform of current frame for future lapping</li><li>if not first frame, return results of overlap/add as audio result of current frame</li></ol></div><p>
-</p></div><p>
-Note that clever rearrangement of the synthesis arithmetic is
-possible; as an example, one can take advantage of symmetries in the
-MDCT to store the right-hand transform data of a partial MDCT for a
-50% inter-frame buffer space savings, and then complete the transform
-later before overlap/add with the next frame.  This optimization
-produces entirely equivalent output and is naturally perfectly legal.
-The decoder must be <span class="emphasis"><em>entirely mathematically equivalent</em></span> to the
-specification, it need not be a literal semantic implementation.</p><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id312754"></a>1.3.2.1. Packet type decode</h5></div></div></div><p>
-Vorbis I uses four packet types. The first three packet types mark each
-of the three Vorbis headers described above. The fourth packet type
-marks an audio packet. All other packet types are reserved; packets
-marked with a reserved type should be ignored.</p><p>
-Following the three header packets, all packets in a Vorbis I stream
-are audio.  The first step of audio packet decode is to read and
-verify the packet type; <span class="emphasis"><em>a non-audio packet when audio is expected
-indicates stream corruption or a non-compliant stream. The decoder
-must ignore the packet and not attempt decoding it to
-audio</em></span>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id312776"></a>1.3.2.2. Mode decode</h5></div></div></div><p>
-Vorbis allows an encoder to set up multiple, numbered packet 'modes',
-as described earlier, all of which may be used in a given Vorbis
-stream. The mode is encoded as an integer used as a direct offset into
-the mode instance index. </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="vorbis-spec-window"></a>1.3.2.3. Window shape decode (long windows only)</h5></div></div></div><p>
-Vorbis frames may be one of two PCM sample sizes specified during
-codec setup.  In Vorbis I, legal frame sizes are powers of two from 64
-to 8192 samples.  Aside from coupling, Vorbis handles channels as
-independent vectors and these frame sizes are in samples per channel.</p><p>
-Vorbis uses an overlapping transform, namely the MDCT, to blend one
-frame into the next, avoiding most inter-frame block boundary
-artifacts.  The MDCT output of one frame is windowed according to MDCT
-requirements, overlapped 50% with the output of the previous frame and
-added.  The window shape assures seamless reconstruction.  </p><p>
-This is easy to visualize in the case of equal sized-windows:</p><div class="mediaobject"><img src="window1.png" alt="overlap of two equal-sized windows"></div><p>
-And slightly more complex in the case of overlapping unequal sized
-windows:</p><div class="mediaobject"><img src="window2.png" alt="overlap of a long and a short window"></div><p>
-In the unequal-sized window case, the window shape of the long window
-must be modified for seamless lapping as above.  It is possible to
-correctly infer window shape to be applied to the current window from
-knowing the sizes of the current, previous and next window.  It is
-legal for a decoder to use this method. However, in the case of a long
-window (short windows require no modification), Vorbis also codes two
-flag bits to specify pre- and post- window shape.  Although not
-strictly necessary for function, this minor redundancy allows a packet
-to be fully decoded to the point of lapping entirely independently of
-any other packet, allowing easier abstraction of decode layers as well
-as allowing a greater level of easy parallelism in encode and
-decode.</p><p>
-A description of valid window functions for use with an inverse MDCT
-can be found in the paper 
-&#8220;<span class="citetitle">
-<a href="http://www.iocon.com/resource/docs/ps/eusipco_corrected.ps" target="_top">
-The use of multirate filter banks for coding of high quality digital
-audio</a></span>&#8221;, by T. Sporer, K. Brandenburg and B. Edler.  Vorbis windows
-all use the slope function 
-  <span class="inlinemediaobject"><span>$y = \sin(.5*\pi \, \sin^2((x+.5)/n*\pi))$</span></span>.
-</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id337723"></a>1.3.2.4. floor decode</h5></div></div></div><p>
-Each floor is encoded/decoded in channel order, however each floor
-belongs to a 'submap' that specifies which floor configuration to
-use.  All floors are decoded before residue decode begins.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id337733"></a>1.3.2.5. residue decode</h5></div></div></div><p>
-Although the number of residue vectors equals the number of channels,
-channel coupling may mean that the raw residue vectors extracted
-during decode do not map directly to specific channels.  When channel
-coupling is in use, some vectors will correspond to coupled magnitude
-or angle.  The coupling relationships are described in the codec setup
-and may differ from frame to frame, due to different mode numbers.</p><p>
-Vorbis codes residue vectors in groups by submap; the coding is done
-in submap order from submap 0 through n-1.  This differs from floors
-which are coded using a configuration provided by submap number, but
-are coded individually in channel order.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id337751"></a>1.3.2.6. inverse channel coupling</h5></div></div></div><p>
-A detailed discussion of stereo in the Vorbis codec can be found in
-the document <a href="stereo.html" target="_top"><em class="citetitle">Stereo Channel Coupling in the
-Vorbis CODEC</em></a>.  Vorbis is not limited to only stereo coupling, but
-the stereo document also gives a good overview of the generic coupling
-mechanism.</p><p>
-Vorbis coupling applies to pairs of residue vectors at a time;
-decoupling is done in-place a pair at a time in the order and using
-the vectors specified in the current mapping configuration.  The
-decoupling operation is the same for all pairs, converting square
-polar representation (where one vector is magnitude and the second
-angle) back to Cartesian representation.</p><p>
-After decoupling, in order, each pair of vectors on the coupling list, 
-the resulting residue vectors represent the fine spectral detail
-of each output channel.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id337779"></a>1.3.2.7. generate floor curve</h5></div></div></div><p>
-The decoder may choose to generate the floor curve at any appropriate
-time.  It is reasonable to generate the output curve when the floor
-data is decoded from the raw packet, or it can be generated after
-inverse coupling and applied to the spectral residue directly,
-combining generation and the dot product into one step and eliminating
-some working space.</p><p>
-Both floor 0 and floor 1 generate a linear-range, linear-domain output
-vector to be multiplied (dot product) by the linear-range,
-linear-domain spectral residue.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id337795"></a>1.3.2.8. compute floor/residue dot product</h5></div></div></div><p>
-This step is straightforward; for each output channel, the decoder
-multiplies the floor curve and residue vectors element by element,
-producing the finished audio spectrum of each channel.</p><p>
-One point is worth mentioning about this dot product; a common mistake
-in a fixed point implementation might be to assume that a 32 bit
-fixed-point representation for floor and residue and direct
-multiplication of the vectors is sufficient for acceptable spectral
-depth in all cases because it happens to mostly work with the current
-Xiph.Org reference encoder.</p><p>
-However, floor vector values can span ~140dB (~24 bits unsigned), and
-the audio spectrum vector should represent a minimum of 120dB (~21
-bits with sign), even when output is to a 16 bit PCM device.  For the
-residue vector to represent full scale if the floor is nailed to
--140dB, it must be able to span 0 to +140dB.  For the residue vector
-to reach full scale if the floor is nailed at 0dB, it must be able to
-represent -140dB to +0dB.  Thus, in order to handle full range
-dynamics, a residue vector may span -140dB to +140dB entirely within
-spec.  A 280dB range is approximately 48 bits with sign; thus the
-residue vector must be able to represent a 48 bit range and the dot
-product must be able to handle an effective 48 bit times 24 bit
-multiplication.  This range may be achieved using large (64 bit or
-larger) integers, or implementing a movable binary point
-representation.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id337822"></a>1.3.2.9. inverse monolithic transform (MDCT)</h5></div></div></div><p>
-The audio spectrum is converted back into time domain PCM audio via an
-inverse Modified Discrete Cosine Transform (MDCT).  A detailed
-description of the MDCT is available in the paper <a href="http://www.iocon.com/resource/docs/ps/eusipco_corrected.ps" target="_top">&#8220;<span class="citetitle">The use of multirate filter banks for coding of high quality digital
-audio</span>&#8221;</a>, by T. Sporer, K. Brandenburg and B. Edler.</p><p>
-Note that the PCM produced directly from the MDCT is not yet finished
-audio; it must be lapped with surrounding frames using an appropriate
-window (such as the Vorbis window) before the MDCT can be considered
-orthogonal.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id337847"></a>1.3.2.10. overlap/add data</h5></div></div></div><p>
-Windowed MDCT output is overlapped and added with the right hand data
-of the previous window such that the 3/4 point of the previous window
-is aligned with the 1/4 point of the current window (as illustrated in
-the window overlap diagram). At this point, the audio data between the
-center of the previous frame and the center of the current frame is
-now finished and ready to be returned. </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id337859"></a>1.3.2.11. cache right hand data</h5></div></div></div><p>
-The decoder must cache the right hand portion of the current frame to
-be lapped with the left hand portion of the next frame.
-</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id337869"></a>1.3.2.12. return finished audio data</h5></div></div></div><p>
-The overlapped portion produced from overlapping the previous and
-current frame data is finished data to be returned by the decoder.
-This data spans from the center of the previous window to the center
-of the current window.  In the case of same-sized windows, the amount
-of data to return is one-half block consisting of and only of the
-overlapped portions. When overlapping a short and long window, much of
-the returned range is not actually overlap.  This does not damage
-transform orthogonality.  Pay attention however to returning the
-correct data range; the amount of data to be returned is:
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"  
+  "http://www.w3.org/TR/html4/loose.dtd">  
+<html > 
+<head><title>Vorbis I specification</title> 
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
+<meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)"> 
+<meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)"> 
+<!-- html --> 
+<meta name="src" content="Vorbis_I_spec.tex"> 
+<meta name="date" content="2009-03-06 10:49:00"> 
+<link rel="stylesheet" type="text/css" href="Vorbis_I_spec.css"> 
+</head><body 
+>
+<div class="maketitle">
+                                                                                    
 
-</p><pre class="programlisting">
-window_blocksize(previous_window)/4+window_blocksize(current_window)/4
-</pre><p>
+                                                                                    
+                                                                                    
 
-from the center of the previous window to the center of the current
-window.</p><p>
-Data is not returned from the first frame; it must be used to 'prime'
-the decode engine.  The encoder accounts for this priming when
-calculating PCM offsets; after the first frame, the proper PCM output
-offset is '0' (as no data has been returned yet).</p></div></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="vorbis-spec-bitpacking"></a>2. Bitpacking Convention</h2></div><div><p class="releaseinfo">
- $Id: 02-bitpacking.xml 7186 2004-07-20 07:19:25Z xiphmont $
-</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id316853"></a>2.1. Overview</h3></div></div></div><p>
-The Vorbis codec uses relatively unstructured raw packets containing
-arbitrary-width binary integer fields.  Logically, these packets are a
-bitstream in which bits are coded one-by-one by the encoder and then
-read one-by-one in the same monotonically increasing order by the
-decoder.  Most current binary storage arrangements group bits into a
-native word size of eight bits (octets), sixteen bits, thirty-two bits
-or, less commonly other fixed word sizes.  The Vorbis bitpacking
-convention specifies the correct mapping of the logical packet
-bitstream into an actual representation in fixed-width words.
-</p><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id318012"></a>2.1.1. octets, bytes and words</h4></div></div></div><p>
-In most contemporary architectures, a 'byte' is synonymous with an
-'octet', that is, eight bits.  This has not always been the case;
-seven, ten, eleven and sixteen bit 'bytes' have been used.  For
-purposes of the bitpacking convention, a byte implies the native,
-smallest integer storage representation offered by a platform.  On
-modern platforms, this is generally assumed to be eight bits (not
-necessarily because of the processor but because of the
-filesystem/memory architecture.  Modern filesystems invariably offer
-bytes as the fundamental atom of storage).  A 'word' is an integer
-size that is a grouped multiple of this smallest size.</p><p>
-The most ubiquitous architectures today consider a 'byte' to be an
-octet (eight bits) and a word to be a group of two, four or eight
-bytes (16, 32 or 64 bits).  Note however that the Vorbis bitpacking
-convention is still well defined for any native byte size; Vorbis uses
-the native bit-width of a given storage system. This document assumes
-that a byte is one octet for purposes of example.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id326209"></a>2.1.2. bit order</h4></div></div></div><p>
-A byte has a well-defined 'least significant' bit (LSb), which is the
-only bit set when the byte is storing the two's complement integer
-value +1.  A byte's 'most significant' bit (MSb) is at the opposite
-end of the byte. Bits in a byte are numbered from zero at the LSb to
-<span class="emphasis"><em>n</em></span> (<span class="emphasis"><em>n</em></span>=7 in an octet) for the
-MSb.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id323175"></a>2.1.3. byte order</h4></div></div></div><p>
-Words are native groupings of multiple bytes.  Several byte orderings
-are possible in a word; the common ones are 3-2-1-0 ('big endian' or
-'most significant byte first' in which the highest-valued byte comes
-first), 0-1-2-3 ('little endian' or 'least significant byte first' in
-which the lowest value byte comes first) and less commonly 3-1-2-0 and
-0-2-1-3 ('mixed endian').</p><p>
-The Vorbis bitpacking convention specifies storage and bitstream
-manipulation at the byte, not word, level, thus host word ordering is
-of a concern only during optimization when writing high performance
-code that operates on a word of storage at a time rather than by byte.
-Logically, bytes are always coded and decoded in order from byte zero
-through byte <span class="emphasis"><em>n</em></span>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id323198"></a>2.1.4. coding bits into byte sequences</h4></div></div></div><p>
-The Vorbis codec has need to code arbitrary bit-width integers, from
-zero to 32 bits wide, into packets.  These integer fields are not
-aligned to the boundaries of the byte representation; the next field
-is written at the bit position at which the previous field ends.</p><p>
-The encoder logically packs integers by writing the LSb of a binary
-integer to the logical bitstream first, followed by next least
-significant bit, etc, until the requested number of bits have been
-coded.  When packing the bits into bytes, the encoder begins by
-placing the LSb of the integer to be written into the least
-significant unused bit position of the destination byte, followed by
-the next-least significant bit of the source integer and so on up to
-the requested number of bits.  When all bits of the destination byte
-have been filled, encoding continues by zeroing all bits of the next
-byte and writing the next bit into the bit position 0 of that byte.
-Decoding follows the same process as encoding, but by reading bits
-from the byte stream and reassembling them into integers.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id312415"></a>2.1.5. signedness</h4></div></div></div><p>
-The signedness of a specific number resulting from decode is to be
-interpreted by the decoder given decode context.  That is, the three
-bit binary pattern 'b111' can be taken to represent either 'seven' as
-an unsigned integer, or '-1' as a signed, two's complement integer.
-The encoder and decoder are responsible for knowing if fields are to
-be treated as signed or unsigned.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id312428"></a>2.1.6. coding example</h4></div></div></div><p>
-Code the 4 bit integer value '12' [b1100] into an empty bytestream.
-Bytestream result:
+                                                                                    
 
-</p><pre class="screen">  
-              |
-              V
+<h2 class="titleHead">Vorbis I specification</h2>
+<div class="author" ><span 
+class="cmr-12x-x-120">Xiph.org Foundation</span></div>
+<br />
+<div class="date" ><span 
+class="cmr-12x-x-120">March 6, 2009</span></div>
+</div>
+<h3 class="likesectionHead"><a 
+ id="x1-1000"></a>Contents</h3>
+<div class="tableofcontents">
+<span class="sectionToc" >1 <a 
+href="#x1-20001" id="QQ2-1-2">Introduction and Description</a></span>
+<br />&#x00A0;<span class="subsectionToc" >1.1 <a 
+href="#x1-30001.1" id="QQ2-1-3">Overview</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >1.1.1 <a 
+href="#x1-40001.1.1" id="QQ2-1-4">Application</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >1.1.2 <a 
+href="#x1-50001.1.2" id="QQ2-1-5">Classification</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >1.1.3 <a 
+href="#x1-60001.1.3" id="QQ2-1-6">Assumptions</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >1.1.4 <a 
+href="#x1-70001.1.4" id="QQ2-1-7">Codec Setup and Probability Model</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >1.1.5 <a 
+href="#x1-90001.1.5" id="QQ2-1-9">Format Specification</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >1.1.6 <a 
+href="#x1-100001.1.6" id="QQ2-1-10">Hardware Profile</a></span>
+<br />&#x00A0;<span class="subsectionToc" >1.2 <a 
+href="#x1-110001.2" id="QQ2-1-11">Decoder Configuration</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >1.2.1 <a 
+href="#x1-120001.2.1" id="QQ2-1-13">Global Config</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >1.2.2 <a 
+href="#x1-130001.2.2" id="QQ2-1-14">Mode</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >1.2.3 <a 
+href="#x1-140001.2.3" id="QQ2-1-15">Mapping</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >1.2.4 <a 
+href="#x1-150001.2.4" id="QQ2-1-16">Floor</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >1.2.5 <a 
+href="#x1-160001.2.5" id="QQ2-1-17">Residue</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >1.2.6 <a 
+href="#x1-170001.2.6" id="QQ2-1-18">Codebooks</a></span>
+                                                                                    
 
-        7 6 5 4 3 2 1 0
-byte 0 [0 0 0 0 1 1 0 0]  &lt;-
-byte 1 [               ]
-byte 2 [               ]
-byte 3 [               ]
-             ...
-byte n [               ]  bytestream length == 1 byte
+                                                                                    
+<br />&#x00A0;<span class="subsectionToc" >1.3 <a 
+href="#x1-180001.3" id="QQ2-1-19">High-level Decode Process</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >1.3.1 <a 
+href="#x1-190001.3.1" id="QQ2-1-20">Decode Setup</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >1.3.2 <a 
+href="#x1-230001.3.2" id="QQ2-1-24">Decode Procedure</a></span>
+<br /><span class="sectionToc" >2 <a 
+href="#x1-360002" id="QQ2-1-39">Bitpacking Convention</a></span>
+<br />&#x00A0;<span class="subsectionToc" >2.1 <a 
+href="#x1-370002.1" id="QQ2-1-40">Overview</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >2.1.1 <a 
+href="#x1-380002.1.1" id="QQ2-1-41">octets, bytes and words</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >2.1.2 <a 
+href="#x1-390002.1.2" id="QQ2-1-42">bit order</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >2.1.3 <a 
+href="#x1-400002.1.3" id="QQ2-1-43">byte order</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >2.1.4 <a 
+href="#x1-410002.1.4" id="QQ2-1-44">coding bits into byte sequences</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >2.1.5 <a 
+href="#x1-420002.1.5" id="QQ2-1-45">signedness</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >2.1.6 <a 
+href="#x1-430002.1.6" id="QQ2-1-46">coding example</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >2.1.7 <a 
+href="#x1-440002.1.7" id="QQ2-1-47">decoding example</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >2.1.8 <a 
+href="#x1-450002.1.8" id="QQ2-1-48">end-of-packet alignment</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >2.1.9 <a 
+href="#x1-460002.1.9" id="QQ2-1-49">reading zero bits</a></span>
+<br /><span class="sectionToc" >3 <a 
+href="#x1-470003" id="QQ2-1-50">Probability Model and Codebooks</a></span>
+<br />&#x00A0;<span class="subsectionToc" >3.1 <a 
+href="#x1-480003.1" id="QQ2-1-51">Overview</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >3.1.1 <a 
+href="#x1-490003.1.1" id="QQ2-1-52">Bitwise operation</a></span>
+<br />&#x00A0;<span class="subsectionToc" >3.2 <a 
+href="#x1-500003.2" id="QQ2-1-53">Packed codebook format</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >3.2.1 <a 
+href="#x1-510003.2.1" id="QQ2-1-54">codebook decode</a></span>
+<br />&#x00A0;<span class="subsectionToc" >3.3 <a 
+href="#x1-570003.3" id="QQ2-1-62">Use of the codebook abstraction</a></span>
+<br /><span class="sectionToc" >4 <a 
+href="#x1-580004" id="QQ2-1-63">Codec Setup and Packet Decode</a></span>
+<br />&#x00A0;<span class="subsectionToc" >4.1 <a 
+href="#x1-590004.1" id="QQ2-1-64">Overview</a></span>
+<br />&#x00A0;<span class="subsectionToc" >4.2 <a 
+href="#x1-600004.2" id="QQ2-1-65">Header decode and decode setup</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >4.2.1 <a 
+href="#x1-610004.2.1" id="QQ2-1-66">Common header decode</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >4.2.2 <a 
+href="#x1-620004.2.2" id="QQ2-1-67">Identification header</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >4.2.3 <a 
+href="#x1-630004.2.3" id="QQ2-1-68">Comment header</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >4.2.4 <a 
+href="#x1-640004.2.4" id="QQ2-1-69">Setup header</a></span>
+<br />&#x00A0;<span class="subsectionToc" >4.3 <a 
+href="#x1-710004.3" id="QQ2-1-77">Audio packet decode and synthesis</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >4.3.1 <a 
+href="#x1-720004.3.1" id="QQ2-1-78">packet type, mode and window decode</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >4.3.2 <a 
+href="#x1-730004.3.2" id="QQ2-1-79">floor curve decode</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >4.3.3 <a 
+href="#x1-740004.3.3" id="QQ2-1-80">nonzero vector propagate</a></span>
+                                                                                    
 
-</pre><p>
-</p><p>
-Continue by coding the 3 bit integer value '-1' [b111]:
+                                                                                    
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >4.3.4 <a 
+href="#x1-750004.3.4" id="QQ2-1-81">residue decode</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >4.3.5 <a 
+href="#x1-760004.3.5" id="QQ2-1-82">inverse coupling</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >4.3.6 <a 
+href="#x1-770004.3.6" id="QQ2-1-83">dot product</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >4.3.7 <a 
+href="#x1-780004.3.7" id="QQ2-1-84">inverse MDCT</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >4.3.8 <a 
+href="#x1-790004.3.8" id="QQ2-1-85">overlap&#x02D9;add</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >4.3.9 <a 
+href="#x1-800004.3.9" id="QQ2-1-86">output channel order</a></span>
+<br /><span class="sectionToc" >5 <a 
+href="#x1-810005" id="QQ2-1-87">comment field and header specification</a></span>
+<br />&#x00A0;<span class="subsectionToc" >5.1 <a 
+href="#x1-820005.1" id="QQ2-1-88">Overview</a></span>
+<br />&#x00A0;<span class="subsectionToc" >5.2 <a 
+href="#x1-830005.2" id="QQ2-1-89">Comment encoding</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >5.2.1 <a 
+href="#x1-840005.2.1" id="QQ2-1-90">Structure</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >5.2.2 <a 
+href="#x1-850005.2.2" id="QQ2-1-91">Content vector format</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >5.2.3 <a 
+href="#x1-880005.2.3" id="QQ2-1-94">Encoding</a></span>
+<br /><span class="sectionToc" >6 <a 
+href="#x1-890006" id="QQ2-1-95">Floor type 0 setup and decode</a></span>
+<br />&#x00A0;<span class="subsectionToc" >6.1 <a 
+href="#x1-900006.1" id="QQ2-1-96">Overview</a></span>
+<br />&#x00A0;<span class="subsectionToc" >6.2 <a 
+href="#x1-910006.2" id="QQ2-1-97">Floor 0 format</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >6.2.1 <a 
+href="#x1-920006.2.1" id="QQ2-1-98">header decode</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >6.2.2 <a 
+href="#x1-930006.2.2" id="QQ2-1-99">packet decode</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >6.2.3 <a 
+href="#x1-940006.2.3" id="QQ2-1-100">curve computation</a></span>
+<br /><span class="sectionToc" >7 <a 
+href="#x1-950007" id="QQ2-1-101">Floor type 1 setup and decode</a></span>
+<br />&#x00A0;<span class="subsectionToc" >7.1 <a 
+href="#x1-960007.1" id="QQ2-1-102">Overview</a></span>
+<br />&#x00A0;<span class="subsectionToc" >7.2 <a 
+href="#x1-970007.2" id="QQ2-1-103">Floor 1 format</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >7.2.1 <a 
+href="#x1-980007.2.1" id="QQ2-1-104">model</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >7.2.2 <a 
+href="#x1-990007.2.2" id="QQ2-1-109">header decode</a></span>
+<br /><span class="sectionToc" >8 <a 
+href="#x1-1020008" id="QQ2-1-112">Residue setup and decode</a></span>
+<br />&#x00A0;<span class="subsectionToc" >8.1 <a 
+href="#x1-1030008.1" id="QQ2-1-113">Overview</a></span>
+<br />&#x00A0;<span class="subsectionToc" >8.2 <a 
+href="#x1-1040008.2" id="QQ2-1-114">Residue format</a></span>
+<br />&#x00A0;<span class="subsectionToc" >8.3 <a 
+href="#x1-1050008.3" id="QQ2-1-116">residue 0</a></span>
+<br />&#x00A0;<span class="subsectionToc" >8.4 <a 
+href="#x1-1060008.4" id="QQ2-1-117">residue 1</a></span>
+<br />&#x00A0;<span class="subsectionToc" >8.5 <a 
+href="#x1-1070008.5" id="QQ2-1-118">residue 2</a></span>
+<br />&#x00A0;<span class="subsectionToc" >8.6 <a 
+href="#x1-1080008.6" id="QQ2-1-120">Residue decode</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >8.6.1 <a 
+href="#x1-1090008.6.1" id="QQ2-1-121">header decode</a></span>
+                                                                                    
 
-</p><pre class="screen">
-        |
-        V
+                                                                                    
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >8.6.2 <a 
+href="#x1-1100008.6.2" id="QQ2-1-122">packet decode</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >8.6.3 <a 
+href="#x1-1110008.6.3" id="QQ2-1-123">format 0 specifics</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >8.6.4 <a 
+href="#x1-1120008.6.4" id="QQ2-1-124">format 1 specifics</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >8.6.5 <a 
+href="#x1-1130008.6.5" id="QQ2-1-125">format 2 specifics</a></span>
+<br /><span class="sectionToc" >9 <a 
+href="#x1-1140009" id="QQ2-1-126">Helper equations</a></span>
+<br />&#x00A0;<span class="subsectionToc" >9.1 <a 
+href="#x1-1150009.1" id="QQ2-1-127">Overview</a></span>
+<br />&#x00A0;<span class="subsectionToc" >9.2 <a 
+href="#x1-1160009.2" id="QQ2-1-128">Functions</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >9.2.1 <a 
+href="#x1-1170009.2.1" id="QQ2-1-129">ilog</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >9.2.2 <a 
+href="#x1-1180009.2.2" id="QQ2-1-130">float32&#x02D9;unpack</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >9.2.3 <a 
+href="#x1-1190009.2.3" id="QQ2-1-131">lookup1&#x02D9;values</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >9.2.4 <a 
+href="#x1-1200009.2.4" id="QQ2-1-132">low&#x02D9;neighbor</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >9.2.5 <a 
+href="#x1-1210009.2.5" id="QQ2-1-133">high&#x02D9;neighbor</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >9.2.6 <a 
+href="#x1-1220009.2.6" id="QQ2-1-134">render&#x02D9;point</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >9.2.7 <a 
+href="#x1-1230009.2.7" id="QQ2-1-135">render&#x02D9;line</a></span>
+<br /><span class="sectionToc" >10 <a 
+href="#x1-12400010" id="QQ2-1-136">Tables</a></span>
+<br />&#x00A0;<span class="subsectionToc" >10.1 <a 
+href="#x1-12500010.1" id="QQ2-1-137">floor1_inverse_dB_table</a></span>
+<br /><span class="sectionToc" >A <a 
+href="#x1-126000A" id="QQ2-1-138">Embedding Vorbis into an Ogg stream</a></span>
+<br />&#x00A0;<span class="subsectionToc" >A.1 <a 
+href="#x1-127000A.1" id="QQ2-1-139">Overview</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >A.1.1 <a 
+href="#x1-128000A.1.1" id="QQ2-1-140">Restrictions</a></span>
+<br />&#x00A0;&#x00A0;<span class="subsubsectionToc" >A.1.2 <a 
+href="#x1-129000A.1.2" id="QQ2-1-141">MIME type</a></span>
+<br />&#x00A0;<span class="subsectionToc" >A.2 <a 
+href="#x1-130000A.2" id="QQ2-1-142">Encapsulation</a></span>
+<br /><span class="sectionToc" >B <a 
+href="#x1-132000B" id="QQ2-1-144">Vorbis encapsulation in RTP</a></span>
+</div>
+                                                                                    
 
-        7 6 5 4 3 2 1 0
-byte 0 [0 1 1 1 1 1 0 0]  &lt;-
-byte 1 [               ]
-byte 2 [               ]
-byte 3 [               ]
-             ... 
-byte n [               ]  bytestream length == 1 byte
-</pre><p>
-</p><p>
-Continue by coding the 7 bit integer value '17' [b0010001]:
+                                                                                    
+<h3 class="sectionHead"><span class="titlemark">1 </span> <a 
+ id="x1-20001"></a>Introduction and Description</h3>
+<!--l. 6--><p class="noindent" >
+<h4 class="subsectionHead"><span class="titlemark">1.1 </span> <a 
+ id="x1-30001.1"></a>Overview</h4>
+<!--l. 8--><p class="noindent" >This document provides a high level description of the Vorbis codec&#8217;s construction. A bit-by-bit
+specification appears beginning in <a 
+href="#x1-580004">Section&#x00A0;4<!--tex4ht:ref: vorbis:spec:codec --></a>, &#8220;<a 
+href="#x1-580004">Codec Setup and Packet Decode<!--tex4ht:ref: vorbis:spec:codec --></a>&#8221;. The later
+sections assume a high-level understanding of the Vorbis decode process, which is provided
+here.
+<!--l. 15--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">1.1.1 </span> <a 
+ id="x1-40001.1.1"></a>Application</h5>
+<!--l. 16--><p class="noindent" >Vorbis is a general purpose perceptual audio CODEC intended to allow maximum encoder
+flexibility, thus allowing it to scale competitively over an exceptionally wide range of bitrates. At the
+high quality/bitrate end of the scale (CD or DAT rate stereo, 16/24 bits) it is in the same league as
+MPEG-2 and MPC. Similarly, the 1.0 encoder can encode high-quality CD and DAT rate stereo at
+below 48kbps without resampling to a lower rate. Vorbis is also intended for lower and higher
+sample rates (from 8kHz telephony to 192kHz digital masters) and a range of channel
+representations (monaural, polyphonic, stereo, quadraphonic, 5.1, ambisonic, or up to 255 discrete
+channels).
+<!--l. 29--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">1.1.2 </span> <a 
+ id="x1-50001.1.2"></a>Classification</h5>
+<!--l. 30--><p class="noindent" >Vorbis I is a forward-adaptive monolithic transform CODEC based on the Modified Discrete Cosine
+Transform. The codec is structured to allow addition of a hybrid wavelet filterbank in Vorbis II to
+offer better transient response and reproduction using a transform better suited to localized time
+events.
+<!--l. 37--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">1.1.3 </span> <a 
+ id="x1-60001.1.3"></a>Assumptions</h5>
+                                                                                    
 
-</p><pre class="screen">
-          |
-          V    
+                                                                                    
+<!--l. 39--><p class="noindent" >The Vorbis CODEC design assumes a complex, psychoacoustically-aware encoder and simple,
+low-complexity decoder. Vorbis decode is computationally simpler than mp3, although it does
+require more working memory as Vorbis has no static probability model; the vector codebooks used
+in the first stage of decoding from the bitstream are packed in their entirety into the Vorbis
+bitstream headers. In packed form, these codebooks occupy only a few kilobytes; the extent
+to which they are pre-decoded into a cache is the dominant factor in decoder memory
+usage.
+<!--l. 50--><p class="noindent" >Vorbis provides none of its own framing, synchronization or protection against errors; it is solely a
+method of accepting input audio, dividing it into individual frames and compressing these frames
+into raw, unformatted &#8217;packets&#8217;. The decoder then accepts these raw packets in sequence, decodes
+them, synthesizes audio frames from them, and reassembles the frames into a facsimile of the
+original audio stream. Vorbis is a free-form variable bit rate (VBR) codec and packets have no
+minimum size, maximum size, or fixed/expected size. Packets are designed that they may be
+truncated (or padded) and remain decodable; this is not to be considered an error condition and is
+used extensively in bitrate management in peeling. Both the transport mechanism and
+decoder must allow that a packet may be any size, or end before or after packet decode
+expects.
+<!--l. 64--><p class="noindent" >Vorbis packets are thus intended to be used with a transport mechanism that provides free-form
+framing, sync, positioning and error correction in accordance with these design assumptions, such as
+Ogg (for file transport) or RTP (for network multicast). For purposes of a few examples in this
+document, we will assume that Vorbis is to be embedded in an Ogg stream specifically,
+although this is by no means a requirement or fundamental assumption in the Vorbis
+design.
+<!--l. 72--><p class="noindent" >The specification for embedding Vorbis into an Ogg transport stream is in <a 
+href="#x1-126000A">Section&#x00A0;A<!--tex4ht:ref: vorbis:over:ogg --></a>, &#8220;<a 
+href="#x1-126000A">Embedding
+Vorbis into an Ogg stream<!--tex4ht:ref: vorbis:over:ogg --></a>&#8221;.
+<!--l. 77--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">1.1.4 </span> <a 
+ id="x1-70001.1.4"></a>Codec Setup and Probability Model</h5>
+<!--l. 79--><p class="noindent" >Vorbis&#8217; heritage is as a research CODEC and its current design reflects a desire to allow multiple
+decades of continuous encoder improvement before running out of room within the codec
+specification. For these reasons, configurable aspects of codec setup intentionally lean toward the
+extreme of forward adaptive.
+<!--l. 85--><p class="noindent" >The single most controversial design decision in Vorbis (and the most unusual for a Vorbis developer
+to keep in mind) is that the entire probability model of the codec, the Huffman and
+VQ codebooks, is packed into the bitstream header along with extensive CODEC setup
+parameters (often several hundred fields). This makes it impossible, as it would be with
+MPEG audio layers, to embed a simple frame type flag in each audio packet, or begin
+decode at any frame in the stream without having previously fetched the codec setup
+header.
+                                                                                    
 
-        7 6 5 4 3 2 1 0
-byte 0 [1 1 1 1 1 1 0 0]
-byte 1 [0 0 0 0 1 0 0 0]  &lt;-
-byte 2 [               ]
-byte 3 [               ]
-             ...
-byte n [               ]  bytestream length == 2 bytes
-                          bit cursor == 6
-</pre><p>
-</p><p>
-Continue by coding the 13 bit integer value '6969' [b110 11001110 01]:
+                                                                                    
+<!--l. 95--><p class="noindent" ><span class="likesubparagraphHead"><a 
+ id="x1-80001.1.4"></a><span 
+class="cmbx-10x-x-109">Note:</span></span> Vorbis <span 
+class="cmti-10x-x-109">can </span>initiate decode at any arbitrary packet within a bitstream so long as the codec
+has been initialized/setup with the setup headers.
+<!--l. 101--><p class="noindent" >Thus, Vorbis headers are both required for decode to begin and relatively large as bitstream headers
+go. The header size is unbounded, although for streaming a rule-of-thumb of 4kB or less is
+recommended (and Xiph.Org&#8217;s Vorbis encoder follows this suggestion).
+<!--l. 106--><p class="noindent" >Our own design work indicates the primary liability of the required header is in mindshare; it is an
+unusual design and thus causes some amount of complaint among engineers as this runs against
+current design trends (and also points out limitations in some existing software/interface designs,
+such as Windows&#8217; ACM codec framework). However, we find that it does not fundamentally limit
+Vorbis&#8217; suitable application space.
+<!--l. 115--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">1.1.5 </span> <a 
+ id="x1-90001.1.5"></a>Format Specification</h5>
+<!--l. 116--><p class="noindent" >The Vorbis format is well-defined by its decode specification; any encoder that produces
+packets that are correctly decoded by the reference Vorbis decoder described below may be
+considered a proper Vorbis encoder. A decoder must faithfully and completely implement
+the specification defined below (except where noted) to be considered a proper Vorbis
+decoder.
+<!--l. 123--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">1.1.6 </span> <a 
+ id="x1-100001.1.6"></a>Hardware Profile</h5>
+<!--l. 124--><p class="noindent" >Although Vorbis decode is computationally simple, it may still run into specific limitations of an
+embedded design. For this reason, embedded designs are allowed to deviate in limited ways from the
+&#8216;full&#8217; decode specification yet still be certified compliant. These optional omissions are labelled in
+the spec where relevant.
+<!--l. 131--><p class="noindent" >
+<h4 class="subsectionHead"><span class="titlemark">1.2 </span> <a 
+ id="x1-110001.2"></a>Decoder Configuration</h4>
+<!--l. 133--><p class="noindent" >Decoder setup consists of configuration of multiple, self-contained component abstractions that
+perform specific functions in the decode pipeline. Each different component instance of a specific
+type is semantically interchangeable; decoder configuration consists both of internal component
+configuration, as well as arrangement of specific instances into a decode pipeline. Componentry
+                                                                                    
 
-</p><pre class="screen">
-                |
-                V
+                                                                                    
+arrangement is roughly as follows:
+<div class="center" 
+>
+<!--l. 141--><p class="noindent" >
 
-        7 6 5 4 3 2 1 0
-byte 0 [1 1 1 1 1 1 0 0]
-byte 1 [0 1 0 0 1 0 0 0]
-byte 2 [1 1 0 0 1 1 1 0]
-byte 3 [0 0 0 0 0 1 1 0]  &lt;-
-             ...
-byte n [               ]  bytestream length == 4 bytes
+<!--l. 142--><p class="noindent" ><img 
+src="components.png" alt="PIC"  
+>
+<br /> <table class="caption" 
+><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure&#x00A0;1: </td><td  
+class="content">decoder pipeline configuration</td></tr></table><!--tex4ht:label?: x1-110011 -->
+</div>
+<!--l. 146--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">1.2.1 </span> <a 
+ id="x1-120001.2.1"></a>Global Config</h5>
+<!--l. 147--><p class="noindent" >Global codec configuration consists of a few audio related fields (sample rate, channels), Vorbis
+version (always &#8217;0&#8217; in Vorbis I), bitrate hints, and the lists of component instances. All other
+configuration is in the context of specific components.
+<!--l. 152--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">1.2.2 </span> <a 
+ id="x1-130001.2.2"></a>Mode</h5>
+<!--l. 154--><p class="noindent" >Each Vorbis frame is coded according to a master &#8217;mode&#8217;. A bitstream may use one or many
+modes.
+<!--l. 157--><p class="noindent" >The mode mechanism is used to encode a frame according to one of multiple possible
+methods with the intention of choosing a method best suited to that frame. Different
+modes are, e.g. how frame size is changed from frame to frame. The mode number of a
+frame serves as a top level configuration switch for all other specific aspects of frame
+decode.
+<!--l. 164--><p class="noindent" >A &#8217;mode&#8217; configuration consists of a frame size setting, window type (always 0, the Vorbis window,
+in Vorbis I), transform type (always type 0, the MDCT, in Vorbis I) and a mapping number. The
+mapping number specifies which mapping configuration instance to use for low-level packet decode
+and synthesis.
+<!--l. 171--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">1.2.3 </span> <a 
+ id="x1-140001.2.3"></a>Mapping</h5>
+                                                                                    
 
-</pre><p>
-</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id317084"></a>2.1.7. decoding example</h4></div></div></div><p>
-Reading from the beginning of the bytestream encoded in the above example:
+                                                                                    
+<!--l. 173--><p class="noindent" >A mapping contains a channel coupling description and a list of &#8217;submaps&#8217; that bundle
+sets of channel vectors together for grouped encoding and decoding. These submaps
+are not references to external components; the submap list is internal and specific to a
+mapping.
+<!--l. 178--><p class="noindent" >A &#8217;submap&#8217; is a configuration/grouping that applies to a subset of floor and residue vectors within a
+mapping. The submap functions as a last layer of indirection such that specific special floor or
+residue settings can be applied not only to all the vectors in a given mode, but also
+specific vectors in a specific mode. Each submap specifies the proper floor and residue
+instance number to use for decoding that submap&#8217;s spectral floor and spectral residue
+vectors.
+<!--l. 186--><p class="noindent" >As an example:
+<!--l. 188--><p class="noindent" >Assume a Vorbis stream that contains six channels in the standard 5.1 format. The sixth channel, as
+is normal in 5.1, is bass only. Therefore it would be wasteful to encode a full-spectrum version of it
+as with the other channels. The submapping mechanism can be used to apply a full range floor and
+residue encoding to channels 0 through 4, and a bass-only representation to the bass channel,
+thus saving space. In this example, channels 0-4 belong to submap 0 (which indicates
+use of a full-range floor) and channel 5 belongs to submap 1, which uses a bass-only
+representation.
+<!--l. 199--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">1.2.4 </span> <a 
+ id="x1-150001.2.4"></a>Floor</h5>
+<!--l. 201--><p class="noindent" >Vorbis encodes a spectral &#8217;floor&#8217; vector for each PCM channel. This vector is a low-resolution
+representation of the audio spectrum for the given channel in the current frame, generally used akin
+to a whitening filter. It is named a &#8217;floor&#8217; because the Xiph.Org reference encoder has historically
+used it as a unit-baseline for spectral resolution.
+<!--l. 208--><p class="noindent" >A floor encoding may be of two types. Floor 0 uses a packed LSP representation on a dB
+amplitude scale and Bark frequency scale. Floor 1 represents the curve as a piecewise linear
+interpolated representation on a dB amplitude scale and linear frequency scale. The two floors
+are semantically interchangeable in encoding/decoding. However, floor type 1 provides
+more stable inter-frame behavior, and so is the preferred choice in all coupled-stereo
+and high bitrate modes. Floor 1 is also considerably less expensive to decode than floor
+0.
+<!--l. 218--><p class="noindent" >Floor 0 is not to be considered deprecated, but it is of limited modern use. No known Vorbis
+encoder past Xiph.org&#8217;s own beta 4 makes use of floor 0.
+<!--l. 222--><p class="noindent" >The values coded/decoded by a floor are both compactly formatted and make use of
+entropy coding to save space. For this reason, a floor configuration generally refers to
+multiple codebooks in the codebook component list. Entropy coding is thus provided as an
+abstraction, and each floor instance may choose from any and all available codebooks when
+coding/decoding.
+                                                                                    
 
-</p><pre class="screen">
-                      |
-                      V
-                      
-        7 6 5 4 3 2 1 0
-byte 0 [1 1 1 1 1 1 0 0]  &lt;-
-byte 1 [0 1 0 0 1 0 0 0]
-byte 2 [1 1 0 0 1 1 1 0]
-byte 3 [0 0 0 0 0 1 1 0]  bytestream length == 4 bytes
+                                                                                    
+<!--l. 230--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">1.2.5 </span> <a 
+ id="x1-160001.2.5"></a>Residue</h5>
+<!--l. 231--><p class="noindent" >The spectral residue is the fine structure of the audio spectrum once the floor curve
+has been subtracted out. In simplest terms, it is coded in the bitstream using cascaded
+(multi-pass) vector quantization according to one of three specific packing/coding algorithms
+numbered 0 through 2. The packing algorithm details are configured by residue instance.
+As with the floor components, the final VQ/entropy encoding is provided by external
+codebook instances and each residue instance may choose from any and all available
+codebooks.
+<!--l. 241--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">1.2.6 </span> <a 
+ id="x1-170001.2.6"></a>Codebooks</h5>
+<!--l. 243--><p class="noindent" >Codebooks are a self-contained abstraction that perform entropy decoding and, optionally, use the
+entropy-decoded integer value as an offset into an index of output value vectors, returning the
+indicated vector of values.
+<!--l. 248--><p class="noindent" >The entropy coding in a Vorbis I codebook is provided by a standard Huffman binary tree
+representation. This tree is tightly packed using one of several methods, depending on whether
+codeword lengths are ordered or unordered, or the tree is sparse.
+<!--l. 253--><p class="noindent" >The codebook vector index is similarly packed according to index characteristic. Most commonly,
+the vector index is encoded as a single list of values of possible values that are then permuted into a
+list of n-dimensional rows (lattice VQ).
+<!--l. 260--><p class="noindent" >
+<h4 class="subsectionHead"><span class="titlemark">1.3 </span> <a 
+ id="x1-180001.3"></a>High-level Decode Process</h4>
+<!--l. 262--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">1.3.1 </span> <a 
+ id="x1-190001.3.1"></a>Decode Setup</h5>
+<!--l. 264--><p class="noindent" >Before decoding can begin, a decoder must initialize using the bitstream headers matching the
+stream to be decoded. Vorbis uses three header packets; all are required, in-order, by this
+                                                                                    
 
-</pre><p>
-</p><p>
-We read two, two-bit integer fields, resulting in the returned numbers
-'b00' and 'b11'.  Two things are worth noting here:
+                                                                                    
+specification. Once set up, decode may begin at any audio packet belonging to the Vorbis stream. In
+Vorbis I, all packets after the three initial headers are audio packets.
+<!--l. 271--><p class="noindent" >The header packets are, in order, the identification header, the comments header, and the setup
+header.
+<!--l. 274--><p class="noindent" ><span class="paragraphHead"><a 
+ id="x1-200001.3.1"></a><span 
+class="cmbx-10x-x-109">Identification Header</span></span>
+The identification header identifies the bitstream as Vorbis, Vorbis version, and the simple audio
+characteristics of the stream such as sample rate and number of channels.
+<!--l. 279--><p class="noindent" ><span class="paragraphHead"><a 
+ id="x1-210001.3.1"></a><span 
+class="cmbx-10x-x-109">Comment Header</span></span>
+The comment header includes user text comments (&#8220;tags&#8221;) and a vendor string for the
+application/library that produced the bitstream. The encoding and proper use of the comment
+header is described in <a 
+href="#x1-810005">Section&#x00A0;5<!--tex4ht:ref: vorbis:spec:comment --></a>, &#8220;<a 
+href="#x1-810005">comment field and header specification<!--tex4ht:ref: vorbis:spec:comment --></a>&#8221;.
+<!--l. 284--><p class="noindent" ><span class="paragraphHead"><a 
+ id="x1-220001.3.1"></a><span 
+class="cmbx-10x-x-109">Setup Header</span></span>
+The setup header includes extensive CODEC setup information as well as the complete VQ and
+Huffman codebooks needed for decode.
+<!--l. 289--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">1.3.2 </span> <a 
+ id="x1-230001.3.2"></a>Decode Procedure</h5>
+<!--l. 291--><p class="noindent" >The decoding and synthesis procedure for all audio packets is fundamentally the same.
+     <ol  class="enumerate1" >
+     <li 
+  class="enumerate" id="x1-23002x1">decode packet type flag
+     </li>
+     <li 
+  class="enumerate" id="x1-23004x2">decode mode number
+     </li>
+     <li 
+  class="enumerate" id="x1-23006x3">decode window shape (long windows only)
+     </li>
+     <li 
+  class="enumerate" id="x1-23008x4">decode floor
+     </li>
+     <li 
+  class="enumerate" id="x1-23010x5">decode residue into residue vectors
+                                                                                    
 
-</p><div class="itemizedlist"><ul type="disc"><li><p>Although these four bits were originally written as a single
-four-bit integer, reading some other combination of bit-widths from the
-bitstream is well defined.  There are no artificial alignment
-boundaries maintained in the bitstream.</p></li><li><p>The second value is the
-two-bit-wide integer 'b11'.  This value may be interpreted either as
-the unsigned value '3', or the signed value '-1'.  Signedness is
-dependent on decode context.</p></li></ul></div><p>
-</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id322995"></a>2.1.8. end-of-packet alignment</h4></div></div></div><p>
-The typical use of bitpacking is to produce many independent
-byte-aligned packets which are embedded into a larger byte-aligned
-container structure, such as an Ogg transport bitstream.  Externally,
-each bytestream (encoded bitstream) must begin and end on a byte
-boundary.  Often, the encoded bitstream is not an integer number of
-bytes, and so there is unused (uncoded) space in the last byte of a
-packet.</p><p>
-Unused space in the last byte of a bytestream is always zeroed during
-the coding process.  Thus, should this unused space be read, it will
-return binary zeroes.</p><p>
-Attempting to read past the end of an encoded packet results in an
-'end-of-packet' condition.  End-of-packet is not to be considered an
-error; it is merely a state indicating that there is insufficient
-remaining data to fulfill the desired read size.  Vorbis uses truncated
-packets as a normal mode of operation, and as such, decoders must
-handle reading past the end of a packet as a typical mode of
-operation. Any further read operations after an 'end-of-packet'
-condition shall also return 'end-of-packet'.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id323021"></a>2.1.9.  reading zero bits</h4></div></div></div><p>
-Reading a zero-bit-wide integer returns the value '0' and does not
-increment the stream cursor.  Reading to the end of the packet (but
-not past, such that an 'end-of-packet' condition has not triggered)
-and then reading a zero bit integer shall succeed, returning 0, and
-not trigger an end-of-packet condition.  Reading a zero-bit-wide
-integer after a previous read sets 'end-of-packet' shall also fail
-with 'end-of-packet'.</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="vorbis-spec-codebook"></a>3. Probability Model and Codebooks</h2></div><div><p class="releaseinfo">
- $Id: 03-codebook.xml 7186 2004-07-20 07:19:25Z xiphmont $
-</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id326636"></a>3.1. Overview</h3></div></div></div><p>
-Unlike practically every other mainstream audio codec, Vorbis has no
-statically configured probability model, instead packing all entropy
-decoding configuration, VQ and Huffman, into the bitstream itself in
-the third header, the codec setup header.  This packed configuration
-consists of multiple 'codebooks', each containing a specific
-Huffman-equivalent representation for decoding compressed codewords as
-well as an optional lookup table of output vector values to which a
-decoded Huffman value is applied as an offset, generating the final
-decoded output corresponding to a given compressed codeword.</p><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id331970"></a>3.1.1. Bitwise operation</h4></div></div></div><p>
-The codebook mechanism is built on top of the vorbis bitpacker. Both
-the codebooks themselves and the codewords they decode are unrolled 
-from a packet as a series of arbitrary-width values read from the 
-stream according to <a href="#vorbis-spec-bitpacking" title="2. Bitpacking Convention">Section 2, &#8220;Bitpacking Convention&#8221;</a>.</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id329366"></a>3.2. Packed codebook format</h3></div></div></div><p>
-For purposes of the examples below, we assume that the storage
-system's native byte width is eight bits.  This is not universally
-true; see <a href="#vorbis-spec-bitpacking" title="2. Bitpacking Convention">Section 2, &#8220;Bitpacking Convention&#8221;</a> for discussion 
-relating to non-eight-bit bytes.</p><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id310869"></a>3.2.1. codebook decode</h4></div></div></div><p>
-A codebook begins with a 24 bit sync pattern, 0x564342:
+                                                                                    
+     </li>
+     <li 
+  class="enumerate" id="x1-23012x6">inverse channel coupling of residue vectors
+     </li>
+     <li 
+  class="enumerate" id="x1-23014x7">generate floor curve from decoded floor data
+     </li>
+     <li 
+  class="enumerate" id="x1-23016x8">compute dot product of floor and residue, producing audio spectrum vector
+     </li>
+     <li 
+  class="enumerate" id="x1-23018x9">inverse monolithic transform of audio spectrum vector, always an MDCT in Vorbis I
+     </li>
+     <li 
+  class="enumerate" id="x1-23020x10">overlap/add left-hand output of transform with right-hand output of previous frame
+     </li>
+     <li 
+  class="enumerate" id="x1-23022x11">store right hand-data from transform of current frame for future lapping
+     </li>
+     <li 
+  class="enumerate" id="x1-23024x12">if not first frame, return results of overlap/add as audio result of current frame</li></ol>
+<!--l. 308--><p class="noindent" >Note that clever rearrangement of the synthesis arithmetic is possible; as an example, one can take
+advantage of symmetries in the MDCT to store the right-hand transform data of a partial MDCT
+for a 50% inter-frame buffer space savings, and then complete the transform later before
+overlap/add with the next frame. This optimization produces entirely equivalent output and is
+naturally perfectly legal. The decoder must be <span 
+class="cmti-10x-x-109">entirely mathematically equivalent </span>to the
+specification, it need not be a literal semantic implementation.
+<!--l. 317--><p class="noindent" ><span class="paragraphHead"><a 
+ id="x1-240001.3.2"></a><span 
+class="cmbx-10x-x-109">Packet type decode</span></span>
+Vorbis I uses four packet types. The first three packet types mark each of the three Vorbis headers
+described above. The fourth packet type marks an audio packet. All other packet types are reserved;
+packets marked with a reserved type should be ignored.
+<!--l. 324--><p class="noindent" >Following the three header packets, all packets in a Vorbis I stream are audio. The first step of
+audio packet decode is to read and verify the packet type; <span 
+class="cmti-10x-x-109">a non-audio packet when audio is</span>
+<span 
+class="cmti-10x-x-109">expected indicates stream corruption or a non-compliant stream. The decoder must ignore the packet</span>
+<span 
+class="cmti-10x-x-109">and not attempt decoding it to audio</span>.
+<!--l. 334--><p class="noindent" ><span class="paragraphHead"><a 
+ id="x1-250001.3.2"></a><span 
+class="cmbx-10x-x-109">Mode decode</span></span>
+Vorbis allows an encoder to set up multiple, numbered packet &#8217;modes&#8217;, as described earlier, all of
+which may be used in a given Vorbis stream. The mode is encoded as an integer used as a direct
+offset into the mode instance index.
+                                                                                    
 
-</p><pre class="screen">
-byte 0: [ 0 1 0 0 0 0 1 0 ] (0x42)
-byte 1: [ 0 1 0 0 0 0 1 1 ] (0x43)
-byte 2: [ 0 1 0 1 0 1 1 0 ] (0x56)
-</pre><p>
-16 bit <code class="varname">[codebook_dimensions]</code> and 24 bit <code class="varname">[codebook_entries]</code> fields:
+                                                                                    
+<!--l. 341--><p class="noindent" ><span class="paragraphHead"><a 
+ id="x1-260001.3.2"></a><span 
+class="cmbx-10x-x-109">Window shape decode (long windows only)</span></span>
+Vorbis frames may be one of two PCM sample sizes specified during codec setup. In Vorbis
+I, legal frame sizes are powers of two from 64 to 8192 samples. Aside from coupling,
+Vorbis handles channels as independent vectors and these frame sizes are in samples per
+channel.
+<!--l. 348--><p class="noindent" >Vorbis uses an overlapping transform, namely the MDCT, to blend one frame into the next,
+avoiding most inter-frame block boundary artifacts. The MDCT output of one frame is windowed
+according to MDCT requirements, overlapped 50% with the output of the previous frame and
+added. The window shape assures seamless reconstruction.
+<!--l. 354--><p class="noindent" >This is easy to visualize in the case of equal sized-windows:
+<div class="center" 
+>
+<!--l. 356--><p class="noindent" >
 
-</p><pre class="screen">
+<!--l. 357--><p class="noindent" ><img 
+src="window1.png" alt="PIC"  
+>
+<br /> <table class="caption" 
+><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure&#x00A0;2: </td><td  
+class="content">overlap of two equal-sized windows</td></tr></table><!--tex4ht:label?: x1-260012 -->
+</div>
+<!--l. 361--><p class="noindent" >And slightly more complex in the case of overlapping unequal sized windows:
+<div class="center" 
+>
+<!--l. 364--><p class="noindent" >
 
-byte 3: [ X X X X X X X X ] 
-byte 4: [ X X X X X X X X ] [codebook_dimensions] (16 bit unsigned)
+<!--l. 365--><p class="noindent" ><img 
+src="window2.png" alt="PIC"  
+>
+<br /> <table class="caption" 
+><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure&#x00A0;3: </td><td  
+class="content">overlap of a long and a short window</td></tr></table><!--tex4ht:label?: x1-260023 -->
+</div>
+<!--l. 369--><p class="noindent" >In the unequal-sized window case, the window shape of the long window must be modified for
+seamless lapping as above. It is possible to correctly infer window shape to be applied to the current
+window from knowing the sizes of the current, previous and next window. It is legal for a decoder to
+use this method. However, in the case of a long window (short windows require no modification),
+Vorbis also codes two flag bits to specify pre- and post- window shape. Although not strictly
+necessary for function, this minor redundancy allows a packet to be fully decoded to the
+point of lapping entirely independently of any other packet, allowing easier abstraction
+of decode layers as well as allowing a greater level of easy parallelism in encode and
+decode.
+<!--l. 382--><p class="noindent" >A description of valid window functions for use with an inverse MDCT can be found in <span class="cite">[<a 
+href="#XSporer/Brandenburg/Edler">1</a>]</span>. Vorbis
+windows all use the slope function
+<center class="math-display" >
+<img 
+src="Vorbis_I_spec0x.png" alt="y = sin (.5* &#x03C0; sin2((x + .5)&#x2215;n *&#x03C0; )).
+" class="math-display" ></center>
+<!--l. 385--><p class="nopar" >
+<!--l. 389--><p class="noindent" ><span class="paragraphHead"><a 
+ id="x1-270001.3.2"></a><span 
+class="cmbx-10x-x-109">floor decode</span></span>
+Each floor is encoded/decoded in channel order, however each floor belongs to a &#8217;submap&#8217; that
+specifies which floor configuration to use. All floors are decoded before residue decode
+begins.
+<!--l. 395--><p class="noindent" ><span class="paragraphHead"><a 
+ id="x1-280001.3.2"></a><span 
+class="cmbx-10x-x-109">residue decode</span></span>
+Although the number of residue vectors equals the number of channels, channel coupling may mean
+that the raw residue vectors extracted during decode do not map directly to specific channels. When
+channel coupling is in use, some vectors will correspond to coupled magnitude or angle. The
+coupling relationships are described in the codec setup and may differ from frame to frame, due to
+different mode numbers.
+<!--l. 404--><p class="noindent" >Vorbis codes residue vectors in groups by submap; the coding is done in submap order from submap
+0 through n-1. This differs from floors which are coded using a configuration provided by submap
+number, but are coded individually in channel order.
+<!--l. 411--><p class="noindent" ><span class="paragraphHead"><a 
+ id="x1-290001.3.2"></a><span 
+class="cmbx-10x-x-109">inverse channel coupling</span></span>
+A detailed discussion of stereo in the Vorbis codec can be found in the document <a 
+href="stereo.html" >Stereo Channel
+Coupling in the Vorbis CODEC</a>. Vorbis is not limited to only stereo coupling, but the stereo
+document also gives a good overview of the generic coupling mechanism.
+<!--l. 419--><p class="noindent" >Vorbis coupling applies to pairs of residue vectors at a time; decoupling is done in-place
+a pair at a time in the order and using the vectors specified in the current mapping
+configuration. The decoupling operation is the same for all pairs, converting square polar
+representation (where one vector is magnitude and the second angle) back to Cartesian
+representation.
+<!--l. 426--><p class="noindent" >After decoupling, in order, each pair of vectors on the coupling list, the resulting residue vectors
+represent the fine spectral detail of each output channel.
+<!--l. 432--><p class="noindent" ><span class="paragraphHead"><a 
+ id="x1-300001.3.2"></a><span 
+class="cmbx-10x-x-109">generate floor curve</span></span>
+                                                                                    
 
-byte 5: [ X X X X X X X X ] 
-byte 6: [ X X X X X X X X ] 
-byte 7: [ X X X X X X X X ] [codebook_entries] (24 bit unsigned)
+                                                                                    
+The decoder may choose to generate the floor curve at any appropriate time. It is reasonable
+to generate the output curve when the floor data is decoded from the raw packet, or
+it can be generated after inverse coupling and applied to the spectral residue directly,
+combining generation and the dot product into one step and eliminating some working
+space.
+<!--l. 441--><p class="noindent" >Both floor 0 and floor 1 generate a linear-range, linear-domain output vector to be multiplied (dot
+product) by the linear-range, linear-domain spectral residue.
+<!--l. 447--><p class="noindent" ><span class="paragraphHead"><a 
+ id="x1-310001.3.2"></a><span 
+class="cmbx-10x-x-109">compute floor/residue dot product</span></span>
+This step is straightforward; for each output channel, the decoder multiplies the floor curve
+and residue vectors element by element, producing the finished audio spectrum of each
+channel.
+<!--l. 455--><p class="noindent" >One point is worth mentioning about this dot product; a common mistake in a fixed point
+implementation might be to assume that a 32 bit fixed-point representation for floor
+and residue and direct multiplication of the vectors is sufficient for acceptable spectral
+depth in all cases because it happens to mostly work with the current Xiph.Org reference
+encoder.
+<!--l. 462--><p class="noindent" >However, floor vector values can span <span 
+class="cmsy-10x-x-109">~</span>140dB (<span 
+class="cmsy-10x-x-109">~</span>24 bits unsigned), and the audio spectrum vector
+should represent a minimum of 120dB (<span 
+class="cmsy-10x-x-109">~</span>21 bits with sign), even when output is to a 16 bit PCM
+device. For the residue vector to represent full scale if the floor is nailed to <span 
+class="cmsy-10x-x-109">-</span>140dB, it must be able
+to span 0 to +140dB. For the residue vector to reach full scale if the floor is nailed at 0dB, it must
+be able to represent <span 
+class="cmsy-10x-x-109">-</span>140dB to +0dB. Thus, in order to handle full range dynamics, a residue
+vector may span <span 
+class="cmsy-10x-x-109">-</span>140dB to +140dB entirely within spec. A 280dB range is approximately 48 bits
+with sign; thus the residue vector must be able to represent a 48 bit range and the dot product
+must be able to handle an effective 48 bit times 24 bit multiplication. This range may be
+achieved using large (64 bit or larger) integers, or implementing a movable binary point
+representation.
+<!--l. 479--><p class="noindent" ><span class="paragraphHead"><a 
+ id="x1-320001.3.2"></a><span 
+class="cmbx-10x-x-109">inverse monolithic transform (MDCT)</span></span>
+The audio spectrum is converted back into time domain PCM audio via an inverse Modified
+Discrete Cosine Transform (MDCT). A detailed description of the MDCT is available in
+<span class="cite">[<a 
+href="#XSporer/Brandenburg/Edler">1</a>]</span>.
+<!--l. 485--><p class="noindent" >Note that the PCM produced directly from the MDCT is not yet finished audio; it must be lapped
+with surrounding frames using an appropriate window (such as the Vorbis window) before the
+MDCT can be considered orthogonal.
+                                                                                    
 
-</pre><p>
-Next is the <code class="varname">[ordered]</code> bit flag:
+                                                                                    
+<!--l. 492--><p class="noindent" ><span class="paragraphHead"><a 
+ id="x1-330001.3.2"></a><span 
+class="cmbx-10x-x-109">overlap/add data</span></span>
+Windowed MDCT output is overlapped and added with the right hand data of the previous window
+such that the 3/4 point of the previous window is aligned with the 1/4 point of the current window
+(as illustrated in the window overlap diagram). At this point, the audio data between the center of
+the previous frame and the center of the current frame is now finished and ready to be
+returned.
+<!--l. 501--><p class="noindent" ><span class="paragraphHead"><a 
+ id="x1-340001.3.2"></a><span 
+class="cmbx-10x-x-109">cache right hand data</span></span>
+The decoder must cache the right hand portion of the current frame to be lapped with the left hand
+portion of the next frame.
+<!--l. 507--><p class="noindent" ><span class="paragraphHead"><a 
+ id="x1-350001.3.2"></a><span 
+class="cmbx-10x-x-109">return finished audio data</span></span>
+The overlapped portion produced from overlapping the previous and current frame data is finished
+data to be returned by the decoder. This data spans from the center of the previous window to the
+center of the current window. In the case of same-sized windows, the amount of data to return is
+one-half block consisting of and only of the overlapped portions. When overlapping a short and long
+window, much of the returned range is not actually overlap. This does not damage transform
+orthogonality. Pay attention however to returning the correct data range; the amount of data to be
+returned is:
+<!--l. 519--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb1">
+<a 
+ id="x1-35002r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;window_blocksize(previous_window)/4+window_blocksize(current_window)/4</span>
+</div>
+<!--l. 523--><p class="noindent" >from the center of the previous window to the center of the current window.
+<!--l. 526--><p class="noindent" >Data is not returned from the first frame; it must be used to &#8217;prime&#8217; the decode engine. The encoder
+accounts for this priming when calculating PCM offsets; after the first frame, the proper PCM
+output offset is &#8217;0&#8217; (as no data has been returned yet).
+                                                                                    
 
-</p><pre class="screen">
+                                                                                    
+                                                                                    
 
-byte 8: [               X ] [ordered] (1 bit)
+                                                                                    
+<h3 class="sectionHead"><span class="titlemark">2 </span> <a 
+ id="x1-360002"></a>Bitpacking Convention</h3>
+<!--l. 6--><p class="noindent" >
+<h4 class="subsectionHead"><span class="titlemark">2.1 </span> <a 
+ id="x1-370002.1"></a>Overview</h4>
+<!--l. 8--><p class="noindent" >The Vorbis codec uses relatively unstructured raw packets containing arbitrary-width binary integer
+fields. Logically, these packets are a bitstream in which bits are coded one-by-one by the encoder
+and then read one-by-one in the same monotonically increasing order by the decoder. Most current
+binary storage arrangements group bits into a native word size of eight bits (octets), sixteen bits,
+thirty-two bits or, less commonly other fixed word sizes. The Vorbis bitpacking convention specifies
+the correct mapping of the logical packet bitstream into an actual representation in fixed-width
+words.
+<!--l. 19--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">2.1.1 </span> <a 
+ id="x1-380002.1.1"></a>octets, bytes and words</h5>
+<!--l. 21--><p class="noindent" >In most contemporary architectures, a &#8217;byte&#8217; is synonymous with an &#8217;octet&#8217;, that is, eight bits. This
+has not always been the case; seven, ten, eleven and sixteen bit &#8217;bytes&#8217; have been used.
+For purposes of the bitpacking convention, a byte implies the native, smallest integer
+storage representation offered by a platform. On modern platforms, this is generally
+assumed to be eight bits (not necessarily because of the processor but because of the
+filesystem/memory architecture. Modern filesystems invariably offer bytes as the fundamental
+atom of storage). A &#8217;word&#8217; is an integer size that is a grouped multiple of this smallest
+size.
+<!--l. 32--><p class="noindent" >The most ubiquitous architectures today consider a &#8217;byte&#8217; to be an octet (eight bits) and a word to
+be a group of two, four or eight bytes (16, 32 or 64 bits). Note however that the Vorbis bitpacking
+convention is still well defined for any native byte size; Vorbis uses the native bit-width of a
+given storage system. This document assumes that a byte is one octet for purposes of
+example.
+<!--l. 39--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">2.1.2 </span> <a 
+ id="x1-390002.1.2"></a>bit order</h5>
+<!--l. 41--><p class="noindent" >A byte has a well-defined &#8217;least significant&#8217; bit (LSb), which is the only bit set when the byte is
+storing the two&#8217;s complement integer value +1. A byte&#8217;s &#8217;most significant&#8217; bit (MSb) is at the
+                                                                                    
 
-</pre><p>
-Each entry, numbering a
-total of <code class="varname">[codebook_entries]</code>, is assigned a codeword length.
-We now read the list of codeword lengths and store these lengths in
-the array <code class="varname">[codebook_codeword_lengths]</code>. Decode of lengths is
-according to whether the <code class="varname">[ordered]</code> flag is set or unset.
+                                                                                    
+opposite end of the byte. Bits in a byte are numbered from zero at the LSb to <span 
+class="cmmi-10x-x-109">n </span>(<span 
+class="cmmi-10x-x-109">n </span>= 7 in an octet)
+for the MSb.
+<!--l. 50--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">2.1.3 </span> <a 
+ id="x1-400002.1.3"></a>byte order</h5>
+<!--l. 52--><p class="noindent" >Words are native groupings of multiple bytes. Several byte orderings are possible in a word;
+the common ones are 3-2-1-0 (&#8217;big endian&#8217; or &#8217;most significant byte first&#8217; in which the
+highest-valued byte comes first), 0-1-2-3 (&#8217;little endian&#8217; or &#8217;least significant byte first&#8217; in
+which the lowest value byte comes first) and less commonly 3-1-2-0 and 0-2-1-3 (&#8217;mixed
+endian&#8217;).
+<!--l. 59--><p class="noindent" >The Vorbis bitpacking convention specifies storage and bitstream manipulation at the byte, not
+word, level, thus host word ordering is of a concern only during optimization when writing high
+performance code that operates on a word of storage at a time rather than by byte.
+Logically, bytes are always coded and decoded in order from byte zero through byte
+<span 
+class="cmmi-10x-x-109">n</span>.
+<!--l. 68--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">2.1.4 </span> <a 
+ id="x1-410002.1.4"></a>coding bits into byte sequences</h5>
+<!--l. 70--><p class="noindent" >The Vorbis codec has need to code arbitrary bit-width integers, from zero to 32 bits
+wide, into packets. These integer fields are not aligned to the boundaries of the byte
+representation; the next field is written at the bit position at which the previous field
+ends.
+<!--l. 75--><p class="noindent" >The encoder logically packs integers by writing the LSb of a binary integer to the logical bitstream
+first, followed by next least significant bit, etc, until the requested number of bits have been coded.
+When packing the bits into bytes, the encoder begins by placing the LSb of the integer to be written
+into the least significant unused bit position of the destination byte, followed by the next-least
+significant bit of the source integer and so on up to the requested number of bits. When all bits of
+the destination byte have been filled, encoding continues by zeroing all bits of the next byte
+and writing the next bit into the bit position 0 of that byte. Decoding follows the same
+process as encoding, but by reading bits from the byte stream and reassembling them into
+integers.
+<!--l. 90--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">2.1.5 </span> <a 
+ id="x1-420002.1.5"></a>signedness</h5>
+                                                                                    
 
-</p><div class="itemizedlist"><ul type="disc"><li><p>If the <code class="varname">[ordered]</code> flag is unset, the codeword list is not
-  length ordered and the decoder needs to read each codeword length
-  one-by-one.</p><p>The decoder first reads one additional bit flag, the
-  <code class="varname">[sparse]</code> flag.  This flag determines whether or not the
-  codebook contains unused entries that are not to be included in the
-  codeword decode tree:
+                                                                                    
+<!--l. 92--><p class="noindent" >The signedness of a specific number resulting from decode is to be interpreted by the decoder given
+decode context. That is, the three bit binary pattern &#8217;b111&#8217; can be taken to represent
+either &#8217;seven&#8217; as an unsigned integer, or &#8217;-1&#8217; as a signed, two&#8217;s complement integer. The
+encoder and decoder are responsible for knowing if fields are to be treated as signed or
+unsigned.
+<!--l. 101--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">2.1.6 </span> <a 
+ id="x1-430002.1.6"></a>coding example</h5>
+<!--l. 103--><p class="noindent" >Code the 4 bit integer value &#8217;12&#8217; [b1100] into an empty bytestream. Bytestream result:
+<!--l. 106--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb2">
+<a 
+ id="x1-43002r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;|</span>
+<br class="fancyvrb" /><a 
+ id="x1-43004r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;V</span>
+<br class="fancyvrb" /><a 
+ id="x1-43006r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-43008r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;7</span><span 
+class="cmtt-10">&#x00A0;6</span><span 
+class="cmtt-10">&#x00A0;5</span><span 
+class="cmtt-10">&#x00A0;4</span><span 
+class="cmtt-10">&#x00A0;3</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;0</span>
+<br class="fancyvrb" /><a 
+ id="x1-43010r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;[0</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;0]</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;&#x003C;-</span>
+<br class="fancyvrb" /><a 
+ id="x1-43012r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;]</span>
+<br class="fancyvrb" /><a 
+ id="x1-43014r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;]</span>
+<br class="fancyvrb" /><a 
+ id="x1-43016r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;3</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;]</span>
+<br class="fancyvrb" /><a 
+ id="x1-43018r9"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;...</span>
+<br class="fancyvrb" /><a 
+ id="x1-43020r10"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;n</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;]</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;bytestream</span><span 
+class="cmtt-10">&#x00A0;length</span><span 
+class="cmtt-10">&#x00A0;==</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;byte</span>
+<br class="fancyvrb" /><a 
+ id="x1-43022r11"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+</div>
+<!--l. 121--><p class="noindent" >Continue by coding the 3 bit integer value &#8217;-1&#8217; [b111]:
+<!--l. 123--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb3">
+<a 
+ id="x1-43024r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;|</span>
+<br class="fancyvrb" /><a 
+ id="x1-43026r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;V</span>
+<br class="fancyvrb" /><a 
+ id="x1-43028r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-43030r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;7</span><span 
+class="cmtt-10">&#x00A0;6</span><span 
+class="cmtt-10">&#x00A0;5</span><span 
+class="cmtt-10">&#x00A0;4</span><span 
+class="cmtt-10">&#x00A0;3</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;0</span>
+<br class="fancyvrb" /><a 
+ id="x1-43032r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;[0</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;0]</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;&#x003C;-</span>
+<br class="fancyvrb" /><a 
+ id="x1-43034r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;]</span>
+<br class="fancyvrb" /><a 
+ id="x1-43036r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;]</span>
+<br class="fancyvrb" /><a 
+ id="x1-43038r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;3</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;]</span>
+<br class="fancyvrb" /><a 
+ id="x1-43040r9"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;...</span>
+<br class="fancyvrb" /><a 
+ id="x1-43042r10"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;n</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;]</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;bytestream</span><span 
+class="cmtt-10">&#x00A0;length</span><span 
+class="cmtt-10">&#x00A0;==</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;byte</span>
+</div>
+<!--l. 137--><p class="noindent" >Continue by coding the 7 bit integer value &#8217;17&#8217; [b0010001]:
+<!--l. 139--><p class="noindent" >
+                                                                                    
 
-</p><pre class="screen">
-byte 8: [             X 1 ] [sparse] flag (1 bit)
-</pre><p>
-  The decoder now performs for each of the <code class="varname">[codebook_entries]</code>
-  codebook entries:
+                                                                                    
+<div class="fancyvrb" id="fancyvrb4">
+<a 
+ id="x1-43044r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;|</span>
+<br class="fancyvrb" /><a 
+ id="x1-43046r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;V</span>
+<br class="fancyvrb" /><a 
+ id="x1-43048r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-43050r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;7</span><span 
+class="cmtt-10">&#x00A0;6</span><span 
+class="cmtt-10">&#x00A0;5</span><span 
+class="cmtt-10">&#x00A0;4</span><span 
+class="cmtt-10">&#x00A0;3</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;0</span>
+<br class="fancyvrb" /><a 
+ id="x1-43052r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;[1</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;0]</span>
+<br class="fancyvrb" /><a 
+ id="x1-43054r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;[0</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;0]</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;&#x003C;-</span>
+<br class="fancyvrb" /><a 
+ id="x1-43056r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;]</span>
+<br class="fancyvrb" /><a 
+ id="x1-43058r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;3</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;]</span>
+<br class="fancyvrb" /><a 
+ id="x1-43060r9"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;...</span>
+<br class="fancyvrb" /><a 
+ id="x1-43062r10"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;n</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;]</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;bytestream</span><span 
+class="cmtt-10">&#x00A0;length</span><span 
+class="cmtt-10">&#x00A0;==</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;bytes</span>
+<br class="fancyvrb" /><a 
+ id="x1-43064r11"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;bit</span><span 
+class="cmtt-10">&#x00A0;cursor</span><span 
+class="cmtt-10">&#x00A0;==</span><span 
+class="cmtt-10">&#x00A0;6</span>
+</div>
+<!--l. 154--><p class="noindent" >Continue by coding the 13 bit integer value &#8217;6969&#8217; [b110 11001110 01]:
+<!--l. 156--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb5">
+<a 
+ id="x1-43066r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;|</span>
+<br class="fancyvrb" /><a 
+ id="x1-43068r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;V</span>
+<br class="fancyvrb" /><a 
+ id="x1-43070r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-43072r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;7</span><span 
+class="cmtt-10">&#x00A0;6</span><span 
+class="cmtt-10">&#x00A0;5</span><span 
+class="cmtt-10">&#x00A0;4</span><span 
+class="cmtt-10">&#x00A0;3</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;0</span>
+<br class="fancyvrb" /><a 
+ id="x1-43074r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;[1</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;0]</span>
+<br class="fancyvrb" /><a 
+ id="x1-43076r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;[0</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;0]</span>
+<br class="fancyvrb" /><a 
+ id="x1-43078r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;[1</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;0]</span>
+<br class="fancyvrb" /><a 
+ id="x1-43080r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;3</span><span 
+class="cmtt-10">&#x00A0;[0</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;0]</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;&#x003C;-</span>
+<br class="fancyvrb" /><a 
+ id="x1-43082r9"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;...</span>
+<br class="fancyvrb" /><a 
+ id="x1-43084r10"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;n</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;]</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;bytestream</span><span 
+class="cmtt-10">&#x00A0;length</span><span 
+class="cmtt-10">&#x00A0;==</span><span 
+class="cmtt-10">&#x00A0;4</span><span 
+class="cmtt-10">&#x00A0;bytes</span>
+<br class="fancyvrb" /><a 
+ id="x1-43086r11"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+</div>
+<!--l. 173--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">2.1.7 </span> <a 
+ id="x1-440002.1.7"></a>decoding example</h5>
+<!--l. 175--><p class="noindent" >Reading from the beginning of the bytestream encoded in the above example:
+<!--l. 177--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb6">
+<a 
+ id="x1-44002r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;|</span>
+<br class="fancyvrb" /><a 
+ id="x1-44004r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;V</span>
+<br class="fancyvrb" /><a 
+ id="x1-44006r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-44008r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;7</span><span 
+class="cmtt-10">&#x00A0;6</span><span 
+class="cmtt-10">&#x00A0;5</span><span 
+class="cmtt-10">&#x00A0;4</span><span 
+class="cmtt-10">&#x00A0;3</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;0</span>
+<br class="fancyvrb" /><a 
+ id="x1-44010r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;[1</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;0]</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;&#x003C;-</span>
+<br class="fancyvrb" /><a 
+ id="x1-44012r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;[0</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;0]</span>
+<br class="fancyvrb" /><a 
+ id="x1-44014r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;[1</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;0]</span>
+<br class="fancyvrb" /><a 
+ id="x1-44016r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;3</span><span 
+class="cmtt-10">&#x00A0;[0</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;0]</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;bytestream</span><span 
+class="cmtt-10">&#x00A0;length</span><span 
+class="cmtt-10">&#x00A0;==</span><span 
+class="cmtt-10">&#x00A0;4</span><span 
+class="cmtt-10">&#x00A0;bytes</span>
+                                                                                    
 
-</p><pre class="screen">
-  
-  1) if([sparse] is set){
+                                                                                    
+<br class="fancyvrb" /><a 
+ id="x1-44018r9"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+</div>
+<!--l. 190--><p class="noindent" >We read two, two-bit integer fields, resulting in the returned numbers &#8217;b00&#8217; and &#8217;b11&#8217;. Two things
+are worth noting here:
+     <ul class="itemize1">
+     <li class="itemize">Although these four bits were originally written as a single four-bit integer, reading
+     some other combination of bit-widths from the bitstream is well defined. There are no
+     artificial alignment boundaries maintained in the bitstream.
+     </li>
+     <li class="itemize">The second value is the two-bit-wide integer &#8217;b11&#8217;. This value may be interpreted either
+     as the unsigned value &#8217;3&#8217;, or the signed value &#8217;-1&#8217;. Signedness is dependent on decode
+     context.</li></ul>
+<!--l. 208--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">2.1.8 </span> <a 
+ id="x1-450002.1.8"></a>end-of-packet alignment</h5>
+<!--l. 210--><p class="noindent" >The typical use of bitpacking is to produce many independent byte-aligned packets which are
+embedded into a larger byte-aligned container structure, such as an Ogg transport bitstream.
+Externally, each bytestream (encoded bitstream) must begin and end on a byte boundary. Often,
+the encoded bitstream is not an integer number of bytes, and so there is unused (uncoded) space in
+the last byte of a packet.
+<!--l. 218--><p class="noindent" >Unused space in the last byte of a bytestream is always zeroed during the coding process. Thus,
+should this unused space be read, it will return binary zeroes.
+<!--l. 222--><p class="noindent" >Attempting to read past the end of an encoded packet results in an &#8217;end-of-packet&#8217; condition.
+End-of-packet is not to be considered an error; it is merely a state indicating that there is
+insufficient remaining data to fulfill the desired read size. Vorbis uses truncated packets as a normal
+mode of operation, and as such, decoders must handle reading past the end of a packet as a typical
+mode of operation. Any further read operations after an &#8217;end-of-packet&#8217; condition shall also return
+&#8217;end-of-packet&#8217;.
+<!--l. 233--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">2.1.9 </span> <a 
+ id="x1-460002.1.9"></a>reading zero bits</h5>
+<!--l. 235--><p class="noindent" >Reading a zero-bit-wide integer returns the value &#8217;0&#8217; and does not increment the stream cursor.
+Reading to the end of the packet (but not past, such that an &#8217;end-of-packet&#8217; condition has not
+triggered) and then reading a zero bit integer shall succeed, returning 0, and not trigger an
+                                                                                    
 
-         2) [flag] = read one bit;
-         3) if([flag] is set){
+                                                                                    
+end-of-packet condition. Reading a zero-bit-wide integer after a previous read sets &#8217;end-of-packet&#8217;
+shall also fail with &#8217;end-of-packet&#8217;.
+                                                                                    
 
-              4) [length] = read a five bit unsigned integer;
-              5) codeword length for this entry is [length]+1;
+                                                                                    
+                                                                                    
 
-            } else {
+                                                                                    
+<h3 class="sectionHead"><span class="titlemark">3 </span> <a 
+ id="x1-470003"></a>Probability Model and Codebooks</h3>
+<!--l. 6--><p class="noindent" >
+<h4 class="subsectionHead"><span class="titlemark">3.1 </span> <a 
+ id="x1-480003.1"></a>Overview</h4>
+<!--l. 8--><p class="noindent" >Unlike practically every other mainstream audio codec, Vorbis has no statically configured
+probability model, instead packing all entropy decoding configuration, VQ and Huffman, into the
+bitstream itself in the third header, the codec setup header. This packed configuration consists of
+multiple &#8217;codebooks&#8217;, each containing a specific Huffman-equivalent representation for decoding
+compressed codewords as well as an optional lookup table of output vector values to which a
+decoded Huffman value is applied as an offset, generating the final decoded output corresponding to
+a given compressed codeword.
+<!--l. 18--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">3.1.1 </span> <a 
+ id="x1-490003.1.1"></a>Bitwise operation</h5>
+<!--l. 19--><p class="noindent" >The codebook mechanism is built on top of the vorbis bitpacker. Both the codebooks themselves
+and the codewords they decode are unrolled from a packet as a series of arbitrary-width values read
+from the stream according to <a 
+href="#x1-360002">Section&#x00A0;2<!--tex4ht:ref: vorbis:spec:bitpacking --></a>, &#8220;<a 
+href="#x1-360002">Bitpacking Convention<!--tex4ht:ref: vorbis:spec:bitpacking --></a>&#8221;.
+<!--l. 27--><p class="noindent" >
+<h4 class="subsectionHead"><span class="titlemark">3.2 </span> <a 
+ id="x1-500003.2"></a>Packed codebook format</h4>
+<!--l. 29--><p class="noindent" >For purposes of the examples below, we assume that the storage system&#8217;s native byte width is eight
+bits. This is not universally true; see <a 
+href="#x1-360002">Section&#x00A0;2<!--tex4ht:ref: vorbis:spec:bitpacking --></a>, &#8220;<a 
+href="#x1-360002">Bitpacking Convention<!--tex4ht:ref: vorbis:spec:bitpacking --></a>&#8221; for discussion relating to
+non-eight-bit bytes.
+<!--l. 34--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">3.2.1 </span> <a 
+ id="x1-510003.2.1"></a>codebook decode</h5>
+<!--l. 36--><p class="noindent" >A codebook begins with a 24 bit sync pattern, 0x564342:
+<!--l. 38--><p class="noindent" >
+                                                                                    
 
-              6) this entry is unused.  mark it as such.
+                                                                                    
+<div class="fancyvrb" id="fancyvrb7">
+<a 
+ id="x1-51002r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;0:</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;]</span><span 
+class="cmtt-10">&#x00A0;(0x42)</span>
+<br class="fancyvrb" /><a 
+ id="x1-51004r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;1:</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;]</span><span 
+class="cmtt-10">&#x00A0;(0x43)</span>
+<br class="fancyvrb" /><a 
+ id="x1-51006r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;2:</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;]</span><span 
+class="cmtt-10">&#x00A0;(0x56)</span>
+</div>
+<!--l. 44--><p class="noindent" >16 bit <span 
+class="cmtt-10x-x-109">[codebook_dimensions] </span>and 24 bit <span 
+class="cmtt-10x-x-109">[codebook_entries] </span>fields:
+<!--l. 46--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb8">
+<a 
+ id="x1-51008r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-51010r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;3:</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;]</span>
+<br class="fancyvrb" /><a 
+ id="x1-51012r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;4:</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;]</span><span 
+class="cmtt-10">&#x00A0;[codebook_dimensions]</span><span 
+class="cmtt-10">&#x00A0;(16</span><span 
+class="cmtt-10">&#x00A0;bit</span><span 
+class="cmtt-10">&#x00A0;unsigned)</span>
+<br class="fancyvrb" /><a 
+ id="x1-51014r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-51016r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;5:</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;]</span>
+<br class="fancyvrb" /><a 
+ id="x1-51018r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;6:</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;]</span>
+<br class="fancyvrb" /><a 
+ id="x1-51020r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;7:</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;]</span><span 
+class="cmtt-10">&#x00A0;[codebook_entries]</span><span 
+class="cmtt-10">&#x00A0;(24</span><span 
+class="cmtt-10">&#x00A0;bit</span><span 
+class="cmtt-10">&#x00A0;unsigned)</span>
+<br class="fancyvrb" /><a 
+ id="x1-51022r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+</div>
+<!--l. 57--><p class="noindent" >Next is the <span 
+class="cmtt-10x-x-109">[ordered] </span>bit flag:
+<!--l. 59--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb9">
+<a 
+ id="x1-51024r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-51026r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;8:</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;]</span><span 
+class="cmtt-10">&#x00A0;[ordered]</span><span 
+class="cmtt-10">&#x00A0;(1</span><span 
+class="cmtt-10">&#x00A0;bit)</span>
+<br class="fancyvrb" /><a 
+ id="x1-51028r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+</div>
+<!--l. 65--><p class="noindent" >Each entry, numbering a total of <span 
+class="cmtt-10x-x-109">[codebook_entries]</span>, is assigned a codeword length. We now read
+the list of codeword lengths and store these lengths in the array <span 
+class="cmtt-10x-x-109">[codebook_codeword_lengths]</span>.
+Decode of lengths is according to whether the <span 
+class="cmtt-10x-x-109">[ordered] </span>flag is set or unset.
+     <ul class="itemize1">
+     <li class="itemize">If the <span 
+class="cmtt-10x-x-109">[ordered] </span>flag is unset, the codeword list is not length ordered and the decoder
+     needs to read each codeword length one-by-one.
+     <!--l. 77--><p class="noindent" >The decoder first reads one additional bit flag, the <span 
+class="cmtt-10x-x-109">[sparse] </span>flag. This flag determines
+     whether or not the codebook contains unused entries that are not to be included in the
+     codeword decode tree:
+     <!--l. 82--><p class="noindent" >
+     <div class="fancyvrb" id="fancyvrb10">
+<a 
+ id="x1-51030r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;byte</span><span 
+class="cmtt-10">&#x00A0;8:</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;X</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;]</span><span 
+class="cmtt-10">&#x00A0;[sparse]</span><span 
+class="cmtt-10">&#x00A0;flag</span><span 
+class="cmtt-10">&#x00A0;(1</span><span 
+class="cmtt-10">&#x00A0;bit)</span>
+</div>
+                                                                                    
 
-            }
+                                                                                    
+     <!--l. 86--><p class="noindent" >The decoder now performs for each of the <span 
+class="cmtt-10x-x-109">[codebook_entries] </span>codebook entries:
+     <!--l. 89--><p class="noindent" >
+     <div class="fancyvrb" id="fancyvrb11">
+<a 
+ id="x1-51032r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-51034r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1)</span><span 
+class="cmtt-10">&#x00A0;if([sparse]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;set)</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-51036r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-51038r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2)</span><span 
+class="cmtt-10">&#x00A0;[flag]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;one</span><span 
+class="cmtt-10">&#x00A0;bit;</span>
+<br class="fancyvrb" /><a 
+ id="x1-51040r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;3)</span><span 
+class="cmtt-10">&#x00A0;if([flag]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;set)</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-51042r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-51044r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;4)</span><span 
+class="cmtt-10">&#x00A0;[length]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;a</span><span 
+class="cmtt-10">&#x00A0;five</span><span 
+class="cmtt-10">&#x00A0;bit</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer;</span>
+<br class="fancyvrb" /><a 
+ id="x1-51046r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;5)</span><span 
+class="cmtt-10">&#x00A0;codeword</span><span 
+class="cmtt-10">&#x00A0;length</span><span 
+class="cmtt-10">&#x00A0;for</span><span 
+class="cmtt-10">&#x00A0;this</span><span 
+class="cmtt-10">&#x00A0;entry</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;[length]+1;</span>
+<br class="fancyvrb" /><a 
+ id="x1-51048r9"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-51050r10"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span><span 
+class="cmtt-10">&#x00A0;else</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-51052r11"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-51054r12"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;6)</span><span 
+class="cmtt-10">&#x00A0;this</span><span 
+class="cmtt-10">&#x00A0;entry</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;unused.</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;mark</span><span 
+class="cmtt-10">&#x00A0;it</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;such.</span>
+<br class="fancyvrb" /><a 
+ id="x1-51056r13"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-51058r14"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span>
+<br class="fancyvrb" /><a 
+ id="x1-51060r15"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-51062r16"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span><span 
+class="cmtt-10">&#x00A0;else</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;sparse</span><span 
+class="cmtt-10">&#x00A0;flag</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;not</span><span 
+class="cmtt-10">&#x00A0;set</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-51064r17"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-51066r18"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;7)</span><span 
+class="cmtt-10">&#x00A0;[length]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;a</span><span 
+class="cmtt-10">&#x00A0;five</span><span 
+class="cmtt-10">&#x00A0;bit</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer;</span>
+<br class="fancyvrb" /><a 
+ id="x1-51068r19"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;8)</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;codeword</span><span 
+class="cmtt-10">&#x00A0;length</span><span 
+class="cmtt-10">&#x00A0;for</span><span 
+class="cmtt-10">&#x00A0;this</span><span 
+class="cmtt-10">&#x00A0;entry</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;[length]+1;</span>
+<br class="fancyvrb" /><a 
+ id="x1-51070r20"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-51072r21"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span>
+<br class="fancyvrb" /><a 
+ id="x1-51074r22"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+</div>
+     </li>
+     <li class="itemize">If the <span 
+class="cmtt-10x-x-109">[ordered] </span>flag is set, the codeword list for this codebook is encoded in ascending length
+     order. Rather than reading a length for every codeword, the encoder reads the number of
+     codewords per length. That is, beginning at entry zero:
+     <!--l. 120--><p class="noindent" >
+     <div class="fancyvrb" id="fancyvrb12">
+<a 
+ id="x1-51076r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1)</span><span 
+class="cmtt-10">&#x00A0;[current_entry]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-51078r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2)</span><span 
+class="cmtt-10">&#x00A0;[current_length]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;a</span><span 
+class="cmtt-10">&#x00A0;five</span><span 
+class="cmtt-10">&#x00A0;bit</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span><span 
+class="cmtt-10">&#x00A0;and</span><span 
+class="cmtt-10">&#x00A0;add</span><span 
+class="cmtt-10">&#x00A0;1;</span>
+<br class="fancyvrb" /><a 
+ id="x1-51080r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;3)</span><span 
+class="cmtt-10">&#x00A0;[number]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;</span><a 
+href="#x1-1170009.2.1"><span 
+class="cmtt-10">ilog</span></a><span 
+class="cmtt-10">([codebook_entries]</span><span 
+class="cmtt-10">&#x00A0;-</span><span 
+class="cmtt-10">&#x00A0;[current_entry])</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;an</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span>
+<br class="fancyvrb" /><a 
+ id="x1-51082r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;4)</span><span 
+class="cmtt-10">&#x00A0;set</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;entries</span><span 
+class="cmtt-10">&#x00A0;[current_entry]</span><span 
+class="cmtt-10">&#x00A0;through</span><span 
+class="cmtt-10">&#x00A0;[current_entry]+[number]-1,</span><span 
+class="cmtt-10">&#x00A0;inclusive,</span>
+<br class="fancyvrb" /><a 
+ id="x1-51084r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;of</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;[codebook_codeword_lengths]</span><span 
+class="cmtt-10">&#x00A0;array</span><span 
+class="cmtt-10">&#x00A0;to</span><span 
+class="cmtt-10">&#x00A0;[current_length]</span>
+<br class="fancyvrb" /><a 
+ id="x1-51086r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;5)</span><span 
+class="cmtt-10">&#x00A0;set</span><span 
+class="cmtt-10">&#x00A0;[current_entry]</span><span 
+class="cmtt-10">&#x00A0;to</span><span 
+class="cmtt-10">&#x00A0;[number]</span><span 
+class="cmtt-10">&#x00A0;+</span><span 
+class="cmtt-10">&#x00A0;[current_entry]</span>
+<br class="fancyvrb" /><a 
+ id="x1-51088r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;6)</span><span 
+class="cmtt-10">&#x00A0;increment</span><span 
+class="cmtt-10">&#x00A0;[current_length]</span><span 
+class="cmtt-10">&#x00A0;by</span><span 
+class="cmtt-10">&#x00A0;1</span>
+<br class="fancyvrb" /><a 
+ id="x1-51090r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;7)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;[current_entry]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;greater</span><span 
+class="cmtt-10">&#x00A0;than</span><span 
+class="cmtt-10">&#x00A0;[codebook_entries]</span><span 
+class="cmtt-10">&#x00A0;ERROR</span><span 
+class="cmtt-10">&#x00A0;CONDITION;</span>
+<br class="fancyvrb" /><a 
+ id="x1-51092r9"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;decoder</span><span 
+class="cmtt-10">&#x00A0;will</span><span 
+class="cmtt-10">&#x00A0;not</span><span 
+class="cmtt-10">&#x00A0;be</span><span 
+class="cmtt-10">&#x00A0;able</span><span 
+class="cmtt-10">&#x00A0;to</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;this</span><span 
+class="cmtt-10">&#x00A0;stream.</span>
+<br class="fancyvrb" /><a 
+ id="x1-51094r10"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;8)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;[current_entry]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;less</span><span 
+class="cmtt-10">&#x00A0;than</span><span 
+class="cmtt-10">&#x00A0;[codebook_entries],</span><span 
+class="cmtt-10">&#x00A0;repeat</span><span 
+class="cmtt-10">&#x00A0;process</span><span 
+class="cmtt-10">&#x00A0;starting</span><span 
+class="cmtt-10">&#x00A0;at</span><span 
+class="cmtt-10">&#x00A0;3)</span>
+<br class="fancyvrb" /><a 
+ id="x1-51096r11"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;9)</span><span 
+class="cmtt-10">&#x00A0;done.</span>
+</div>
+     </li></ul>
+                                                                                    
 
-     } else the sparse flag is not set {
+                                                                                    
+<!--l. 136--><p class="noindent" >After all codeword lengths have been decoded, the decoder reads the vector lookup table. Vorbis I
+supports three lookup types:
+     <ol  class="enumerate1" >
+     <li 
+  class="enumerate" id="x1-51098x1">No lookup
+     </li>
+     <li 
+  class="enumerate" id="x1-51100x2">Implicitly populated value mapping (lattice VQ)
+     </li>
+     <li 
+  class="enumerate" id="x1-51102x3">Explicitly populated value mapping (tessellated or &#8217;foam&#8217; VQ)</li></ol>
+<!--l. 149--><p class="noindent" >The lookup table type is read as a four bit unsigned integer:
+<div class="fancyvrb" id="fancyvrb13">
+<a 
+ id="x1-51104r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1)</span><span 
+class="cmtt-10">&#x00A0;[codebook_lookup_type]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;four</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;an</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span>
+</div>
+<!--l. 154--><p class="noindent" >Codebook decode precedes according to <span 
+class="cmtt-10x-x-109">[codebook_lookup_type]</span>:
+     <ul class="itemize1">
+     <li class="itemize">Lookup type zero indicates no lookup to be read. Proceed past lookup decode.
+     </li>
+     <li class="itemize">Lookup types one and two are similar, differing only in the number of lookup values
+     to be read. Lookup type one reads a list of values that are permuted in a set pattern
+     to build a list of vectors, each vector of order <span 
+class="cmtt-10x-x-109">[codebook_dimensions] </span>scalars. Lookup
+     type two builds the same vector list, but reads each scalar for each vector explicitly,
+     rather than building vectors from a smaller list of possible scalar values. Lookup decode
+     proceeds as follows:
+     <!--l. 168--><p class="noindent" >
+     <div class="fancyvrb" id="fancyvrb14">
+<a 
+ id="x1-51106r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1)</span><span 
+class="cmtt-10">&#x00A0;[codebook_minimum_value]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;</span><a 
+href="#x1-1180009.2.2"><span 
+class="cmtt-10">float32_unpack</span></a><span 
+class="cmtt-10">(</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;32</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;an</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer)</span>
+<br class="fancyvrb" /><a 
+ id="x1-51108r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2)</span><span 
+class="cmtt-10">&#x00A0;[codebook_delta_value]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;</span><a 
+href="#x1-1180009.2.2"><span 
+class="cmtt-10">float32_unpack</span></a><span 
+class="cmtt-10">(</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;32</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;an</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer)</span>
+<br class="fancyvrb" /><a 
+ id="x1-51110r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;3)</span><span 
+class="cmtt-10">&#x00A0;[codebook_value_bits]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;4</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;an</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span><span 
+class="cmtt-10">&#x00A0;and</span><span 
+class="cmtt-10">&#x00A0;add</span><span 
+class="cmtt-10">&#x00A0;1</span>
+<br class="fancyvrb" /><a 
+ id="x1-51112r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;4)</span><span 
+class="cmtt-10">&#x00A0;[codebook_sequence_p]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;bit</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;a</span><span 
+class="cmtt-10">&#x00A0;boolean</span><span 
+class="cmtt-10">&#x00A0;flag</span>
+<br class="fancyvrb" /><a 
+ id="x1-51114r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-51116r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;(</span><span 
+class="cmtt-10">&#x00A0;[codebook_lookup_type]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;)</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-51118r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-51120r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;5)</span><span 
+class="cmtt-10">&#x00A0;[codebook_lookup_values]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;</span><a 
+href="#x1-1190009.2.3"><span 
+class="cmtt-10">lookup1_values</span></a><span 
+class="cmtt-10">([codebook_entries],</span><span 
+class="cmtt-10">&#x00A0;[codebook_dimensions]</span><span 
+class="cmtt-10">&#x00A0;)</span>
+<br class="fancyvrb" /><a 
+ id="x1-51122r9"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-51124r10"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span><span 
+class="cmtt-10">&#x00A0;else</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-51126r11"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-51128r12"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;6)</span><span 
+class="cmtt-10">&#x00A0;[codebook_lookup_values]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[codebook_entries]</span><span 
+class="cmtt-10">&#x00A0;*</span><span 
+class="cmtt-10">&#x00A0;[codebook_dimensions]</span>
+<br class="fancyvrb" /><a 
+ id="x1-51130r13"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-51132r14"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span>
+<br class="fancyvrb" /><a 
+ id="x1-51134r15"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-51136r16"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;7)</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;a</span><span 
+class="cmtt-10">&#x00A0;total</span><span 
+class="cmtt-10">&#x00A0;of</span><span 
+class="cmtt-10">&#x00A0;[codebook_lookup_values]</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integers</span><span 
+class="cmtt-10">&#x00A0;of</span><span 
+class="cmtt-10">&#x00A0;[codebook_value_bits]</span><span 
+class="cmtt-10">&#x00A0;each;</span>
+<br class="fancyvrb" /><a 
+ id="x1-51138r17"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;store</span><span 
+class="cmtt-10">&#x00A0;these</span><span 
+class="cmtt-10">&#x00A0;in</span><span 
+class="cmtt-10">&#x00A0;order</span><span 
+class="cmtt-10">&#x00A0;in</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;array</span><span 
+class="cmtt-10">&#x00A0;[codebook_multiplicands]</span>
+</div>
+                                                                                    
 
-        7) [length] = read a five bit unsigned integer;
-        8) the codeword length for this entry is [length]+1;
-        
-     }
+                                                                                    
+     </li>
+     <li class="itemize">A <span 
+class="cmtt-10x-x-109">[codebook_lookup_type] </span>of greater than two is reserved and indicates a stream that is not
+     decodable by the specification in this document.
+     </li></ul>
+<!--l. 195--><p class="noindent" >An &#8217;end of packet&#8217; during any read operation in the above steps is considered an error condition
+rendering the stream undecodable.
+<!--l. 198--><p class="noindent" ><span class="paragraphHead"><a 
+ id="x1-520003.2.1"></a><span 
+class="cmbx-10x-x-109">Huffman decision tree representation</span></span>
+The <span 
+class="cmtt-10x-x-109">[codebook_codeword_lengths] </span>array and <span 
+class="cmtt-10x-x-109">[codebook_entries] </span>value uniquely define the
+Huffman decision tree used for entropy decoding.
+<!--l. 204--><p class="noindent" >Briefly, each used codebook entry (recall that length-unordered codebooks support unused codeword
+entries) is assigned, in order, the lowest valued unused binary Huffman codeword possible. Assume
+the following codeword length list:
+<!--l. 209--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb15">
+<a 
+ id="x1-52002r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;entry</span><span 
+class="cmtt-10">&#x00A0;0:</span><span 
+class="cmtt-10">&#x00A0;length</span><span 
+class="cmtt-10">&#x00A0;2</span>
+<br class="fancyvrb" /><a 
+ id="x1-52004r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;entry</span><span 
+class="cmtt-10">&#x00A0;1:</span><span 
+class="cmtt-10">&#x00A0;length</span><span 
+class="cmtt-10">&#x00A0;4</span>
+<br class="fancyvrb" /><a 
+ id="x1-52006r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;entry</span><span 
+class="cmtt-10">&#x00A0;2:</span><span 
+class="cmtt-10">&#x00A0;length</span><span 
+class="cmtt-10">&#x00A0;4</span>
+<br class="fancyvrb" /><a 
+ id="x1-52008r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;entry</span><span 
+class="cmtt-10">&#x00A0;3:</span><span 
+class="cmtt-10">&#x00A0;length</span><span 
+class="cmtt-10">&#x00A0;4</span>
+<br class="fancyvrb" /><a 
+ id="x1-52010r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;entry</span><span 
+class="cmtt-10">&#x00A0;4:</span><span 
+class="cmtt-10">&#x00A0;length</span><span 
+class="cmtt-10">&#x00A0;4</span>
+<br class="fancyvrb" /><a 
+ id="x1-52012r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;entry</span><span 
+class="cmtt-10">&#x00A0;5:</span><span 
+class="cmtt-10">&#x00A0;length</span><span 
+class="cmtt-10">&#x00A0;2</span>
+<br class="fancyvrb" /><a 
+ id="x1-52014r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;entry</span><span 
+class="cmtt-10">&#x00A0;6:</span><span 
+class="cmtt-10">&#x00A0;length</span><span 
+class="cmtt-10">&#x00A0;3</span>
+<br class="fancyvrb" /><a 
+ id="x1-52016r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;entry</span><span 
+class="cmtt-10">&#x00A0;7:</span><span 
+class="cmtt-10">&#x00A0;length</span><span 
+class="cmtt-10">&#x00A0;3</span>
+</div>
+<!--l. 220--><p class="noindent" >Assigning codewords in order (lowest possible value of the appropriate length to highest) results in
+the following codeword list:
+<!--l. 223--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb16">
+<a 
+ id="x1-52018r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;entry</span><span 
+class="cmtt-10">&#x00A0;0:</span><span 
+class="cmtt-10">&#x00A0;length</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;codeword</span><span 
+class="cmtt-10">&#x00A0;00</span>
+<br class="fancyvrb" /><a 
+ id="x1-52020r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;entry</span><span 
+class="cmtt-10">&#x00A0;1:</span><span 
+class="cmtt-10">&#x00A0;length</span><span 
+class="cmtt-10">&#x00A0;4</span><span 
+class="cmtt-10">&#x00A0;codeword</span><span 
+class="cmtt-10">&#x00A0;0100</span>
+<br class="fancyvrb" /><a 
+ id="x1-52022r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;entry</span><span 
+class="cmtt-10">&#x00A0;2:</span><span 
+class="cmtt-10">&#x00A0;length</span><span 
+class="cmtt-10">&#x00A0;4</span><span 
+class="cmtt-10">&#x00A0;codeword</span><span 
+class="cmtt-10">&#x00A0;0101</span>
+<br class="fancyvrb" /><a 
+ id="x1-52024r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;entry</span><span 
+class="cmtt-10">&#x00A0;3:</span><span 
+class="cmtt-10">&#x00A0;length</span><span 
+class="cmtt-10">&#x00A0;4</span><span 
+class="cmtt-10">&#x00A0;codeword</span><span 
+class="cmtt-10">&#x00A0;0110</span>
+<br class="fancyvrb" /><a 
+ id="x1-52026r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;entry</span><span 
+class="cmtt-10">&#x00A0;4:</span><span 
+class="cmtt-10">&#x00A0;length</span><span 
+class="cmtt-10">&#x00A0;4</span><span 
+class="cmtt-10">&#x00A0;codeword</span><span 
+class="cmtt-10">&#x00A0;0111</span>
+<br class="fancyvrb" /><a 
+ id="x1-52028r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;entry</span><span 
+class="cmtt-10">&#x00A0;5:</span><span 
+class="cmtt-10">&#x00A0;length</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;codeword</span><span 
+class="cmtt-10">&#x00A0;10</span>
+<br class="fancyvrb" /><a 
+ id="x1-52030r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;entry</span><span 
+class="cmtt-10">&#x00A0;6:</span><span 
+class="cmtt-10">&#x00A0;length</span><span 
+class="cmtt-10">&#x00A0;3</span><span 
+class="cmtt-10">&#x00A0;codeword</span><span 
+class="cmtt-10">&#x00A0;110</span>
+<br class="fancyvrb" /><a 
+ id="x1-52032r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;entry</span><span 
+class="cmtt-10">&#x00A0;7:</span><span 
+class="cmtt-10">&#x00A0;length</span><span 
+class="cmtt-10">&#x00A0;3</span><span 
+class="cmtt-10">&#x00A0;codeword</span><span 
+class="cmtt-10">&#x00A0;111</span>
+</div>
+                                                                                    
 
-</pre></li><li><p>If the <code class="varname">[ordered]</code> flag is set, the codeword list for this
-  codebook is encoded in ascending length order.  Rather than reading
-  a length for every codeword, the encoder reads the number of
-  codewords per length.  That is, beginning at entry zero:
+                                                                                    
+<!--l. 235--><p class="noindent" ><span class="likesubparagraphHead"><a 
+ id="x1-530003.2.1"></a><span 
+class="cmbx-10x-x-109">Note:</span></span> Unlike most binary numerical values in this document, we intend the above codewords to be
+read and used bit by bit from left to right, thus the codeword &#8217;001&#8217; is the bit string &#8217;zero, zero, one&#8217;.
+When determining &#8217;lowest possible value&#8217; in the assignment definition above, the leftmost bit is the
+MSb.
+<!--l. 243--><p class="noindent" >It is clear that the codeword length list represents a Huffman decision tree with the entry numbers
+equivalent to the leaves numbered left-to-right:
+<div class="center" 
+>
+<!--l. 247--><p class="noindent" >
 
-</p><pre class="screen">
-  1) [current_entry] = 0;
-  2) [current_length] = read a five bit unsigned integer and add 1;
-  3) [number] = read <a href="#vorbis-spec-ilog" title="9.2.1. ilog">ilog</a>([codebook_entries] - [current_entry]) bits as an unsigned integer
-  4) set the entries [current_entry] through [current_entry]+[number]-1, inclusive, 
-    of the [codebook_codeword_lengths] array to [current_length]
-  5) set [current_entry] to [number] + [current_entry]
-  6) increment [current_length] by 1
-  7) if [current_entry] is greater than [codebook_entries] ERROR CONDITION; 
-    the decoder will not be able to read this stream.
-  8) if [current_entry] is less than [codebook_entries], repeat process starting at 3)
-  9) done.
-</pre></li></ul></div><p>
+<!--l. 248--><p class="noindent" ><img 
+src="hufftree.png" alt="PIC"  
+>
+<br /> <table class="caption" 
+><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure&#x00A0;4: </td><td  
+class="content">huffman tree illustration</td></tr></table><!--tex4ht:label?: x1-530014 -->
+</div>
+<!--l. 253--><p class="noindent" >As we assign codewords in order, we see that each choice constructs a new leaf in the leftmost
+possible position.
+<!--l. 256--><p class="noindent" >Note that it&#8217;s possible to underspecify or overspecify a Huffman tree via the length list. In the above
+example, if codeword seven were eliminated, it&#8217;s clear that the tree is unfinished:
+<div class="center" 
+>
+<!--l. 260--><p class="noindent" >
 
-After all codeword lengths have been decoded, the decoder reads the
-vector lookup table.  Vorbis I supports three lookup types:
-</p><div class="orderedlist"><ol type="1"><li>No lookup</li><li>Implicitly populated value mapping (lattice VQ)</li><li>Explicitly populated value mapping (tessellated or 'foam'
-VQ)</li></ol></div><p>
-</p><p>
-The lookup table type is read as a four bit unsigned integer:
-</p><pre class="screen">
-  1) [codebook_lookup_type] = read four bits as an unsigned integer
-</pre><p>
-Codebook decode precedes according to <code class="varname">[codebook_lookup_type]</code>:
-</p><div class="itemizedlist"><ul type="disc"><li><p>Lookup type zero indicates no lookup to be read.  Proceed past
-lookup decode.</p></li><li><p>Lookup types one and two are similar, differing only in the
-number of lookup values to be read.  Lookup type one reads a list of
-values that are permuted in a set pattern to build a list of vectors,
-each vector of order <code class="varname">[codebook_dimensions]</code> scalars.  Lookup
-type two builds the same vector list, but reads each scalar for each
-vector explicitly, rather than building vectors from a smaller list of
-possible scalar values.  Lookup decode proceeds as follows:
-
-</p><pre class="screen">
-  1) [codebook_minimum_value] = <a href="#vorbis-spec-float32_unpack" title="9.2.2. float32_unpack">float32_unpack</a>( read 32 bits as an unsigned integer) 
-  2) [codebook_delta_value] = <a href="#vorbis-spec-float32_unpack" title="9.2.2. float32_unpack">float32_unpack</a>( read 32 bits as an unsigned integer) 
-  3) [codebook_value_bits] = read 4 bits as an unsigned integer and add 1
-  4) [codebook_sequence_p] = read 1 bit as a boolean flag
-
-  if ( [codebook_lookup_type] is 1 ) {
-   
-     5) [codebook_lookup_values] = <a href="#vorbis-spec-lookup1_values" title="9.2.3. lookup1_values">lookup1_values</a>(<code class="varname">[codebook_entries]</code>, <code class="varname">[codebook_dimensions]</code> )
-
-  } else {
-
-     6) [codebook_lookup_values] = <code class="varname">[codebook_entries]</code> * <code class="varname">[codebook_dimensions]</code>
-
-  }
-
-  7) read a total of [codebook_lookup_values] unsigned integers of [codebook_value_bits] each; 
-     store these in order in the array [codebook_multiplicands]
-</pre></li><li><p>A <code class="varname">[codebook_lookup_type]</code> of greater than two is reserved
-and indicates a stream that is not decodable by the specification in this
-document.</p></li></ul></div><p>
-</p><p>
-An 'end of packet' during any read operation in the above steps is
-considered an error condition rendering the stream undecodable.</p><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id257433"></a>3.2.1.1. Huffman decision tree representation</h5></div></div></div><p>
-The <code class="varname">[codebook_codeword_lengths]</code> array and
-<code class="varname">[codebook_entries]</code> value uniquely define the Huffman decision
-tree used for entropy decoding.</p><p>
-Briefly, each used codebook entry (recall that length-unordered
-codebooks support unused codeword entries) is assigned, in order, the
-lowest valued unused binary Huffman codeword possible.  Assume the
-following codeword length list:
-
-</p><pre class="screen">
-entry 0: length 2
-entry 1: length 4
-entry 2: length 4
-entry 3: length 4
-entry 4: length 4
-entry 5: length 2
-entry 6: length 3
-entry 7: length 3
-</pre><p>
-Assigning codewords in order (lowest possible value of the appropriate
-length to highest) results in the following codeword list:
-
-</p><pre class="screen">
-entry 0: length 2 codeword 00
-entry 1: length 4 codeword 0100
-entry 2: length 4 codeword 0101
-entry 3: length 4 codeword 0110
-entry 4: length 4 codeword 0111
-entry 5: length 2 codeword 10
-entry 6: length 3 codeword 110
-entry 7: length 3 codeword 111
-</pre><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
-Unlike most binary numerical values in this document, we
-intend the above codewords to be read and used bit by bit from left to
-right, thus the codeword '001' is the bit string 'zero, zero, one'.
-When determining 'lowest possible value' in the assignment definition
-above, the leftmost bit is the MSb.</p></div><p>
-It is clear that the codeword length list represents a Huffman
-decision tree with the entry numbers equivalent to the leaves numbered
-left-to-right:
-
-</p><div class="mediaobject"><img src="hufftree.png" alt="[huffman tree illustration]"></div><p>
-</p><p>
-As we assign codewords in order, we see that each choice constructs a
-new leaf in the leftmost possible position.</p><p>
-Note that it's possible to underspecify or overspecify a Huffman tree
-via the length list.  In the above example, if codeword seven were
-eliminated, it's clear that the tree is unfinished:
-
-</p><div class="mediaobject"><img src="hufftree-under.png" alt="[underspecified huffman tree illustration]"></div><p>
-</p><p>
-Similarly, in the original codebook, it's clear that the tree is fully
-populated and a ninth codeword is impossible.  Both underspecified and
-overspecified trees are an error condition rendering the stream
-undecodable.</p><p>
-Codebook entries marked 'unused' are simply skipped in the assigning
-process.  They have no codeword and do not appear in the decision
-tree, thus it's impossible for any bit pattern read from the stream to
-decode to that entry number.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id320556"></a>3.2.1.2. VQ lookup table vector representation</h5></div></div></div><p>
+<!--l. 261--><p class="noindent" ><img 
+src="hufftree-under.png" alt="PIC"  
+>
+<br /> <table class="caption" 
+><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure&#x00A0;5: </td><td  
+class="content">underspecified huffman tree illustration</td></tr></table><!--tex4ht:label?: x1-530025 -->
+</div>
+<!--l. 266--><p class="noindent" >Similarly, in the original codebook, it&#8217;s clear that the tree is fully populated and a ninth codeword is
+impossible. Both underspecified and overspecified trees are an error condition rendering the stream
+undecodable.
+<!--l. 271--><p class="noindent" >Codebook entries marked &#8217;unused&#8217; are simply skipped in the assigning process. They have no
+codeword and do not appear in the decision tree, thus it&#8217;s impossible for any bit pattern read from
+the stream to decode to that entry number.
+<!--l. 278--><p class="noindent" ><span class="paragraphHead"><a 
+ id="x1-540003.2.1"></a><span 
+class="cmbx-10x-x-109">VQ lookup table vector representation</span></span>
 Unpacking the VQ lookup table vectors relies on the following values:
-</p><pre class="programlisting">
-the [codebook_multiplicands] array
-[codebook_minimum_value]
-[codebook_delta_value]
-[codebook_sequence_p]
-[codebook_lookup_type]
-[codebook_entries]
-[codebook_dimensions]
-[codebook_lookup_values]
-</pre><p>
-</p><p>
-Decoding (unpacking) a specific vector in the vector lookup table
-proceeds according to <code class="varname">[codebook_lookup_type]</code>.  The unpacked
-vector values are what a codebook would return during audio packet
-decode in a VQ context.</p><div class="section" lang="en"><div class="titlepage"><div><div><h6 class="title"><a name="id320581"></a>3.2.1.2.1. Vector value decode: Lookup type 1</h6></div></div></div><p>
-Lookup type one specifies a lattice VQ lookup table built
-algorithmically from a list of scalar values.  Calculate (unpack) the
-final values of a codebook entry vector from the entries in
-<code class="varname">[codebook_multiplicands]</code> as follows (<code class="varname">[value_vector]</code>
-is the output vector representing the vector of values for entry number
-<code class="varname">[lookup_offset]</code> in this codebook):
+<div class="fancyvrb" id="fancyvrb17">
+                                                                                    
 
-</p><pre class="screen">
-  1) [last] = 0;
-  2) [index_divisor] = 1;
-  3) iterate [i] over the range 0 ... [codebook_dimensions]-1 (once for each scalar value in the value vector) {
-       
-       4) [multiplicand_offset] = ( [lookup_offset] divided by [index_divisor] using integer 
-          division ) integer modulo [codebook_lookup_values]
+                                                                                    
+<a 
+ id="x1-54002r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;[codebook_multiplicands]</span><span 
+class="cmtt-10">&#x00A0;array</span>
+<br class="fancyvrb" /><a 
+ id="x1-54004r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;[codebook_minimum_value]</span>
+<br class="fancyvrb" /><a 
+ id="x1-54006r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;[codebook_delta_value]</span>
+<br class="fancyvrb" /><a 
+ id="x1-54008r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;[codebook_sequence_p]</span>
+<br class="fancyvrb" /><a 
+ id="x1-54010r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;[codebook_lookup_type]</span>
+<br class="fancyvrb" /><a 
+ id="x1-54012r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;[codebook_entries]</span>
+<br class="fancyvrb" /><a 
+ id="x1-54014r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;[codebook_dimensions]</span>
+<br class="fancyvrb" /><a 
+ id="x1-54016r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;[codebook_lookup_values]</span>
+</div>
+<!--l. 294--><p class="noindent" >Decoding (unpacking) a specific vector in the vector lookup table proceeds according to
+<span 
+class="cmtt-10x-x-109">[codebook_lookup_type]</span>. The unpacked vector values are what a codebook would return during
+audio packet decode in a VQ context.
+<!--l. 299--><p class="noindent" ><span class="paragraphHead"><a 
+ id="x1-550003.2.1"></a><span 
+class="cmbx-10x-x-109">Vector value decode: Lookup type 1</span></span>
+Lookup type one specifies a lattice VQ lookup table built algorithmically from a list of scalar
+values. Calculate (unpack) the final values of a codebook entry vector from the entries in
+<span 
+class="cmtt-10x-x-109">[codebook_multiplicands] </span>as follows (<span 
+class="cmtt-10x-x-109">[value_vector] </span>is the output vector representing the
+vector of values for entry number <span 
+class="cmtt-10x-x-109">[lookup_offset] </span>in this codebook):
+<!--l. 308--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb18">
+<a 
+ id="x1-55002r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1)</span><span 
+class="cmtt-10">&#x00A0;[last]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-55004r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2)</span><span 
+class="cmtt-10">&#x00A0;[index_divisor]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;1;</span>
+<br class="fancyvrb" /><a 
+ id="x1-55006r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;3)</span><span 
+class="cmtt-10">&#x00A0;iterate</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;over</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;range</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;...</span><span 
+class="cmtt-10">&#x00A0;[codebook_dimensions]-1</span><span 
+class="cmtt-10">&#x00A0;(once</span><span 
+class="cmtt-10">&#x00A0;for</span><span 
+class="cmtt-10">&#x00A0;each</span><span 
+class="cmtt-10">&#x00A0;scalar</span><span 
+class="cmtt-10">&#x00A0;value</span><span 
+class="cmtt-10">&#x00A0;in</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;value</span><span 
+class="cmtt-10">&#x00A0;vector)</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-55008r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-55010r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;4)</span><span 
+class="cmtt-10">&#x00A0;[multiplicand_offset]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;(</span><span 
+class="cmtt-10">&#x00A0;[lookup_offset]</span><span 
+class="cmtt-10">&#x00A0;divided</span><span 
+class="cmtt-10">&#x00A0;by</span><span 
+class="cmtt-10">&#x00A0;[index_divisor]</span><span 
+class="cmtt-10">&#x00A0;using</span><span 
+class="cmtt-10">&#x00A0;integer</span>
+<br class="fancyvrb" /><a 
+ id="x1-55012r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;division</span><span 
+class="cmtt-10">&#x00A0;)</span><span 
+class="cmtt-10">&#x00A0;integer</span><span 
+class="cmtt-10">&#x00A0;modulo</span><span 
+class="cmtt-10">&#x00A0;[codebook_lookup_values]</span>
+<br class="fancyvrb" /><a 
+ id="x1-55014r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-55016r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;5)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[value_vector]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;=</span>
+<br class="fancyvrb" /><a 
+ id="x1-55018r9"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;(</span><span 
+class="cmtt-10">&#x00A0;[codebook_multiplicands]</span><span 
+class="cmtt-10">&#x00A0;array</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;number</span><span 
+class="cmtt-10">&#x00A0;[multiplicand_offset]</span><span 
+class="cmtt-10">&#x00A0;)</span><span 
+class="cmtt-10">&#x00A0;*</span>
+<br class="fancyvrb" /><a 
+ id="x1-55020r10"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;[codebook_delta_value]</span><span 
+class="cmtt-10">&#x00A0;+</span><span 
+class="cmtt-10">&#x00A0;[codebook_minimum_value]</span><span 
+class="cmtt-10">&#x00A0;+</span><span 
+class="cmtt-10">&#x00A0;[last];</span>
+<br class="fancyvrb" /><a 
+ id="x1-55022r11"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-55024r12"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;6)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;(</span><span 
+class="cmtt-10">&#x00A0;[codebook_sequence_p]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;set</span><span 
+class="cmtt-10">&#x00A0;)</span><span 
+class="cmtt-10">&#x00A0;then</span><span 
+class="cmtt-10">&#x00A0;set</span><span 
+class="cmtt-10">&#x00A0;[last]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[value_vector]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[i]</span>
+<br class="fancyvrb" /><a 
+ id="x1-55026r13"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-55028r14"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;7)</span><span 
+class="cmtt-10">&#x00A0;[index_divisor]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[index_divisor]</span><span 
+class="cmtt-10">&#x00A0;*</span><span 
+class="cmtt-10">&#x00A0;[codebook_lookup_values]</span>
+<br class="fancyvrb" /><a 
+ id="x1-55030r15"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-55032r16"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span>
+<br class="fancyvrb" /><a 
+ id="x1-55034r17"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-55036r18"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;8)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;calculation</span><span 
+class="cmtt-10">&#x00A0;completed.</span>
+</div>
+<!--l. 331--><p class="noindent" ><span class="paragraphHead"><a 
+ id="x1-560003.2.1"></a><span 
+class="cmbx-10x-x-109">Vector value decode: Lookup type 2</span></span>
+                                                                                    
 
-       5) vector [value_vector] element [i] = 
-            ( [codebook_multiplicands] array element number [multiplicand_offset] ) *
-            [codebook_delta_value] + [codebook_minimum_value] + [last];
+                                                                                    
+Lookup type two specifies a VQ lookup table in which each scalar in each vector is explicitly set by
+the <span 
+class="cmtt-10x-x-109">[codebook_multiplicands] </span>array in a one-to-one mapping. Calculate [unpack] the final values
+of a codebook entry vector from the entries in <span 
+class="cmtt-10x-x-109">[codebook_multiplicands] </span>as follows
+(<span 
+class="cmtt-10x-x-109">[value_vector] </span>is the output vector representing the vector of values for entry number
+<span 
+class="cmtt-10x-x-109">[lookup_offset] </span>in this codebook):
+<!--l. 341--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb19">
+<a 
+ id="x1-56002r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1)</span><span 
+class="cmtt-10">&#x00A0;[last]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-56004r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2)</span><span 
+class="cmtt-10">&#x00A0;[multiplicand_offset]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[lookup_offset]</span><span 
+class="cmtt-10">&#x00A0;*</span><span 
+class="cmtt-10">&#x00A0;[codebook_dimensions]</span>
+<br class="fancyvrb" /><a 
+ id="x1-56006r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;3)</span><span 
+class="cmtt-10">&#x00A0;iterate</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;over</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;range</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;...</span><span 
+class="cmtt-10">&#x00A0;[codebook_dimensions]-1</span><span 
+class="cmtt-10">&#x00A0;(once</span><span 
+class="cmtt-10">&#x00A0;for</span><span 
+class="cmtt-10">&#x00A0;each</span><span 
+class="cmtt-10">&#x00A0;scalar</span><span 
+class="cmtt-10">&#x00A0;value</span><span 
+class="cmtt-10">&#x00A0;in</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;value</span><span 
+class="cmtt-10">&#x00A0;vector)</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-56008r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-56010r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;4)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[value_vector]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;=</span>
+<br class="fancyvrb" /><a 
+ id="x1-56012r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;(</span><span 
+class="cmtt-10">&#x00A0;[codebook_multiplicands]</span><span 
+class="cmtt-10">&#x00A0;array</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;number</span><span 
+class="cmtt-10">&#x00A0;[multiplicand_offset]</span><span 
+class="cmtt-10">&#x00A0;)</span><span 
+class="cmtt-10">&#x00A0;*</span>
+<br class="fancyvrb" /><a 
+ id="x1-56014r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;[codebook_delta_value]</span><span 
+class="cmtt-10">&#x00A0;+</span><span 
+class="cmtt-10">&#x00A0;[codebook_minimum_value]</span><span 
+class="cmtt-10">&#x00A0;+</span><span 
+class="cmtt-10">&#x00A0;[last];</span>
+<br class="fancyvrb" /><a 
+ id="x1-56016r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-56018r9"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;5)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;(</span><span 
+class="cmtt-10">&#x00A0;[codebook_sequence_p]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;set</span><span 
+class="cmtt-10">&#x00A0;)</span><span 
+class="cmtt-10">&#x00A0;then</span><span 
+class="cmtt-10">&#x00A0;set</span><span 
+class="cmtt-10">&#x00A0;[last]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[value_vector]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[i]</span>
+<br class="fancyvrb" /><a 
+ id="x1-56020r10"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-56022r11"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;6)</span><span 
+class="cmtt-10">&#x00A0;increment</span><span 
+class="cmtt-10">&#x00A0;[multiplicand_offset]</span>
+<br class="fancyvrb" /><a 
+ id="x1-56024r12"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-56026r13"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span>
+<br class="fancyvrb" /><a 
+ id="x1-56028r14"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-56030r15"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;7)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;calculation</span><span 
+class="cmtt-10">&#x00A0;completed.</span>
+</div>
+<!--l. 367--><p class="noindent" >
+<h4 class="subsectionHead"><span class="titlemark">3.3 </span> <a 
+ id="x1-570003.3"></a>Use of the codebook abstraction</h4>
+<!--l. 369--><p class="noindent" >The decoder uses the codebook abstraction much as it does the bit-unpacking convention; a specific
+codebook reads a codeword from the bitstream, decoding it into an entry number, and then returns
+that entry number to the decoder (when used in a scalar entropy coding context), or uses
+that entry number as an offset into the VQ lookup table, returning a vector of values
+(when used in a context desiring a VQ value). Scalar or VQ context is always explicit;
+any call to the codebook mechanism requests either a scalar entry number or a lookup
+vector.
+<!--l. 379--><p class="noindent" >Note that VQ lookup type zero indicates that there is no lookup table; requesting decode using a
+codebook of lookup type 0 in any context expecting a vector return value (even in a case where a
+vector of dimension one) is forbidden. If decoder setup or decode requests such an action, that is an
+error condition rendering the packet undecodable.
+<!--l. 386--><p class="noindent" >Using a codebook to read from the packet bitstream consists first of reading and decoding
+the next codeword in the bitstream. The decoder reads bits until the accumulated bits
+match a codeword in the codebook. This process can be though of as logically walking
+the Huffman decode tree by reading one bit at a time from the bitstream, and using
+                                                                                    
 
-       6) if ( [codebook_sequence_p] is set ) then set [last] = vector [value_vector] element [i]
+                                                                                    
+the bit as a decision boolean to take the 0 branch (left in the above examples) or the 1
+branch (right in the above examples). Walking the tree finishes when the decode process
+hits a leaf in the decision tree; the result is the entry number corresponding to that
+leaf. Reading past the end of a packet propagates the &#8217;end-of-stream&#8217; condition to the
+decoder.
+<!--l. 398--><p class="noindent" >When used in a scalar context, the resulting codeword entry is the desired return value.
+<!--l. 401--><p class="noindent" >When used in a VQ context, the codeword entry number is used as an offset into the VQ lookup
+table. The value returned to the decoder is the vector of scalars corresponding to this
+offset.
+                                                                                    
 
-       7) [index_divisor] = [index_divisor] * [codebook_lookup_values]
+                                                                                    
+                                                                                    
 
-     }
- 
-  8) vector calculation completed.
-</pre></div><div class="section" lang="en"><div class="titlepage"><div><div><h6 class="title"><a name="id320614"></a>3.2.1.2.2. Vector value decode: Lookup type 2</h6></div></div></div><p>
-Lookup type two specifies a VQ lookup table in which each scalar in
-each vector is explicitly set by the <code class="varname">[codebook_multiplicands]</code>
-array in a one-to-one mapping.  Calculate [unpack] the
-final values of a codebook entry vector from the entries in
-<code class="varname">[codebook_multiplicands]</code> as follows (<code class="varname">[value_vector]</code>
-is the output vector representing the vector of values for entry number
-<code class="varname">[lookup_offset]</code> in this codebook):
+                                                                                    
+<h3 class="sectionHead"><span class="titlemark">4 </span> <a 
+ id="x1-580004"></a>Codec Setup and Packet Decode</h3>
+<!--l. 6--><p class="noindent" >
+<h4 class="subsectionHead"><span class="titlemark">4.1 </span> <a 
+ id="x1-590004.1"></a>Overview</h4>
+<!--l. 8--><p class="noindent" >This document serves as the top-level reference document for the bit-by-bit decode specification of
+Vorbis I. This document assumes a high-level understanding of the Vorbis decode process, which is
+provided in <a 
+href="#x1-20001">Section&#x00A0;1<!--tex4ht:ref: vorbis:spec:intro --></a>, &#8220;<a 
+href="#x1-20001">Introduction and Description<!--tex4ht:ref: vorbis:spec:intro --></a>&#8221;. <a 
+href="#x1-360002">Section&#x00A0;2<!--tex4ht:ref: vorbis:spec:bitpacking --></a>, &#8220;<a 
+href="#x1-360002">Bitpacking Convention<!--tex4ht:ref: vorbis:spec:bitpacking --></a>&#8221; covers
+reading and writing bit fields from and to bitstream packets.
+<!--l. 16--><p class="noindent" >
+<h4 class="subsectionHead"><span class="titlemark">4.2 </span> <a 
+ id="x1-600004.2"></a>Header decode and decode setup</h4>
+<!--l. 18--><p class="noindent" >A Vorbis bitstream begins with three header packets. The header packets are, in order, the
+identification header, the comments header, and the setup header. All are required for decode
+compliance. An end-of-packet condition during decoding the first or third header packet renders the
+stream undecodable. End-of-packet decoding the comment header is a non-fatal error
+condition.
+<!--l. 25--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">4.2.1 </span> <a 
+ id="x1-610004.2.1"></a>Common header decode</h5>
+<!--l. 27--><p class="noindent" >Each header packet begins with the same header fields.
+<!--l. 30--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb20">
+<a 
+ id="x1-61002r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1)</span><span 
+class="cmtt-10">&#x00A0;[packet_type]</span><span 
+class="cmtt-10">&#x00A0;:</span><span 
+class="cmtt-10">&#x00A0;8</span><span 
+class="cmtt-10">&#x00A0;bit</span><span 
+class="cmtt-10">&#x00A0;value</span>
+<br class="fancyvrb" /><a 
+ id="x1-61004r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2)</span><span 
+class="cmtt-10">&#x00A0;0x76,</span><span 
+class="cmtt-10">&#x00A0;0x6f,</span><span 
+class="cmtt-10">&#x00A0;0x72,</span><span 
+class="cmtt-10">&#x00A0;0x62,</span><span 
+class="cmtt-10">&#x00A0;0x69,</span><span 
+class="cmtt-10">&#x00A0;0x73:</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;characters</span><span 
+class="cmtt-10">&#x00A0;&#8217;v&#8217;,&#8217;o&#8217;,&#8217;r&#8217;,&#8217;b&#8217;,&#8217;i&#8217;,&#8217;s&#8217;</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;six</span><span 
+class="cmtt-10">&#x00A0;octets</span>
+</div>
+<!--l. 35--><p class="noindent" >Decode continues according to packet type; the identification header is type 1, the comment header
+type 3 and the setup header type 5 (these types are all odd as a packet with a leading single bit of
+&#8217;0&#8217; is an audio packet). The packets must occur in the order of identification, comment,
+setup.
+                                                                                    
 
-</p><pre class="screen">
-  1) [last] = 0;
-  2) [multiplicand_offset] = [lookup_offset] * [codebook_dimensions]
-  3) iterate [i] over the range 0 ... [codebook_dimensions]-1 (once for each scalar value in the value vector) {
+                                                                                    
+<!--l. 43--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">4.2.2 </span> <a 
+ id="x1-620004.2.2"></a>Identification header</h5>
+<!--l. 45--><p class="noindent" >The identification header is a short header of only a few fields used to declare the stream definitively
+as Vorbis, and provide a few externally relevant pieces of information about the audio stream. The
+identification header is coded as follows:
+<!--l. 50--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb21">
+<a 
+ id="x1-62002r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1)</span><span 
+class="cmtt-10">&#x00A0;[vorbis_version]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;32</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span>
+<br class="fancyvrb" /><a 
+ id="x1-62004r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2)</span><span 
+class="cmtt-10">&#x00A0;[audio_channels]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;8</span><span 
+class="cmtt-10">&#x00A0;bit</span><span 
+class="cmtt-10">&#x00A0;integer</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;unsigned</span>
+<br class="fancyvrb" /><a 
+ id="x1-62006r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;3)</span><span 
+class="cmtt-10">&#x00A0;[audio_sample_rate]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;32</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span>
+<br class="fancyvrb" /><a 
+ id="x1-62008r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;4)</span><span 
+class="cmtt-10">&#x00A0;[bitrate_maximum]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;32</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;signed</span><span 
+class="cmtt-10">&#x00A0;integer</span>
+<br class="fancyvrb" /><a 
+ id="x1-62010r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;5)</span><span 
+class="cmtt-10">&#x00A0;[bitrate_nominal]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;32</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;signed</span><span 
+class="cmtt-10">&#x00A0;integer</span>
+<br class="fancyvrb" /><a 
+ id="x1-62012r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;6)</span><span 
+class="cmtt-10">&#x00A0;[bitrate_minimum]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;32</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;signed</span><span 
+class="cmtt-10">&#x00A0;integer</span>
+<br class="fancyvrb" /><a 
+ id="x1-62014r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;7)</span><span 
+class="cmtt-10">&#x00A0;[blocksize_0]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;exponent</span><span 
+class="cmtt-10">&#x00A0;(read</span><span 
+class="cmtt-10">&#x00A0;4</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer)</span>
+<br class="fancyvrb" /><a 
+ id="x1-62016r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;8)</span><span 
+class="cmtt-10">&#x00A0;[blocksize_1]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;exponent</span><span 
+class="cmtt-10">&#x00A0;(read</span><span 
+class="cmtt-10">&#x00A0;4</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer)</span>
+<br class="fancyvrb" /><a 
+ id="x1-62018r9"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;9)</span><span 
+class="cmtt-10">&#x00A0;[framing_flag]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;one</span><span 
+class="cmtt-10">&#x00A0;bit</span>
+</div>
+<!--l. 62--><p class="noindent" ><span 
+class="cmtt-10x-x-109">[vorbis_version] </span>is to read &#8217;0&#8217; in order to be compatible with this document. Both
+<span 
+class="cmtt-10x-x-109">[audio_channels] </span>and <span 
+class="cmtt-10x-x-109">[audio_sample_rate] </span>must read greater than zero. Allowed final blocksize
+values are 64, 128, 256, 512, 1024, 2048, 4096 and 8192 in Vorbis I. <span 
+class="cmtt-10x-x-109">[blocksize_0] </span>must be less
+than or equal to <span 
+class="cmtt-10x-x-109">[blocksize_1]</span>. The framing bit must be nonzero. Failure to meet any of these
+conditions renders a stream undecodable.
+<!--l. 70--><p class="noindent" >The bitrate fields above are used only as hints. The nominal bitrate field especially may be
+considerably off in purely VBR streams. The fields are meaningful only when greater than
+zero.
+     <ul class="itemize1">
+     <li class="itemize">All three fields set to the same value implies a fixed rate, or tightly bounded, nearly
+     fixed-rate bitstream
+     </li>
+     <li class="itemize">Only nominal set implies a VBR or ABR stream that averages the nominal bitrate
+     </li>
+     <li class="itemize">Maximum and or minimum set implies a VBR bitstream that obeys the bitrate limits
+     </li>
+     <li class="itemize">None set indicates the encoder does not care to speculate.</li></ul>
+<!--l. 84--><p class="noindent" >
+                                                                                    
 
-       4) vector [value_vector] element [i] = 
-            ( [codebook_multiplicands] array element number [multiplicand_offset] ) *
-            [codebook_delta_value] + [codebook_minimum_value] + [last];
+                                                                                    
+<h5 class="subsubsectionHead"><span class="titlemark">4.2.3 </span> <a 
+ id="x1-630004.2.3"></a>Comment header</h5>
+<!--l. 85--><p class="noindent" >Comment header decode and data specification is covered in <a 
+href="#x1-810005">Section&#x00A0;5<!--tex4ht:ref: vorbis:spec:comment --></a>, &#8220;<a 
+href="#x1-810005">comment field and header
+specification<!--tex4ht:ref: vorbis:spec:comment --></a>&#8221;.
+<!--l. 89--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">4.2.4 </span> <a 
+ id="x1-640004.2.4"></a>Setup header</h5>
+<!--l. 91--><p class="noindent" >Vorbis codec setup is configurable to an extreme degree:
+<div class="center" 
+>
+<!--l. 93--><p class="noindent" >
 
-       5) if ( [codebook_sequence_p] is set ) then set [last] = vector [value_vector] element [i] 
+<!--l. 94--><p class="noindent" ><img 
+src="components.png" alt="PIC"  
+>
+<br /> <table class="caption" 
+><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure&#x00A0;6: </td><td  
+class="content">decoder pipeline configuration</td></tr></table><!--tex4ht:label?: x1-640016 -->
+</div>
+<!--l. 99--><p class="noindent" >The setup header contains the bulk of the codec setup information needed for decode. The setup
+header contains, in order, the lists of codebook configurations, time-domain transform
+configurations (placeholders in Vorbis I), floor configurations, residue configurations, channel
+mapping configurations and mode configurations. It finishes with a framing bit of &#8217;1&#8217;. Header decode
+proceeds in the following order:
+<!--l. 107--><p class="noindent" ><span class="paragraphHead"><a 
+ id="x1-650004.2.4"></a><span 
+class="cmbx-10x-x-109">Codebooks</span></span>
+     <ol  class="enumerate1" >
+     <li 
+  class="enumerate" id="x1-65002x1"><span 
+class="cmtt-10x-x-109">[vorbis_codebook_count] </span>= read eight bits as unsigned integer and add one
+     </li>
+     <li 
+  class="enumerate" id="x1-65004x2">Decode  <span 
+class="cmtt-10x-x-109">[vorbis_codebook_count] </span>codebooks  in  order  as  defined  in  <a 
+href="#x1-470003">Section&#x00A0;3<!--tex4ht:ref: vorbis:spec:codebook --></a>,
+     &#8220;<a 
+href="#x1-470003">Probability Model and Codebooks<!--tex4ht:ref: vorbis:spec:codebook --></a>&#8221;. Save each configuration, in order, in an array of
+     codebook configurations <span 
+class="cmtt-10x-x-109">[vorbis_codebook_configurations]</span>.</li></ol>
+<!--l. 119--><p class="noindent" ><span class="paragraphHead"><a 
+ id="x1-660004.2.4"></a><span 
+class="cmbx-10x-x-109">Time domain transforms</span></span>
+These hooks are placeholders in Vorbis I. Nevertheless, the configuration placeholder values must be
+read to maintain bitstream sync.
+                                                                                    
 
-       6) increment [multiplicand_offset]
-
-     }
- 
-  7) vector calculation completed.
-</pre></div></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id320654"></a>3.3. Use of the codebook abstraction</h3></div></div></div><p>
-The decoder uses the codebook abstraction much as it does the
-bit-unpacking convention; a specific codebook reads a
-codeword from the bitstream, decoding it into an entry number, and then
-returns that entry number to the decoder (when used in a scalar
-entropy coding context), or uses that entry number as an offset into
-the VQ lookup table, returning a vector of values (when used in a context
-desiring a VQ value). Scalar or VQ context is always explicit; any call
-to the codebook mechanism requests either a scalar entry number or a
-lookup vector.</p><p>
-Note that VQ lookup type zero indicates that there is no lookup table;
-requesting decode using a codebook of lookup type 0 in any context
-expecting a vector return value (even in a case where a vector of
-dimension one) is forbidden.  If decoder setup or decode requests such
-an action, that is an error condition rendering the packet
-undecodable.</p><p>
-Using a codebook to read from the packet bitstream consists first of
-reading and decoding the next codeword in the bitstream. The decoder
-reads bits until the accumulated bits match a codeword in the
-codebook.  This process can be though of as logically walking the
-Huffman decode tree by reading one bit at a time from the bitstream,
-and using the bit as a decision boolean to take the 0 branch (left in
-the above examples) or the 1 branch (right in the above examples).
-Walking the tree finishes when the decode process hits a leaf in the
-decision tree; the result is the entry number corresponding to that
-leaf.  Reading past the end of a packet propagates the 'end-of-stream'
-condition to the decoder.</p><p>
-When used in a scalar context, the resulting codeword entry is the
-desired return value.</p><p>
-When used in a VQ context, the codeword entry number is used as an
-offset into the VQ lookup table.  The value returned to the decoder is
-the vector of scalars corresponding to this offset.</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="vorbis-spec-codec"></a>4. Codec Setup and Packet Decode</h2></div><div><p class="releaseinfo">
- $Id: 04-codec.xml 10466 2005-11-28 00:34:44Z giles $
-</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id332455"></a>4.1. Overview</h3></div></div></div><p>
-This document serves as the top-level reference document for the
-bit-by-bit decode specification of Vorbis I.  This document assumes a
-high-level understanding of the Vorbis decode process, which is
-provided in <a href="#vorbis-spec-intro" title="1. Introduction and Description">Section 1, &#8220;Introduction and Description&#8221;</a>.  <a href="#vorbis-spec-bitpacking" title="2. Bitpacking Convention">Section 2, &#8220;Bitpacking Convention&#8221;</a> covers reading and writing bit fields from
-and to bitstream packets.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id332825"></a>4.2. Header decode and decode setup</h3></div></div></div><p>
-A Vorbis bitstream begins with three header packets. The header
-packets are, in order, the identification header, the comments header,
-and the setup header. All are required for decode compliance.  An
-end-of-packet condition during decoding the first or third header
-packet renders the stream undecodable.  End-of-packet decoding the
-comment header is a non-fatal error condition.</p><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id313589"></a>4.2.1. Common header decode</h4></div></div></div><p>
-Each header packet begins with the same header fields.
-</p><pre class="screen">
-  1) [packet_type] : 8 bit value
-  2) 0x76, 0x6f, 0x72, 0x62, 0x69, 0x73: the characters 'v','o','r','b','i','s' as six octets
-</pre><p>
-Decode continues according to packet type; the identification header
-is type 1, the comment header type 3 and the setup header type 5
-(these types are all odd as a packet with a leading single bit of '0'
-is an audio packet).  The packets must occur in the order of
-identification, comment, setup.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id339332"></a>4.2.2. Identification header</h4></div></div></div><p>
-The identification header is a short header of only a few fields used
-to declare the stream definitively as Vorbis, and provide a few externally
-relevant pieces of information about the audio stream. The
-identification header is coded as follows:</p><pre class="screen">
- 1) [vorbis_version] = read 32 bits as unsigned integer
- 2) [audio_channels] = read 8 bit integer as unsigned
- 3) [audio_sample_rate] = read 32 bits as unsigned integer
- 4) [bitrate_maximum] = read 32 bits as signed integer
- 5) [bitrate_nominal] = read 32 bits as signed integer
- 6) [bitrate_minimum] = read 32 bits as signed integer
- 7) [blocksize_0] = 2 exponent (read 4 bits as unsigned integer)
- 8) [blocksize_1] = 2 exponent (read 4 bits as unsigned integer)
- 9) [framing_flag] = read one bit
-</pre><p>
-<code class="varname">[vorbis_version]</code> is to read '0' in order to be compatible
-with this document.  Both <code class="varname">[audio_channels]</code> and
-<code class="varname">[audio_sample_rate]</code> must read greater than zero.  Allowed final
-blocksize values are 64, 128, 256, 512, 1024, 2048, 4096 and 8192 in
-Vorbis I.  <code class="varname">[blocksize_0]</code> must be less than or equal to
-<code class="varname">[blocksize_1]</code>.  The framing bit must be nonzero.  Failure to
-meet any of these conditions renders a stream undecodable.</p><p>
-The bitrate fields above are used only as hints. The nominal bitrate
-field especially may be considerably off in purely VBR streams.  The
-fields are meaningful only when greater than zero.</p><p>
-</p><div class="itemizedlist"><ul type="disc"><li>All three fields set to the same value implies a fixed rate, or tightly bounded, nearly fixed-rate bitstream</li><li>Only nominal set implies a VBR or ABR stream that averages the nominal bitrate</li><li>Maximum and or minimum set implies a VBR bitstream that obeys the bitrate limits</li><li>None set indicates the encoder does not care to speculate.</li></ul></div><p>
-</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id320761"></a>4.2.3. Comment header</h4></div></div></div><p>
-Comment header decode and data specification is covered in
-<a href="#vorbis-spec-comment" title="5. comment field and header specification">Section 5, &#8220;comment field and header specification&#8221;</a>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id317509"></a>4.2.4. Setup header</h4></div></div></div><p>
-Vorbis codec setup is configurable to an extreme degree:
-
-</p><div class="mediaobject"><img src="components.png" alt="[decoder pipeline configuration]"></div><p>
-</p><p>
-The setup header contains the bulk of the codec setup information
-needed for decode.  The setup header contains, in order, the lists of
-codebook configurations, time-domain transform configurations
-(placeholders in Vorbis I), floor configurations, residue
-configurations, channel mapping configurations and mode
-configurations. It finishes with a framing bit of '1'.  Header decode
-proceeds in the following order:</p><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id317547"></a>4.2.4.1. Codebooks</h5></div></div></div><div class="orderedlist"><ol type="1"><li><code class="varname">[vorbis_codebook_count]</code> = read eight bits as unsigned integer and add one</li><li>Decode <code class="varname">[vorbis_codebook_count]</code> codebooks in order as defined
-in <a href="#vorbis-spec-codebook" title="3. Probability Model and Codebooks">Section 3, &#8220;Probability Model and Codebooks&#8221;</a>.  Save each configuration, in
-order, in an array of
-codebook configurations <code class="varname">[vorbis_codebook_configurations]</code>.</li></ol></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id309581"></a>4.2.4.2. Time domain transforms</h5></div></div></div><p>
-These hooks are placeholders in Vorbis I.  Nevertheless, the
-configuration placeholder values must be read to maintain bitstream
-sync.</p><div class="orderedlist"><ol type="1"><li><code class="varname">[vorbis_time_count]</code> = read 6 bits as unsigned integer and add one</li><li>read <code class="varname">[vorbis_time_count]</code> 16 bit values; each value should be zero.  If any value is nonzero, this is an error condition and the stream is undecodable.</li></ol></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id309616"></a>4.2.4.3. Floors</h5></div></div></div><p>
-Vorbis uses two floor types; header decode is handed to the decode
-abstraction of the appropriate type.</p><div class="orderedlist"><ol type="1"><li><code class="varname">[vorbis_floor_count]</code> = read 6 bits as unsigned integer and add one</li><li><p>For each <code class="varname">[i]</code> of <code class="varname">[vorbis_floor_count]</code> floor numbers:
-  </p><div class="orderedlist"><ol type="a"><li>read the floor type: vector <code class="varname">[vorbis_floor_types]</code> element <code class="varname">[i]</code> =
-read 16 bits as unsigned integer</li><li>If the floor type is zero, decode the floor
-configuration as defined in <a href="#vorbis-spec-floor0" title="6. Floor type 0 setup and decode">Section 6, &#8220;Floor type 0 setup and decode&#8221;</a>; save
-this
-configuration in slot <code class="varname">[i]</code> of the floor configuration array <code class="varname">[vorbis_floor_configurations]</code>.</li><li>If the floor type is one,
-decode the floor configuration as defined in <a href="#vorbis-spec-floor1" title="7. Floor type 1 setup and decode">Section 7, &#8220;Floor type 1 setup and decode&#8221;</a>; save this configuration in slot <code class="varname">[i]</code> of the floor configuration array <code class="varname">[vorbis_floor_configurations]</code>.</li><li>If the the floor type is greater than one, this stream is undecodable; ERROR CONDITION</li></ol></div><p>
- </p></li></ol></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id273566"></a>4.2.4.4. Residues</h5></div></div></div><p>
+                                                                                    
+<!--l. 126--><p class="noindent" >
+     <ol  class="enumerate1" >
+     <li 
+  class="enumerate" id="x1-66002x1"><span 
+class="cmtt-10x-x-109">[vorbis_time_count] </span>= read 6 bits as unsigned integer and add one
+     </li>
+     <li 
+  class="enumerate" id="x1-66004x2">read <span 
+class="cmtt-10x-x-109">[vorbis_time_count] </span>16 bit values; each value should be zero. If any value is
+     nonzero, this is an error condition and the stream is undecodable.</li></ol>
+<!--l. 132--><p class="noindent" ><span class="paragraphHead"><a 
+ id="x1-670004.2.4"></a><span 
+class="cmbx-10x-x-109">Floors</span></span>
+Vorbis uses two floor types; header decode is handed to the decode abstraction of the appropriate
+type.
+<!--l. 138--><p class="noindent" >
+     <ol  class="enumerate1" >
+     <li 
+  class="enumerate" id="x1-67002x1"><span 
+class="cmtt-10x-x-109">[vorbis_floor_count] </span>= read 6 bits as unsigned integer and add one
+     </li>
+     <li 
+  class="enumerate" id="x1-67004x2">For each <span 
+class="cmtt-10x-x-109">[i] </span>of <span 
+class="cmtt-10x-x-109">[vorbis_floor_count] </span>floor numbers:
+          <ol  class="enumerate2" >
+          <li 
+  class="enumerate" id="x1-67006x1">read the floor type: vector <span 
+class="cmtt-10x-x-109">[vorbis_floor_types] </span>element <span 
+class="cmtt-10x-x-109">[i] </span>= read 16 bits as
+          unsigned integer
+          </li>
+          <li 
+  class="enumerate" id="x1-67008x2">If the floor type is zero, decode the floor configuration as defined in <a 
+href="#x1-890006">Section&#x00A0;6<!--tex4ht:ref: vorbis:spec:floor0 --></a>,
+          &#8220;<a 
+href="#x1-890006">Floor type 0 setup and decode<!--tex4ht:ref: vorbis:spec:floor0 --></a>&#8221;; save this configuration in slot <span 
+class="cmtt-10x-x-109">[i] </span>of the floor
+          configuration array <span 
+class="cmtt-10x-x-109">[vorbis_floor_configurations]</span>.
+          </li>
+          <li 
+  class="enumerate" id="x1-67010x3">If the floor type is one, decode the floor configuration as defined in <a 
+href="#x1-950007">Section&#x00A0;7<!--tex4ht:ref: vorbis:spec:floor1 --></a>,
+          &#8220;<a 
+href="#x1-950007">Floor type 1 setup and decode<!--tex4ht:ref: vorbis:spec:floor1 --></a>&#8221;; save this configuration in slot <span 
+class="cmtt-10x-x-109">[i] </span>of the floor
+          configuration array <span 
+class="cmtt-10x-x-109">[vorbis_floor_configurations]</span>.
+          </li>
+          <li 
+  class="enumerate" id="x1-67012x4">If the the floor type is greater than one, this stream is undecodable; ERROR
+          CONDITION</li></ol>
+     </li></ol>
+<!--l. 156--><p class="noindent" ><span class="paragraphHead"><a 
+ id="x1-680004.2.4"></a><span 
+class="cmbx-10x-x-109">Residues</span></span>
 Vorbis uses three residue types; header decode of each type is identical.
-</p><div class="orderedlist"><ol type="1"><li><code class="varname">[vorbis_residue_count]</code> = read 6 bits as unsigned integer and add one
-</li><li><p>For each of <code class="varname">[vorbis_residue_count]</code> residue numbers:
- </p><div class="orderedlist"><ol type="a"><li>read the residue type; vector <code class="varname">[vorbis_residue_types]</code> element <code class="varname">[i]</code> = read 16 bits as unsigned integer</li><li>If the residue type is zero,
-one or two, decode the residue configuration as defined in <a href="#vorbis-spec-residue" title="8. Residue setup and decode">Section 8, &#8220;Residue setup and decode&#8221;</a>; save this configuration in slot <code class="varname">[i]</code> of the residue configuration array <code class="varname">[vorbis_residue_configurations]</code>.</li><li>If the the residue type is greater than two, this stream is undecodable; ERROR CONDITION</li></ol></div><p>
-</p></li></ol></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id273643"></a>4.2.4.5. Mappings</h5></div></div></div><p>
-Mappings are used to set up specific pipelines for encoding
-multichannel audio with varying channel mapping applications. Vorbis I
-uses a single mapping type (0), with implicit PCM channel mappings.</p><div class="orderedlist"><ol type="1"><li><code class="varname">[vorbis_mapping_count]</code> = read 6 bits as unsigned integer and add one</li><li><p>For each <code class="varname">[i]</code> of <code class="varname">[vorbis_mapping_count]</code> mapping numbers:
-  </p><div class="orderedlist"><ol type="a"><li>read the mapping type: 16 bits as unsigned integer.  There's no reason to save the mapping type in Vorbis I.</li><li>If the mapping type is nonzero, the stream is undecodable</li><li><p>If the mapping type is zero:
-    </p><div class="orderedlist"><ol type="i"><li><p>read 1 bit as a boolean flag
-      </p><div class="orderedlist"><ol type="A"><li>if set, <code class="varname">[vorbis_mapping_submaps]</code> = read 4 bits as unsigned integer and add one</li><li>if unset, <code class="varname">[vorbis_mapping_submaps]</code> = 1</li></ol></div><p>
-      </p></li><li><p>read 1 bit as a boolean flag
-       </p><div class="orderedlist"><ol type="A"><li><p>if set, square polar channel mapping is in use:
-           </p><div class="orderedlist"><ol type="I"><li><code class="varname">[vorbis_mapping_coupling_steps]</code> = read 8 bits as unsigned integer and add one</li><li><p>for <code class="varname">[j]</code> each of <code class="varname">[vorbis_mapping_coupling_steps]</code> steps:
-               </p><div class="orderedlist"><ol type="1"><li>vector <code class="varname">[vorbis_mapping_magnitude]</code> element <code class="varname">[j]</code>= read <a href="#vorbis-spec-ilog" title="9.2.1. ilog">ilog</a>(<code class="varname">[audio_channels]</code> - 1) bits as unsigned integer</li><li>vector <code class="varname">[vorbis_mapping_angle]</code> element <code class="varname">[j]</code>= read <a href="#vorbis-spec-ilog" title="9.2.1. ilog">ilog</a>(<code class="varname">[audio_channels]</code> - 1) bits as unsigned integer</li><li>the numbers read in the above two steps are channel numbers representing the channel to treat as magnitude and the channel to treat as angle, respectively.  If for any coupling step the angle channel number equals the magnitude channel number, the magnitude channel number is greater than <code class="varname">[audio_channels]</code>-1, or the angle channel is greater than <code class="varname">[audio_channels]</code>-1, the st
 ream is undecodable.</li></ol></div><p>
-               </p></li></ol></div><p>
-           </p></li><li>if unset, <code class="varname">[vorbis_mapping_coupling_steps]</code> = 0</li></ol></div><p>
-       </p></li><li>read 2 bits (reserved field); if the value is nonzero, the stream is undecodable</li><li><p>if <code class="varname">[vorbis_mapping_submaps]</code> is greater than one, we read channel multiplex settings. For each <code class="varname">[j]</code> of <code class="varname">[audio_channels]</code> channels:</p><div class="orderedlist"><ol type="A"><li>vector <code class="varname">[vorbis_mapping_mux]</code> element <code class="varname">[j]</code> = read 4 bits as unsigned integer</li><li>if the value is greater than the highest numbered submap (<code class="varname">[vorbis_mapping_submaps]</code> - 1), this in an error condition rendering the stream undecodable</li></ol></div></li><li><p>for each submap <code class="varname">[j]</code> of <code class="varname">[vorbis_mapping_submaps]</code> submaps, read the floor and residue numbers for use in decoding that submap:</p><div class="orderedlist"><ol type="A"><li>read and discard 8 bits (the unused time con
 figuration placeholder)</li><li>read 8 bits as unsigned integer for the floor number; save in vector <code class="varname">[vorbis_mapping_submap_floor]</code> element <code class="varname">[j]</code></li><li>verify the floor number is not greater than the highest number floor configured for the bitstream. If it is, the bitstream is undecodable</li><li>read 8 bits as unsigned integer for the residue number; save in vector <code class="varname">[vorbis_mapping_submap_residue]</code> element <code class="varname">[j]</code></li><li>verify the residue number is not greater than the highest number residue configured for the bitstream.  If it is, the bitstream is undecodable</li></ol></div></li><li>save this mapping configuration in slot <code class="varname">[i]</code> of the mapping configuration array <code class="varname">[vorbis_mapping_configurations]</code>.</li></ol></div></li></ol></div><p>
- </p></li></ol></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id341202"></a>4.2.4.6. Modes</h5></div></div></div><div class="orderedlist"><ol type="1"><li><code class="varname">[vorbis_mode_count]</code> = read 6 bits as unsigned integer and add one</li><li><p>For each of <code class="varname">[vorbis_mode_count]</code> mode numbers:</p><div class="orderedlist"><ol type="a"><li><code class="varname">[vorbis_mode_blockflag]</code> = read 1 bit</li><li><code class="varname">[vorbis_mode_windowtype]</code> = read 16 bits as unsigned integer</li><li><code class="varname">[vorbis_mode_transformtype]</code> = read 16 bits as unsigned integer</li><li><code class="varname">[vorbis_mode_mapping]</code> = read 8 bits as unsigned integer</li><li>verify ranges; zero is the only legal value in Vorbis I for
-<code class="varname">[vorbis_mode_windowtype]</code>
-and <code class="varname">[vorbis_mode_transformtype]</code>.  <code class="varname">[vorbis_mode_mapping]</code> must not be greater than the highest number mapping in use.  Any illegal values render the stream undecodable.</li><li>save this mode configuration in slot <code class="varname">[i]</code> of the mode configuration array
-<code class="varname">[vorbis_mode_configurations]</code>.</li></ol></div></li><li>read 1 bit as a framing flag.  If unset, a framing error occurred and the stream is not
-decodable.</li></ol></div><p>
-After reading mode descriptions, setup header decode is complete.
-</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id341314"></a>4.3. Audio packet decode and synthesis</h3></div></div></div><p>
-Following the three header packets, all packets in a Vorbis I stream
-are audio.  The first step of audio packet decode is to read and
-verify the packet type. <span class="emphasis"><em>A non-audio packet when audio is expected
-indicates stream corruption or a non-compliant stream. The decoder
-must ignore the packet and not attempt decoding it to audio</em></span>.
-</p><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id341330"></a>4.3.1. packet type, mode and window decode</h4></div></div></div><div class="orderedlist"><ol type="1"><li>read 1 bit <code class="varname">[packet_type]</code>; check that packet type is 0 (audio)</li><li>read <a href="#vorbis-spec-ilog" title="9.2.1. ilog">ilog</a>([vorbis_mode_count]-1) bits
-<code class="varname">[mode_number]</code></li><li>decode blocksize <code class="varname">[n]</code> is equal to <code class="varname">[blocksize_0]</code> if 
-<code class="varname">[vorbis_mode_blockflag]</code> is 0, else <code class="varname">[n]</code> is equal to <code class="varname">[blocksize_1]</code>.</li><li><p>perform window selection and setup; this window is used later by the inverse MDCT:</p><div class="orderedlist"><ol type="a"><li><p>if this is a long window (the <code class="varname">[vorbis_mode_blockflag]</code> flag of this mode is
-set):</p><div class="orderedlist"><ol type="i"><li>read 1 bit for <code class="varname">[previous_window_flag]</code></li><li>read 1 bit for <code class="varname">[next_window_flag]</code></li><li>if <code class="varname">[previous_window_flag]</code> is not set, the left half
-         of the window will be a hybrid window for lapping with a
-         short block.  See <a href="#vorbis-spec-window" title="1.3.2.3. Window shape decode (long windows only)">Section 1.3.2.3, &#8220;Window shape decode (long windows only)&#8221;</a> for an illustration of overlapping
-dissimilar
-         windows. Else, the left half window will have normal long
-         shape.</li><li>if <code class="varname">[next_window_flag]</code> is not set, the right half of
-         the window will be a hybrid window for lapping with a short
-         block.  See <a href="#vorbis-spec-window" title="1.3.2.3. Window shape decode (long windows only)">Section 1.3.2.3, &#8220;Window shape decode (long windows only)&#8221;</a> for an
-illustration of overlapping dissimilar
-         windows. Else, the left right window will have normal long
-         shape.</li></ol></div></li><li> if this is a short window, the window is always the same 
-       short-window shape.</li></ol></div></li></ol></div><p>
-Vorbis windows all use the slope function y=sin(0.5 * &#960; * sin^2((x+.5)/n * &#960;)),
-where n is window size and x ranges 0...n-1, but dissimilar
-lapping requirements can affect overall shape.  Window generation
-proceeds as follows:</p><div class="orderedlist"><ol type="1"><li> <code class="varname">[window_center]</code> = <code class="varname">[n]</code> / 2</li><li><p> if (<code class="varname">[vorbis_mode_blockflag]</code> is set and <code class="varname">[previous_window_flag]</code> is
-not set) then
-  </p><div class="orderedlist"><ol type="a"><li><code class="varname">[left_window_start]</code> = <code class="varname">[n]</code>/4 -
-<code class="varname">[blocksize_0]</code>/4</li><li><code class="varname">[left_window_end]</code> = <code class="varname">[n]</code>/4 + <code class="varname">[blocksize_0]</code>/4</li><li><code class="varname">[left_n]</code> = <code class="varname">[blocksize_0]</code>/2</li></ol></div><p>
- else
-  </p><div class="orderedlist"><ol type="a"><li><code class="varname">[left_window_start]</code> = 0</li><li><code class="varname">[left_window_end]</code> = <code class="varname">[window_center]</code></li><li><code class="varname">[left_n]</code> = <code class="varname">[n]</code>/2</li></ol></div></li><li><p> if (<code class="varname">[vorbis_mode_blockflag]</code> is set and <code class="varname">[next_window_flag]</code> is not
-set) then 
-  </p><div class="orderedlist"><ol type="a"><li><code class="varname">[right_window_start]</code> = <code class="varname">[n]*3</code>/4 -
-<code class="varname">[blocksize_0]</code>/4</li><li><code class="varname">[right_window_end]</code> = <code class="varname">[n]*3</code>/4 +
-<code class="varname">[blocksize_0]</code>/4</li><li><code class="varname">[right_n]</code> = <code class="varname">[blocksize_0]</code>/2</li></ol></div><p>
- else
-  </p><div class="orderedlist"><ol type="a"><li><code class="varname">[right_window_start]</code> = <code class="varname">[window_center]</code></li><li><code class="varname">[right_window_end]</code> = <code class="varname">[n]</code></li><li><code class="varname">[right_n]</code> = <code class="varname">[n]</code>/2</li></ol></div></li><li> window from range 0 ... <code class="varname">[left_window_start]</code>-1 inclusive is zero</li><li> for <code class="varname">[i]</code> in range <code class="varname">[left_window_start]</code> ...
-<code class="varname">[left_window_end]</code>-1, window(<code class="varname">[i]</code>) = sin(.5 * &#960; * sin^2( (<code class="varname">[i]</code>-<code class="varname">[left_window_start]</code>+.5) / <code class="varname">[left_n]</code> * .5 * &#960;) )</li><li> window from range <code class="varname">[left_window_end]</code> ... <code class="varname">[right_window_start]</code>-1
-inclusive is one</li><li> for <code class="varname">[i]</code> in range <code class="varname">[right_window_start]</code> ... <code class="varname">[right_window_end]</code>-1, window(<code class="varname">[i]</code>) = sin(.5 * &#960; * sin^2( (<code class="varname">[i]</code>-<code class="varname">[right_window_start]</code>+.5) / <code class="varname">[right_n]</code> * .5 * &#960; + .5 * &#960;) )</li><li> window from range <code class="varname">[right_window_start]</code> ... <code class="varname">[n]</code>-1 is
-zero</li></ol></div><p>
-An end-of-packet condition up to this point should be considered an
-error that discards this packet from the stream.  An end of packet
-condition past this point is to be considered a possible nominal
-occurrence.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id341794"></a>4.3.2. floor curve decode</h4></div></div></div><p>
-From this point on, we assume out decode context is using mode number
-<code class="varname">[mode_number]</code> from configuration array
-<code class="varname">[vorbis_mode_configurations]</code> and the map number
-<code class="varname">[vorbis_mode_mapping]</code> (specified by the current mode) taken
-from the mapping configuration array
-<code class="varname">[vorbis_mapping_configurations]</code>.</p><p>
-Floor curves are decoded one-by-one in channel order.</p><p>
-For each floor <code class="varname">[i]</code> of <code class="varname">[audio_channels]</code>
- </p><div class="orderedlist"><ol type="1"><li><code class="varname">[submap_number]</code> = element <code class="varname">[i]</code> of vector [vorbis_mapping_mux]</li><li><code class="varname">[floor_number]</code> = element <code class="varname">[submap_number]</code> of vector
-[vorbis_submap_floor]</li><li>if the floor type of this
-floor (vector <code class="varname">[vorbis_floor_types]</code> element
-<code class="varname">[floor_number]</code>) is zero then decode the floor for
-channel <code class="varname">[i]</code> according to the
-<a href="#vorbis-spec-floor0-decode" title="6.2.2. packet decode">Section 6.2.2, &#8220;packet decode&#8221;</a></li><li>if the type of this floor
-is one then decode the floor for channel <code class="varname">[i]</code> according
-to the <a href="#vorbis-spec-floor1-decode" title="7.2.2.1. packet decode">Section 7.2.2.1, &#8220;packet decode&#8221;</a></li><li>save the needed decoded floor information for channel for later synthesis</li><li>if the decoded floor returned 'unused', set vector <code class="varname">[no_residue]</code> element
-<code class="varname">[i]</code> to true, else set vector <code class="varname">[no_residue]</code> element <code class="varname">[i]</code> to
-false</li></ol></div><p>
-</p><p>
-An end-of-packet condition during floor decode shall result in packet
-decode zeroing all channel output vectors and skipping to the
-add/overlap output stage.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id341927"></a>4.3.3. nonzero vector propagate</h4></div></div></div><p>
-A possible result of floor decode is that a specific vector is marked
-'unused' which indicates that that final output vector is all-zero
-values (and the floor is zero).  The residue for that vector is not
-coded in the stream, save for one complication.  If some vectors are
-used and some are not, channel coupling could result in mixing a
-zeroed and nonzeroed vector to produce two nonzeroed vectors.</p><p>
-for each <code class="varname">[i]</code> from 0 ... <code class="varname">[vorbis_mapping_coupling_steps]</code>-1
+<!--l. 162--><p class="noindent" >
+                                                                                    
 
-</p><div class="orderedlist"><ol type="1"><li>if either <code class="varname">[no_residue]</code> entry for channel
-(<code class="varname">[vorbis_mapping_magnitude]</code> element <code class="varname">[i]</code>)
-or channel
-(<code class="varname">[vorbis_mapping_angle]</code> element <code class="varname">[i]</code>)
-are set to false, then both must be set to false.  Note that an 'unused' 
-floor has no decoded floor information; it is important that this is 
-remembered at floor curve synthesis time.</li></ol></div><p>
-</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id341985"></a>4.3.4. residue decode</h4></div></div></div><p>
-Unlike floors, which are decoded in channel order, the residue vectors
-are decoded in submap order.</p><p>
-for each submap <code class="varname">[i]</code> in order from 0 ... <code class="varname">[vorbis_mapping_submaps]</code>-1</p><div class="orderedlist"><ol type="1"><li><code class="varname">[ch]</code> = 0</li><li><p>for each channel <code class="varname">[j]</code> in order from 0 ... <code class="varname">[audio_channels]</code> - 1</p><div class="orderedlist"><ol type="a"><li><p>if channel <code class="varname">[j]</code> in submap <code class="varname">[i]</code> (vector <code class="varname">[vorbis_mapping_mux]</code> element <code class="varname">[j]</code> is equal to <code class="varname">[i]</code>)</p><div class="orderedlist"><ol type="i"><li><p>if vector <code class="varname">[no_residue]</code> element <code class="varname">[j]</code> is true
-      </p><div class="orderedlist"><ol type="A"><li>vector <code class="varname">[do_not_decode_flag]</code> element <code class="varname">[ch]</code> is set</li></ol></div><p>
-     else
-      </p><div class="orderedlist"><ol type="A"><li>vector <code class="varname">[do_not_decode_flag]</code> element <code class="varname">[ch]</code> is unset</li></ol></div></li><li>increment <code class="varname">[ch]</code></li></ol></div></li></ol></div></li><li><code class="varname">[residue_number]</code> = vector <code class="varname">[vorbis_mapping_submap_residue]</code> element <code class="varname">[i]</code></li><li><code class="varname">[residue_type]</code> = vector <code class="varname">[vorbis_residue_types]</code> element <code class="varname">[residue_number]</code></li><li>decode <code class="varname">[ch]</code> vectors using residue <code class="varname">[residue_number]</code>, according to type <code class="varname">[residue_type]</code>, also passing vector <code class="varname">[do_not_decode_flag]</code> to indicate which vectors in the bundle should not be decoded. Correct per-vector decode length is <code class="varname">[n]</code>/2.</li><li><co
 de class="varname">[ch]</code> = 0</li><li><p>for each channel <code class="varname">[j]</code> in order from 0 ... <code class="varname">[audio_channels]</code></p><div class="orderedlist"><ol type="a"><li><p>if channel <code class="varname">[j]</code> is in submap <code class="varname">[i]</code> (vector <code class="varname">[vorbis_mapping_mux]</code> element <code class="varname">[j]</code> is equal to <code class="varname">[i]</code>)</p><div class="orderedlist"><ol type="i"><li>residue vector for channel <code class="varname">[j]</code> is set to decoded residue vector <code class="varname">[ch]</code></li><li>increment <code class="varname">[ch]</code></li></ol></div></li></ol></div></li></ol></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id342218"></a>4.3.5. inverse coupling</h4></div></div></div><p>
-for each <code class="varname">[i]</code> from <code class="varname">[vorbis_mapping_coupling_steps]</code>-1 descending to 0
+                                                                                    
+     <ol  class="enumerate1" >
+     <li 
+  class="enumerate" id="x1-68002x1"><span 
+class="cmtt-10x-x-109">[vorbis_residue_count] </span>= read 6 bits as unsigned integer and add one
+     </li>
+     <li 
+  class="enumerate" id="x1-68004x2">For each of <span 
+class="cmtt-10x-x-109">[vorbis_residue_count] </span>residue numbers:
+          <ol  class="enumerate2" >
+          <li 
+  class="enumerate" id="x1-68006x1">read the residue type; vector <span 
+class="cmtt-10x-x-109">[vorbis_residue_types] </span>element <span 
+class="cmtt-10x-x-109">[i] </span>= read 16
+          bits as unsigned integer
+          </li>
+          <li 
+  class="enumerate" id="x1-68008x2">If the residue type is zero, one or two, decode the residue configuration as defined
+          in <a 
+href="#x1-1020008">Section&#x00A0;8<!--tex4ht:ref: vorbis:spec:residue --></a>, &#8220;<a 
+href="#x1-1020008">Residue setup and decode<!--tex4ht:ref: vorbis:spec:residue --></a>&#8221;; save this configuration in slot <span 
+class="cmtt-10x-x-109">[i] </span>of
+          the residue configuration array <span 
+class="cmtt-10x-x-109">[vorbis_residue_configurations]</span>.
+          </li>
+          <li 
+  class="enumerate" id="x1-68010x3">If the the residue type is greater than two, this stream is undecodable; ERROR
+          CONDITION</li></ol>
+     </li></ol>
+<!--l. 176--><p class="noindent" ><span class="paragraphHead"><a 
+ id="x1-690004.2.4"></a><span 
+class="cmbx-10x-x-109">Mappings</span></span>
+Mappings are used to set up specific pipelines for encoding multichannel audio with varying channel
+mapping applications. Vorbis I uses a single mapping type (0), with implicit PCM channel
+mappings.
+<!--l. 187--><p class="noindent" >
+     <ol  class="enumerate1" >
+     <li 
+  class="enumerate" id="x1-69002x1"><span 
+class="cmtt-10x-x-109">[vorbis_mapping_count] </span>= read 6 bits as unsigned integer and add one
+     </li>
+     <li 
+  class="enumerate" id="x1-69004x2">For each <span 
+class="cmtt-10x-x-109">[i] </span>of <span 
+class="cmtt-10x-x-109">[vorbis_mapping_count] </span>mapping numbers:
+          <ol  class="enumerate2" >
+          <li 
+  class="enumerate" id="x1-69006x1">read the mapping type: 16 bits as unsigned integer. There&#8217;s no reason to save the
+          mapping type in Vorbis I.
+          </li>
+          <li 
+  class="enumerate" id="x1-69008x2">If the mapping type is nonzero, the stream is undecodable
+          </li>
+          <li 
+  class="enumerate" id="x1-69010x3">If the mapping type is zero:
+              <ol  class="enumerate3" >
+              <li 
+  class="enumerate" id="x1-69012x1">read 1 bit as a boolean flag
+                 <ol  class="enumerate4" >
+                 <li 
+  class="enumerate" id="x1-69014x1">if set, <span 
+class="cmtt-10x-x-109">[vorbis_mapping_submaps] </span>= read 4 bits as unsigned integer and
+                 add one
+                                                                                    
 
-</p><div class="orderedlist"><ol type="1"><li><code class="varname">[magnitude_vector]</code> = the residue vector for channel
-(vector <code class="varname">[vorbis_mapping_magnitude]</code> element <code class="varname">[i]</code>)</li><li><code class="varname">[angle_vector]</code> = the residue vector for channel (vector
-<code class="varname">[vorbis_mapping_angle]</code> element <code class="varname">[i]</code>)</li><li><p>for each scalar value <code class="varname">[M]</code> in vector <code class="varname">[magnitude_vector]</code> and the corresponding scalar value <code class="varname">[A]</code> in vector <code class="varname">[angle_vector]</code>:</p><div class="orderedlist"><ol type="a"><li><p>if (<code class="varname">[M]</code> is greater than zero)
-    </p><div class="orderedlist"><ol type="i"><li><p>if (<code class="varname">[A]</code> is greater than zero)
-      </p><div class="orderedlist"><ol type="A"><li><code class="varname">[new_M]</code> = <code class="varname">[M]</code></li><li><code class="varname">[new_A]</code> = <code class="varname">[M]</code>-<code class="varname">[A]</code></li></ol></div><p>
-     else
-      </p><div class="orderedlist"><ol type="A"><li><code class="varname">[new_A]</code> = <code class="varname">[M]</code></li><li><code class="varname">[new_M]</code> = <code class="varname">[M]</code>+<code class="varname">[A]</code></li></ol></div><p>
-     </p></li></ol></div><p>
-   else
-    </p><div class="orderedlist"><ol type="i"><li><p>if (<code class="varname">[A]</code> is greater than zero)
-      </p><div class="orderedlist"><ol type="A"><li><code class="varname">[new_M]</code> = <code class="varname">[M]</code></li><li><code class="varname">[new_A]</code> = <code class="varname">[M]</code>+<code class="varname">[A]</code></li></ol></div><p>
-     else
-      </p><div class="orderedlist"><ol type="A"><li><code class="varname">[new_A]</code> = <code class="varname">[M]</code></li><li><code class="varname">[new_M]</code> = <code class="varname">[M]</code>-<code class="varname">[A]</code></li></ol></div><p>
-     </p></li></ol></div><p>
-   </p></li><li>set scalar value <code class="varname">[M]</code> in vector <code class="varname">[magnitude_vector]</code> to <code class="varname">[new_M]</code></li><li>set scalar value <code class="varname">[A]</code> in vector <code class="varname">[angle_vector]</code> to <code class="varname">[new_A]</code></li></ol></div></li></ol></div><p>
-</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id342463"></a>4.3.6. dot product</h4></div></div></div><p>
-For each channel, synthesize the floor curve from the decoded floor
-information, according to packet type. Note that the vector synthesis
-length for floor computation is <code class="varname">[n]</code>/2.</p><p>
-For each channel, multiply each element of the floor curve by each
-element of that channel's residue vector.  The result is the dot
-product of the floor and residue vectors for each channel; the produced
-vectors are the length <code class="varname">[n]</code>/2 audio spectrum for each
-channel.</p><p>
-One point is worth mentioning about this dot product; a common mistake
-in a fixed point implementation might be to assume that a 32 bit
-fixed-point representation for floor and residue and direct
-multiplication of the vectors is sufficient for acceptable spectral
-depth in all cases because it happens to mostly work with the current
-Xiph.Org reference encoder. </p><p>
-However, floor vector values can span ~140dB (~24 bits unsigned), and
-the audio spectrum vector should represent a minimum of 120dB (~21
-bits with sign), even when output is to a 16 bit PCM device.  For the
-residue vector to represent full scale if the floor is nailed to
--140dB, it must be able to span 0 to +140dB.  For the residue vector
-to reach full scale if the floor is nailed at 0dB, it must be able to
-represent -140dB to +0dB.  Thus, in order to handle full range
-dynamics, a residue vector may span -140dB to +140dB entirely within
-spec.  A 280dB range is approximately 48 bits with sign; thus the
-residue vector must be able to represent a 48 bit range and the dot
-product must be able to handle an effective 48 bit times 24 bit
-multiplication.  This range may be achieved using large (64 bit or
-larger) integers, or implementing a movable binary point
-representation.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id342502"></a>4.3.7. inverse MDCT</h4></div></div></div><p>
-Convert the audio spectrum vector of each channel back into time
-domain PCM audio via an inverse Modified Discrete Cosine Transform
-(MDCT).  A detailed description of the MDCT is available in the paper
-<a href="http://www.iocon.com/resource/docs/ps/eusipco_corrected.ps" target="_top">&#8220;<span class="citetitle">The
-use of multirate filter banks for coding of high quality digital
-audio</span>&#8221;</a>, by T. Sporer, K. Brandenburg and B. Edler.  The window
-function used for the MDCT is the function described earlier.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id342523"></a>4.3.8. overlap_add</h4></div></div></div><p>
-Windowed MDCT output is overlapped and added with the right hand data
-of the previous window such that the 3/4 point of the previous window
-is aligned with the 1/4 point of the current window (as illustrated in
-<a href="#vorbis-spec-window" title="1.3.2.3. Window shape decode (long windows only)">Section 1.3.2.3, &#8220;Window shape decode (long windows only)&#8221;</a>).  The overlapped portion
-produced from overlapping the previous and current frame data is
-finished data to be returned by the decoder.  This data spans from the
-center of the previous window to the center of the current window.  In
-the case of same-sized windows, the amount of data to return is
-one-half block consisting of and only of the overlapped portions. When
-overlapping a short and long window, much of the returned range does not
-actually overlap.  This does not damage transform orthogonality.  Pay
-attention however to returning the correct data range; the amount of
-data to be returned is:
+                                                                                    
+                 </li>
+                 <li 
+  class="enumerate" id="x1-69016x2">if unset, <span 
+class="cmtt-10x-x-109">[vorbis_mapping_submaps] </span>= 1</li></ol>
+              </li>
+              <li 
+  class="enumerate" id="x1-69018x2">read 1 bit as a boolean flag
+                 <ol  class="enumerate4" >
+                 <li 
+  class="enumerate" id="x1-69020x1">if set, square polar channel mapping is in use:
+                   <ul class="itemize1">
+                   <li class="itemize"><span 
+class="cmtt-10x-x-109">[vorbis_mapping_coupling_steps] </span>= read 8 bits as unsigned integer
+                   and add one
+                   </li>
+                   <li class="itemize">for <span 
+class="cmtt-10x-x-109">[j] </span>each of <span 
+class="cmtt-10x-x-109">[vorbis_mapping_coupling_steps] </span>steps:
+                     <ul class="itemize2">
+                     <li class="itemize">vector     <span 
+class="cmtt-10x-x-109">[vorbis_mapping_magnitude]   </span>element     <span 
+class="cmtt-10x-x-109">[j]</span>=     read
+                     <a 
+href="#x1-1170009.2.1">ilog</a>(<span 
+class="cmtt-10x-x-109">[audio_channels] </span>- 1) bits as unsigned integer
+                     </li>
+                     <li class="itemize">vector      <span 
+class="cmtt-10x-x-109">[vorbis_mapping_angle]    </span>element      <span 
+class="cmtt-10x-x-109">[j]</span>=      read
+                     <a 
+href="#x1-1170009.2.1">ilog</a>(<span 
+class="cmtt-10x-x-109">[audio_channels] </span>- 1) bits as unsigned integer
+                     </li>
+                     <li class="itemize">the  numbers  read  in  the  above  two  steps  are  channel  numbers
+                     representing the channel to treat as magnitude and the channel to
+                     treat as angle, respectively. If for any coupling step the angle channel
+                     number equals the magnitude channel number, the magnitude channel
+                     number is greater than <span 
+class="cmtt-10x-x-109">[audio_channels]</span>-1, or the angle channel is
+                     greater than <span 
+class="cmtt-10x-x-109">[audio_channels]</span>-1, the stream is undecodable.</li></ul>
+                   </li></ul>
+                 </li>
+                 <li 
+  class="enumerate" id="x1-69022x2">if unset, <span 
+class="cmtt-10x-x-109">[vorbis_mapping_coupling_steps] </span>= 0</li></ol>
+              </li>
+              <li 
+  class="enumerate" id="x1-69024x3">read 2 bits (reserved field); if the value is nonzero, the stream is undecodable
+              </li>
+              <li 
+  class="enumerate" id="x1-69026x4">if <span 
+class="cmtt-10x-x-109">[vorbis_mapping_submaps] </span>is greater than one, we read channel multiplex
+              settings. For each <span 
+class="cmtt-10x-x-109">[j] </span>of <span 
+class="cmtt-10x-x-109">[audio_channels] </span>channels:
+                 <ol  class="enumerate4" >
+                 <li 
+  class="enumerate" id="x1-69028x1">vector  <span 
+class="cmtt-10x-x-109">[vorbis_mapping_mux] </span>element  <span 
+class="cmtt-10x-x-109">[j] </span>=  read  4  bits  as  unsigned
+                 integer
+                 </li>
+                 <li 
+  class="enumerate" id="x1-69030x2">if                           the                           value                           is
+                 greater than the highest numbered submap (<span 
+class="cmtt-10x-x-109">[vorbis_mapping_submaps]</span>
+                 - 1), this in an error condition rendering the stream undecodable</li></ol>
+                                                                                    
 
-</p><pre class="programlisting">
-window_blocksize(previous_window)/4+window_blocksize(current_window)/4
-</pre><p>
+                                                                                    
+              </li>
+              <li 
+  class="enumerate" id="x1-69032x5">for each submap <span 
+class="cmtt-10x-x-109">[j] </span>of <span 
+class="cmtt-10x-x-109">[vorbis_mapping_submaps] </span>submaps, read the floor and
+              residue numbers for use in decoding that submap:
+                 <ol  class="enumerate4" >
+                 <li 
+  class="enumerate" id="x1-69034x1">read and discard 8 bits (the unused time configuration placeholder)
+                 </li>
+                 <li 
+  class="enumerate" id="x1-69036x2">read  8  bits  as  unsigned  integer  for  the  floor  number;  save  in  vector
+                 <span 
+class="cmtt-10x-x-109">[vorbis_mapping_submap_floor] </span>element <span 
+class="cmtt-10x-x-109">[j]</span>
+                 </li>
+                 <li 
+  class="enumerate" id="x1-69038x3">verify  the  floor  number  is  not  greater  than  the  highest  number  floor
+                 configured for the bitstream. If it is, the bitstream is undecodable
+                 </li>
+                 <li 
+  class="enumerate" id="x1-69040x4">read 8 bits as unsigned integer for the residue number; save in vector
+                 <span 
+class="cmtt-10x-x-109">[vorbis_mapping_submap_residue] </span>element <span 
+class="cmtt-10x-x-109">[j]</span>
+                 </li>
+                 <li 
+  class="enumerate" id="x1-69042x5">verify the residue number is not greater than the highest number residue
+                 configured for the bitstream. If it is, the bitstream is undecodable</li></ol>
+              </li>
+              <li 
+  class="enumerate" id="x1-69044x6">save this mapping configuration in slot <span 
+class="cmtt-10x-x-109">[i] </span>of the mapping configuration array
+              <span 
+class="cmtt-10x-x-109">[vorbis_mapping_configurations]</span>.</li></ol>
+          </li></ol>
+     </li></ol>
+<!--l. 246--><p class="noindent" ><span class="paragraphHead"><a 
+ id="x1-700004.2.4"></a><span 
+class="cmbx-10x-x-109">Modes</span></span>
+     <ol  class="enumerate1" >
+     <li 
+  class="enumerate" id="x1-70002x1"><span 
+class="cmtt-10x-x-109">[vorbis_mode_count] </span>= read 6 bits as unsigned integer and add one
+     </li>
+     <li 
+  class="enumerate" id="x1-70004x2">For each of <span 
+class="cmtt-10x-x-109">[vorbis_mode_count] </span>mode numbers:
+          <ol  class="enumerate2" >
+          <li 
+  class="enumerate" id="x1-70006x1"><span 
+class="cmtt-10x-x-109">[vorbis_mode_blockflag] </span>= read 1 bit
+          </li>
+          <li 
+  class="enumerate" id="x1-70008x2"><span 
+class="cmtt-10x-x-109">[vorbis_mode_windowtype] </span>= read 16 bits as unsigned integer
+          </li>
+          <li 
+  class="enumerate" id="x1-70010x3"><span 
+class="cmtt-10x-x-109">[vorbis_mode_transformtype] </span>= read 16 bits as unsigned integer
+          </li>
+          <li 
+  class="enumerate" id="x1-70012x4"><span 
+class="cmtt-10x-x-109">[vorbis_mode_mapping] </span>= read 8 bits as unsigned integer
+                                                                                    
 
-from the center (element windowsize/2) of the previous window to the
-center (element windowsize/2-1, inclusive) of the current window.</p><p>
-Data is not returned from the first frame; it must be used to 'prime'
-the decode engine.  The encoder accounts for this priming when
-calculating PCM offsets; after the first frame, the proper PCM output
-offset is '0' (as no data has been returned yet).</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id342556"></a>4.3.9. output channel order</h4></div></div></div><p>
-Vorbis I specifies only a channel mapping type 0.  In mapping type 0,
-channel mapping is implicitly defined as follows for standard audio
-applications:</p><div class="variablelist"><dl><dt><span class="term">one channel</span></dt><dd>the stream is monophonic</dd><dt><span class="term">two channels</span></dt><dd>the stream is stereo.  channel order: left, right</dd><dt><span class="term">three channels</span></dt><dd>the stream is a 1d-surround encoding.  channel order: left,
-center, right</dd><dt><span class="term">four channels</span></dt><dd>the stream is quadraphonic surround.  channel order: front left,
-front right, rear left, rear right</dd><dt><span class="term">five channels</span></dt><dd>the stream is five-channel surround.  channel order: front left,
-front center, front right, rear left, rear right</dd><dt><span class="term">six channels</span></dt><dd>the stream is 5.1 surround.  channel order: front left, front
-center, front right, rear left, rear right, LFE</dd><dt><span class="term">greater than six channels</span></dt><dd>channel use and order is defined by the application</dd></dl></div><p>
-Applications using Vorbis for dedicated purposes may define channel
-mapping as seen fit.  Future channel mappings (such as three and four
-channel <a href="http://www.ambisonic.net/" target="_top">Ambisonics</a>) will
-make use of channel mappings other than mapping 0.</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="vorbis-spec-comment"></a>5. comment field and header specification</h2></div><div><p class="releaseinfo">
- $Id: 05-comment.xml 11703 2006-07-17 16:33:17Z giles $
-</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id333629"></a>5.1. Overview</h3></div></div></div><p>The Vorbis text comment header is the second (of three) header
-packets that begin a Vorbis bitstream. It is meant for short text
-comments, not arbitrary metadata; arbitrary metadata belongs in a
-separate logical bitstream (usually an XML stream type) that provides
-greater structure and machine parseability.</p><p>The comment field is meant to be used much like someone jotting a
-quick note on the bottom of a CDR. It should be a little information to
-remember the disc by and explain it to others; a short, to-the-point
-text note that need not only be a couple words, but isn't going to be
-more than a short paragraph.  The essentials, in other words, whatever
-they turn out to be, eg:
+                                                                                    
+          </li>
+          <li 
+  class="enumerate" id="x1-70014x5">verify         ranges;         zero         is         the         only         legal         value
+          in Vorbis I for <span 
+class="cmtt-10x-x-109">[vorbis_mode_windowtype] </span>and <span 
+class="cmtt-10x-x-109">[vorbis_mode_transformtype]</span>.
+          <span 
+class="cmtt-10x-x-109">[vorbis_mode_mapping] </span>must not be greater than the highest number mapping
+          in use. Any illegal values render the stream undecodable.
+          </li>
+          <li 
+  class="enumerate" id="x1-70016x6">save  this  mode  configuration  in  slot  <span 
+class="cmtt-10x-x-109">[i] </span>of  the  mode  configuration  array
+          <span 
+class="cmtt-10x-x-109">[vorbis_mode_configurations]</span>.</li></ol>
+     </li>
+     <li 
+  class="enumerate" id="x1-70018x3">read 1 bit as a framing flag. If unset, a framing error occurred and the stream is not
+     decodable.</li></ol>
+<!--l. 267--><p class="noindent" >After reading mode descriptions, setup header decode is complete.
+<!--l. 276--><p class="noindent" >
+<h4 class="subsectionHead"><span class="titlemark">4.3 </span> <a 
+ id="x1-710004.3"></a>Audio packet decode and synthesis</h4>
+<!--l. 278--><p class="noindent" >Following the three header packets, all packets in a Vorbis I stream are audio. The first step of
+audio packet decode is to read and verify the packet type. <span 
+class="cmti-10x-x-109">A non-audio packet when audio is</span>
+<span 
+class="cmti-10x-x-109">expected indicates stream corruption or a non-compliant stream. The decoder must ignore the packet</span>
+<span 
+class="cmti-10x-x-109">and not attempt decoding it to audio</span>.
+<!--l. 285--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">4.3.1 </span> <a 
+ id="x1-720004.3.1"></a>packet type, mode and window decode</h5>
+<!--l. 288--><p class="noindent" >
+     <ol  class="enumerate1" >
+     <li 
+  class="enumerate" id="x1-72002x1">read 1 bit <span 
+class="cmtt-10x-x-109">[packet_type]</span>; check that packet type is 0 (audio)
+     </li>
+     <li 
+  class="enumerate" id="x1-72004x2">read <a 
+href="#x1-1170009.2.1">ilog</a>([vorbis&#x02D9;mode&#x02D9;count]-1) bits <span 
+class="cmtt-10x-x-109">[mode_number]</span>
+     </li>
+     <li 
+  class="enumerate" id="x1-72006x3">decode blocksize <span 
+class="cmtt-10x-x-109">[n] </span>is equal to <span 
+class="cmtt-10x-x-109">[blocksize_0] </span>if <span 
+class="cmtt-10x-x-109">[vorbis_mode_blockflag] </span>is 0, else
+     <span 
+class="cmtt-10x-x-109">[n] </span>is equal to <span 
+class="cmtt-10x-x-109">[blocksize_1]</span>.
+     </li>
+     <li 
+  class="enumerate" id="x1-72008x4">perform window selection and setup; this window is used later by the inverse MDCT:
+          <ol  class="enumerate2" >
+          <li 
+  class="enumerate" id="x1-72010x1">if this is a long window (the <span 
+class="cmtt-10x-x-109">[vorbis_mode_blockflag] </span>flag of this mode is
+                                                                                    
 
-</p><div class="blockquote"><blockquote class="blockquote"><p>Honest Bob and the Factory-to-Dealer-Incentives, <em class="citetitle">I'm Still
-Around</em>, opening for Moxy Früvous, 1997.</p></blockquote></div><p>
-</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id333657"></a>5.2. Comment encoding</h3></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id334902"></a>5.2.1. Structure</h4></div></div></div><p>
-The comment header is logically a list of eight-bit-clean vectors; the
-number of vectors is bounded to 2^32-1 and the length of each vector
-is limited to 2^32-1 bytes. The vector length is encoded; the vector
-contents themselves are not null terminated. In addition to the vector
-list, there is a single vector for vendor name (also 8 bit clean,
-length encoded in 32 bits). For example, the 1.0 release of libvorbis 
-set the vendor string to "Xiph.Org libVorbis I 20020717".</p><p>The comment header is decoded as follows:
+                                                                                    
+          set):
+              <ol  class="enumerate3" >
+              <li 
+  class="enumerate" id="x1-72012x1">read 1 bit for <span 
+class="cmtt-10x-x-109">[previous_window_flag]</span>
+              </li>
+              <li 
+  class="enumerate" id="x1-72014x2">read 1 bit for <span 
+class="cmtt-10x-x-109">[next_window_flag]</span>
+              </li>
+              <li 
+  class="enumerate" id="x1-72016x3">if <span 
+class="cmtt-10x-x-109">[previous_window_flag] </span>is not set, the left half of the window will be a
+              hybrid window for lapping with a short block. See <a 
+href="#x1-260001.3.2">paragraph&#x00A0;1.3.2<!--tex4ht:ref: vorbis:spec:window --></a>, &#8220;<a 
+href="#x1-260001.3.2">Window
+              shape decode (long windows only)<!--tex4ht:ref: vorbis:spec:window --></a>&#8221; for an illustration of overlapping dissimilar
+              windows. Else, the left half window will have normal long shape.
+              </li>
+              <li 
+  class="enumerate" id="x1-72018x4">if  <span 
+class="cmtt-10x-x-109">[next_window_flag] </span>is not set, the right half of the window will be a
+              hybrid window for lapping with a short block. See <a 
+href="#x1-260001.3.2">paragraph&#x00A0;1.3.2<!--tex4ht:ref: vorbis:spec:window --></a>, &#8220;<a 
+href="#x1-260001.3.2">Window
+              shape decode (long windows only)<!--tex4ht:ref: vorbis:spec:window --></a>&#8221; for an illustration of overlapping dissimilar
+              windows. Else, the left right window will have normal long shape.</li></ol>
+          </li>
+          <li 
+  class="enumerate" id="x1-72020x2">if this is a short window, the window is always the same short-window shape.</li></ol>
+     </li></ol>
+<!--l. 320--><p class="noindent" >Vorbis windows all use the slope function <span 
+class="cmmi-10x-x-109">y </span>= sin(<img 
+src="Vorbis_I_spec1x.png" alt="&#x03C0;
+2"  class="frac" align="middle"> <span 
+class="cmsy-10x-x-109">*</span> sin<sup><span 
+class="cmr-8">2</span></sup>((<span 
+class="cmmi-10x-x-109">x </span>+ 0<span 
+class="cmmi-10x-x-109">.</span>5)<span 
+class="cmmi-10x-x-109">&#x2215;n</span><span 
+class="cmsy-10x-x-109">*</span><span 
+class="cmmi-10x-x-109">&#x03C0;</span>)), where <span 
+class="cmmi-10x-x-109">n </span>is window size
+and <span 
+class="cmmi-10x-x-109">x </span>ranges 0<span 
+class="cmmi-10x-x-109">&#x2026;</span><span 
+class="cmmi-10x-x-109">n </span><span 
+class="cmsy-10x-x-109">- </span>1, but dissimilar lapping requirements can affect overall shape. Window
+generation proceeds as follows:
+<!--l. 326--><p class="noindent" >
+     <ol  class="enumerate1" >
+     <li 
+  class="enumerate" id="x1-72022x1"><span 
+class="cmtt-10x-x-109">[window_center] </span>= <span 
+class="cmtt-10x-x-109">[n] </span>/ 2
+     </li>
+     <li 
+  class="enumerate" id="x1-72024x2">if (<span 
+class="cmtt-10x-x-109">[vorbis_mode_blockflag] </span>is set and <span 
+class="cmtt-10x-x-109">[previous_window_flag] </span>is not set)
+     then
+          <ol  class="enumerate2" >
+          <li 
+  class="enumerate" id="x1-72026x1"><span 
+class="cmtt-10x-x-109">[left_window_start] </span>= <span 
+class="cmtt-10x-x-109">[n]</span>/4 - <span 
+class="cmtt-10x-x-109">[blocksize_0]</span>/4
+          </li>
+          <li 
+  class="enumerate" id="x1-72028x2"><span 
+class="cmtt-10x-x-109">[left_window_end] </span>= <span 
+class="cmtt-10x-x-109">[n]</span>/4 + <span 
+class="cmtt-10x-x-109">[blocksize_0]</span>/4
+          </li>
+          <li 
+  class="enumerate" id="x1-72030x3"><span 
+class="cmtt-10x-x-109">[left_n] </span>= <span 
+class="cmtt-10x-x-109">[blocksize_0]</span>/2</li></ol>
+     <!--l. 335--><p class="noindent" >else
+          <ol  class="enumerate2" >
+          <li 
+  class="enumerate" id="x1-72032x1"><span 
+class="cmtt-10x-x-109">[left_window_start] </span>= 0
+          </li>
+          <li 
+  class="enumerate" id="x1-72034x2"><span 
+class="cmtt-10x-x-109">[left_window_end] </span>= <span 
+class="cmtt-10x-x-109">[window_center]</span>
+                                                                                    
 
-</p><pre class="programlisting">
-  1) [vendor_length] = read an unsigned integer of 32 bits
-  2) [vendor_string] = read a UTF-8 vector as [vendor_length] octets
-  3) [user_comment_list_length] = read an unsigned integer of 32 bits
-  4) iterate [user_comment_list_length] times {
-       5) [length] = read an unsigned integer of 32 bits
-       6) this iteration's user comment = read a UTF-8 vector as [length] octets
-     }
-  7) [framing_bit] = read a single bit as boolean
-  8) if ( [framing_bit] unset or end-of-packet ) then ERROR
-  9) done.
-</pre><p>
-</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id334926"></a>5.2.2. Content vector format</h4></div></div></div><p>
-The comment vectors are structured similarly to a UNIX environment variable.
-That is, comment fields consist of a field name and a corresponding value and
-look like:</p><div class="blockquote"><blockquote class="blockquote"><pre class="programlisting">
-comment[0]="ARTIST=me"; 
-comment[1]="TITLE=the sound of Vorbis"; 
-</pre></blockquote></div><p>
-The field name is case-insensitive and may consist of ASCII 0x20
-through 0x7D, 0x3D ('=') excluded. ASCII 0x41 through 0x5A inclusive
-(characters A-Z) is to be considered equivalent to ASCII 0x61 through 
-0x7A inclusive (characters a-z).
-</p><p>
-The field name is immediately followed by ASCII 0x3D ('=');
-this equals sign is used to terminate the field name.
-</p><p>
-0x3D is followed by 8 bit clean UTF-8 encoded value of the
-field contents to the end of the field.
-</p><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id334955"></a>5.2.2.1. Field names</h5></div></div></div><p>Below is a proposed, minimal list of standard field names with a
-description of intended use.  No single or group of field names is
-mandatory; a comment header may contain one, all or none of the names
-in this list.</p><div class="variablelist"><dl><dt><span class="term">TITLE</span></dt><dd>Track/Work name</dd><dt><span class="term">VERSION</span></dt><dd>The version field may be used to
-differentiate multiple
-versions of the same track title in a single collection. (e.g. remix
-info)
-</dd><dt><span class="term">ALBUM</span></dt><dd>The collection name to which this track belongs
-</dd><dt><span class="term">TRACKNUMBER</span></dt><dd>The track number of this piece if part of a specific larger collection or album
-</dd><dt><span class="term">ARTIST</span></dt><dd>The artist generally considered responsible for the work. In popular music this is usually the performing band or singer. For classical music it would be the composer. For an audio book it would be the author of the original text.
-</dd><dt><span class="term">PERFORMER</span></dt><dd>The artist(s) who performed the work. In classical music this would be the conductor, orchestra, soloists. In an audio book it would be the actor who did the reading. In popular music this is typically the same as the ARTIST and is omitted.
-</dd><dt><span class="term">COPYRIGHT</span></dt><dd>Copyright attribution, e.g., '2001 Nobody's Band' or '1999 Jack Moffitt'
-</dd><dt><span class="term">LICENSE</span></dt><dd>License information, eg, 'All Rights Reserved', 'Any
-Use Permitted', a URL to a license such as a Creative Commons license
-("www.creativecommons.org/blahblah/license.html") or the EFF Open
-Audio License ('distributed under the terms of the Open Audio
-License. see http://www.eff.org/IP/Open_licenses/eff_oal.html for
-details'), etc.
-</dd><dt><span class="term">ORGANIZATION</span></dt><dd>Name of the organization producing the track (i.e.
-the 'record label')
-</dd><dt><span class="term">DESCRIPTION</span></dt><dd>A short text description of the contents
-</dd><dt><span class="term">GENRE</span></dt><dd>A short text indication of music genre
-</dd><dt><span class="term">DATE</span></dt><dd>Date the track was recorded
-</dd><dt><span class="term">LOCATION</span></dt><dd>Location where track was recorded
-</dd><dt><span class="term">CONTACT</span></dt><dd>Contact information for the creators or distributors of the track. This could be a URL, an email address, the physical address of the producing label.
-</dd><dt><span class="term">ISRC</span></dt><dd>International Standard Recording Code for the
-track; see <a href="http://www.ifpi.org/isrc/" target="_top">the ISRC
-intro page</a> for more information on ISRC numbers.
-</dd></dl></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="id311698"></a>5.2.2.2. Implications</h5></div></div></div><p>Field names should not be 'internationalized'; this is a
-concession to simplicity not an attempt to exclude the majority of
-the world that doesn't speak English. Field <span class="emphasis"><em>contents</em></span>,
-however, use the UTF-8 character encoding to allow easy representation 
-of any language.</p><p>We have the length of the entirety of the field and restrictions on
-the field name so that the field name is bounded in a known way. Thus
-we also have the length of the field contents.</p><p>Individual 'vendors' may use non-standard field names within
-reason. The proper use of comment fields should be clear through
-context at this point.  Abuse will be discouraged.</p><p>There is no vendor-specific prefix to 'nonstandard' field names.
-Vendors should make some effort to avoid arbitrarily polluting the
-common namespace. We will generally collect the more useful tags
-here to help with standardization.</p><p>Field names are not required to be unique (occur once) within a
-comment header.  As an example, assume a track was recorded by three
-well know artists; the following is permissible, and encouraged:
+                                                                                    
+          </li>
+          <li 
+  class="enumerate" id="x1-72036x3"><span 
+class="cmtt-10x-x-109">[left_n] </span>= <span 
+class="cmtt-10x-x-109">[n]</span>/2</li></ol>
+     </li>
+     <li 
+  class="enumerate" id="x1-72038x3">if (<span 
+class="cmtt-10x-x-109">[vorbis_mode_blockflag] </span>is set and <span 
+class="cmtt-10x-x-109">[next_window_flag] </span>is not set) then
+          <ol  class="enumerate2" >
+          <li 
+  class="enumerate" id="x1-72040x1"><span 
+class="cmtt-10x-x-109">[right_window_start] </span>= <span 
+class="cmtt-10x-x-109">[n]*3</span>/4 - <span 
+class="cmtt-10x-x-109">[blocksize_0]</span>/4
+          </li>
+          <li 
+  class="enumerate" id="x1-72042x2"><span 
+class="cmtt-10x-x-109">[right_window_end] </span>= <span 
+class="cmtt-10x-x-109">[n]*3</span>/4 + <span 
+class="cmtt-10x-x-109">[blocksize_0]</span>/4
+          </li>
+          <li 
+  class="enumerate" id="x1-72044x3"><span 
+class="cmtt-10x-x-109">[right_n] </span>= <span 
+class="cmtt-10x-x-109">[blocksize_0]</span>/2</li></ol>
+     <!--l. 351--><p class="noindent" >else
+          <ol  class="enumerate2" >
+          <li 
+  class="enumerate" id="x1-72046x1"><span 
+class="cmtt-10x-x-109">[right_window_start] </span>= <span 
+class="cmtt-10x-x-109">[window_center]</span>
+          </li>
+          <li 
+  class="enumerate" id="x1-72048x2"><span 
+class="cmtt-10x-x-109">[right_window_end] </span>= <span 
+class="cmtt-10x-x-109">[n]</span>
+          </li>
+          <li 
+  class="enumerate" id="x1-72050x3"><span 
+class="cmtt-10x-x-109">[right_n] </span>= <span 
+class="cmtt-10x-x-109">[n]</span>/2</li></ol>
+     </li>
+     <li 
+  class="enumerate" id="x1-72052x4">window from range 0 ... <span 
+class="cmtt-10x-x-109">[left_window_start]</span>-1 inclusive is zero
+     </li>
+     <li 
+  class="enumerate" id="x1-72054x5">for <span 
+class="cmtt-10x-x-109">[i] </span>in range <span 
+class="cmtt-10x-x-109">[left_window_start] </span>... <span 
+class="cmtt-10x-x-109">[left_window_end]</span>-1, window(<span 
+class="cmtt-10x-x-109">[i]</span>) =
+     sin(<img 
+src="Vorbis_I_spec2x.png" alt="&#x03C0;
+2"  class="frac" align="middle"> <span 
+class="cmsy-10x-x-109">*</span> sin<sup><span 
+class="cmr-8">2</span></sup>( (<span 
+class="cmtt-10x-x-109">[i]</span>-<span 
+class="cmtt-10x-x-109">[left_window_start]</span>+0.5) / <span 
+class="cmtt-10x-x-109">[left_n] </span><span 
+class="cmsy-10x-x-109">*</span><img 
+src="Vorbis_I_spec3x.png" alt="&#x03C0;
+ 2"  class="frac" align="middle">) )
+     </li>
+     <li 
+  class="enumerate" id="x1-72056x6">window from range <span 
+class="cmtt-10x-x-109">[left_window_end] </span>... <span 
+class="cmtt-10x-x-109">[right_window_start]</span>-1 inclusive is
+     one
+     </li>
+     <li 
+  class="enumerate" id="x1-72058x7">for <span 
+class="cmtt-10x-x-109">[i] </span>in range <span 
+class="cmtt-10x-x-109">[right_window_start] </span>... <span 
+class="cmtt-10x-x-109">[right_window_end]</span>-1, window(<span 
+class="cmtt-10x-x-109">[i]</span>) =
+     sin(<img 
+src="Vorbis_I_spec4x.png" alt="&#x03C0;
+2"  class="frac" align="middle"> <span 
+class="cmsy-10x-x-109">*</span> sin<sup><span 
+class="cmr-8">2</span></sup>( (<span 
+class="cmtt-10x-x-109">[i]</span>-<span 
+class="cmtt-10x-x-109">[right_window_start]</span>+0.5) / <span 
+class="cmtt-10x-x-109">[right_n] </span><span 
+class="cmsy-10x-x-109">*</span><img 
+src="Vorbis_I_spec5x.png" alt="&#x03C0;
+2"  class="frac" align="middle"> + <img 
+src="Vorbis_I_spec6x.png" alt="&#x03C0;
+2"  class="frac" align="middle">) )
+     </li>
+     <li 
+  class="enumerate" id="x1-72060x8">window from range <span 
+class="cmtt-10x-x-109">[right_window_start] </span>... <span 
+class="cmtt-10x-x-109">[n]</span>-1 is zero</li></ol>
+<!--l. 367--><p class="noindent" >An end-of-packet condition up to this point should be considered an error that discards this packet
+from the stream. An end of packet condition past this point is to be considered a possible nominal
+occurrence.
+<!--l. 374--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">4.3.2 </span> <a 
+ id="x1-730004.3.2"></a>floor curve decode</h5>
+                                                                                    
 
-</p><div class="blockquote"><blockquote class="blockquote"><pre class="programlisting">
-ARTIST=Dizzy Gillespie 
-ARTIST=Sonny Rollins 
-ARTIST=Sonny Stitt 
-</pre></blockquote></div><p>
+                                                                                    
+<!--l. 376--><p class="noindent" >From this point on, we assume out decode context is using mode number <span 
+class="cmtt-10x-x-109">[mode_number]</span>
+from configuration array <span 
+class="cmtt-10x-x-109">[vorbis_mode_configurations] </span>and the map number
+<span 
+class="cmtt-10x-x-109">[vorbis_mode_mapping] </span>(specified by the current mode) taken from the mapping configuration
+array <span 
+class="cmtt-10x-x-109">[vorbis_mapping_configurations]</span>.
+<!--l. 383--><p class="noindent" >Floor curves are decoded one-by-one in channel order.
+<!--l. 385--><p class="noindent" >For each floor <span 
+class="cmtt-10x-x-109">[i] </span>of <span 
+class="cmtt-10x-x-109">[audio_channels]</span>
+     <ol  class="enumerate1" >
+     <li 
+  class="enumerate" id="x1-73002x1"><span 
+class="cmtt-10x-x-109">[submap_number] </span>= element <span 
+class="cmtt-10x-x-109">[i] </span>of vector [vorbis&#x02D9;mapping&#x02D9;mux]
+     </li>
+     <li 
+  class="enumerate" id="x1-73004x2"><span 
+class="cmtt-10x-x-109">[floor_number] </span>= element <span 
+class="cmtt-10x-x-109">[submap_number] </span>of vector [vorbis&#x02D9;submap&#x02D9;floor]
+     </li>
+     <li 
+  class="enumerate" id="x1-73006x3">if the floor type of this floor (vector <span 
+class="cmtt-10x-x-109">[vorbis_floor_types] </span>element <span 
+class="cmtt-10x-x-109">[floor_number]</span>)
+     is zero then decode the floor for channel <span 
+class="cmtt-10x-x-109">[i] </span>according to the <a 
+href="#x1-930006.2.2">subsubsection&#x00A0;6.2.2<!--tex4ht:ref: vorbis:spec:floor0-decode --></a>,
+     &#8220;<a 
+href="#x1-930006.2.2">packet decode<!--tex4ht:ref: vorbis:spec:floor0-decode --></a>&#8221;
+     </li>
+     <li 
+  class="enumerate" id="x1-73008x4">if the type of this floor is one then decode the floor for channel <span 
+class="cmtt-10x-x-109">[i] </span>according to the
+     <a 
+href="#x1-1000007.2.2">paragraph&#x00A0;7.2.2<!--tex4ht:ref: vorbis:spec:floor1-decode --></a>, &#8220;<a 
+href="#x1-1000007.2.2">packet decode<!--tex4ht:ref: vorbis:spec:floor1-decode --></a>&#8221;
+     </li>
+     <li 
+  class="enumerate" id="x1-73010x5">save the needed decoded floor information for channel for later synthesis
+     </li>
+     <li 
+  class="enumerate" id="x1-73012x6">if the decoded floor returned &#8217;unused&#8217;, set vector <span 
+class="cmtt-10x-x-109">[no_residue] </span>element <span 
+class="cmtt-10x-x-109">[i] </span>to true,
+     else set vector <span 
+class="cmtt-10x-x-109">[no_residue] </span>element <span 
+class="cmtt-10x-x-109">[i] </span>to false</li></ol>
+<!--l. 405--><p class="noindent" >An end-of-packet condition during floor decode shall result in packet decode zeroing all channel
+output vectors and skipping to the add/overlap output stage.
+<!--l. 411--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">4.3.3 </span> <a 
+ id="x1-740004.3.3"></a>nonzero vector propagate</h5>
+<!--l. 413--><p class="noindent" >A possible result of floor decode is that a specific vector is marked &#8217;unused&#8217; which indicates that
+that final output vector is all-zero values (and the floor is zero). The residue for that vector is not
+coded in the stream, save for one complication. If some vectors are used and some are not, channel
+coupling could result in mixing a zeroed and nonzeroed vector to produce two nonzeroed
+vectors.
+<!--l. 420--><p class="noindent" >for each <span 
+class="cmtt-10x-x-109">[i] </span>from 0 ... <span 
+class="cmtt-10x-x-109">[vorbis_mapping_coupling_steps]</span>-1
+<!--l. 423--><p class="noindent" >
+     <ol  class="enumerate1" >
+     <li 
+  class="enumerate" id="x1-74002x1">if either <span 
+class="cmtt-10x-x-109">[no_residue] </span>entry for channel (<span 
+class="cmtt-10x-x-109">[vorbis_mapping_magnitude] </span>element <span 
+class="cmtt-10x-x-109">[i]</span>)
+                                                                                    
 
-</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id301005"></a>5.2.3. Encoding</h4></div></div></div><p>
-The comment header comprises the entirety of the second bitstream
-header packet.  Unlike the first bitstream header packet, it is not
-generally the only packet on the second page and may not be restricted
-to within the second bitstream page.  The length of the comment header
-packet is (practically) unbounded.  The comment header packet is not
-optional; it must be present in the bitstream even if it is
-effectively empty.</p><p>
-The comment header is encoded as follows (as per Ogg's standard
-bitstream mapping which renders least-significant-bit of the word to be
-coded into the least significant available bit of the current
-bitstream octet first):
+                                                                                    
+     or channel (<span 
+class="cmtt-10x-x-109">[vorbis_mapping_angle] </span>element <span 
+class="cmtt-10x-x-109">[i]</span>) are set to false, then both must be
+     set to false. Note that an &#8217;unused&#8217; floor has no decoded floor information; it is important
+     that this is remembered at floor curve synthesis time.</li></ol>
+<!--l. 435--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">4.3.4 </span> <a 
+ id="x1-750004.3.4"></a>residue decode</h5>
+<!--l. 437--><p class="noindent" >Unlike floors, which are decoded in channel order, the residue vectors are decoded in submap
+order.
+<!--l. 440--><p class="noindent" >for each submap <span 
+class="cmtt-10x-x-109">[i] </span>in order from 0 ... <span 
+class="cmtt-10x-x-109">[vorbis_mapping_submaps]</span>-1
+<!--l. 443--><p class="noindent" >
+     <ol  class="enumerate1" >
+     <li 
+  class="enumerate" id="x1-75002x1"><span 
+class="cmtt-10x-x-109">[ch] </span>= 0
+     </li>
+     <li 
+  class="enumerate" id="x1-75004x2">for each channel <span 
+class="cmtt-10x-x-109">[j] </span>in order from 0 ... <span 
+class="cmtt-10x-x-109">[audio_channels] </span>- 1
+          <ol  class="enumerate2" >
+          <li 
+  class="enumerate" id="x1-75006x1">if channel <span 
+class="cmtt-10x-x-109">[j] </span>in submap <span 
+class="cmtt-10x-x-109">[i] </span>(vector <span 
+class="cmtt-10x-x-109">[vorbis_mapping_mux] </span>element <span 
+class="cmtt-10x-x-109">[j] </span>is equal to
+          <span 
+class="cmtt-10x-x-109">[i]</span>)
+              <ol  class="enumerate3" >
+              <li 
+  class="enumerate" id="x1-75008x1">if vector <span 
+class="cmtt-10x-x-109">[no_residue] </span>element <span 
+class="cmtt-10x-x-109">[j] </span>is true
+                 <ol  class="enumerate4" >
+                 <li 
+  class="enumerate" id="x1-75010x1">vector <span 
+class="cmtt-10x-x-109">[do_not_decode_flag] </span>element <span 
+class="cmtt-10x-x-109">[ch] </span>is set</li></ol>
+              <!--l. 452--><p class="noindent" >else
+                 <ol  class="enumerate4" >
+                 <li 
+  class="enumerate" id="x1-75012x1">vector <span 
+class="cmtt-10x-x-109">[do_not_decode_flag] </span>element <span 
+class="cmtt-10x-x-109">[ch] </span>is unset</li></ol>
+              </li>
+              <li 
+  class="enumerate" id="x1-75014x2">increment <span 
+class="cmtt-10x-x-109">[ch]</span></li></ol>
+          </li></ol>
+     </li>
+     <li 
+  class="enumerate" id="x1-75016x3"><span 
+class="cmtt-10x-x-109">[residue_number] </span>= vector <span 
+class="cmtt-10x-x-109">[vorbis_mapping_submap_residue] </span>element <span 
+class="cmtt-10x-x-109">[i]</span>
+     </li>
+     <li 
+  class="enumerate" id="x1-75018x4"><span 
+class="cmtt-10x-x-109">[residue_type] </span>= vector <span 
+class="cmtt-10x-x-109">[vorbis_residue_types] </span>element <span 
+class="cmtt-10x-x-109">[residue_number]</span>
+     </li>
+     <li 
+  class="enumerate" id="x1-75020x5">decode <span 
+class="cmtt-10x-x-109">[ch] </span>vectors using residue <span 
+class="cmtt-10x-x-109">[residue_number]</span>, according to type <span 
+class="cmtt-10x-x-109">[residue_type]</span>,
+     also passing vector <span 
+class="cmtt-10x-x-109">[do_not_decode_flag] </span>to indicate which vectors in the bundle should not
+     be decoded. Correct per-vector decode length is <span 
+class="cmtt-10x-x-109">[n]</span>/2.
+                                                                                    
 
-</p><div class="orderedlist"><ol type="1"><li>
-  Vendor string length (32 bit unsigned quantity specifying number of octets)
- </li><li>
-  Vendor string ([vendor string length] octets coded from beginning of string to end of string, not null terminated)
- </li><li>
-  Number of comment fields (32 bit unsigned quantity specifying number of fields)
- </li><li>
-  Comment field 0 length (if [Number of comment fields]&gt;0; 32 bit unsigned quantity specifying number of octets)
- </li><li>
-  Comment field 0 ([Comment field 0 length] octets coded from beginning of string to end of string, not null terminated)
- </li><li>
-  Comment field 1 length (if [Number of comment fields]&gt;1...)...
- </li></ol></div><p>
-</p><p>
-This is actually somewhat easier to describe in code; implementation of the above can be found in <code class="filename">vorbis/lib/info.c</code>, <code class="function">_vorbis_pack_comment()</code> and <code class="function">_vorbis_unpack_comment()</code>.
-</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="vorbis-spec-floor0"></a>6. Floor type 0 setup and decode</h2></div><div><p class="releaseinfo">
-  $Id: 06-floor0.xml 14529 2008-02-19 10:15:13Z xiphmont $
-</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id320318"></a>6.1. Overview</h3></div></div></div><p>
-Vorbis floor type zero uses Line Spectral Pair (LSP, also alternately
-known as Line Spectral Frequency or LSF) representation to encode a
-smooth spectral envelope curve as the frequency response of the LSP
-filter.  This representation is equivalent to a traditional all-pole
-infinite impulse response filter as would be used in linear predictive
-coding; LSP representation may be converted to LPC representation and
-vice-versa.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id324407"></a>6.2. Floor 0 format</h3></div></div></div><p>
-Floor zero configuration consists of six integer fields and a list of
-VQ codebooks for use in coding/decoding the LSP filter coefficient
-values used by each frame. </p><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id322051"></a>6.2.1. header decode</h4></div></div></div><p>
-Configuration information for instances of floor zero decodes from the
-codec setup header (third packet).  configuration decode proceeds as
-follows:</p><pre class="screen">
-  1) [floor0_order] = read an unsigned integer of 8 bits
-  2) [floor0_rate] = read an unsigned integer of 16 bits
-  3) [floor0_bark_map_size] = read an unsigned integer of 16 bits
-  4) [floor0_amplitude_bits] = read an unsigned integer of six bits
-  5) [floor0_amplitude_offset] = read an unsigned integer of eight bits
-  6) [floor0_number_of_books] = read an unsigned integer of four bits and add 1
-  7) array [floor0_book_list] = read a list of [floor0_number_of_books] unsigned integers of eight bits each;
-</pre><p>
-An end-of-packet condition during any of these bitstream reads renders
-this stream undecodable.  In addition, any element of the array
-<code class="varname">[floor0_book_list]</code> that is greater than the maximum codebook
-number for this bitstream is an error condition that also renders the
-stream undecodable.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="vorbis-spec-floor0-decode"></a>6.2.2. packet decode</h4></div></div></div><p>
-Extracting a floor0 curve from an audio packet consists of first
-decoding the curve amplitude and <code class="varname">[floor0_order]</code> LSP
-coefficient values from the bitstream, and then computing the floor
-curve, which is defined as the frequency response of the decoded LSP
-filter.</p><p>
-Packet decode proceeds as follows:</p><pre class="screen">
-  1) [amplitude] = read an unsigned integer of [floor0_amplitude_bits] bits
-  2) if ( [amplitude] is greater than zero ) {
-       3) [coefficients] is an empty, zero length vector
-       4) [booknumber] = read an unsigned integer of <a href="#vorbis-spec-ilog" title="9.2.1. ilog">ilog</a>( [floor0_number_of_books] ) bits
-       5) if ( [booknumber] is greater than the highest number decode codebook ) then packet is undecodable
-       6) [last] = zero;
-       7) vector [temp_vector] = read vector from bitstream using codebook number [floor0_book_list] element [booknumber] in VQ context.
-       8) add the scalar value [last] to each scalar in vector [temp_vector]
-       9) [last] = the value of the last scalar in vector [temp_vector]
-      10) concatenate [temp_vector] onto the end of the [coefficients] vector
-      11) if (length of vector [coefficients] is less than [floor0_order], continue at step 6
+                                                                                    
+     </li>
+     <li 
+  class="enumerate" id="x1-75022x6"><span 
+class="cmtt-10x-x-109">[ch] </span>= 0
+     </li>
+     <li 
+  class="enumerate" id="x1-75024x7">for each channel <span 
+class="cmtt-10x-x-109">[j] </span>in order from 0 ... <span 
+class="cmtt-10x-x-109">[audio_channels]</span>
+          <ol  class="enumerate2" >
+          <li 
+  class="enumerate" id="x1-75026x1">if channel <span 
+class="cmtt-10x-x-109">[j] </span>is in submap <span 
+class="cmtt-10x-x-109">[i] </span>(vector <span 
+class="cmtt-10x-x-109">[vorbis_mapping_mux] </span>element <span 
+class="cmtt-10x-x-109">[j] </span>is equal to
+          <span 
+class="cmtt-10x-x-109">[i]</span>)
+              <ol  class="enumerate3" >
+              <li 
+  class="enumerate" id="x1-75028x1">residue vector for channel <span 
+class="cmtt-10x-x-109">[j] </span>is set to decoded residue vector <span 
+class="cmtt-10x-x-109">[ch]</span>
+              </li>
+              <li 
+  class="enumerate" id="x1-75030x2">increment <span 
+class="cmtt-10x-x-109">[ch]</span></li></ol>
+          </li></ol>
+     </li></ol>
+<!--l. 479--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">4.3.5 </span> <a 
+ id="x1-760004.3.5"></a>inverse coupling</h5>
+<!--l. 481--><p class="noindent" >for each <span 
+class="cmtt-10x-x-109">[i] </span>from <span 
+class="cmtt-10x-x-109">[vorbis_mapping_coupling_steps]</span>-1 descending to 0
+<!--l. 484--><p class="noindent" >
+     <ol  class="enumerate1" >
+     <li 
+  class="enumerate" id="x1-76002x1"><span 
+class="cmtt-10x-x-109">[magnitude_vector]    </span>=      the      residue      vector      for      channel      (vector
+     <span 
+class="cmtt-10x-x-109">[vorbis_mapping_magnitude] </span>element <span 
+class="cmtt-10x-x-109">[i]</span>)
+     </li>
+     <li 
+  class="enumerate" id="x1-76004x2"><span 
+class="cmtt-10x-x-109">[angle_vector] </span>= the residue vector for channel (vector <span 
+class="cmtt-10x-x-109">[vorbis_mapping_angle]</span>
+     element <span 
+class="cmtt-10x-x-109">[i]</span>)
+     </li>
+     <li 
+  class="enumerate" id="x1-76006x3">for each scalar value <span 
+class="cmtt-10x-x-109">[M] </span>in vector <span 
+class="cmtt-10x-x-109">[magnitude_vector] </span>and the corresponding scalar value
+     <span 
+class="cmtt-10x-x-109">[A] </span>in vector <span 
+class="cmtt-10x-x-109">[angle_vector]</span>:
+          <ol  class="enumerate2" >
+          <li 
+  class="enumerate" id="x1-76008x1">if (<span 
+class="cmtt-10x-x-109">[M] </span>is greater than zero)
+              <ol  class="enumerate3" >
+              <li 
+  class="enumerate" id="x1-76010x1">if (<span 
+class="cmtt-10x-x-109">[A] </span>is greater than zero)
+                 <ol  class="enumerate4" >
+                 <li 
+  class="enumerate" id="x1-76012x1"><span 
+class="cmtt-10x-x-109">[new_M] </span>= <span 
+class="cmtt-10x-x-109">[M]</span>
+                 </li>
+                 <li 
+  class="enumerate" id="x1-76014x2"><span 
+class="cmtt-10x-x-109">[new_A] </span>= <span 
+class="cmtt-10x-x-109">[M]</span>-<span 
+class="cmtt-10x-x-109">[A]</span></li></ol>
+                                                                                    
 
-     }
+                                                                                    
+              <!--l. 497--><p class="noindent" >else
+                 <ol  class="enumerate4" >
+                 <li 
+  class="enumerate" id="x1-76016x1"><span 
+class="cmtt-10x-x-109">[new_A] </span>= <span 
+class="cmtt-10x-x-109">[M]</span>
+                 </li>
+                 <li 
+  class="enumerate" id="x1-76018x2"><span 
+class="cmtt-10x-x-109">[new_M] </span>= <span 
+class="cmtt-10x-x-109">[M]</span>+<span 
+class="cmtt-10x-x-109">[A]</span></li></ol>
+              </li></ol>
+          <!--l. 504--><p class="noindent" >else
+              <ol  class="enumerate3" >
+              <li 
+  class="enumerate" id="x1-76020x1">if (<span 
+class="cmtt-10x-x-109">[A] </span>is greater than zero)
+                 <ol  class="enumerate4" >
+                 <li 
+  class="enumerate" id="x1-76022x1"><span 
+class="cmtt-10x-x-109">[new_M] </span>= <span 
+class="cmtt-10x-x-109">[M]</span>
+                 </li>
+                 <li 
+  class="enumerate" id="x1-76024x2"><span 
+class="cmtt-10x-x-109">[new_A] </span>= <span 
+class="cmtt-10x-x-109">[M]</span>+<span 
+class="cmtt-10x-x-109">[A]</span></li></ol>
+              <!--l. 511--><p class="noindent" >else
+                 <ol  class="enumerate4" >
+                 <li 
+  class="enumerate" id="x1-76026x1"><span 
+class="cmtt-10x-x-109">[new_A] </span>= <span 
+class="cmtt-10x-x-109">[M]</span>
+                 </li>
+                 <li 
+  class="enumerate" id="x1-76028x2"><span 
+class="cmtt-10x-x-109">[new_M] </span>= <span 
+class="cmtt-10x-x-109">[M]</span>-<span 
+class="cmtt-10x-x-109">[A]</span></li></ol>
+              </li></ol>
+          </li>
+          <li 
+  class="enumerate" id="x1-76030x2">set scalar value <span 
+class="cmtt-10x-x-109">[M] </span>in vector <span 
+class="cmtt-10x-x-109">[magnitude_vector] </span>to <span 
+class="cmtt-10x-x-109">[new_M]</span>
+          </li>
+          <li 
+  class="enumerate" id="x1-76032x3">set scalar value <span 
+class="cmtt-10x-x-109">[A] </span>in vector <span 
+class="cmtt-10x-x-109">[angle_vector] </span>to <span 
+class="cmtt-10x-x-109">[new_A]</span></li></ol>
+     </li></ol>
+<!--l. 528--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">4.3.6 </span> <a 
+ id="x1-770004.3.6"></a>dot product</h5>
+<!--l. 530--><p class="noindent" >For each channel, synthesize the floor curve from the decoded floor information, according to packet
+type. Note that the vector synthesis length for floor computation is <span 
+class="cmtt-10x-x-109">[n]</span>/2.
+<!--l. 534--><p class="noindent" >For each channel, multiply each element of the floor curve by each element of that channel&#8217;s residue
+vector. The result is the dot product of the floor and residue vectors for each channel; the produced
+vectors are the length <span 
+class="cmtt-10x-x-109">[n]</span>/2 audio spectrum for each channel.
+<!--l. 542--><p class="noindent" >One point is worth mentioning about this dot product; a common mistake in a fixed point
+implementation might be to assume that a 32 bit fixed-point representation for floor
+                                                                                    
 
- 12) done.
- 
-</pre><p>
-Take note of the following properties of decode:
-</p><div class="itemizedlist"><ul type="disc"><li>An <code class="varname">[amplitude]</code> value of zero must result in a return code that indicates this channel is unused in this frame (the output of the channel will be all-zeroes in synthesis).  Several later stages of decode don't occur for an unused channel.</li><li>An end-of-packet condition during decode should be considered a
-nominal occruence; if end-of-packet is reached during any read
-operation above, floor decode is to return 'unused' status as if the
-<code class="varname">[amplitude]</code> value had read zero at the beginning of decode.</li><li>The book number used for decode
-can, in fact, be stored in the bitstream in <a href="#vorbis-spec-ilog" title="9.2.1. ilog">ilog</a>( <code class="varname">[floor0_number_of_books]</code> -
-1 ) bits.  Nevertheless, the above specification is correct and values
-greater than the maximum possible book value are reserved.</li><li>The number of scalars read into the vector <code class="varname">[coefficients]</code>
-may be greater than <code class="varname">[floor0_order]</code>, the number actually
-required for curve computation.  For example, if the VQ codebook used
-for the floor currently being decoded has a
-<code class="varname">[codebook_dimensions]</code> value of three and
-<code class="varname">[floor0_order]</code> is ten, the only way to fill all the needed
-scalars in <code class="varname">[coefficients]</code> is to to read a total of twelve
-scalars as four vectors of three scalars each.  This is not an error
-condition, and care must be taken not to allow a buffer overflow in
-decode. The extra values are not used and may be ignored or discarded.</li></ul></div><p>
-</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="vorbis-spec-floor0-synth"></a>6.2.3. curve computation</h4></div></div></div><p>
-Given an <code class="varname">[amplitude]</code> integer and <code class="varname">[coefficients]</code>
-vector from packet decode as well as the [floor0_order],
-[floor0_rate], [floor0_bark_map_size], [floor0_amplitude_bits] and
-[floor0_amplitude_offset] values from floor setup, and an output
-vector size <code class="varname">[n]</code> specified by the decode process, we compute a
-floor output vector.</p><p>
-If the value <code class="varname">[amplitude]</code> is zero, the return value is a
-length <code class="varname">[n]</code> vector with all-zero scalars.  Otherwise, begin by
-assuming the following definitions for the given vector to be
-synthesized:</p><div class="informalequation"><div class="mediaobject"><img src="lspmap.png" alt="[lsp map equation]"></div></div><p>
-The above is used to synthesize the LSP curve on a Bark-scale frequency
-axis, then map the result to a linear-scale frequency axis.
-Similarly, the below calculation synthesizes the output LSP curve <code class="varname">[output]</code> on a log
-(dB) amplitude scale, mapping it to linear amplitude in the last step:</p><div class="orderedlist"><ol type="1"><li> <code class="varname">[i]</code> = 0 </li><li> <code class="varname">[&#969;]</code> = &#960; * map element <code class="varname">[i]</code> / <code class="varname">[floor0_bark_map_size]</code></li><li><p>if ( <code class="varname">[floor0_order]</code> is odd ) {
-  </p><div class="orderedlist"><ol type="a"><li><p>calculate <code class="varname">[p]</code> and <code class="varname">[q]</code> according to:
-        </p><div class="informalequation"><div class="mediaobject"><img src="oddlsp.png" alt="[equation for odd lsp]"></div></div><p>
-   </p></li></ol></div><p>
-  } else <code class="varname">[floor0_order]</code> is even {
-  </p><div class="orderedlist"><ol type="a"><li><p>calculate <code class="varname">[p]</code> and <code class="varname">[q]</code> according to:
-        </p><div class="informalequation"><div class="mediaobject"><img src="evenlsp.png" alt="[equation for even lsp]"></div></div><p>
-   </p></li></ol></div><p> 
-  }
- </p></li><li><p>calculate <code class="varname">[linear_floor_value]</code> according to:
-     </p><div class="informalequation"><div class="mediaobject"><img src="floorval.png" alt="[expression for floorval]"></div></div><p>
- </p></li><li><code class="varname">[iteration_condition]</code> = map element <code class="varname">[i]</code></li><li><code class="varname">[output]</code> element <code class="varname">[i]</code> = <code class="varname">[linear_floor_value]</code></li><li>increment <code class="varname">[i]</code></li><li>if ( map element <code class="varname">[i]</code> is equal to <code class="varname">[iteration_condition]</code> ) continue at step 5</li><li>if ( <code class="varname">[i]</code> is less than <code class="varname">[n]</code> ) continue at step 2</li><li>done</li></ol></div></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="vorbis-spec-floor1"></a>7. Floor type 1 setup and decode</h2></div><div><p class="releaseinfo">
- $Id: 07-floor1.xml 10466 2005-11-28 00:34:44Z giles $
-</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id321969"></a>7.1. Overview</h3></div></div></div><p>
-Vorbis floor type one uses a piecewise straight-line representation to
-encode a spectral envelope curve. The representation plots this curve
-mechanically on a linear frequency axis and a logarithmic (dB)
-amplitude axis. The integer plotting algorithm used is similar to
-Bresenham's algorithm.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id315653"></a>7.2. Floor 1 format</h3></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id317058"></a>7.2.1. model</h4></div></div></div><p>
-Floor type one represents a spectral curve as a series of
-line segments.  Synthesis constructs a floor curve using iterative
-prediction in a process roughly equivalent to the following simplified
-description:</p><p>
-</p><div class="itemizedlist"><ul type="disc"><li> the first line segment (base case) is a logical line spanning
-from x_0,y_0 to x_1,y_1 where in the base case x_0=0 and x_1=[n], the
-full range of the spectral floor to be computed.</li><li>the induction step chooses a point x_new within an existing
-logical line segment and produces a y_new value at that point computed
-from the existing line's y value at x_new (as plotted by the line) and
-a difference value decoded from the bitstream packet.</li><li>floor computation produces two new line segments, one running from
-x_0,y_0 to x_new,y_new and from x_new,y_new to x_1,y_1. This step is
-performed logically even if y_new represents no change to the
-amplitude value at x_new so that later refinement is additionally
-bounded at x_new.</li><li>the induction step repeats, using a list of x values specified in
-the codec setup header at floor 1 initialization time.  Computation
-is completed at the end of the x value list.</li></ul></div><p>
-</p><p>
-Consider the following example, with values chosen for ease of
-understanding rather than representing typical configuration:</p><p>
-For the below example, we assume a floor setup with an [n] of 128.
-The list of selected X values in increasing order is
-0,16,32,48,64,80,96,112 and 128.  In list order, the values interleave
-as 0, 128, 64, 32, 96, 16, 48, 80 and 112.  The corresponding
-list-order Y values as decoded from an example packet are 110, 20, -5,
--45, 0, -25, -10, 30 and -10.  We compute the floor in the following
-way, beginning with the first line:</p><div class="mediaobject"><img src="floor1-1.png" alt="[graph of example floor]"></div><p>
-We now draw new logical lines to reflect the correction to new_Y, and
-iterate for X positions 32 and 96:</p><div class="mediaobject"><img src="floor1-2.png" alt="[graph of example floor]"></div><p>
-Although the new Y value at X position 96 is unchanged, it is still
-used later as an endpoint for further refinement.  From here on, the
-pattern should be clear; we complete the floor computation as follows:</p><div class="mediaobject"><img src="floor1-3.png" alt="[graph of example floor]"></div><div class="mediaobject"><img src="floor1-4.png" alt="[graph of example floor]"></div><p>
-A more efficient algorithm with carefully defined integer rounding
-behavior is used for actual decode, as described later.  The actual
-algorithm splits Y value computation and line plotting into two steps
-with modifications to the above algorithm to eliminate noise
-accumulation through integer roundoff/truncation. </p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id334215"></a>7.2.2. header decode</h4></div></div></div><p>
-A list of floor X values is stored in the packet header in interleaved
-format (used in list order during packet decode and synthesis).  This
-list is split into partitions, and each partition is assigned to a
-partition class.  X positions 0 and [n] are implicit and do not belong
-to an explicit partition or partition class.</p><p>
-A partition class consists of a representation vector width (the
-number of Y values which the partition class encodes at once), a
-'subclass' value representing the number of alternate entropy books
-the partition class may use in representing Y values, the list of
-[subclass] books and a master book used to encode which alternate
-books were chosen for representation in a given packet.  The
-master/subclass mechanism is meant to be used as a flexible
-representation cascade while still using codebooks only in a scalar
-context.</p><pre class="screen">
+                                                                                    
+and residue and direct multiplication of the vectors is sufficient for acceptable spectral
+depth in all cases because it happens to mostly work with the current Xiph.Org reference
+encoder.
+<!--l. 549--><p class="noindent" >However, floor vector values can span <span 
+class="cmsy-10x-x-109">~</span>140dB (<span 
+class="cmsy-10x-x-109">~</span>24 bits unsigned), and the audio spectrum vector
+should represent a minimum of 120dB (<span 
+class="cmsy-10x-x-109">~</span>21 bits with sign), even when output is to a 16 bit PCM
+device. For the residue vector to represent full scale if the floor is nailed to <span 
+class="cmsy-10x-x-109">-</span>140dB, it must be able
+to span 0 to +140dB. For the residue vector to reach full scale if the floor is nailed at 0dB, it must
+be able to represent <span 
+class="cmsy-10x-x-109">-</span>140dB to +0dB. Thus, in order to handle full range dynamics, a residue
+vector may span <span 
+class="cmsy-10x-x-109">-</span>140dB to +140dB entirely within spec. A 280dB range is approximately 48 bits
+with sign; thus the residue vector must be able to represent a 48 bit range and the dot product
+must be able to handle an effective 48 bit times 24 bit multiplication. This range may be
+achieved using large (64 bit or larger) integers, or implementing a movable binary point
+representation.
+<!--l. 566--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">4.3.7 </span> <a 
+ id="x1-780004.3.7"></a>inverse MDCT</h5>
+<!--l. 568--><p class="noindent" >Convert the audio spectrum vector of each channel back into time domain PCM audio via an
+inverse Modified Discrete Cosine Transform (MDCT). A detailed description of the MDCT
+is available in <span class="cite">[<a 
+href="#XSporer/Brandenburg/Edler">1</a>]</span>. The window function used for the MDCT is the function described
+earlier.
+<!--l. 575--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">4.3.8 </span> <a 
+ id="x1-790004.3.8"></a>overlap&#x02D9;add</h5>
+<!--l. 577--><p class="noindent" >Windowed MDCT output is overlapped and added with the right hand data of the previous
+window such that the 3/4 point of the previous window is aligned with the 1/4 point of the
+current window (as illustrated in <a 
+href="#x1-260001.3.2">paragraph&#x00A0;1.3.2<!--tex4ht:ref: vorbis:spec:window --></a>, &#8220;<a 
+href="#x1-260001.3.2">Window shape decode (long windows
+only)<!--tex4ht:ref: vorbis:spec:window --></a>&#8221;). The overlapped portion produced from overlapping the previous and current frame
+data is finished data to be returned by the decoder. This data spans from the center
+of the previous window to the center of the current window. In the case of same-sized
+windows, the amount of data to return is one-half block consisting of and only of the
+overlapped portions. When overlapping a short and long window, much of the returned
+range does not actually overlap. This does not damage transform orthogonality. Pay
+attention however to returning the correct data range; the amount of data to be returned
+is:
+<!--l. 591--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb22">
+<a 
+ id="x1-79002r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;window_blocksize(previous_window)/4+window_blocksize(current_window)/4</span>
+                                                                                    
 
-  1) [floor1_partitions] = read 5 bits as unsigned integer
-  2) [maximum_class] = -1
-  3) iterate [i] over the range 0 ... [floor1_partitions]-1 {
-       
-        4) vector [floor1_partition_class_list] element [i] = read 4 bits as unsigned integer
+                                                                                    
+</div>
+<!--l. 595--><p class="noindent" >from the center (element windowsize/2) of the previous window to the center (element
+windowsize/2-1, inclusive) of the current window.
+<!--l. 598--><p class="noindent" >Data is not returned from the first frame; it must be used to &#8217;prime&#8217; the decode engine. The encoder
+accounts for this priming when calculating PCM offsets; after the first frame, the proper PCM
+output offset is &#8217;0&#8217; (as no data has been returned yet).
+<!--l. 605--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">4.3.9 </span> <a 
+ id="x1-800004.3.9"></a>output channel order</h5>
+<!--l. 607--><p class="noindent" >Vorbis I specifies only a channel mapping type 0. In mapping type 0, channel mapping is implicitly
+defined as follows for standard audio applications:
+<!--l. 612--><p class="noindent" >
+     <dl class="description"><dt class="description">
+<span 
+class="cmssbx-10x-x-109">three channels</span> </dt><dd 
+class="description">the stream is monophonic
+     </dd><dt class="description">
+<span 
+class="cmssbx-10x-x-109">two channels</span> </dt><dd 
+class="description">the stream is stereo. channel order: left, right
+     </dd><dt class="description">
+<span 
+class="cmssbx-10x-x-109">three channels</span> </dt><dd 
+class="description">the stream is a 1d-surround encoding. channel order: left, center, right
+     </dd><dt class="description">
+<span 
+class="cmssbx-10x-x-109">four channels</span> </dt><dd 
+class="description">the stream is quadraphonic surround. channel order: front left, front right, rear
+     left, rear right
+     </dd><dt class="description">
+<span 
+class="cmssbx-10x-x-109">five channels</span> </dt><dd 
+class="description">the stream is five-channel surround. channel order: front left, front center, front
+     right, rear left, rear right
+     </dd><dt class="description">
+<span 
+class="cmssbx-10x-x-109">six channels</span> </dt><dd 
+class="description">the stream is 5.1 surround. channel order: front left, front center, front right,
+     rear left, rear right, LFE
+     </dd><dt class="description">
+<span 
+class="cmssbx-10x-x-109">greater than six channels</span> </dt><dd 
+class="description">channel use and order is defined by the application
+     </dd></dl>
+<!--l. 639--><p class="noindent" >Applications using Vorbis for dedicated purposes may define channel mapping as seen fit. Future
+channel mappings (such as three and four channel <a 
+href="http://www.ambisonic.net/" >Ambisonics</a>) will make use of channel mappings
+other than mapping 0.
+                                                                                    
 
-     }
+                                                                                    
+                                                                                    
 
-  5) [maximum_class] = largest integer scalar value in vector [floor1_partition_class_list]
-  6) iterate [i] over the range 0 ... [maximum_class] {
+                                                                                    
+<h3 class="sectionHead"><span class="titlemark">5 </span> <a 
+ id="x1-810005"></a>comment field and header specification</h3>
+<!--l. 6--><p class="noindent" >
+<h4 class="subsectionHead"><span class="titlemark">5.1 </span> <a 
+ id="x1-820005.1"></a>Overview</h4>
+<!--l. 8--><p class="noindent" >The Vorbis text comment header is the second (of three) header packets that begin a Vorbis
+bitstream. It is meant for short text comments, not arbitrary metadata; arbitrary metadata belongs
+in a separate logical bitstream (usually an XML stream type) that provides greater structure and
+machine parseability.
+<!--l. 14--><p class="noindent" >The comment field is meant to be used much like someone jotting a quick note on the bottom of a
+CDR. It should be a little information to remember the disc by and explain it to others; a short,
+to-the-point text note that need not only be a couple words, but isn&#8217;t going to be more
+than a short paragraph. The essentials, in other words, whatever they turn out to be,
+eg:
+<!--l. 21--><p class="noindent" >
+     <div class="quote">
+     <!--l. 22--><p class="noindent" >Honest Bob and the Factory-to-Dealer-Incentives, <span 
+class="cmti-10x-x-109">&#8220;I&#8217;m Still Around&#8221;</span>, opening for
+     Moxy Früvous, 1997.</div>
+<!--l. 29--><p class="noindent" >
+<h4 class="subsectionHead"><span class="titlemark">5.2 </span> <a 
+ id="x1-830005.2"></a>Comment encoding</h4>
+<!--l. 31--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">5.2.1 </span> <a 
+ id="x1-840005.2.1"></a>Structure</h5>
+<!--l. 33--><p class="noindent" >The comment header is logically a list of eight-bit-clean vectors; the number of vectors is bounded
+to 2<sup><span 
+class="cmr-8">32</span></sup> <span 
+class="cmsy-10x-x-109">- </span>1 and the length of each vector is limited to 2<sup><span 
+class="cmr-8">32</span></sup> <span 
+class="cmsy-10x-x-109">- </span>1 bytes. The vector length is encoded;
+the vector contents themselves are not null terminated. In addition to the vector list,
+there is a single vector for vendor name (also 8 bit clean, length encoded in 32 bits).
+For example, the 1.0 release of libvorbis set the vendor string to &#8220;Xiph.Org libVorbis I
+20020717&#8221;.
+                                                                                    
 
-        7) vector [floor1_class_dimensions] element [i] = read 3 bits as unsigned integer and add 1
-	8) vector [floor1_class_subclasses] element [i] = read 2 bits as unsigned integer
-        9) if ( vector [floor1_class_subclasses] element [i] is nonzero ) {
-            
-             10) vector [floor1_class_masterbooks] element [i] = read 8 bits as unsigned integer
-           
-           }
+                                                                                    
+<!--l. 41--><p class="noindent" >The vector lengths and number of vectors are stored lsb first, according to the bit packing
+conventions of the vorbis codec. However, since data in the comment header is octet-aligned, they
+can simply be read as unaligned 32 bit little endian unsigned integers.
+<!--l. 46--><p class="noindent" >The comment header is decoded as follows:
+<!--l. 48--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb23">
+<a 
+ id="x1-84002r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1)</span><span 
+class="cmtt-10">&#x00A0;[vendor_length]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;an</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span><span 
+class="cmtt-10">&#x00A0;of</span><span 
+class="cmtt-10">&#x00A0;32</span><span 
+class="cmtt-10">&#x00A0;bits</span>
+<br class="fancyvrb" /><a 
+ id="x1-84004r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2)</span><span 
+class="cmtt-10">&#x00A0;[vendor_string]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;a</span><span 
+class="cmtt-10">&#x00A0;UTF-8</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;[vendor_length]</span><span 
+class="cmtt-10">&#x00A0;octets</span>
+<br class="fancyvrb" /><a 
+ id="x1-84006r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;3)</span><span 
+class="cmtt-10">&#x00A0;[user_comment_list_length]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;an</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span><span 
+class="cmtt-10">&#x00A0;of</span><span 
+class="cmtt-10">&#x00A0;32</span><span 
+class="cmtt-10">&#x00A0;bits</span>
+<br class="fancyvrb" /><a 
+ id="x1-84008r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;4)</span><span 
+class="cmtt-10">&#x00A0;iterate</span><span 
+class="cmtt-10">&#x00A0;[user_comment_list_length]</span><span 
+class="cmtt-10">&#x00A0;times</span><span 
+class="cmtt-10">&#x00A0;{</span>
+<br class="fancyvrb" /><a 
+ id="x1-84010r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;5)</span><span 
+class="cmtt-10">&#x00A0;[length]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;an</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span><span 
+class="cmtt-10">&#x00A0;of</span><span 
+class="cmtt-10">&#x00A0;32</span><span 
+class="cmtt-10">&#x00A0;bits</span>
+<br class="fancyvrb" /><a 
+ id="x1-84012r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;6)</span><span 
+class="cmtt-10">&#x00A0;this</span><span 
+class="cmtt-10">&#x00A0;iteration&#8217;s</span><span 
+class="cmtt-10">&#x00A0;user</span><span 
+class="cmtt-10">&#x00A0;comment</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;a</span><span 
+class="cmtt-10">&#x00A0;UTF-8</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;[length]</span><span 
+class="cmtt-10">&#x00A0;octets</span>
+<br class="fancyvrb" /><a 
+ id="x1-84014r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;}</span>
+<br class="fancyvrb" /><a 
+ id="x1-84016r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;7)</span><span 
+class="cmtt-10">&#x00A0;[framing_bit]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;a</span><span 
+class="cmtt-10">&#x00A0;single</span><span 
+class="cmtt-10">&#x00A0;bit</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;boolean</span>
+<br class="fancyvrb" /><a 
+ id="x1-84018r9"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;8)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;(</span><span 
+class="cmtt-10">&#x00A0;[framing_bit]</span><span 
+class="cmtt-10">&#x00A0;unset</span><span 
+class="cmtt-10">&#x00A0;or</span><span 
+class="cmtt-10">&#x00A0;end-of-packet</span><span 
+class="cmtt-10">&#x00A0;)</span><span 
+class="cmtt-10">&#x00A0;then</span><span 
+class="cmtt-10">&#x00A0;ERROR</span>
+<br class="fancyvrb" /><a 
+ id="x1-84020r10"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;9)</span><span 
+class="cmtt-10">&#x00A0;done.</span>
+</div>
+<!--l. 64--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">5.2.2 </span> <a 
+ id="x1-850005.2.2"></a>Content vector format</h5>
+<!--l. 66--><p class="noindent" >The comment vectors are structured similarly to a UNIX environment variable. That is, comment
+fields consist of a field name and a corresponding value and look like:
+<!--l. 70--><p class="noindent" >
+     <div class="quote">
+     <!--l. 71--><p class="noindent" >
+     <div class="fancyvrb" id="fancyvrb24">
+<a 
+ id="x1-85002r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;comment[0]="ARTIST=me";</span>
+<br class="fancyvrb" /><a 
+ id="x1-85004r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;comment[1]="TITLE=the</span><span 
+class="cmtt-10">&#x00A0;sound</span><span 
+class="cmtt-10">&#x00A0;of</span><span 
+class="cmtt-10">&#x00A0;Vorbis";</span>
+</div>
+     </div>
+<!--l. 77--><p class="noindent" >The field name is case-insensitive and may consist of ASCII 0x20 through 0x7D, 0x3D (&#8217;=&#8217;)
+excluded. ASCII 0x41 through 0x5A inclusive (characters A-Z) is to be considered equivalent to
+ASCII 0x61 through 0x7A inclusive (characters a-z).
+<!--l. 83--><p class="noindent" >The field name is immediately followed by ASCII 0x3D (&#8217;=&#8217;); this equals sign is used to terminate
+the field name.
+                                                                                    
 
-       11) iterate [j] over the range 0 ... (2 exponent [floor1_class_subclasses] element [i]) - 1  {
+                                                                                    
+<!--l. 87--><p class="noindent" >0x3D is followed by 8 bit clean UTF-8 encoded value of the field contents to the end of the
+field.
+<!--l. 91--><p class="noindent" ><span class="paragraphHead"><a 
+ id="x1-860005.2.2"></a><span 
+class="cmbx-10x-x-109">Field names</span></span>
+Below is a proposed, minimal list of standard field names with a description of intended use. No
+single or group of field names is mandatory; a comment header may contain one, all or none of the
+names in this list.
+<!--l. 99--><p class="noindent" >
+     <dl class="description"><dt class="description">
+<span 
+class="cmssbx-10x-x-109">TITLE</span> </dt><dd 
+class="description">Track/Work name
+     </dd><dt class="description">
+<span 
+class="cmssbx-10x-x-109">VERSION</span> </dt><dd 
+class="description">The version field may be used to differentiate multiple versions of the same track
+     title in a single collection. (e.g. remix info)
+     </dd><dt class="description">
+<span 
+class="cmssbx-10x-x-109">ALBUM</span> </dt><dd 
+class="description">The collection name to which this track belongs
+     </dd><dt class="description">
+<span 
+class="cmssbx-10x-x-109">TRACKNUMBER</span> </dt><dd 
+class="description">The track number of this piece if part of a specific larger collection or
+     album
+     </dd><dt class="description">
+<span 
+class="cmssbx-10x-x-109">ARTIST</span> </dt><dd 
+class="description">The artist generally considered responsible for the work. In popular music this is
+     usually the performing band or singer. For classical music it would be the composer.
+     For an audio book it would be the author of the original text.
+     </dd><dt class="description">
+<span 
+class="cmssbx-10x-x-109">PERFORMER</span> </dt><dd 
+class="description">The artist(s) who performed the work. In classical music this would be the
+     conductor, orchestra, soloists. In an audio book it would be the actor who did the
+     reading. In popular music this is typically the same as the ARTIST and is omitted.
+     </dd><dt class="description">
+<span 
+class="cmssbx-10x-x-109">COPYRIGHT</span> </dt><dd 
+class="description">Copyright attribution, e.g., &#8217;2001 Nobody&#8217;s Band&#8217; or &#8217;1999 Jack Moffitt&#8217;
+     </dd><dt class="description">
+<span 
+class="cmssbx-10x-x-109">LICENSE</span> </dt><dd 
+class="description">License information, eg, &#8217;All Rights Reserved&#8217;, &#8217;Any Use Permitted&#8217;, a URL to a
+     license                                such                                as                                a
+     Creative Commons license (&#8221;www.creativecommons.org/blahblah/license.html&#8221;) or the
+     EFF Open Audio License (&#8217;distributed under the terms of the Open Audio License. see
+     http://www.eff.org/IP/Open&#x02D9;licenses/eff&#x02D9;oal.html for details&#8217;), etc.
+     </dd><dt class="description">
+<span 
+class="cmssbx-10x-x-109">ORGANIZATION</span> </dt><dd 
+class="description">Name of the organization producing the track (i.e. the &#8217;record label&#8217;)
+     </dd><dt class="description">
+<span 
+class="cmssbx-10x-x-109">DESCRIPTION</span> </dt><dd 
+class="description">A short text description of the contents
+                                                                                    
 
-             12) array [floor1_subclass_books] element [i],[j] = 
-                 read 8 bits as unsigned integer and subtract one
-           }
-      }
+                                                                                    
+     </dd><dt class="description">
+<span 
+class="cmssbx-10x-x-109">GENRE</span> </dt><dd 
+class="description">A short text indication of music genre
+     </dd><dt class="description">
+<span 
+class="cmssbx-10x-x-109">DATE</span> </dt><dd 
+class="description">Date the track was recorded
+     </dd><dt class="description">
+<span 
+class="cmssbx-10x-x-109">LOCATION</span> </dt><dd 
+class="description">Location where track was recorded
+     </dd><dt class="description">
+<span 
+class="cmssbx-10x-x-109">CONTACT</span> </dt><dd 
+class="description">Contact information for the creators or distributors of the track. This could be
+     a URL, an email address, the physical address of the producing label.
+     </dd><dt class="description">
+<span 
+class="cmssbx-10x-x-109">ISRC</span> </dt><dd 
+class="description">International Standard Recording Code for the track; see <a 
+href="http://www.ifpi.org/isrc/" >the ISRC intro page</a> for more
+     information on ISRC numbers.
+     </dd></dl>
+<!--l. 158--><p class="noindent" ><span class="paragraphHead"><a 
+ id="x1-870005.2.2"></a><span 
+class="cmbx-10x-x-109">Implications</span></span>
+Field names should not be &#8217;internationalized&#8217;; this is a concession to simplicity not an attempt to
+exclude the majority of the world that doesn&#8217;t speak English. Field <span 
+class="cmti-10x-x-109">contents</span>, however, use the
+UTF-8 character encoding to allow easy representation of any language.
+<!--l. 166--><p class="noindent" >We have the length of the entirety of the field and restrictions on the field name so that
+the field name is bounded in a known way. Thus we also have the length of the field
+contents.
+<!--l. 170--><p class="noindent" >Individual &#8217;vendors&#8217; may use non-standard field names within reason. The proper use of comment
+fields should be clear through context at this point. Abuse will be discouraged.
+<!--l. 174--><p class="noindent" >There is no vendor-specific prefix to &#8217;nonstandard&#8217; field names. Vendors should make some effort to
+avoid arbitrarily polluting the common namespace. We will generally collect the more useful tags
+here to help with standardization.
+<!--l. 179--><p class="noindent" >Field names are not required to be unique (occur once) within a comment header. As an example,
+assume a track was recorded by three well know artists; the following is permissible, and
+encouraged:
+<!--l. 183--><p class="noindent" >
+     <div class="quote">
+     <!--l. 184--><p class="noindent" >
+     <div class="fancyvrb" id="fancyvrb25">
+<a 
+ id="x1-87002r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;ARTIST=Dizzy</span><span 
+class="cmtt-10">&#x00A0;Gillespie</span>
+<br class="fancyvrb" /><a 
+ id="x1-87004r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;ARTIST=Sonny</span><span 
+class="cmtt-10">&#x00A0;Rollins</span>
+<br class="fancyvrb" /><a 
+ id="x1-87006r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;ARTIST=Sonny</span><span 
+class="cmtt-10">&#x00A0;Stitt</span>
+                                                                                    
 
- 13) [floor1_multiplier] = read 2 bits as unsigned integer and add one
- 14) [rangebits] = read 4 bits as unsigned integer
- 15) vector [floor1_X_list] element [0] = 0
- 16) vector [floor1_X_list] element [1] = 2 exponent [rangebits];
- 17) [floor1_values] = 2
- 18) iterate [i] over the range 0 ... [floor1_partitions]-1 {
+                                                                                    
+</div>
+     </div>
+<!--l. 197--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">5.2.3 </span> <a 
+ id="x1-880005.2.3"></a>Encoding</h5>
+<!--l. 199--><p class="noindent" >The comment header comprises the entirety of the second bitstream header packet. Unlike the first
+bitstream header packet, it is not generally the only packet on the second page and may not be
+restricted to within the second bitstream page. The length of the comment header packet is
+(practically) unbounded. The comment header packet is not optional; it must be present in the
+bitstream even if it is effectively empty.
+<!--l. 207--><p class="noindent" >The comment header is encoded as follows (as per Ogg&#8217;s standard bitstream mapping which renders
+least-significant-bit of the word to be coded into the least significant available bit of the current
+bitstream octet first):
+<!--l. 213--><p class="noindent" >
+     <ol  class="enumerate1" >
+     <li 
+  class="enumerate" id="x1-88002x1">Vendor string length (32 bit unsigned quantity specifying number of octets)
+     </li>
+     <li 
+  class="enumerate" id="x1-88004x2">Vendor string ([vendor string length] octets coded from beginning of string to end of
+     string, not null terminated)
+     </li>
+     <li 
+  class="enumerate" id="x1-88006x3">Number of comment fields (32 bit unsigned quantity specifying number of fields)
+     </li>
+     <li 
+  class="enumerate" id="x1-88008x4">Comment field 0 length (if [Number of comment fields] <span 
+class="cmmi-10x-x-109">&#x003E; </span>0; 32 bit unsigned quantity
+     specifying number of octets)
+     </li>
+     <li 
+  class="enumerate" id="x1-88010x5">Comment field 0 ([Comment field 0 length] octets coded from beginning of string to end
+     of string, not null terminated)
+     </li>
+     <li 
+  class="enumerate" id="x1-88012x6">Comment field 1 length (if [Number of comment fields] <span 
+class="cmmi-10x-x-109">&#x003E; </span>1...)...
+     </li></ol>
+<!--l. 234--><p class="noindent" >This is actually somewhat easier to describe in code; implementation of the above can be found in
+<span 
+class="cmtt-10x-x-109">vorbis/lib/info.c</span>, <span 
+class="cmtt-10x-x-109">_vorbis_pack_comment() </span>and <span 
+class="cmtt-10x-x-109">_vorbis_unpack_comment()</span>.
+                                                                                    
 
-       19) [current_class_number] = vector [floor1_partition_class_list] element [i]
-       20) iterate [j] over the range 0 ... ([floor1_class_dimensions] element [current_class_number])-1 {
-             21) vector [floor1_X_list] element ([floor1_values]) = 
-                 read [rangebits] bits as unsigned integer
-             22) increment [floor1_values] by one
-           }
-     }
- 
- 23) done
-</pre><p>
-An end-of-packet condition while reading any aspect of a floor 1
-configuration during setup renders a stream undecodable.  In
-addition, a <code class="varname">[floor1_class_masterbooks]</code> or
-<code class="varname">[floor1_subclass_books]</code> scalar element greater than the
-highest numbered codebook configured in this stream is an error
-condition that renders the stream undecodable.</p><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="vorbis-spec-floor1-decode"></a>7.2.2.1. packet decode</h5></div></div></div><p>
-Packet decode begins by checking the <code class="varname">[nonzero]</code> flag:</p><pre class="screen">
-  1) [nonzero] = read 1 bit as boolean
-</pre><p>
-If <code class="varname">[nonzero]</code> is unset, that indicates this channel contained
-no audio energy in this frame.  Decode immediately returns a status
-indicating this floor curve (and thus this channel) is unused this
-frame.  (A return status of 'unused' is different from decoding a
-floor that has all points set to minimum representation amplitude,
-which happens to be approximately -140dB).
-</p><p>
-Assuming <code class="varname">[nonzero]</code> is set, decode proceeds as follows:</p><pre class="screen">
-  1) [range] = vector { 256, 128, 86, 64 } element ([floor1_multiplier]-1)
-  2) vector [floor1_Y] element [0] = read <a href="#vorbis-spec-ilog" title="9.2.1. ilog">ilog</a>([range]-1) bits as unsigned integer
-  3) vector [floor1_Y] element [1] = read <a href="#vorbis-spec-ilog" title="9.2.1. ilog">ilog</a>([range]-1) bits as unsigned integer
-  4) [offset] = 2;
-  5) iterate [i] over the range 0 ... [floor1_partitions]-1 {
+                                                                                    
+                                                                                    
 
-       6) [class] = vector [floor1_partition_class]  element [i]
-       7) [cdim]  = vector [floor1_class_dimensions] element [class]
-       8) [cbits] = vector [floor1_class_subclasses] element [class]
-       9) [csub]  = (2 exponent [cbits])-1
-      10) [cval]  = 0
-      11) if ( [cbits] is greater than zero ) {
- 
-             12) [cval] = read from packet using codebook number
-                 (vector [floor1_class_masterbooks] element [class]) in scalar context
-          }
-      
-      13) iterate [j] over the range 0 ... [cdim]-1 {
-       
-             14) [book] = array [floor1_subclass_books] element [class],([cval] bitwise AND [csub])
-             15) [cval] = [cval] right shifted [cbits] bits
-	     16) if ( [book] is not less than zero ) {
-	     
-	           17) vector [floor1_Y] element ([j]+[offset]) = read from packet using codebook 
-                       [book] in scalar context
+                                                                                    
+<h3 class="sectionHead"><span class="titlemark">6 </span> <a 
+ id="x1-890006"></a>Floor type 0 setup and decode</h3>
+<!--l. 6--><p class="noindent" >
+<h4 class="subsectionHead"><span class="titlemark">6.1 </span> <a 
+ id="x1-900006.1"></a>Overview</h4>
+<!--l. 8--><p class="noindent" >Vorbis floor type zero uses Line Spectral Pair (LSP, also alternately known as Line Spectral
+Frequency or LSF) representation to encode a smooth spectral envelope curve as the frequency
+response of the LSP filter. This representation is equivalent to a traditional all-pole infinite impulse
+response filter as would be used in linear predictive coding; LSP representation may be converted to
+LPC representation and vice-versa.
+<!--l. 18--><p class="noindent" >
+<h4 class="subsectionHead"><span class="titlemark">6.2 </span> <a 
+ id="x1-910006.2"></a>Floor 0 format</h4>
+<!--l. 20--><p class="noindent" >Floor zero configuration consists of six integer fields and a list of VQ codebooks for use in
+coding/decoding the LSP filter coefficient values used by each frame.
+<!--l. 24--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">6.2.1 </span> <a 
+ id="x1-920006.2.1"></a>header decode</h5>
+<!--l. 26--><p class="noindent" >Configuration information for instances of floor zero decodes from the codec setup header (third
+packet). configuration decode proceeds as follows:
+<!--l. 30--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb26">
+<a 
+ id="x1-92002r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1)</span><span 
+class="cmtt-10">&#x00A0;[floor0_order]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;an</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span><span 
+class="cmtt-10">&#x00A0;of</span><span 
+class="cmtt-10">&#x00A0;8</span><span 
+class="cmtt-10">&#x00A0;bits</span>
+<br class="fancyvrb" /><a 
+ id="x1-92004r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2)</span><span 
+class="cmtt-10">&#x00A0;[floor0_rate]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;an</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span><span 
+class="cmtt-10">&#x00A0;of</span><span 
+class="cmtt-10">&#x00A0;16</span><span 
+class="cmtt-10">&#x00A0;bits</span>
+<br class="fancyvrb" /><a 
+ id="x1-92006r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;3)</span><span 
+class="cmtt-10">&#x00A0;[floor0_bark_map_size]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;an</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span><span 
+class="cmtt-10">&#x00A0;of</span><span 
+class="cmtt-10">&#x00A0;16</span><span 
+class="cmtt-10">&#x00A0;bits</span>
+<br class="fancyvrb" /><a 
+ id="x1-92008r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;4)</span><span 
+class="cmtt-10">&#x00A0;[floor0_amplitude_bits]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;an</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span><span 
+class="cmtt-10">&#x00A0;of</span><span 
+class="cmtt-10">&#x00A0;six</span><span 
+class="cmtt-10">&#x00A0;bits</span>
+<br class="fancyvrb" /><a 
+ id="x1-92010r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;5)</span><span 
+class="cmtt-10">&#x00A0;[floor0_amplitude_offset]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;an</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span><span 
+class="cmtt-10">&#x00A0;of</span><span 
+class="cmtt-10">&#x00A0;eight</span><span 
+class="cmtt-10">&#x00A0;bits</span>
+<br class="fancyvrb" /><a 
+ id="x1-92012r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;6)</span><span 
+class="cmtt-10">&#x00A0;[floor0_number_of_books]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;an</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span><span 
+class="cmtt-10">&#x00A0;of</span><span 
+class="cmtt-10">&#x00A0;four</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;and</span><span 
+class="cmtt-10">&#x00A0;add</span><span 
+class="cmtt-10">&#x00A0;1</span>
+<br class="fancyvrb" /><a 
+ id="x1-92014r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;7)</span><span 
+class="cmtt-10">&#x00A0;array</span><span 
+class="cmtt-10">&#x00A0;[floor0_book_list]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;a</span><span 
+class="cmtt-10">&#x00A0;list</span><span 
+class="cmtt-10">&#x00A0;of</span><span 
+class="cmtt-10">&#x00A0;[floor0_number_of_books]</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integers</span><span 
+class="cmtt-10">&#x00A0;of</span><span 
+class="cmtt-10">&#x00A0;eight</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;each;</span>
+</div>
+                                                                                    
 
-                 } else [book] is less than zero {
+                                                                                    
+<!--l. 40--><p class="noindent" >An end-of-packet condition during any of these bitstream reads renders this stream undecodable. In
+addition, any element of the array <span 
+class="cmtt-10x-x-109">[floor0_book_list] </span>that is greater than the maximum
+codebook number for this bitstream is an error condition that also renders the stream
+undecodable.
+<!--l. 48--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">6.2.2 </span> <a 
+ id="x1-930006.2.2"></a>packet decode</h5>
+<!--l. 50--><p class="noindent" >Extracting a floor0 curve from an audio packet consists of first decoding the curve amplitude and
+<span 
+class="cmtt-10x-x-109">[floor0_order] </span>LSP coefficient values from the bitstream, and then computing the floor curve,
+which is defined as the frequency response of the decoded LSP filter.
+<!--l. 56--><p class="noindent" >Packet decode proceeds as follows:
+<div class="fancyvrb" id="fancyvrb27">
+<a 
+ id="x1-93002r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1)</span><span 
+class="cmtt-10">&#x00A0;[amplitude]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;an</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span><span 
+class="cmtt-10">&#x00A0;of</span><span 
+class="cmtt-10">&#x00A0;[floor0_amplitude_bits]</span><span 
+class="cmtt-10">&#x00A0;bits</span>
+<br class="fancyvrb" /><a 
+ id="x1-93004r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;(</span><span 
+class="cmtt-10">&#x00A0;[amplitude]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;greater</span><span 
+class="cmtt-10">&#x00A0;than</span><span 
+class="cmtt-10">&#x00A0;zero</span><span 
+class="cmtt-10">&#x00A0;)</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-93006r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;3)</span><span 
+class="cmtt-10">&#x00A0;[coefficients]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;an</span><span 
+class="cmtt-10">&#x00A0;empty,</span><span 
+class="cmtt-10">&#x00A0;zero</span><span 
+class="cmtt-10">&#x00A0;length</span><span 
+class="cmtt-10">&#x00A0;vector</span>
+<br class="fancyvrb" /><a 
+ id="x1-93008r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;4)</span><span 
+class="cmtt-10">&#x00A0;[booknumber]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;an</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span><span 
+class="cmtt-10">&#x00A0;of</span><span 
+class="cmtt-10">&#x00A0;</span><a 
+href="#x1-1170009.2.1"><span 
+class="cmtt-10">ilog</span></a><span 
+class="cmtt-10">(</span><span 
+class="cmtt-10">&#x00A0;[floor0_number_of_books]</span><span 
+class="cmtt-10">&#x00A0;)</span><span 
+class="cmtt-10">&#x00A0;bits</span>
+<br class="fancyvrb" /><a 
+ id="x1-93010r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;5)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;(</span><span 
+class="cmtt-10">&#x00A0;[booknumber]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;greater</span><span 
+class="cmtt-10">&#x00A0;than</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;highest</span><span 
+class="cmtt-10">&#x00A0;number</span><span 
+class="cmtt-10">&#x00A0;decode</span><span 
+class="cmtt-10">&#x00A0;codebook</span><span 
+class="cmtt-10">&#x00A0;)</span><span 
+class="cmtt-10">&#x00A0;then</span><span 
+class="cmtt-10">&#x00A0;packet</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;undecodable</span>
+<br class="fancyvrb" /><a 
+ id="x1-93012r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;6)</span><span 
+class="cmtt-10">&#x00A0;[last]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;zero;</span>
+<br class="fancyvrb" /><a 
+ id="x1-93014r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;7)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[temp_vector]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;from</span><span 
+class="cmtt-10">&#x00A0;bitstream</span><span 
+class="cmtt-10">&#x00A0;using</span><span 
+class="cmtt-10">&#x00A0;codebook</span><span 
+class="cmtt-10">&#x00A0;number</span><span 
+class="cmtt-10">&#x00A0;[floor0_book_list]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[booknumber]</span><span 
+class="cmtt-10">&#x00A0;in</span><span 
+class="cmtt-10">&#x00A0;VQ</span><span 
+class="cmtt-10">&#x00A0;context.</span>
+<br class="fancyvrb" /><a 
+ id="x1-93016r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;8)</span><span 
+class="cmtt-10">&#x00A0;add</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;scalar</span><span 
+class="cmtt-10">&#x00A0;value</span><span 
+class="cmtt-10">&#x00A0;[last]</span><span 
+class="cmtt-10">&#x00A0;to</span><span 
+class="cmtt-10">&#x00A0;each</span><span 
+class="cmtt-10">&#x00A0;scalar</span><span 
+class="cmtt-10">&#x00A0;in</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[temp_vector]</span>
+<br class="fancyvrb" /><a 
+ id="x1-93018r9"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;9)</span><span 
+class="cmtt-10">&#x00A0;[last]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;value</span><span 
+class="cmtt-10">&#x00A0;of</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;last</span><span 
+class="cmtt-10">&#x00A0;scalar</span><span 
+class="cmtt-10">&#x00A0;in</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[temp_vector]</span>
+<br class="fancyvrb" /><a 
+ id="x1-93020r10"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;10)</span><span 
+class="cmtt-10">&#x00A0;concatenate</span><span 
+class="cmtt-10">&#x00A0;[temp_vector]</span><span 
+class="cmtt-10">&#x00A0;onto</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;end</span><span 
+class="cmtt-10">&#x00A0;of</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;[coefficients]</span><span 
+class="cmtt-10">&#x00A0;vector</span>
+<br class="fancyvrb" /><a 
+ id="x1-93022r11"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;11)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;(length</span><span 
+class="cmtt-10">&#x00A0;of</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[coefficients]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;less</span><span 
+class="cmtt-10">&#x00A0;than</span><span 
+class="cmtt-10">&#x00A0;[floor0_order],</span><span 
+class="cmtt-10">&#x00A0;continue</span><span 
+class="cmtt-10">&#x00A0;at</span><span 
+class="cmtt-10">&#x00A0;step</span><span 
+class="cmtt-10">&#x00A0;6</span>
+<br class="fancyvrb" /><a 
+ id="x1-93024r12"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-93026r13"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span>
+<br class="fancyvrb" /><a 
+ id="x1-93028r14"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-93030r15"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;12)</span><span 
+class="cmtt-10">&#x00A0;done.</span>
+<br class="fancyvrb" /><a 
+ id="x1-93032r16"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+</div>
+<!--l. 76--><p class="noindent" >Take note of the following properties of decode:
+     <ul class="itemize1">
+     <li class="itemize">An <span 
+class="cmtt-10x-x-109">[amplitude] </span>value of zero must result in a return code that indicates this channel is
+     unused in this frame (the output of the channel will be all-zeroes in synthesis). Several
+     later stages of decode don&#8217;t occur for an unused channel.
+     </li>
+     <li class="itemize">An end-of-packet condition during decode should be considered a nominal occruence;
+     if end-of-packet is reached during any read operation above, floor decode is to return
+     &#8217;unused&#8217; status as if the <span 
+class="cmtt-10x-x-109">[amplitude] </span>value had read zero at the beginning of decode.
+     </li>
+     <li class="itemize">The book number used for decode can, in fact, be stored in the bitstream in <a 
+href="#x1-1170009.2.1">ilog</a>(
+     <span 
+class="cmtt-10x-x-109">[floor0_number_of_books] </span>- 1 ) bits. Nevertheless, the above specification is correct
+                                                                                    
 
-	           18) vector [floor1_Y] element ([j]+[offset]) = 0
+                                                                                    
+     and values greater than the maximum possible book value are reserved.
+     </li>
+     <li class="itemize">The  number  of  scalars  read  into  the  vector  <span 
+class="cmtt-10x-x-109">[coefficients] </span>may  be  greater
+     than  <span 
+class="cmtt-10x-x-109">[floor0_order]</span>,  the  number  actually  required  for  curve  computation.  For
+     example,  if  the  VQ  codebook  used  for  the  floor  currently  being  decoded  has  a
+     <span 
+class="cmtt-10x-x-109">[codebook_dimensions] </span>value of three and <span 
+class="cmtt-10x-x-109">[floor0_order] </span>is ten, the only way to fill
+     all the needed scalars in <span 
+class="cmtt-10x-x-109">[coefficients] </span>is to to read a total of twelve scalars as four
+     vectors of three scalars each. This is not an error condition, and care must be taken not
+     to allow a buffer overflow in decode. The extra values are not used and may be ignored
+     or discarded.</li></ul>
+<!--l. 104--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">6.2.3 </span> <a 
+ id="x1-940006.2.3"></a>curve computation</h5>
+<!--l. 106--><p class="noindent" >Given an <span 
+class="cmtt-10x-x-109">[amplitude] </span>integer and <span 
+class="cmtt-10x-x-109">[coefficients] </span>vector from packet decode as well as the
+[floor0&#x02D9;order], [floor0&#x02D9;rate], [floor0&#x02D9;bark&#x02D9;map&#x02D9;size], [floor0&#x02D9;amplitude&#x02D9;bits] and [floor0&#x02D9;amplitude&#x02D9;offset]
+values from floor setup, and an output vector size <span 
+class="cmtt-10x-x-109">[n] </span>specified by the decode process, we compute
+a floor output vector.
+<!--l. 113--><p class="noindent" >If the value <span 
+class="cmtt-10x-x-109">[amplitude] </span>is zero, the return value is a length <span 
+class="cmtt-10x-x-109">[n] </span>vector with all-zero
+scalars. Otherwise, begin by assuming the following definitions for the given vector to be
+synthesized:
+<center class="par-math-display" >
+<img 
+src="Vorbis_I_spec7x.png" alt="        {
+          min (floor0xbarkxmapxsize  - 1,foobar)  for i &#x2208; [0,n - 1]
+mapi  =   - 1                                     for i = n
+" class="par-math-display" ></center>
+<!--l. 128--><p class="nopar" >
+<!--l. 130--><p class="noindent" >where
+<center class="par-math-display" >
+<img 
+src="Vorbis_I_spec8x.png" alt="         &#x230A;     (               )                        &#x230B;
+f oobar =  bark  floor0xrate-&#x22C5;i- &#x22C5; floor0xbarkxmapxsize-
+                       2n          bark(.5 &#x22C5;floor0xrate )
+" class="par-math-display" ></center>
+<!--l. 137--><p class="nopar" >
+<!--l. 139--><p class="noindent" >and
+                                                                                    
 
-                 }
-          }
-             
-      19) [offset] = [offset] + [cdim]
-         
-     }
-  
- 20) done
-</pre><p>
-An end-of-packet condition during curve decode should be considered a
-nominal occurrence; if end-of-packet is reached during any read
-operation above, floor decode is to return 'unused' status as if the
-<code class="varname">[nonzero]</code> flag had been unset at the beginning of decode.
-</p><p>
-Vector <code class="varname">[floor1_Y]</code> contains the values from packet decode
-needed for floor 1 synthesis.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="vorbis-spec-floor1-synth"></a>7.2.2.2. curve computation</h5></div></div></div><p>
-Curve computation is split into two logical steps; the first step
-derives final Y amplitude values from the encoded, wrapped difference
-values taken from the bitstream.  The second step plots the curve
-lines.  Also, although zero-difference values are used in the
-iterative prediction to find final Y values, these points are
-conditionally skipped during final line computation in step two.
-Skipping zero-difference values allows a smoother line fit.  </p><p>
-Although some aspects of the below algorithm look like inconsequential
-optimizations, implementors are warned to follow the details closely.
-Deviation from implementing a strictly equivalent algorithm can result
-in serious decoding errors.</p><div class="section" lang="en"><div class="titlepage"><div><div><h6 class="title"><a name="id309087"></a>7.2.2.2.1. step 1: amplitude value synthesis</h6></div></div></div><p>
-Unwrap the always-positive-or-zero values read from the packet into
-+/- difference values, then apply to line prediction.</p><pre class="screen">
-  1) [range] = vector { 256, 128, 86, 64 } element ([floor1_multiplier]-1)
-  2) vector [floor1_step2_flag] element [0] = set
-  3) vector [floor1_step2_flag] element [1] = set
-  4) vector [floor1_final_Y] element [0] = vector [floor1_Y] element [0]
-  5) vector [floor1_final_Y] element [1] = vector [floor1_Y] element [1]
-  6) iterate [i] over the range 2 ... [floor1_values]-1 {
-    
-       7) [low_neighbor_offset] = <a href="#vorbis-spec-low_neighbor" title="9.2.4. low_neighbor">low_neighbor</a>([floor1_X_list],[i])
-       8) [high_neighbor_offset] = <a href="#vorbis-spec-high_neighbor" title="9.2.4.1. high_neighbor">high_neighbor</a>([floor1_X_list],[i])
+                                                                                    
+<center class="par-math-display" >
+<img 
+src="Vorbis_I_spec9x.png" alt="bark(x) = 13.1 arctan (.00074x) + 2.24 arctan (.0000000185x2 + .0001x)
+" class="par-math-display" ></center>
+<!--l. 143--><p class="nopar" >
+<!--l. 145--><p class="noindent" >The above is used to synthesize the LSP curve on a Bark-scale frequency axis, then map the result
+to a linear-scale frequency axis. Similarly, the below calculation synthesizes the output LSP
+curve <span 
+class="cmtt-10x-x-109">[output] </span>on a log (dB) amplitude scale, mapping it to linear amplitude in the last
+step:
+<!--l. 151--><p class="noindent" >
+     <ol  class="enumerate1" >
+     <li 
+  class="enumerate" id="x1-94002x1"><span 
+class="cmtt-10x-x-109">[i] </span>= 0
+     </li>
+     <li 
+  class="enumerate" id="x1-94004x2"><span 
+class="cmtt-10x-x-109">[</span><span 
+class="cmmi-10x-x-109">&#x03C9;</span><span 
+class="cmtt-10x-x-109">] </span>= <span 
+class="cmmi-10x-x-109">&#x03C0; </span>* map element <span 
+class="cmtt-10x-x-109">[i] </span>/ <span 
+class="cmtt-10x-x-109">[floor0_bark_map_size]</span>
+     </li>
+     <li 
+  class="enumerate" id="x1-94006x3">if ( <span 
+class="cmtt-10x-x-109">[floor0_order] </span>is odd )
+          <ol  class="enumerate2" >
+          <li 
+  class="enumerate" id="x1-94008x1">calculate <span 
+class="cmtt-10x-x-109">[p] </span>and <span 
+class="cmtt-10x-x-109">[q] </span>according to: <span id="textcolor1">*** the following is generated from the TeX code
+          embedded into the DocBook files: ***</span> <div class="eqnarray">
+          <center class="math-display" >
+          <img 
+src="Vorbis_I_spec10x.png" alt="                  (orde&#x220F;r- 3)&#x2215;2
+p  =   (1 - cos2&#x03C9;)          4(cosc2j+1 - cos&#x03C9; )2
+                     j=0
+         (order-1)&#x2215;2
+       1-   &#x220F;                      2
+q  =   4          4(cosc2j+1 - cos&#x03C9; )
+            j=0
+          " class="math-display" ></center>
+          </div>
+          <!--l. 162--><p class="noindent" ><span id="textcolor2">*** the following is what oddlsp.png contains: ***</span> <div class="eqnarray">
+                                                                                    
 
-       9) [predicted] = <a href="#vorbis-spec-render_point" title="9.2.4.2. render_point">render_point</a>( vector [floor1_X_list] element [low_neighbor_offset],
-				      vector [floor1_final_Y] element [low_neighbor_offset],
-                                      vector [floor1_X_list] element [high_neighbor_offset],
-				      vector [floor1_final_Y] element [high_neighbor_offset],
-                                      vector [floor1_X_list] element [i] )
+                                                                                    
+          <center class="math-display" >
+          <img 
+src="Vorbis_I_spec11x.png" alt="                  floor0xorder-3
+              2       2&#x220F;                                     2
+p  =   (1- cos &#x03C9; )          4(cos([coefficients ]2j+1 )- cos&#x03C9; )
+                     j=0
+       1 floor0&#x220F;x2order-1
+q  =   --          4(cos([coefficients ]2j) - cos&#x03C9;)2
+       4    j=0
+          " class="math-display" ></center>
+          </div>
+          </li></ol>
+     <!--l. 169--><p class="noindent" >else <span 
+class="cmtt-10x-x-109">[floor0_order] </span>is even
+          <ol  class="enumerate2" >
+          <li 
+  class="enumerate" id="x1-94012x1">calculate <span 
+class="cmtt-10x-x-109">[p] </span>and <span 
+class="cmtt-10x-x-109">[q] </span>according to: <span id="textcolor3">*** the following is generated from the TeX code
+          embedded into the DocBook files: ***</span> <div class="eqnarray">
+          <center class="math-display" >
+          <img 
+src="Vorbis_I_spec12x.png" alt="       (1--cos2&#x03C9;-)(orde&#x220F;r-2)&#x2215;2                2
+p  =        2              4(cosc2j - cos&#x03C9; )
+                     j=0
+       (1+ cos2&#x03C9; )(orde&#x220F;r-2)&#x2215;2
+q  =   -----------         4(cosc2j - cos&#x03C9; )2
+            2        j=0
+          " class="math-display" ></center>
+          </div>
+          <!--l. 178--><p class="noindent" ><span id="textcolor4">*** the following is what oddlsp.png contains: ***</span> <div class="eqnarray">
+                                                                                    
 
-      10) [val] = vector [floor1_Y] element [i]
-      11) [highroom] = [range] - [predicted]
-      12) [lowroom]  = [predicted]
-      13) if ( [highroom] is less than [lowroom] ) {
+                                                                                    
+          <center class="math-display" >
+          <img 
+src="Vorbis_I_spec13x.png" alt="                  floor0xorder-2
+       (1--cos2&#x03C9;-)    &#x220F;2                                     2
+p  =        2               4(cos([coefficients  ]2j+1)- cos&#x03C9; )
+                      j=0
+       (1+ cos2&#x03C9; )floor0x&#x220F;o2rder-2
+q  =   -----------          4(cos([coefficients  ]2j)- cos&#x03C9; )2
+            2         j=0
+          " class="math-display" ></center>
+          </div>
+          </li></ol>
+     </li>
+     <li 
+  class="enumerate" id="x1-94016x4">calculate <span 
+class="cmtt-10x-x-109">[linear_floor_value] </span>according to:
+     <center class="math-display" >
+     <img 
+src="Vorbis_I_spec14x.png" alt="   (          (                                                                 ))
+exp  .11512925  amplitude--&#x22C5;floor0xamplitutex&#x221A;offset-- - floor0xamplitudexoffset
+                   (2floor0xamplitudexbits - 1) p + q
+     " class="math-display" ></center>
+     <!--l. 191--><p class="nopar" >
+     </li>
+     <li 
+  class="enumerate" id="x1-94018x5"><span 
+class="cmtt-10x-x-109">[iteration_condition] </span>= map element <span 
+class="cmtt-10x-x-109">[i]</span>
+     </li>
+     <li 
+  class="enumerate" id="x1-94020x6"><span 
+class="cmtt-10x-x-109">[output] </span>element <span 
+class="cmtt-10x-x-109">[i] </span>= <span 
+class="cmtt-10x-x-109">[linear_floor_value]</span>
+     </li>
+     <li 
+  class="enumerate" id="x1-94022x7">increment <span 
+class="cmtt-10x-x-109">[i]</span>
+     </li>
+     <li 
+  class="enumerate" id="x1-94024x8">if ( map element <span 
+class="cmtt-10x-x-109">[i] </span>is equal to <span 
+class="cmtt-10x-x-109">[iteration_condition] </span>) continue at step 5
+     </li>
+     <li 
+  class="enumerate" id="x1-94026x9">if ( <span 
+class="cmtt-10x-x-109">[i] </span>is less than <span 
+class="cmtt-10x-x-109">[n] </span>) continue at step 2
+     </li>
+     <li 
+  class="enumerate" id="x1-94028x10">done</li></ol>
+                                                                                    
 
-            14) [room] = [highroom] * 2
-         
-          } else [highroom] is not less than [lowroom] {
-		      
-            15) [room] = [lowroom] * 2
-        
-          }
+                                                                                    
+                                                                                    
 
-      16) if ( [val] is nonzero ) {
+                                                                                    
+<h3 class="sectionHead"><span class="titlemark">7 </span> <a 
+ id="x1-950007"></a>Floor type 1 setup and decode</h3>
+<!--l. 6--><p class="noindent" >
+<h4 class="subsectionHead"><span class="titlemark">7.1 </span> <a 
+ id="x1-960007.1"></a>Overview</h4>
+<!--l. 8--><p class="noindent" >Vorbis floor type one uses a piecewise straight-line representation to encode a spectral envelope
+curve. The representation plots this curve mechanically on a linear frequency axis and a
+logarithmic (dB) amplitude axis. The integer plotting algorithm used is similar to Bresenham&#8217;s
+algorithm.
+<!--l. 16--><p class="noindent" >
+<h4 class="subsectionHead"><span class="titlemark">7.2 </span> <a 
+ id="x1-970007.2"></a>Floor 1 format</h4>
+<!--l. 18--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">7.2.1 </span> <a 
+ id="x1-980007.2.1"></a>model</h5>
+<!--l. 20--><p class="noindent" >Floor type one represents a spectral curve as a series of line segments. Synthesis constructs a floor
+curve using iterative prediction in a process roughly equivalent to the following simplified
+description:
+     <ul class="itemize1">
+     <li class="itemize">the first line segment (base case) is a logical line spanning from x&#x02D9;0,y&#x02D9;0 to x&#x02D9;1,y&#x02D9;1 where
+     in the base case x&#x02D9;0=0 and x&#x02D9;1=[n], the full range of the spectral floor to be computed.
+     </li>
+     <li class="itemize">the induction step chooses a point x&#x02D9;new within an existing logical line segment and
+     produces a y&#x02D9;new value at that point computed from the existing line&#8217;s y value at x&#x02D9;new
+     (as plotted by the line) and a difference value decoded from the bitstream packet.
+     </li>
+     <li class="itemize">floor  computation  produces  two  new  line  segments,  one  running  from  x&#x02D9;0,y&#x02D9;0  to
+     x&#x02D9;new,y&#x02D9;new and from x&#x02D9;new,y&#x02D9;new to x&#x02D9;1,y&#x02D9;1. This step is performed logically even if
+     y&#x02D9;new represents no change to the amplitude value at x&#x02D9;new so that later refinement is
+     additionally bounded at x&#x02D9;new.
+                                                                                    
 
-            17) vector [floor1_step2_flag] element [low_neighbor_offset] = set
-            18) vector [floor1_step2_flag] element [high_neighbor_offset] = set
-            19) vector [floor1_step2_flag] element [i] = set
-            20) if ( [val] is greater than or equal to [room] ) {
- 
-                  21) if ( [highroom] is greater than [lowroom] ) {
+                                                                                    
+     </li>
+     <li class="itemize">the induction step repeats, using a list of x values specified in the codec setup header
+     at floor 1 initialization time. Computation is completed at the end of the x value list.
+     </li></ul>
+<!--l. 48--><p class="noindent" >Consider the following example, with values chosen for ease of understanding rather than
+representing typical configuration:
+<!--l. 51--><p class="noindent" >For the below example, we assume a floor setup with an [n] of 128. The list of selected X values in
+increasing order is 0,16,32,48,64,80,96,112 and 128. In list order, the values interleave as 0, 128, 64,
+32, 96, 16, 48, 80 and 112. The corresponding list-order Y values as decoded from an example
+packet are 110, 20, -5, -45, 0, -25, -10, 30 and -10. We compute the floor in the following way,
+beginning with the first line:
+<div class="center" 
+>
+<!--l. 59--><p class="noindent" >
 
-                        22) vector [floor1_final_Y] element [i] = [val] - [lowroom] + [predicted]
-		     
-		      } else [highroom] is not greater than [lowroom] {
-              
-                        23) vector [floor1_final_Y] element [i] = [predicted] - [val] + [highroom] - 1
-                   
-                      }
-               
-                } else [val] is less than [room] {
-		 
-		  24) if ([val] is odd) {
-                 
-                        25) vector [floor1_final_Y] element [i] = 
-                            [predicted] - (([val] + 1) divided by  2 using integer division)
+<!--l. 60--><p class="noindent" ><img 
+src="floor1-1.png" alt="PIC"  
+>
+<br /> <table class="caption" 
+><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure&#x00A0;7: </td><td  
+class="content">graph of example floor</td></tr></table><!--tex4ht:label?: x1-980017 -->
+</div>
+<!--l. 64--><p class="noindent" >We now draw new logical lines to reflect the correction to new&#x02D9;Y, and iterate for X positions 32 and
+96:
+<div class="center" 
+>
+<!--l. 67--><p class="noindent" >
 
-                      } else [val] is even {
+<!--l. 68--><p class="noindent" ><img 
+src="floor1-2.png" alt="PIC"  
+>
+<br /> <table class="caption" 
+><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure&#x00A0;8: </td><td  
+class="content">graph of example floor</td></tr></table><!--tex4ht:label?: x1-980028 -->
+</div>
+<!--l. 72--><p class="noindent" >Although the new Y value at X position 96 is unchanged, it is still used later as an endpoint for
+further refinement. From here on, the pattern should be clear; we complete the floor computation as
+follows:
+<div class="center" 
+>
+<!--l. 76--><p class="noindent" >
 
-                        26) vector [floor1_final_Y] element [i] = 
-                            [predicted] + ([val] / 2 using integer division)
-                          
-                      }
+<!--l. 77--><p class="noindent" ><img 
+src="floor1-3.png" alt="PIC"  
+>
+<br /> <table class="caption" 
+><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure&#x00A0;9: </td><td  
+class="content">graph of example floor</td></tr></table><!--tex4ht:label?: x1-980039 -->
+</div>
+                                                                                    
 
-                }      
+                                                                                    
+<div class="center" 
+>
+<!--l. 81--><p class="noindent" >
 
-          } else [val] is zero {
+<!--l. 82--><p class="noindent" ><img 
+src="floor1-4.png" alt="PIC"  
+>
+<br /> <table class="caption" 
+><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure&#x00A0;10: </td><td  
+class="content">graph of example floor</td></tr></table><!--tex4ht:label?: x1-9800410 -->
+</div>
+<!--l. 86--><p class="noindent" >A more efficient algorithm with carefully defined integer rounding behavior is used for actual
+decode, as described later. The actual algorithm splits Y value computation and line plotting into
+two steps with modifications to the above algorithm to eliminate noise accumulation through integer
+roundoff/truncation.
+<!--l. 94--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">7.2.2 </span> <a 
+ id="x1-990007.2.2"></a>header decode</h5>
+<!--l. 96--><p class="noindent" >A list of floor X values is stored in the packet header in interleaved format (used in list order during
+packet decode and synthesis). This list is split into partitions, and each partition is assigned to a
+partition class. X positions 0 and [n] are implicit and do not belong to an explicit partition or
+partition class.
+<!--l. 102--><p class="noindent" >A partition class consists of a representation vector width (the number of Y values which the
+partition class encodes at once), a &#8217;subclass&#8217; value representing the number of alternate entropy
+books the partition class may use in representing Y values, the list of [subclass] books and a master
+book used to encode which alternate books were chosen for representation in a given packet. The
+master/subclass mechanism is meant to be used as a flexible representation cascade while still using
+codebooks only in a scalar context.
+<!--l. 112--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb28">
+<a 
+ id="x1-99002r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-99004r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1)</span><span 
+class="cmtt-10">&#x00A0;[floor1_partitions]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;5</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span>
+<br class="fancyvrb" /><a 
+ id="x1-99006r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2)</span><span 
+class="cmtt-10">&#x00A0;[maximum_class]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;-1</span>
+<br class="fancyvrb" /><a 
+ id="x1-99008r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;3)</span><span 
+class="cmtt-10">&#x00A0;iterate</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;over</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;range</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;...</span><span 
+class="cmtt-10">&#x00A0;[floor1_partitions]-1</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-99010r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-99012r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;4)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_partition_class_list]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;4</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span>
+<br class="fancyvrb" /><a 
+ id="x1-99014r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-99016r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span>
+<br class="fancyvrb" /><a 
+ id="x1-99018r9"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-99020r10"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;5)</span><span 
+class="cmtt-10">&#x00A0;[maximum_class]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;largest</span><span 
+class="cmtt-10">&#x00A0;integer</span><span 
+class="cmtt-10">&#x00A0;scalar</span><span 
+class="cmtt-10">&#x00A0;value</span><span 
+class="cmtt-10">&#x00A0;in</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_partition_class_list]</span>
+<br class="fancyvrb" /><a 
+ id="x1-99022r11"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;6)</span><span 
+class="cmtt-10">&#x00A0;iterate</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;over</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;range</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;...</span><span 
+class="cmtt-10">&#x00A0;[maximum_class]</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-99024r12"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-99026r13"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;7)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_class_dimensions]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;3</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span><span 
+class="cmtt-10">&#x00A0;and</span><span 
+class="cmtt-10">&#x00A0;add</span><span 
+class="cmtt-10">&#x00A0;1</span>
+<br class="fancyvrb" /><a 
+ id="x1-99028r14"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;    8)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_class_subclasses]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span>
+                                                                                    
 
-            27) vector [floor1_step2_flag] element [i] = unset
-            28) vector [floor1_final_Y] element [i] = [predicted]
+                                                                                    
+<br class="fancyvrb" /><a 
+ id="x1-99030r15"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;9)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;(</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_class_subclasses]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;nonzero</span><span 
+class="cmtt-10">&#x00A0;)</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-99032r16"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-99034r17"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;10)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_class_masterbooks]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;8</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span>
+<br class="fancyvrb" /><a 
+ id="x1-99036r18"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-99038r19"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span>
+<br class="fancyvrb" /><a 
+ id="x1-99040r20"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-99042r21"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;11)</span><span 
+class="cmtt-10">&#x00A0;iterate</span><span 
+class="cmtt-10">&#x00A0;[j]</span><span 
+class="cmtt-10">&#x00A0;over</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;range</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;...</span><span 
+class="cmtt-10">&#x00A0;(2</span><span 
+class="cmtt-10">&#x00A0;exponent</span><span 
+class="cmtt-10">&#x00A0;[floor1_class_subclasses]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[i])</span><span 
+class="cmtt-10">&#x00A0;-</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-99044r22"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-99046r23"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;12)</span><span 
+class="cmtt-10">&#x00A0;array</span><span 
+class="cmtt-10">&#x00A0;[floor1_subclass_books]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[i],[j]</span><span 
+class="cmtt-10">&#x00A0;=</span>
+<br class="fancyvrb" /><a 
+ id="x1-99048r24"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;8</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span><span 
+class="cmtt-10">&#x00A0;and</span><span 
+class="cmtt-10">&#x00A0;subtract</span><span 
+class="cmtt-10">&#x00A0;one</span>
+<br class="fancyvrb" /><a 
+ id="x1-99050r25"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span>
+<br class="fancyvrb" /><a 
+ id="x1-99052r26"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span>
+<br class="fancyvrb" /><a 
+ id="x1-99054r27"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-99056r28"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;13)</span><span 
+class="cmtt-10">&#x00A0;[floor1_multiplier]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span><span 
+class="cmtt-10">&#x00A0;and</span><span 
+class="cmtt-10">&#x00A0;add</span><span 
+class="cmtt-10">&#x00A0;one</span>
+<br class="fancyvrb" /><a 
+ id="x1-99058r29"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;14)</span><span 
+class="cmtt-10">&#x00A0;[rangebits]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;4</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span>
+<br class="fancyvrb" /><a 
+ id="x1-99060r30"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;15)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_X_list]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[0]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;0</span>
+<br class="fancyvrb" /><a 
+ id="x1-99062r31"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;16)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_X_list]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[1]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;exponent</span><span 
+class="cmtt-10">&#x00A0;[rangebits];</span>
+<br class="fancyvrb" /><a 
+ id="x1-99064r32"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;17)</span><span 
+class="cmtt-10">&#x00A0;[floor1_values]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;2</span>
+<br class="fancyvrb" /><a 
+ id="x1-99066r33"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;18)</span><span 
+class="cmtt-10">&#x00A0;iterate</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;over</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;range</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;...</span><span 
+class="cmtt-10">&#x00A0;[floor1_partitions]-1</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-99068r34"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-99070r35"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;19)</span><span 
+class="cmtt-10">&#x00A0;[current_class_number]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_partition_class_list]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[i]</span>
+<br class="fancyvrb" /><a 
+ id="x1-99072r36"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;20)</span><span 
+class="cmtt-10">&#x00A0;iterate</span><span 
+class="cmtt-10">&#x00A0;[j]</span><span 
+class="cmtt-10">&#x00A0;over</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;range</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;...</span><span 
+class="cmtt-10">&#x00A0;([floor1_class_dimensions]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[current_class_number])-1</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-99074r37"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;21)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_X_list]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;([floor1_values])</span><span 
+class="cmtt-10">&#x00A0;=</span>
+<br class="fancyvrb" /><a 
+ id="x1-99076r38"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;[rangebits]</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span>
+<br class="fancyvrb" /><a 
+ id="x1-99078r39"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;22)</span><span 
+class="cmtt-10">&#x00A0;increment</span><span 
+class="cmtt-10">&#x00A0;[floor1_values]</span><span 
+class="cmtt-10">&#x00A0;by</span><span 
+class="cmtt-10">&#x00A0;one</span>
+<br class="fancyvrb" /><a 
+ id="x1-99080r40"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span>
+<br class="fancyvrb" /><a 
+ id="x1-99082r41"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span>
+<br class="fancyvrb" /><a 
+ id="x1-99084r42"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-99086r43"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;23)</span><span 
+class="cmtt-10">&#x00A0;done</span>
+</div>
+<!--l. 158--><p class="noindent" >An end-of-packet condition while reading any aspect of a floor 1 configuration during setup renders
+a stream undecodable. In addition, a <span 
+class="cmtt-10x-x-109">[floor1_class_masterbooks] </span>or <span 
+class="cmtt-10x-x-109">[floor1_subclass_books]</span>
+scalar element greater than the highest numbered codebook configured in this stream is an error
+condition that renders the stream undecodable.
+<!--l. 165--><p class="noindent" ><span class="paragraphHead"><a 
+ id="x1-1000007.2.2"></a><span 
+class="cmbx-10x-x-109">packet decode</span></span>
+Packet decode begins by checking the <span 
+class="cmtt-10x-x-109">[nonzero] </span>flag:
+<!--l. 169--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb29">
+<a 
+ id="x1-100002r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1)</span><span 
+class="cmtt-10">&#x00A0;[nonzero]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;bit</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;boolean</span>
+</div>
+<!--l. 173--><p class="noindent" >If <span 
+class="cmtt-10x-x-109">[nonzero] </span>is unset, that indicates this channel contained no audio energy in this frame. Decode
+immediately returns a status indicating this floor curve (and thus this channel) is unused
+this frame. (A return status of &#8217;unused&#8217; is different from decoding a floor that has all
+                                                                                    
 
-          }
+                                                                                    
+points set to minimum representation amplitude, which happens to be approximately
+-140dB).
+<!--l. 181--><p class="noindent" >Assuming <span 
+class="cmtt-10x-x-109">[nonzero] </span>is set, decode proceeds as follows:
+<!--l. 183--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb30">
+<a 
+ id="x1-100004r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1)</span><span 
+class="cmtt-10">&#x00A0;[range]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span><span 
+class="cmtt-10">&#x00A0;256,</span><span 
+class="cmtt-10">&#x00A0;128,</span><span 
+class="cmtt-10">&#x00A0;86,</span><span 
+class="cmtt-10">&#x00A0;64</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;([floor1_multiplier]-1)</span>
+<br class="fancyvrb" /><a 
+ id="x1-100006r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_Y]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[0]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;</span><a 
+href="#x1-1170009.2.1"><span 
+class="cmtt-10">ilog</span></a><span 
+class="cmtt-10">([range]-1)</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span>
+<br class="fancyvrb" /><a 
+ id="x1-100008r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;3)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_Y]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[1]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;</span><a 
+href="#x1-1170009.2.1"><span 
+class="cmtt-10">ilog</span></a><span 
+class="cmtt-10">([range]-1)</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span>
+<br class="fancyvrb" /><a 
+ id="x1-100010r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;4)</span><span 
+class="cmtt-10">&#x00A0;[offset]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;2;</span>
+<br class="fancyvrb" /><a 
+ id="x1-100012r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;5)</span><span 
+class="cmtt-10">&#x00A0;iterate</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;over</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;range</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;...</span><span 
+class="cmtt-10">&#x00A0;[floor1_partitions]-1</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-100014r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-100016r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;6)</span><span 
+class="cmtt-10">&#x00A0;[class]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_partition_class]</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[i]</span>
+<br class="fancyvrb" /><a 
+ id="x1-100018r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;7)</span><span 
+class="cmtt-10">&#x00A0;[cdim]</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_class_dimensions]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[class]</span>
+<br class="fancyvrb" /><a 
+ id="x1-100020r9"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;8)</span><span 
+class="cmtt-10">&#x00A0;[cbits]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_class_subclasses]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[class]</span>
+<br class="fancyvrb" /><a 
+ id="x1-100022r10"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;9)</span><span 
+class="cmtt-10">&#x00A0;[csub]</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;(2</span><span 
+class="cmtt-10">&#x00A0;exponent</span><span 
+class="cmtt-10">&#x00A0;[cbits])-1</span>
+<br class="fancyvrb" /><a 
+ id="x1-100024r11"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;10)</span><span 
+class="cmtt-10">&#x00A0;[cval]</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;0</span>
+<br class="fancyvrb" /><a 
+ id="x1-100026r12"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;11)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;(</span><span 
+class="cmtt-10">&#x00A0;[cbits]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;greater</span><span 
+class="cmtt-10">&#x00A0;than</span><span 
+class="cmtt-10">&#x00A0;zero</span><span 
+class="cmtt-10">&#x00A0;)</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-100028r13"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-100030r14"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;12)</span><span 
+class="cmtt-10">&#x00A0;[cval]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;from</span><span 
+class="cmtt-10">&#x00A0;packet</span><span 
+class="cmtt-10">&#x00A0;using</span><span 
+class="cmtt-10">&#x00A0;codebook</span><span 
+class="cmtt-10">&#x00A0;number</span>
+<br class="fancyvrb" /><a 
+ id="x1-100032r15"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;(vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_class_masterbooks]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[class])</span><span 
+class="cmtt-10">&#x00A0;in</span><span 
+class="cmtt-10">&#x00A0;scalar</span><span 
+class="cmtt-10">&#x00A0;context</span>
+<br class="fancyvrb" /><a 
+ id="x1-100034r16"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span>
+<br class="fancyvrb" /><a 
+ id="x1-100036r17"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-100038r18"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;13)</span><span 
+class="cmtt-10">&#x00A0;iterate</span><span 
+class="cmtt-10">&#x00A0;[j]</span><span 
+class="cmtt-10">&#x00A0;over</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;range</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;...</span><span 
+class="cmtt-10">&#x00A0;[cdim]-1</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-100040r19"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-100042r20"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;14)</span><span 
+class="cmtt-10">&#x00A0;[book]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;array</span><span 
+class="cmtt-10">&#x00A0;[floor1_subclass_books]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[class],([cval]</span><span 
+class="cmtt-10">&#x00A0;bitwise</span><span 
+class="cmtt-10">&#x00A0;AND</span><span 
+class="cmtt-10">&#x00A0;[csub])</span>
+<br class="fancyvrb" /><a 
+ id="x1-100044r21"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;15)</span><span 
+class="cmtt-10">&#x00A0;[cval]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[cval]</span><span 
+class="cmtt-10">&#x00A0;right</span><span 
+class="cmtt-10">&#x00A0;shifted</span><span 
+class="cmtt-10">&#x00A0;[cbits]</span><span 
+class="cmtt-10">&#x00A0;bits</span>
+<br class="fancyvrb" /><a 
+ id="x1-100046r22"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;    </span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;16)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;(</span><span 
+class="cmtt-10">&#x00A0;[book]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;not</span><span 
+class="cmtt-10">&#x00A0;less</span><span 
+class="cmtt-10">&#x00A0;than</span><span 
+class="cmtt-10">&#x00A0;zero</span><span 
+class="cmtt-10">&#x00A0;)</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-100048r23"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-100050r24"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;    </span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;17)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_Y]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;([j]+[offset])</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;from</span><span 
+class="cmtt-10">&#x00A0;packet</span><span 
+class="cmtt-10">&#x00A0;using</span><span 
+class="cmtt-10">&#x00A0;codebook</span>
+<br class="fancyvrb" /><a 
+ id="x1-100052r25"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;[book]</span><span 
+class="cmtt-10">&#x00A0;in</span><span 
+class="cmtt-10">&#x00A0;scalar</span><span 
+class="cmtt-10">&#x00A0;context</span>
+<br class="fancyvrb" /><a 
+ id="x1-100054r26"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-100056r27"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span><span 
+class="cmtt-10">&#x00A0;else</span><span 
+class="cmtt-10">&#x00A0;[book]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;less</span><span 
+class="cmtt-10">&#x00A0;than</span><span 
+class="cmtt-10">&#x00A0;zero</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-100058r28"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-100060r29"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;    </span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;18)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_Y]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;([j]+[offset])</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;0</span>
+<br class="fancyvrb" /><a 
+ id="x1-100062r30"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-100064r31"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span>
+<br class="fancyvrb" /><a 
+ id="x1-100066r32"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span>
+<br class="fancyvrb" /><a 
+ id="x1-100068r33"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-100070r34"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;19)</span><span 
+class="cmtt-10">&#x00A0;[offset]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[offset]</span><span 
+class="cmtt-10">&#x00A0;+</span><span 
+class="cmtt-10">&#x00A0;[cdim]</span>
+<br class="fancyvrb" /><a 
+ id="x1-100072r35"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-100074r36"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span>
+<br class="fancyvrb" /><a 
+ id="x1-100076r37"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-100078r38"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;20)</span><span 
+class="cmtt-10">&#x00A0;done</span>
+</div>
+<!--l. 224--><p class="noindent" >An end-of-packet condition during curve decode should be considered a nominal occurrence; if
+end-of-packet is reached during any read operation above, floor decode is to return &#8217;unused&#8217; status
+as if the <span 
+class="cmtt-10x-x-109">[nonzero] </span>flag had been unset at the beginning of decode.
+<!--l. 230--><p class="noindent" >Vector <span 
+class="cmtt-10x-x-109">[floor1_Y] </span>contains the values from packet decode needed for floor 1 synthesis.
+                                                                                    
 
-     }
+                                                                                    
+<!--l. 235--><p class="noindent" ><span class="paragraphHead"><a 
+ id="x1-1010007.2.2"></a><span 
+class="cmbx-10x-x-109">curve computation</span></span>
+Curve computation is split into two logical steps; the first step derives final Y amplitude values from
+the encoded, wrapped difference values taken from the bitstream. The second step plots the curve
+lines. Also, although zero-difference values are used in the iterative prediction to find final Y values,
+these points are conditionally skipped during final line computation in step two. Skipping
+zero-difference values allows a smoother line fit.
+<!--l. 245--><p class="noindent" >Although some aspects of the below algorithm look like inconsequential optimizations, implementors
+are warned to follow the details closely. Deviation from implementing a strictly equivalent algorithm
+can result in serious decoding errors.
+<!--l. 251--><p class="noindent" >
+     <dl class="description"><dt class="description">
+<span 
+class="cmssbx-10x-x-109">step 1: amplitude value synthesis</span> </dt><dd 
+class="description">
+     <!--l. 253--><p class="noindent" >Unwrap the always-positive-or-zero values read from the packet into +/- difference
+     values, then apply to line prediction.
+     <!--l. 256--><p class="noindent" >
+     <div class="fancyvrb" id="fancyvrb31">
+<a 
+ id="x1-101002r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1)</span><span 
+class="cmtt-10">&#x00A0;[range]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span><span 
+class="cmtt-10">&#x00A0;256,</span><span 
+class="cmtt-10">&#x00A0;128,</span><span 
+class="cmtt-10">&#x00A0;86,</span><span 
+class="cmtt-10">&#x00A0;64</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;([floor1_multiplier]-1)</span>
+<br class="fancyvrb" /><a 
+ id="x1-101004r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_step2_flag]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[0]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;set</span>
+<br class="fancyvrb" /><a 
+ id="x1-101006r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;3)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_step2_flag]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[1]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;set</span>
+<br class="fancyvrb" /><a 
+ id="x1-101008r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;4)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_final_Y]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[0]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_Y]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[0]</span>
+<br class="fancyvrb" /><a 
+ id="x1-101010r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;5)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_final_Y]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[1]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_Y]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[1]</span>
+<br class="fancyvrb" /><a 
+ id="x1-101012r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;6)</span><span 
+class="cmtt-10">&#x00A0;iterate</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;over</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;range</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;...</span><span 
+class="cmtt-10">&#x00A0;[floor1_values]-1</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-101014r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101016r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;7)</span><span 
+class="cmtt-10">&#x00A0;[low_neighbor_offset]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;</span><a 
+href="#x1-1200009.2.4"><span 
+class="cmtt-10">low_neighbor</span></a><span 
+class="cmtt-10">([floor1_X_list],[i])</span>
+<br class="fancyvrb" /><a 
+ id="x1-101018r9"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;8)</span><span 
+class="cmtt-10">&#x00A0;[high_neighbor_offset]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;</span><a 
+href="#x1-1210009.2.5"><span 
+class="cmtt-10">high_neighbor</span></a><span 
+class="cmtt-10">([floor1_X_list],[i])</span>
+<br class="fancyvrb" /><a 
+ id="x1-101020r10"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101022r11"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;9)</span><span 
+class="cmtt-10">&#x00A0;[predicted]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;</span><a 
+href="#x1-1220009.2.6"><span 
+class="cmtt-10">render_point</span></a><span 
+class="cmtt-10">(</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_X_list]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[low_neighbor_offset],</span>
+<br class="fancyvrb" /><a 
+ id="x1-101024r12"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;                </span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_final_Y]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[low_neighbor_offset],</span>
+<br class="fancyvrb" /><a 
+ id="x1-101026r13"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_X_list]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[high_neighbor_offset],</span>
+<br class="fancyvrb" /><a 
+ id="x1-101028r14"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;                </span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_final_Y]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[high_neighbor_offset],</span>
+<br class="fancyvrb" /><a 
+ id="x1-101030r15"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_X_list]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;)</span>
+<br class="fancyvrb" /><a 
+ id="x1-101032r16"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101034r17"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;10)</span><span 
+class="cmtt-10">&#x00A0;[val]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_Y]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[i]</span>
+<br class="fancyvrb" /><a 
+ id="x1-101036r18"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;11)</span><span 
+class="cmtt-10">&#x00A0;[highroom]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[range]</span><span 
+class="cmtt-10">&#x00A0;-</span><span 
+class="cmtt-10">&#x00A0;[predicted]</span>
+<br class="fancyvrb" /><a 
+ id="x1-101038r19"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;12)</span><span 
+class="cmtt-10">&#x00A0;[lowroom]</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[predicted]</span>
+<br class="fancyvrb" /><a 
+ id="x1-101040r20"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;13)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;(</span><span 
+class="cmtt-10">&#x00A0;[highroom]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;less</span><span 
+class="cmtt-10">&#x00A0;than</span><span 
+class="cmtt-10">&#x00A0;[lowroom]</span><span 
+class="cmtt-10">&#x00A0;)</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-101042r21"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101044r22"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;14)</span><span 
+class="cmtt-10">&#x00A0;[room]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[highroom]</span><span 
+class="cmtt-10">&#x00A0;*</span><span 
+class="cmtt-10">&#x00A0;2</span>
+<br class="fancyvrb" /><a 
+ id="x1-101046r23"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101048r24"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span><span 
+class="cmtt-10">&#x00A0;else</span><span 
+class="cmtt-10">&#x00A0;[highroom]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;not</span><span 
+class="cmtt-10">&#x00A0;less</span><span 
+class="cmtt-10">&#x00A0;than</span><span 
+class="cmtt-10">&#x00A0;[lowroom]</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-101050r25"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101052r26"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;15)</span><span 
+class="cmtt-10">&#x00A0;[room]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[lowroom]</span><span 
+class="cmtt-10">&#x00A0;*</span><span 
+class="cmtt-10">&#x00A0;2</span>
+<br class="fancyvrb" /><a 
+ id="x1-101054r27"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+                                                                                    
 
- 29) done
+                                                                                    
+<br class="fancyvrb" /><a 
+ id="x1-101056r28"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span>
+<br class="fancyvrb" /><a 
+ id="x1-101058r29"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101060r30"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;16)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;(</span><span 
+class="cmtt-10">&#x00A0;[val]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;nonzero</span><span 
+class="cmtt-10">&#x00A0;)</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-101062r31"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101064r32"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;17)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_step2_flag]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[low_neighbor_offset]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;set</span>
+<br class="fancyvrb" /><a 
+ id="x1-101066r33"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;18)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_step2_flag]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[high_neighbor_offset]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;set</span>
+<br class="fancyvrb" /><a 
+ id="x1-101068r34"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;19)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_step2_flag]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;set</span>
+<br class="fancyvrb" /><a 
+ id="x1-101070r35"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;20)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;(</span><span 
+class="cmtt-10">&#x00A0;[val]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;greater</span><span 
+class="cmtt-10">&#x00A0;than</span><span 
+class="cmtt-10">&#x00A0;or</span><span 
+class="cmtt-10">&#x00A0;equal</span><span 
+class="cmtt-10">&#x00A0;to</span><span 
+class="cmtt-10">&#x00A0;[room]</span><span 
+class="cmtt-10">&#x00A0;)</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-101072r36"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101074r37"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;21)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;(</span><span 
+class="cmtt-10">&#x00A0;[highroom]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;greater</span><span 
+class="cmtt-10">&#x00A0;than</span><span 
+class="cmtt-10">&#x00A0;[lowroom]</span><span 
+class="cmtt-10">&#x00A0;)</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-101076r38"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101078r39"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;22)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_final_Y]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[val]</span><span 
+class="cmtt-10">&#x00A0;-</span><span 
+class="cmtt-10">&#x00A0;[lowroom]</span><span 
+class="cmtt-10">&#x00A0;+</span><span 
+class="cmtt-10">&#x00A0;[predicted]</span>
+<br class="fancyvrb" /><a 
+ id="x1-101080r40"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101082r41"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;        </span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span><span 
+class="cmtt-10">&#x00A0;else</span><span 
+class="cmtt-10">&#x00A0;[highroom]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;not</span><span 
+class="cmtt-10">&#x00A0;greater</span><span 
+class="cmtt-10">&#x00A0;than</span><span 
+class="cmtt-10">&#x00A0;[lowroom]</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-101084r42"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101086r43"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;23)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_final_Y]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[predicted]</span><span 
+class="cmtt-10">&#x00A0;-</span><span 
+class="cmtt-10">&#x00A0;[val]</span><span 
+class="cmtt-10">&#x00A0;+</span><span 
+class="cmtt-10">&#x00A0;[highroom]</span><span 
+class="cmtt-10">&#x00A0;-</span><span 
+class="cmtt-10">&#x00A0;1</span>
+<br class="fancyvrb" /><a 
+ id="x1-101088r44"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101090r45"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span>
+<br class="fancyvrb" /><a 
+ id="x1-101092r46"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101094r47"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span><span 
+class="cmtt-10">&#x00A0;else</span><span 
+class="cmtt-10">&#x00A0;[val]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;less</span><span 
+class="cmtt-10">&#x00A0;than</span><span 
+class="cmtt-10">&#x00A0;[room]</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-101096r48"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101098r49"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;        </span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;24)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;([val]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;odd)</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-101100r50"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101102r51"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;25)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_final_Y]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;=</span>
+<br class="fancyvrb" /><a 
+ id="x1-101104r52"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;[predicted]</span><span 
+class="cmtt-10">&#x00A0;-</span><span 
+class="cmtt-10">&#x00A0;(([val]</span><span 
+class="cmtt-10">&#x00A0;+</span><span 
+class="cmtt-10">&#x00A0;1)</span><span 
+class="cmtt-10">&#x00A0;divided</span><span 
+class="cmtt-10">&#x00A0;by</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;using</span><span 
+class="cmtt-10">&#x00A0;integer</span><span 
+class="cmtt-10">&#x00A0;division)</span>
+<br class="fancyvrb" /><a 
+ id="x1-101106r53"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101108r54"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span><span 
+class="cmtt-10">&#x00A0;else</span><span 
+class="cmtt-10">&#x00A0;[val]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;even</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-101110r55"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101112r56"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;26)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_final_Y]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;=</span>
+<br class="fancyvrb" /><a 
+ id="x1-101114r57"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;[predicted]</span><span 
+class="cmtt-10">&#x00A0;+</span><span 
+class="cmtt-10">&#x00A0;([val]</span><span 
+class="cmtt-10">&#x00A0;/</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;using</span><span 
+class="cmtt-10">&#x00A0;integer</span><span 
+class="cmtt-10">&#x00A0;division)</span>
+<br class="fancyvrb" /><a 
+ id="x1-101116r58"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101118r59"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span>
+<br class="fancyvrb" /><a 
+ id="x1-101120r60"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101122r61"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span>
+<br class="fancyvrb" /><a 
+ id="x1-101124r62"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101126r63"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span><span 
+class="cmtt-10">&#x00A0;else</span><span 
+class="cmtt-10">&#x00A0;[val]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;zero</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-101128r64"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101130r65"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;27)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_step2_flag]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;unset</span>
+<br class="fancyvrb" /><a 
+ id="x1-101132r66"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;28)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_final_Y]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[predicted]</span>
+<br class="fancyvrb" /><a 
+ id="x1-101134r67"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101136r68"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span>
+<br class="fancyvrb" /><a 
+ id="x1-101138r69"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101140r70"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span>
+<br class="fancyvrb" /><a 
+ id="x1-101142r71"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101144r72"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;29)</span><span 
+class="cmtt-10">&#x00A0;done</span>
+<br class="fancyvrb" /><a 
+ id="x1-101146r73"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+</div>
+     </dd><dt class="description">
+<span 
+class="cmssbx-10x-x-109">step 2: curve synthesis</span> </dt><dd 
+class="description">
+     <!--l. 336--><p class="noindent" >Curve synthesis generates a return vector <span 
+class="cmtt-10x-x-109">[floor] </span>of length <span 
+class="cmtt-10x-x-109">[n] </span>(where <span 
+class="cmtt-10x-x-109">[n] </span>is provided by the
+                                                                                    
 
-</pre></div><div class="section" lang="en"><div class="titlepage"><div><div><h6 class="title"><a name="id309123"></a>7.2.2.2.2. step 2: curve synthesis</h6></div></div></div><p>
-Curve synthesis generates a return vector <code class="varname">[floor]</code> of length
-<code class="varname">[n]</code> (where <code class="varname">[n]</code> is provided by the decode process
-calling to floor decode).  Floor 1 curve synthesis makes use of the
-<code class="varname">[floor1_X_list]</code>, <code class="varname">[floor1_final_Y]</code> and
-<code class="varname">[floor1_step2_flag]</code> vectors, as well as [floor1_multiplier]
-and [floor1_values] values.</p><p>
-Decode begins by sorting the scalars from vectors
-<code class="varname">[floor1_X_list]</code>, <code class="varname">[floor1_final_Y]</code> and
-<code class="varname">[floor1_step2_flag]</code> together into new vectors
-<code class="varname">[floor1_X_list]'</code>, <code class="varname">[floor1_final_Y]'</code> and
-<code class="varname">[floor1_step2_flag]'</code> according to ascending sort order of the
-values in <code class="varname">[floor1_X_list]</code>.  That is, sort the values of
-<code class="varname">[floor1_X_list]</code> and then apply the same permutation to
-elements of the other two vectors so that the X, Y and step2_flag
-values still match.</p><p>
-Then compute the final curve in one pass:</p><pre class="screen">
-  1) [hx] = 0
-  2) [lx] = 0
-  3) [ly] = vector [floor1_final_Y]' element [0] * [floor1_multiplier]
-  4) iterate [i] over the range 1 ... [floor1_values]-1 {
+                                                                                    
+     decode process calling to floor decode). Floor 1 curve synthesis makes use of the
+     <span 
+class="cmtt-10x-x-109">[floor1_X_list]</span>, <span 
+class="cmtt-10x-x-109">[floor1_final_Y] </span>and <span 
+class="cmtt-10x-x-109">[floor1_step2_flag] </span>vectors, as well as
+     [floor1&#x02D9;multiplier] and [floor1&#x02D9;values] values.
+     <!--l. 343--><p class="noindent" >Decode begins by sorting the scalars from vectors <span 
+class="cmtt-10x-x-109">[floor1_X_list]</span>, <span 
+class="cmtt-10x-x-109">[floor1_final_Y] </span>and
+     <span 
+class="cmtt-10x-x-109">[floor1_step2_flag] </span>together into new vectors <span 
+class="cmtt-10x-x-109">[floor1_X_list]&#8217;</span>, <span 
+class="cmtt-10x-x-109">[floor1_final_Y]&#8217;</span>
+     and <span 
+class="cmtt-10x-x-109">[floor1_step2_flag]&#8217; </span>according to ascending sort order of the values in
+     <span 
+class="cmtt-10x-x-109">[floor1_X_list]</span>. That is, sort the values of <span 
+class="cmtt-10x-x-109">[floor1_X_list] </span>and then apply the same
+     permutation to elements of the other two vectors so that the X, Y and step2&#x02D9;flag values still
+     match.
+     <!--l. 353--><p class="noindent" >Then compute the final curve in one pass:
+     <!--l. 355--><p class="noindent" >
+     <div class="fancyvrb" id="fancyvrb32">
+<a 
+ id="x1-101148r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1)</span><span 
+class="cmtt-10">&#x00A0;[hx]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;0</span>
+<br class="fancyvrb" /><a 
+ id="x1-101150r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2)</span><span 
+class="cmtt-10">&#x00A0;[lx]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;0</span>
+<br class="fancyvrb" /><a 
+ id="x1-101152r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;3)</span><span 
+class="cmtt-10">&#x00A0;[ly]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor1_final_Y]&#8217;</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[0]</span><span 
+class="cmtt-10">&#x00A0;*</span><span 
+class="cmtt-10">&#x00A0;[floor1_multiplier]</span>
+<br class="fancyvrb" /><a 
+ id="x1-101154r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;4)</span><span 
+class="cmtt-10">&#x00A0;iterate</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;over</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;range</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;...</span><span 
+class="cmtt-10">&#x00A0;[floor1_values]-1</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-101156r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101158r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;5)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;(</span><span 
+class="cmtt-10">&#x00A0;[floor1_step2_flag]&#8217;</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;set</span><span 
+class="cmtt-10">&#x00A0;)</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-101160r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101162r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;6)</span><span 
+class="cmtt-10">&#x00A0;[hy]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[floor1_final_Y]&#8217;</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;*</span><span 
+class="cmtt-10">&#x00A0;[floor1_multiplier]</span>
+<br class="fancyvrb" /><a 
+ id="x1-101164r9"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;    </span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;7)</span><span 
+class="cmtt-10">&#x00A0;[hx]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[floor1_X_list]&#8217;</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[i]</span>
+<br class="fancyvrb" /><a 
+ id="x1-101166r10"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;8)</span><span 
+class="cmtt-10">&#x00A0;</span><a 
+href="#x1-1230009.2.7"><span 
+class="cmtt-10">render_line</span></a><span 
+class="cmtt-10">(</span><span 
+class="cmtt-10">&#x00A0;[lx],</span><span 
+class="cmtt-10">&#x00A0;[ly],</span><span 
+class="cmtt-10">&#x00A0;[hx],</span><span 
+class="cmtt-10">&#x00A0;[hy],</span><span 
+class="cmtt-10">&#x00A0;[floor]</span><span 
+class="cmtt-10">&#x00A0;)</span>
+<br class="fancyvrb" /><a 
+ id="x1-101168r11"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;9)</span><span 
+class="cmtt-10">&#x00A0;[lx]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[hx]</span>
+<br class="fancyvrb" /><a 
+ id="x1-101170r12"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;    </span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;10)</span><span 
+class="cmtt-10">&#x00A0;[ly]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[hy]</span>
+<br class="fancyvrb" /><a 
+ id="x1-101172r13"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span>
+<br class="fancyvrb" /><a 
+ id="x1-101174r14"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span>
+<br class="fancyvrb" /><a 
+ id="x1-101176r15"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101178r16"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;11)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;(</span><span 
+class="cmtt-10">&#x00A0;[hx]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;less</span><span 
+class="cmtt-10">&#x00A0;than</span><span 
+class="cmtt-10">&#x00A0;[n]</span><span 
+class="cmtt-10">&#x00A0;)</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-101180r17"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101182r18"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;12)</span><span 
+class="cmtt-10">&#x00A0;</span><a 
+href="#x1-1230009.2.7"><span 
+class="cmtt-10">render_line</span></a><span 
+class="cmtt-10">(</span><span 
+class="cmtt-10">&#x00A0;[hx],</span><span 
+class="cmtt-10">&#x00A0;[hy],</span><span 
+class="cmtt-10">&#x00A0;[n],</span><span 
+class="cmtt-10">&#x00A0;[hy],</span><span 
+class="cmtt-10">&#x00A0;[floor]</span><span 
+class="cmtt-10">&#x00A0;)</span>
+<br class="fancyvrb" /><a 
+ id="x1-101184r19"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101186r20"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span>
+<br class="fancyvrb" /><a 
+ id="x1-101188r21"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101190r22"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;13)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;(</span><span 
+class="cmtt-10">&#x00A0;[hx]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;greater</span><span 
+class="cmtt-10">&#x00A0;than</span><span 
+class="cmtt-10">&#x00A0;[n]</span><span 
+class="cmtt-10">&#x00A0;)</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">{</span>
+<br class="fancyvrb" /><a 
+ id="x1-101192r23"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101194r24"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;14)</span><span 
+class="cmtt-10">&#x00A0;truncate</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor]</span><span 
+class="cmtt-10">&#x00A0;to</span><span 
+class="cmtt-10">&#x00A0;[n]</span><span 
+class="cmtt-10">&#x00A0;elements</span>
+<br class="fancyvrb" /><a 
+ id="x1-101196r25"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101198r26"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmsy-10">}</span>
+<br class="fancyvrb" /><a 
+ id="x1-101200r27"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101202r28"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;15)</span><span 
+class="cmtt-10">&#x00A0;for</span><span 
+class="cmtt-10">&#x00A0;each</span><span 
+class="cmtt-10">&#x00A0;scalar</span><span 
+class="cmtt-10">&#x00A0;in</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[floor],</span><span 
+class="cmtt-10">&#x00A0;perform</span><span 
+class="cmtt-10">&#x00A0;a</span><span 
+class="cmtt-10">&#x00A0;lookup</span><span 
+class="cmtt-10">&#x00A0;substitution</span><span 
+class="cmtt-10">&#x00A0;using</span>
+<br class="fancyvrb" /><a 
+ id="x1-101204r29"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;scalar</span><span 
+class="cmtt-10">&#x00A0;value</span><span 
+class="cmtt-10">&#x00A0;from</span><span 
+class="cmtt-10">&#x00A0;[floor]</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;an</span><span 
+class="cmtt-10">&#x00A0;offset</span><span 
+class="cmtt-10">&#x00A0;into</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmbx-10">??</span>
+<br class="fancyvrb" /><a 
+ id="x1-101206r30"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-101208r31"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;16)</span><span 
+class="cmtt-10">&#x00A0;done</span>
+<br class="fancyvrb" /><a 
+ id="x1-101210r32"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+</div>
+     </dd></dl>
+                                                                                    
 
-       5) if ( [floor1_step2_flag]' element [i] is set ) {
+                                                                                    
+<h3 class="sectionHead"><span class="titlemark">8 </span> <a 
+ id="x1-1020008"></a>Residue setup and decode</h3>
+<!--l. 6--><p class="noindent" >
+<h4 class="subsectionHead"><span class="titlemark">8.1 </span> <a 
+ id="x1-1030008.1"></a>Overview</h4>
+<!--l. 8--><p class="noindent" >A residue vector represents the fine detail of the audio spectrum of one channel in an audio frame
+after the encoder subtracts the floor curve and performs any channel coupling. A residue vector
+may represent spectral lines, spectral magnitude, spectral phase or hybrids as mixed by
+channel coupling. The exact semantic content of the vector does not matter to the residue
+abstraction.
+<!--l. 15--><p class="noindent" >Whatever the exact qualities, the Vorbis residue abstraction codes the residue vectors into the
+bitstream packet, and then reconstructs the vectors during decode. Vorbis makes use of three
+different encoding variants (numbered 0, 1 and 2) of the same basic vector encoding
+abstraction.
+<!--l. 23--><p class="noindent" >
+<h4 class="subsectionHead"><span class="titlemark">8.2 </span> <a 
+ id="x1-1040008.2"></a>Residue format</h4>
+<!--l. 25--><p class="noindent" >Residue format partitions each vector in the vector bundle into chunks, classifies each chunk,
+encodes the chunk classifications and finally encodes the chunks themselves using the the specific
+VQ arrangement defined for each selected classification. The exact interleaving and partitioning
+vary by residue encoding number, however the high-level process used to classify and encode the
+residue vector is the same in all three variants.
+<!--l. 33--><p class="noindent" >A set of coded residue vectors are all of the same length. High level coding structure, ignoring
+for the moment exactly how a partition is encoded and simply trusting that it is, is as
+follows:
+     <ul class="itemize1">
+     <li class="itemize">Each vector is partitioned into multiple equal sized chunks according to configuration
+     specified.  If  we  have  a  vector  size  of  <span 
+class="cmti-10x-x-109">n</span>,  a  partition  size  <span 
+class="cmti-10x-x-109">residue&#x02d9;partition&#x02d9;size</span>,  and
+     a  total  of  <span 
+class="cmti-10x-x-109">ch  </span>residue  vectors,  the  total  number  of  partitioned  chunks  coded  is
+     <span 
+class="cmti-10x-x-109">n</span>/<span 
+class="cmti-10x-x-109">residue&#x02d9;partition&#x02d9;size</span>*<span 
+class="cmti-10x-x-109">ch</span>. It is important to note that the integer division truncates.
+     In the below example, we assume an example <span 
+class="cmti-10x-x-109">residue&#x02d9;partition&#x02d9;size </span>of 8.
+     </li>
+     <li class="itemize">Each partition in each vector has a classification number that specifies which of multiple
+     configured VQ codebook setups are used to decode that partition. The classification
+                                                                                    
 
-             6) [hy] = [floor1_final_Y]' element [i] * [floor1_multiplier]
- 	     7) [hx] = [floor1_X_list]' element [i]
-             8) <a href="#vorbis-spec-render_line" title="9.2.4.3. render_line">render_line</a>( [lx], [ly], [hx], [hy], [floor] )
-             9) [lx] = [hx]
-	    10) [ly] = [hy]
-          }
-     }
- 
- 11) if ( [hx] is less than [n] ) {
+                                                                                    
+     numbers of each partition can be thought of as forming a vector in their own right, as
+     in the illustration below. Just as the residue vectors are coded in grouped partitions
+     to increase encoding efficiency, the classification vector is also partitioned into chunks.
+     The integer elements of each scalar in a classification chunk are built into a single scalar
+     that represents the classification numbers in that chunk. In the below example, the
+     classification codeword encodes two classification numbers.
+     </li>
+     <li class="itemize">The values in a residue vector may be encoded monolithically in a single pass through
+     the residue vector, but more often efficient codebook design dictates that each vector
+     is encoded as the additive sum of several passes through the residue vector using more
+     than one VQ codebook. Thus, each residue value potentially accumulates values from
+     multiple decode passes. The classification value associated with a partition is the same
+     in each pass, thus the classification codeword is coded only in the first pass.
+     </li></ul>
+<div class="center" 
+>
+<!--l. 70--><p class="noindent" >
 
-        12) <a href="#vorbis-spec-render_line" title="9.2.4.3. render_line">render_line</a>( [hx], [hy], [n], [hy], [floor] )
+<!--l. 71--><p class="noindent" ><img 
+src="residue-pack.png" alt="PIC"  
+>
+<br /> <table class="caption" 
+><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure&#x00A0;11: </td><td  
+class="content">illustration of residue vector format</td></tr></table><!--tex4ht:label?: x1-10400111 -->
+</div>
+<!--l. 77--><p class="noindent" >
+<h4 class="subsectionHead"><span class="titlemark">8.3 </span> <a 
+ id="x1-1050008.3"></a>residue 0</h4>
+<!--l. 79--><p class="noindent" >Residue 0 and 1 differ only in the way the values within a residue partition are interleaved during
+partition encoding (visually treated as a black box&#8211;or cyan box or brown box&#8211;in the above
+figure).
+<!--l. 83--><p class="noindent" >Residue encoding 0 interleaves VQ encoding according to the dimension of the codebook used to
+encode a partition in a specific pass. The dimension of the codebook need not be the same in
+multiple passes, however the partition size must be an even multiple of the codebook
+dimension.
+<!--l. 89--><p class="noindent" >As an example, assume a partition vector of size eight, to be encoded by residue 0 using codebook
+sizes of 8, 4, 2 and 1:
+<!--l. 92--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb33">
+                                                                                    
 
-     }
+                                                                                    
+<a 
+ id="x1-105002r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-105004r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;original</span><span 
+class="cmtt-10">&#x00A0;residue</span><span 
+class="cmtt-10">&#x00A0;vector:</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;3</span><span 
+class="cmtt-10">&#x00A0;4</span><span 
+class="cmtt-10">&#x00A0;5</span><span 
+class="cmtt-10">&#x00A0;6</span><span 
+class="cmtt-10">&#x00A0;7</span><span 
+class="cmtt-10">&#x00A0;]</span>
+<br class="fancyvrb" /><a 
+ id="x1-105006r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-105008r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;codebook</span><span 
+class="cmtt-10">&#x00A0;dimensions</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;8</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;encoded</span><span 
+class="cmtt-10">&#x00A0;as:</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;3</span><span 
+class="cmtt-10">&#x00A0;4</span><span 
+class="cmtt-10">&#x00A0;5</span><span 
+class="cmtt-10">&#x00A0;6</span><span 
+class="cmtt-10">&#x00A0;7</span><span 
+class="cmtt-10">&#x00A0;]</span>
+<br class="fancyvrb" /><a 
+ id="x1-105010r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-105012r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;codebook</span><span 
+class="cmtt-10">&#x00A0;dimensions</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;4</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;encoded</span><span 
+class="cmtt-10">&#x00A0;as:</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;4</span><span 
+class="cmtt-10">&#x00A0;6</span><span 
+class="cmtt-10">&#x00A0;],</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;3</span><span 
+class="cmtt-10">&#x00A0;5</span><span 
+class="cmtt-10">&#x00A0;7</span><span 
+class="cmtt-10">&#x00A0;]</span>
+<br class="fancyvrb" /><a 
+ id="x1-105014r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-105016r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;codebook</span><span 
+class="cmtt-10">&#x00A0;dimensions</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;encoded</span><span 
+class="cmtt-10">&#x00A0;as:</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;4</span><span 
+class="cmtt-10">&#x00A0;],</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;5</span><span 
+class="cmtt-10">&#x00A0;],</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;6</span><span 
+class="cmtt-10">&#x00A0;],</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;3</span><span 
+class="cmtt-10">&#x00A0;7</span><span 
+class="cmtt-10">&#x00A0;]</span>
+<br class="fancyvrb" /><a 
+ id="x1-105018r9"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-105020r10"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;codebook</span><span 
+class="cmtt-10">&#x00A0;dimensions</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;encoded</span><span 
+class="cmtt-10">&#x00A0;as:</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;],</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;],</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;],</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;3</span><span 
+class="cmtt-10">&#x00A0;],</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;4</span><span 
+class="cmtt-10">&#x00A0;],</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;5</span><span 
+class="cmtt-10">&#x00A0;],</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;6</span><span 
+class="cmtt-10">&#x00A0;],</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;7</span><span 
+class="cmtt-10">&#x00A0;]</span>
+<br class="fancyvrb" /><a 
+ id="x1-105022r11"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+</div>
+<!--l. 106--><p class="noindent" >It is worth mentioning at this point that no configurable value in the residue coding setup is
+restricted to a power of two.
+<!--l. 111--><p class="noindent" >
+<h4 class="subsectionHead"><span class="titlemark">8.4 </span> <a 
+ id="x1-1060008.4"></a>residue 1</h4>
+<!--l. 113--><p class="noindent" >Residue 1 does not interleave VQ encoding. It represents partition vector scalars in order. As with
+residue 0, however, partition length must be an integer multiple of the codebook dimension,
+although dimension may vary from pass to pass.
+<!--l. 118--><p class="noindent" >As an example, assume a partition vector of size eight, to be encoded by residue 0 using codebook
+sizes of 8, 4, 2 and 1:
+<!--l. 121--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb34">
+<a 
+ id="x1-106002r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-106004r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;original</span><span 
+class="cmtt-10">&#x00A0;residue</span><span 
+class="cmtt-10">&#x00A0;vector:</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;3</span><span 
+class="cmtt-10">&#x00A0;4</span><span 
+class="cmtt-10">&#x00A0;5</span><span 
+class="cmtt-10">&#x00A0;6</span><span 
+class="cmtt-10">&#x00A0;7</span><span 
+class="cmtt-10">&#x00A0;]</span>
+<br class="fancyvrb" /><a 
+ id="x1-106006r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-106008r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;codebook</span><span 
+class="cmtt-10">&#x00A0;dimensions</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;8</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;encoded</span><span 
+class="cmtt-10">&#x00A0;as:</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;3</span><span 
+class="cmtt-10">&#x00A0;4</span><span 
+class="cmtt-10">&#x00A0;5</span><span 
+class="cmtt-10">&#x00A0;6</span><span 
+class="cmtt-10">&#x00A0;7</span><span 
+class="cmtt-10">&#x00A0;]</span>
+<br class="fancyvrb" /><a 
+ id="x1-106010r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-106012r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;codebook</span><span 
+class="cmtt-10">&#x00A0;dimensions</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;4</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;encoded</span><span 
+class="cmtt-10">&#x00A0;as:</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;3</span><span 
+class="cmtt-10">&#x00A0;],</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;4</span><span 
+class="cmtt-10">&#x00A0;5</span><span 
+class="cmtt-10">&#x00A0;6</span><span 
+class="cmtt-10">&#x00A0;7</span><span 
+class="cmtt-10">&#x00A0;]</span>
+<br class="fancyvrb" /><a 
+ id="x1-106014r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-106016r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;codebook</span><span 
+class="cmtt-10">&#x00A0;dimensions</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;encoded</span><span 
+class="cmtt-10">&#x00A0;as:</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;],</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;3</span><span 
+class="cmtt-10">&#x00A0;],</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;4</span><span 
+class="cmtt-10">&#x00A0;5</span><span 
+class="cmtt-10">&#x00A0;],</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;6</span><span 
+class="cmtt-10">&#x00A0;7</span><span 
+class="cmtt-10">&#x00A0;]</span>
+<br class="fancyvrb" /><a 
+ id="x1-106018r9"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-106020r10"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;codebook</span><span 
+class="cmtt-10">&#x00A0;dimensions</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;encoded</span><span 
+class="cmtt-10">&#x00A0;as:</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;],</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;1</span><span 
+class="cmtt-10">&#x00A0;],</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;],</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;3</span><span 
+class="cmtt-10">&#x00A0;],</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;4</span><span 
+class="cmtt-10">&#x00A0;],</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;5</span><span 
+class="cmtt-10">&#x00A0;],</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;6</span><span 
+class="cmtt-10">&#x00A0;],</span><span 
+class="cmtt-10">&#x00A0;[</span><span 
+class="cmtt-10">&#x00A0;7</span><span 
+class="cmtt-10">&#x00A0;]</span>
+<br class="fancyvrb" /><a 
+ id="x1-106022r11"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+</div>
+<!--l. 137--><p class="noindent" >
+                                                                                    
 
- 13) if ( [hx] is greater than [n] ) {
+                                                                                    
+<h4 class="subsectionHead"><span class="titlemark">8.5 </span> <a 
+ id="x1-1070008.5"></a>residue 2</h4>
+<!--l. 139--><p class="noindent" >Residue type two can be thought of as a variant of residue type 1. Rather than encoding multiple
+passed-in vectors as in residue type 1, the <span 
+class="cmti-10x-x-109">ch </span>passed in vectors of length <span 
+class="cmti-10x-x-109">n </span>are first interleaved and
+flattened into a single vector of length <span 
+class="cmti-10x-x-109">ch</span>*<span 
+class="cmti-10x-x-109">n</span>. Encoding then proceeds as in type 1. Decoding is as in
+type 1 with decode interleave reversed. If operating on a single vector to begin with, residue type 1
+and type 2 are equivalent.
+<div class="center" 
+>
+<!--l. 147--><p class="noindent" >
 
-            14) truncate vector [floor] to [n] elements
+<!--l. 148--><p class="noindent" ><img 
+src="residue2.png" alt="PIC"  
+>
+<br /> <table class="caption" 
+><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure&#x00A0;12: </td><td  
+class="content">illustration of residue type 2</td></tr></table><!--tex4ht:label?: x1-10700112 -->
+</div>
+<!--l. 153--><p class="noindent" >
+<h4 class="subsectionHead"><span class="titlemark">8.6 </span> <a 
+ id="x1-1080008.6"></a>Residue decode</h4>
+<!--l. 155--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">8.6.1 </span> <a 
+ id="x1-1090008.6.1"></a>header decode</h5>
+<!--l. 157--><p class="noindent" >Header decode for all three residue types is identical.
+<div class="fancyvrb" id="fancyvrb35">
+<a 
+ id="x1-109002r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1)</span><span 
+class="cmtt-10">&#x00A0;[residue_begin]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;24</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span>
+<br class="fancyvrb" /><a 
+ id="x1-109004r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2)</span><span 
+class="cmtt-10">&#x00A0;[residue_end]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;24</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span>
+<br class="fancyvrb" /><a 
+ id="x1-109006r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;3)</span><span 
+class="cmtt-10">&#x00A0;[residue_partition_size]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;24</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span><span 
+class="cmtt-10">&#x00A0;and</span><span 
+class="cmtt-10">&#x00A0;add</span><span 
+class="cmtt-10">&#x00A0;one</span>
+<br class="fancyvrb" /><a 
+ id="x1-109008r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;4)</span><span 
+class="cmtt-10">&#x00A0;[residue_classifications]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;6</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span><span 
+class="cmtt-10">&#x00A0;and</span><span 
+class="cmtt-10">&#x00A0;add</span><span 
+class="cmtt-10">&#x00A0;one</span>
+<br class="fancyvrb" /><a 
+ id="x1-109010r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;5)</span><span 
+class="cmtt-10">&#x00A0;[residue_classbook]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;8</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span>
+</div>
+<!--l. 166--><p class="noindent" ><span 
+class="cmtt-10x-x-109">[residue_begin] </span>and <span 
+class="cmtt-10x-x-109">[residue_end] </span>select the specific sub-portion of each vector that is
+actually coded; it implements akin to a bandpass where, for coding purposes, the vector
+effectively begins at element <span 
+class="cmtt-10x-x-109">[residue_begin] </span>and ends at <span 
+class="cmtt-10x-x-109">[residue_end]</span>. Preceding
+and following values in the unpacked vectors are zeroed. Note that for residue type 2,
+these values as well as <span 
+class="cmtt-10x-x-109">[residue_partition_size]</span>apply to the interleaved vector, not
+the individual vectors before interleave. <span 
+class="cmtt-10x-x-109">[residue_partition_size] </span>is as explained
+above, <span 
+class="cmtt-10x-x-109">[residue_classifications] </span>is the number of possible classification to which a
+partition can belong and <span 
+class="cmtt-10x-x-109">[residue_classbook] </span>is the codebook number used to code
+                                                                                    
 
-     }
- 
- 15) for each scalar in vector [floor], perform a lookup substitution using 
-     the scalar value from [floor] as an offset into the vector <a href="#vorbis-spec-floor1_inverse_dB_table" title="10.1. floor1_inverse_dB_table">[floor1_inverse_dB_static_table]</a>
+                                                                                    
+classification codewords. The number of dimensions in book <span 
+class="cmtt-10x-x-109">[residue_classbook] </span>determines
+how many classification values are grouped into a single classification codeword. Note
+that the number of entries and dimensions in book <span 
+class="cmtt-10x-x-109">[residue_classbook]</span>, along with
+<span 
+class="cmtt-10x-x-109">[residue_classifications]</span>, overdetermines to possible number of classification
+codewords. If <span 
+class="cmtt-10x-x-109">[residue_classifications]</span>&#x02C6;<span 
+class="cmtt-10x-x-109">[residue_classbook]</span>.dimensions exceeds
+<span 
+class="cmtt-10x-x-109">[residue_classbook]</span>.entries, the bitstream should be regarded to be undecodable.
+<!--l. 190--><p class="noindent" >Next we read a bitmap pattern that specifies which partition classes code values in which
+passes.
+<!--l. 193--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb36">
+<a 
+ id="x1-109012r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1)</span><span 
+class="cmtt-10">&#x00A0;iterate</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;over</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;range</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;...</span><span 
+class="cmtt-10">&#x00A0;[residue_classifications]-1</span><span 
+class="cmtt-10">&#x00A0;{</span>
+<br class="fancyvrb" /><a 
+ id="x1-109014r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-109016r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2)</span><span 
+class="cmtt-10">&#x00A0;[high_bits]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;0</span>
+<br class="fancyvrb" /><a 
+ id="x1-109018r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;3)</span><span 
+class="cmtt-10">&#x00A0;[low_bits]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;3</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span>
+<br class="fancyvrb" /><a 
+ id="x1-109020r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;4)</span><span 
+class="cmtt-10">&#x00A0;[bitflag]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;one</span><span 
+class="cmtt-10">&#x00A0;bit</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;boolean</span>
+<br class="fancyvrb" /><a 
+ id="x1-109022r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;5)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;(</span><span 
+class="cmtt-10">&#x00A0;[bitflag]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;set</span><span 
+class="cmtt-10">&#x00A0;)</span><span 
+class="cmtt-10">&#x00A0;then</span><span 
+class="cmtt-10">&#x00A0;[high_bits]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;five</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span>
+<br class="fancyvrb" /><a 
+ id="x1-109024r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;6)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[residue_cascade]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[high_bits]</span><span 
+class="cmtt-10">&#x00A0;*</span><span 
+class="cmtt-10">&#x00A0;8</span><span 
+class="cmtt-10">&#x00A0;+</span><span 
+class="cmtt-10">&#x00A0;[low_bits]</span>
+<br class="fancyvrb" /><a 
+ id="x1-109026r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;}</span>
+<br class="fancyvrb" /><a 
+ id="x1-109028r9"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;7)</span><span 
+class="cmtt-10">&#x00A0;done</span>
+</div>
+<!--l. 205--><p class="noindent" >Finally, we read in a list of book numbers, each corresponding to specific bit set in the cascade
+bitmap. We loop over the possible codebook classifications and the maximum possible number of
+encoding stages (8 in Vorbis I, as constrained by the elements of the cascade bitmap being eight
+bits):
+<!--l. 211--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb37">
+<a 
+ id="x1-109030r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1)</span><span 
+class="cmtt-10">&#x00A0;iterate</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;over</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;range</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;...</span><span 
+class="cmtt-10">&#x00A0;[residue_classifications]-1</span><span 
+class="cmtt-10">&#x00A0;{</span>
+<br class="fancyvrb" /><a 
+ id="x1-109032r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-109034r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2)</span><span 
+class="cmtt-10">&#x00A0;iterate</span><span 
+class="cmtt-10">&#x00A0;[j]</span><span 
+class="cmtt-10">&#x00A0;over</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;range</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;...</span><span 
+class="cmtt-10">&#x00A0;7</span><span 
+class="cmtt-10">&#x00A0;{</span>
+<br class="fancyvrb" /><a 
+ id="x1-109036r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-109038r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;3)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;(</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[residue_cascade]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;bit</span><span 
+class="cmtt-10">&#x00A0;[j]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;set</span><span 
+class="cmtt-10">&#x00A0;)</span><span 
+class="cmtt-10">&#x00A0;{</span>
+<br class="fancyvrb" /><a 
+ id="x1-109040r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-109042r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;4)</span><span 
+class="cmtt-10">&#x00A0;array</span><span 
+class="cmtt-10">&#x00A0;[residue_books]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[i][j]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;8</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;as</span><span 
+class="cmtt-10">&#x00A0;unsigned</span><span 
+class="cmtt-10">&#x00A0;integer</span>
+<br class="fancyvrb" /><a 
+ id="x1-109044r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-109046r9"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;}</span><span 
+class="cmtt-10">&#x00A0;else</span><span 
+class="cmtt-10">&#x00A0;{</span>
+<br class="fancyvrb" /><a 
+ id="x1-109048r10"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-109050r11"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;5)</span><span 
+class="cmtt-10">&#x00A0;array</span><span 
+class="cmtt-10">&#x00A0;[residue_books]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[i][j]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;unused</span>
+<br class="fancyvrb" /><a 
+ id="x1-109052r12"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-109054r13"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;}</span>
+<br class="fancyvrb" /><a 
+ id="x1-109056r14"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;}</span>
+<br class="fancyvrb" /><a 
+ id="x1-109058r15"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;}</span>
+<br class="fancyvrb" /><a 
+ id="x1-109060r16"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-109062r17"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;6)</span><span 
+class="cmtt-10">&#x00A0;done</span>
+</div>
+<!--l. 231--><p class="noindent" >An end-of-packet condition at any point in header decode renders the stream undecodable. In
+                                                                                    
 
- 16) done
+                                                                                    
+addition, any codebook number greater than the maximum numbered codebook set up in this
+stream also renders the stream undecodable.
+<!--l. 238--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">8.6.2 </span> <a 
+ id="x1-1100008.6.2"></a>packet decode</h5>
+<!--l. 240--><p class="noindent" >Format 0 and 1 packet decode is identical except for specific partition interleave. Format 2 packet
+decode can be built out of the format 1 decode process. Thus we describe first the decode
+infrastructure identical to all three formats.
+<!--l. 245--><p class="noindent" >In addition to configuration information, the residue decode process is passed the number of vectors
+in the submap bundle and a vector of flags indicating if any of the vectors are not to be decoded. If
+the passed in number of vectors is 3 and vector number 1 is marked &#8217;do not decode&#8217;, decode skips
+vector 1 during the decode loop. However, even &#8217;do not decode&#8217; vectors are allocated and
+zeroed.
+<!--l. 252--><p class="noindent" >Depending on the values of <span 
+class="cmtt-10x-x-109">[residue_begin] </span>and <span 
+class="cmtt-10x-x-109">[residue_end]</span>, it is obvious that the encoded
+portion of a residue vector may be the entire possible residue vector or some other strict subset of
+the actual residue vector size with zero padding at either uncoded end. However, it is also
+possible to set <span 
+class="cmtt-10x-x-109">[residue_begin] </span>and <span 
+class="cmtt-10x-x-109">[residue_end] </span>to specify a range partially or wholly
+beyond the maximum vector size. Before beginning residue decode, limit <span 
+class="cmtt-10x-x-109">[residue_begin]</span>
+and <span 
+class="cmtt-10x-x-109">[residue_end] </span>to the maximum possible vector size as follows. We assume that
+the number of vectors being encoded, <span 
+class="cmtt-10x-x-109">[ch] </span>is provided by the higher level decoding
+process.
+<!--l. 266--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb38">
+<a 
+ id="x1-110002r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1)</span><span 
+class="cmtt-10">&#x00A0;[actual_size]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;current</span><span 
+class="cmtt-10">&#x00A0;blocksize/2;</span>
+<br class="fancyvrb" /><a 
+ id="x1-110004r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;residue</span><span 
+class="cmtt-10">&#x00A0;encoding</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;format</span><span 
+class="cmtt-10">&#x00A0;2</span>
+<br class="fancyvrb" /><a 
+ id="x1-110006r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;3)</span><span 
+class="cmtt-10">&#x00A0;[actual_size]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[actual_size]</span><span 
+class="cmtt-10">&#x00A0;*</span><span 
+class="cmtt-10">&#x00A0;[ch];</span>
+<br class="fancyvrb" /><a 
+ id="x1-110008r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;4)</span><span 
+class="cmtt-10">&#x00A0;[limit_residue_begin]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;maximum</span><span 
+class="cmtt-10">&#x00A0;of</span><span 
+class="cmtt-10">&#x00A0;([residue_begin],[actual_size]);</span>
+<br class="fancyvrb" /><a 
+ id="x1-110010r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;5)</span><span 
+class="cmtt-10">&#x00A0;[limit_residue_end]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;maximum</span><span 
+class="cmtt-10">&#x00A0;of</span><span 
+class="cmtt-10">&#x00A0;([residue_end],[actual_size]);</span>
+</div>
+<!--l. 274--><p class="noindent" >The following convenience values are conceptually useful to clarifying the decode process:
+<!--l. 277--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb39">
+<a 
+ id="x1-110012r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1)</span><span 
+class="cmtt-10">&#x00A0;[classwords_per_codeword]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[codebook_dimensions]</span><span 
+class="cmtt-10">&#x00A0;value</span><span 
+class="cmtt-10">&#x00A0;of</span><span 
+class="cmtt-10">&#x00A0;codebook</span><span 
+class="cmtt-10">&#x00A0;[residue_classbook]</span>
+<br class="fancyvrb" /><a 
+ id="x1-110014r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2)</span><span 
+class="cmtt-10">&#x00A0;[n_to_read]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[limit_residue_end]</span><span 
+class="cmtt-10">&#x00A0;-</span><span 
+class="cmtt-10">&#x00A0;[limit_residue_begin]</span>
+<br class="fancyvrb" /><a 
+ id="x1-110016r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;3)</span><span 
+class="cmtt-10">&#x00A0;[partitions_to_read]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[n_to_read]</span><span 
+class="cmtt-10">&#x00A0;/</span><span 
+class="cmtt-10">&#x00A0;[residue_partition_size]</span>
+</div>
+<!--l. 283--><p class="noindent" >Packet decode proceeds as follows, matching the description offered earlier in the document.
+                                                                                    
 
-</pre></div></div></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="vorbis-spec-residue"></a>8. Residue setup and decode</h2></div><div><p class="releaseinfo">
-  $Id: 08-residue.xml 14598 2008-03-18 15:39:43Z xiphmont $
- </p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id333002"></a>8.1. Overview</h3></div></div></div><p>
-A residue vector represents the fine detail of the audio spectrum of
-one channel in an audio frame after the encoder subtracts the floor
-curve and performs any channel coupling.  A residue vector may
-represent spectral lines, spectral magnitude, spectral phase or
-hybrids as mixed by channel coupling.  The exact semantic content of
-the vector does not matter to the residue abstraction.</p><p>
-Whatever the exact qualities, the Vorbis residue abstraction codes the
-residue vectors into the bitstream packet, and then reconstructs the
-vectors during decode.  Vorbis makes use of three different encoding
-variants (numbered 0, 1 and 2) of the same basic vector encoding
-abstraction.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id327769"></a>8.2. Residue format</h3></div></div></div><p>
-Residue format partitions each vector in the vector bundle into chunks,
-classifies each chunk, encodes the chunk classifications and finally
-encodes the chunks themselves using the the specific VQ arrangement
-defined for each selected classification.
-The exact interleaving and partitioning vary by residue encoding number,
-however the high-level process used to classify and encode the residue 
-vector is the same in all three variants.</p><p>
-A set of coded residue vectors are all of the same length.  High level
-coding structure, ignoring for the moment exactly how a partition is
-encoded and simply trusting that it is, is as follows:</p><p>
-</p><div class="itemizedlist"><ul type="disc"><li><p>Each vector is partitioned into multiple equal sized chunks
-according to configuration specified.  If we have a vector size of
-<span class="emphasis"><em>n</em></span>, a partition size <span class="emphasis"><em>residue_partition_size</em></span>, and a total
-of <span class="emphasis"><em>ch</em></span> residue vectors, the total number of partitioned chunks
-coded is <span class="emphasis"><em>n</em></span>/<span class="emphasis"><em>residue_partition_size</em></span>*<span class="emphasis"><em>ch</em></span>.  It is
-important to note that the integer division truncates.  In the below
-example, we assume an example <span class="emphasis"><em>residue_partition_size</em></span> of 8.</p></li><li><p>Each partition in each vector has a classification number that
-specifies which of multiple configured VQ codebook setups are used to
-decode that partition.  The classification numbers of each partition
-can be thought of as forming a vector in their own right, as in the
-illustration below.  Just as the residue vectors are coded in grouped
-partitions to increase encoding efficiency, the classification vector
-is also partitioned into chunks.  The integer elements of each scalar
-in a classification chunk are built into a single scalar that
-represents the classification numbers in that chunk.  In the below
-example, the classification codeword encodes two classification
-numbers.</p></li><li><p>The values in a residue vector may be encoded monolithically in a
-single pass through the residue vector, but more often efficient
-codebook design dictates that each vector is encoded as the additive
-sum of several passes through the residue vector using more than one
-VQ codebook.  Thus, each residue value potentially accumulates values
-from multiple decode passes.  The classification value associated with
-a partition is the same in each pass, thus the classification codeword
-is coded only in the first pass.</p></li></ul></div><p>
-</p><div class="mediaobject"><img src="residue-pack.png" alt="[illustration of residue vector format]"></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id318469"></a>8.3. residue 0</h3></div></div></div><p>
-Residue 0 and 1 differ only in the way the values within a residue
-partition are interleaved during partition encoding (visually treated
-as a black box--or cyan box or brown box--in the above figure).</p><p>
-Residue encoding 0 interleaves VQ encoding according to the
-dimension of the codebook used to encode a partition in a specific
-pass.  The dimension of the codebook need not be the same in multiple
-passes, however the partition size must be an even multiple of the
-codebook dimension.</p><p>
-As an example, assume a partition vector of size eight, to be encoded
-by residue 0 using codebook sizes of 8, 4, 2 and 1:</p><pre class="programlisting">
+                                                                                    
+<div class="fancyvrb" id="fancyvrb40">
+<a 
+ id="x1-110018r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1)</span><span 
+class="cmtt-10">&#x00A0;allocate</span><span 
+class="cmtt-10">&#x00A0;and</span><span 
+class="cmtt-10">&#x00A0;zero</span><span 
+class="cmtt-10">&#x00A0;all</span><span 
+class="cmtt-10">&#x00A0;vectors</span><span 
+class="cmtt-10">&#x00A0;that</span><span 
+class="cmtt-10">&#x00A0;will</span><span 
+class="cmtt-10">&#x00A0;be</span><span 
+class="cmtt-10">&#x00A0;returned.</span>
+<br class="fancyvrb" /><a 
+ id="x1-110020r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;([n_to_read]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;zero),</span><span 
+class="cmtt-10">&#x00A0;stop;</span><span 
+class="cmtt-10">&#x00A0;there</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;no</span><span 
+class="cmtt-10">&#x00A0;residue</span><span 
+class="cmtt-10">&#x00A0;to</span><span 
+class="cmtt-10">&#x00A0;decode.</span>
+<br class="fancyvrb" /><a 
+ id="x1-110022r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;3)</span><span 
+class="cmtt-10">&#x00A0;iterate</span><span 
+class="cmtt-10">&#x00A0;[pass]</span><span 
+class="cmtt-10">&#x00A0;over</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;range</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;...</span><span 
+class="cmtt-10">&#x00A0;7</span><span 
+class="cmtt-10">&#x00A0;{</span>
+<br class="fancyvrb" /><a 
+ id="x1-110024r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-110026r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;4)</span><span 
+class="cmtt-10">&#x00A0;[partition_count]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;0</span>
+<br class="fancyvrb" /><a 
+ id="x1-110028r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-110030r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;5)</span><span 
+class="cmtt-10">&#x00A0;while</span><span 
+class="cmtt-10">&#x00A0;[partition_count]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;less</span><span 
+class="cmtt-10">&#x00A0;than</span><span 
+class="cmtt-10">&#x00A0;[partitions_to_read]</span>
+<br class="fancyvrb" /><a 
+ id="x1-110032r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-110034r9"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;6)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;([pass]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;zero)</span><span 
+class="cmtt-10">&#x00A0;{</span>
+<br class="fancyvrb" /><a 
+ id="x1-110036r10"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-110038r11"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;7)</span><span 
+class="cmtt-10">&#x00A0;iterate</span><span 
+class="cmtt-10">&#x00A0;[j]</span><span 
+class="cmtt-10">&#x00A0;over</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;range</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;..</span><span 
+class="cmtt-10">&#x00A0;[ch]-1</span><span 
+class="cmtt-10">&#x00A0;{</span>
+<br class="fancyvrb" /><a 
+ id="x1-110040r12"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-110042r13"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;8)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[j]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;not</span><span 
+class="cmtt-10">&#x00A0;marked</span><span 
+class="cmtt-10">&#x00A0;&#8217;do</span><span 
+class="cmtt-10">&#x00A0;not</span><span 
+class="cmtt-10">&#x00A0;decode&#8217;</span><span 
+class="cmtt-10">&#x00A0;{</span>
+<br class="fancyvrb" /><a 
+ id="x1-110044r14"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-110046r15"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;9)</span><span 
+class="cmtt-10">&#x00A0;[temp]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;from</span><span 
+class="cmtt-10">&#x00A0;packet</span><span 
+class="cmtt-10">&#x00A0;using</span><span 
+class="cmtt-10">&#x00A0;codebook</span><span 
+class="cmtt-10">&#x00A0;[residue_classbook]</span><span 
+class="cmtt-10">&#x00A0;in</span><span 
+class="cmtt-10">&#x00A0;scalar</span><span 
+class="cmtt-10">&#x00A0;context</span>
+<br class="fancyvrb" /><a 
+ id="x1-110048r16"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;10)</span><span 
+class="cmtt-10">&#x00A0;iterate</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;descending</span><span 
+class="cmtt-10">&#x00A0;over</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;range</span><span 
+class="cmtt-10">&#x00A0;[classwords_per_codeword]-1</span><span 
+class="cmtt-10">&#x00A0;...</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;{</span>
+<br class="fancyvrb" /><a 
+ id="x1-110050r17"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-110052r18"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;11)</span><span 
+class="cmtt-10">&#x00A0;array</span><span 
+class="cmtt-10">&#x00A0;[classifications]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[j],([i]+[partition_count])</span><span 
+class="cmtt-10">&#x00A0;=</span>
+<br class="fancyvrb" /><a 
+ id="x1-110054r19"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;[temp]</span><span 
+class="cmtt-10">&#x00A0;integer</span><span 
+class="cmtt-10">&#x00A0;modulo</span><span 
+class="cmtt-10">&#x00A0;[residue_classifications]</span>
+<br class="fancyvrb" /><a 
+ id="x1-110056r20"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;12)</span><span 
+class="cmtt-10">&#x00A0;[temp]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[temp]</span><span 
+class="cmtt-10">&#x00A0;/</span><span 
+class="cmtt-10">&#x00A0;[residue_classifications]</span><span 
+class="cmtt-10">&#x00A0;using</span><span 
+class="cmtt-10">&#x00A0;integer</span><span 
+class="cmtt-10">&#x00A0;division</span>
+<br class="fancyvrb" /><a 
+ id="x1-110058r21"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-110060r22"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;}</span>
+<br class="fancyvrb" /><a 
+ id="x1-110062r23"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-110064r24"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;}</span>
+<br class="fancyvrb" /><a 
+ id="x1-110066r25"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-110068r26"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;}</span>
+<br class="fancyvrb" /><a 
+ id="x1-110070r27"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-110072r28"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;}</span>
+<br class="fancyvrb" /><a 
+ id="x1-110074r29"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-110076r30"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;13)</span><span 
+class="cmtt-10">&#x00A0;iterate</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;over</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;range</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;..</span><span 
+class="cmtt-10">&#x00A0;([classwords_per_codeword]</span><span 
+class="cmtt-10">&#x00A0;-</span><span 
+class="cmtt-10">&#x00A0;1)</span><span 
+class="cmtt-10">&#x00A0;while</span><span 
+class="cmtt-10">&#x00A0;[partition_count]</span>
+<br class="fancyvrb" /><a 
+ id="x1-110078r31"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;also</span><span 
+class="cmtt-10">&#x00A0;less</span><span 
+class="cmtt-10">&#x00A0;than</span><span 
+class="cmtt-10">&#x00A0;[partitions_to_read]</span><span 
+class="cmtt-10">&#x00A0;{</span>
+<br class="fancyvrb" /><a 
+ id="x1-110080r32"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-110082r33"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;14)</span><span 
+class="cmtt-10">&#x00A0;iterate</span><span 
+class="cmtt-10">&#x00A0;[j]</span><span 
+class="cmtt-10">&#x00A0;over</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;range</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;..</span><span 
+class="cmtt-10">&#x00A0;[ch]-1</span><span 
+class="cmtt-10">&#x00A0;{</span>
+<br class="fancyvrb" /><a 
+ id="x1-110084r34"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-110086r35"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;15)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[j]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;not</span><span 
+class="cmtt-10">&#x00A0;marked</span><span 
+class="cmtt-10">&#x00A0;&#8217;do</span><span 
+class="cmtt-10">&#x00A0;not</span><span 
+class="cmtt-10">&#x00A0;decode&#8217;</span><span 
+class="cmtt-10">&#x00A0;{</span>
+<br class="fancyvrb" /><a 
+ id="x1-110088r36"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-110090r37"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;16)</span><span 
+class="cmtt-10">&#x00A0;[vqclass]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;array</span><span 
+class="cmtt-10">&#x00A0;[classifications]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[j],[partition_count]</span>
+<br class="fancyvrb" /><a 
+ id="x1-110092r38"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;17)</span><span 
+class="cmtt-10">&#x00A0;[vqbook]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;array</span><span 
+class="cmtt-10">&#x00A0;[residue_books]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[vqclass],[pass]</span>
+<br class="fancyvrb" /><a 
+ id="x1-110094r39"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;18)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;([vqbook]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;not</span><span 
+class="cmtt-10">&#x00A0;&#8217;unused&#8217;)</span><span 
+class="cmtt-10">&#x00A0;{</span>
+<br class="fancyvrb" /><a 
+ id="x1-110096r40"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-110098r41"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;19)</span><span 
+class="cmtt-10">&#x00A0;decode</span><span 
+class="cmtt-10">&#x00A0;partition</span><span 
+class="cmtt-10">&#x00A0;into</span><span 
+class="cmtt-10">&#x00A0;output</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;number</span><span 
+class="cmtt-10">&#x00A0;[j],</span><span 
+class="cmtt-10">&#x00A0;starting</span><span 
+class="cmtt-10">&#x00A0;at</span><span 
+class="cmtt-10">&#x00A0;scalar</span>
+<br class="fancyvrb" /><a 
+ id="x1-110100r42"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;offset</span><span 
+class="cmtt-10">&#x00A0;[limit_residue_begin]+[partition_count]*[residue_partition_size]</span><span 
+class="cmtt-10">&#x00A0;using</span>
+<br class="fancyvrb" /><a 
+ id="x1-110102r43"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;codebook</span><span 
+class="cmtt-10">&#x00A0;number</span><span 
+class="cmtt-10">&#x00A0;[vqbook]</span><span 
+class="cmtt-10">&#x00A0;in</span><span 
+class="cmtt-10">&#x00A0;VQ</span><span 
+class="cmtt-10">&#x00A0;context</span>
+<br class="fancyvrb" /><a 
+ id="x1-110104r44"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;}</span>
+<br class="fancyvrb" /><a 
+ id="x1-110106r45"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;}</span>
+<br class="fancyvrb" /><a 
+ id="x1-110108r46"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-110110r47"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;20)</span><span 
+class="cmtt-10">&#x00A0;increment</span><span 
+class="cmtt-10">&#x00A0;[partition_count]</span><span 
+class="cmtt-10">&#x00A0;by</span><span 
+class="cmtt-10">&#x00A0;one</span>
+<br class="fancyvrb" /><a 
+ id="x1-110112r48"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-110114r49"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;}</span>
+<br class="fancyvrb" /><a 
+ id="x1-110116r50"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;}</span>
+<br class="fancyvrb" /><a 
+ id="x1-110118r51"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;}</span>
+<br class="fancyvrb" /><a 
+ id="x1-110120r52"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+                                                                                    
 
-            original residue vector: [ 0 1 2 3 4 5 6 7 ]
+                                                                                    
+<br class="fancyvrb" /><a 
+ id="x1-110122r53"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;21)</span><span 
+class="cmtt-10">&#x00A0;done</span>
+<br class="fancyvrb" /><a 
+ id="x1-110124r54"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+</div>
+<!--l. 341--><p class="noindent" >An end-of-packet condition during packet decode is to be considered a nominal occurrence. Decode
+returns the result of vector decode up to that point.
+<!--l. 347--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">8.6.3 </span> <a 
+ id="x1-1110008.6.3"></a>format 0 specifics</h5>
+<!--l. 349--><p class="noindent" >Format zero decodes partitions exactly as described earlier in the &#8217;Residue Format: residue 0&#8217;
+section. The following pseudocode presents the same algorithm. Assume:
+     <ul class="itemize1">
+     <li class="itemize"><span 
+class="cmtt-10x-x-109">[n] </span>is the value in <span 
+class="cmtt-10x-x-109">[residue_partition_size]</span>
+     </li>
+     <li class="itemize"><span 
+class="cmtt-10x-x-109">[v] </span>is the residue vector
+     </li>
+     <li class="itemize"><span 
+class="cmtt-10x-x-109">[offset] </span>is the beginning read offset in [v]</li></ul>
+<!--l. 360--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb41">
+<a 
+ id="x1-111002r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1)</span><span 
+class="cmtt-10">&#x00A0;[step]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[n]</span><span 
+class="cmtt-10">&#x00A0;/</span><span 
+class="cmtt-10">&#x00A0;[codebook_dimensions]</span>
+<br class="fancyvrb" /><a 
+ id="x1-111004r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2)</span><span 
+class="cmtt-10">&#x00A0;iterate</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;over</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;range</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;...</span><span 
+class="cmtt-10">&#x00A0;[step]-1</span><span 
+class="cmtt-10">&#x00A0;{</span>
+<br class="fancyvrb" /><a 
+ id="x1-111006r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-111008r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;3)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[entry_temp]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;from</span><span 
+class="cmtt-10">&#x00A0;packet</span><span 
+class="cmtt-10">&#x00A0;using</span><span 
+class="cmtt-10">&#x00A0;current</span><span 
+class="cmtt-10">&#x00A0;codebook</span><span 
+class="cmtt-10">&#x00A0;in</span><span 
+class="cmtt-10">&#x00A0;VQ</span><span 
+class="cmtt-10">&#x00A0;context</span>
+<br class="fancyvrb" /><a 
+ id="x1-111010r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;4)</span><span 
+class="cmtt-10">&#x00A0;iterate</span><span 
+class="cmtt-10">&#x00A0;[j]</span><span 
+class="cmtt-10">&#x00A0;over</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;range</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;...</span><span 
+class="cmtt-10">&#x00A0;[codebook_dimensions]-1</span><span 
+class="cmtt-10">&#x00A0;{</span>
+<br class="fancyvrb" /><a 
+ id="x1-111012r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-111014r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;5)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[v]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;([offset]+[i]+[j]*[step])</span><span 
+class="cmtt-10">&#x00A0;=</span>
+<br class="fancyvrb" /><a 
+ id="x1-111016r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;    </span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[v]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;([offset]+[i]+[j]*[step])</span><span 
+class="cmtt-10">&#x00A0;+</span>
+<br class="fancyvrb" /><a 
+ id="x1-111018r9"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[entry_temp]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[j]</span>
+<br class="fancyvrb" /><a 
+ id="x1-111020r10"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-111022r11"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;}</span>
+<br class="fancyvrb" /><a 
+ id="x1-111024r12"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-111026r13"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;}</span>
+<br class="fancyvrb" /><a 
+ id="x1-111028r14"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-111030r15"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;6)</span><span 
+class="cmtt-10">&#x00A0;done</span>
+<br class="fancyvrb" /><a 
+ id="x1-111032r16"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+</div>
+                                                                                    
 
-codebook dimensions = 8  encoded as: [ 0 1 2 3 4 5 6 7 ]
+                                                                                    
+<!--l. 381--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">8.6.4 </span> <a 
+ id="x1-1120008.6.4"></a>format 1 specifics</h5>
+<!--l. 383--><p class="noindent" >Format 1 decodes partitions exactly as described earlier in the &#8217;Residue Format: residue 1&#8217; section.
+The following pseudocode presents the same algorithm. Assume:
+     <ul class="itemize1">
+     <li class="itemize"><span 
+class="cmtt-10x-x-109">[n] </span>is the value in <span 
+class="cmtt-10x-x-109">[residue_partition_size]</span>
+     </li>
+     <li class="itemize"><span 
+class="cmtt-10x-x-109">[v] </span>is the residue vector
+     </li>
+     <li class="itemize"><span 
+class="cmtt-10x-x-109">[offset] </span>is the beginning read offset in [v]</li></ul>
+<!--l. 395--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb42">
+<a 
+ id="x1-112002r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1)</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;0</span>
+<br class="fancyvrb" /><a 
+ id="x1-112004r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[entry_temp]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;read</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;from</span><span 
+class="cmtt-10">&#x00A0;packet</span><span 
+class="cmtt-10">&#x00A0;using</span><span 
+class="cmtt-10">&#x00A0;current</span><span 
+class="cmtt-10">&#x00A0;codebook</span><span 
+class="cmtt-10">&#x00A0;in</span><span 
+class="cmtt-10">&#x00A0;VQ</span><span 
+class="cmtt-10">&#x00A0;context</span>
+<br class="fancyvrb" /><a 
+ id="x1-112006r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;3)</span><span 
+class="cmtt-10">&#x00A0;iterate</span><span 
+class="cmtt-10">&#x00A0;[j]</span><span 
+class="cmtt-10">&#x00A0;over</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;range</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;...</span><span 
+class="cmtt-10">&#x00A0;[codebook_dimensions]-1</span><span 
+class="cmtt-10">&#x00A0;{</span>
+<br class="fancyvrb" /><a 
+ id="x1-112008r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-112010r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;4)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[v]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;([offset]+[i])</span><span 
+class="cmtt-10">&#x00A0;=</span>
+<br class="fancyvrb" /><a 
+ id="x1-112012r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;    </span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[v]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;([offset]+[i])</span><span 
+class="cmtt-10">&#x00A0;+</span>
+<br class="fancyvrb" /><a 
+ id="x1-112014r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[entry_temp]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[j]</span>
+<br class="fancyvrb" /><a 
+ id="x1-112016r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;5)</span><span 
+class="cmtt-10">&#x00A0;increment</span><span 
+class="cmtt-10">&#x00A0;[i]</span>
+<br class="fancyvrb" /><a 
+ id="x1-112018r9"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-112020r10"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;}</span>
+<br class="fancyvrb" /><a 
+ id="x1-112022r11"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-112024r12"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;6)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;(</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;less</span><span 
+class="cmtt-10">&#x00A0;than</span><span 
+class="cmtt-10">&#x00A0;[n]</span><span 
+class="cmtt-10">&#x00A0;)</span><span 
+class="cmtt-10">&#x00A0;continue</span><span 
+class="cmtt-10">&#x00A0;at</span><span 
+class="cmtt-10">&#x00A0;step</span><span 
+class="cmtt-10">&#x00A0;2</span>
+<br class="fancyvrb" /><a 
+ id="x1-112026r13"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;7)</span><span 
+class="cmtt-10">&#x00A0;done</span>
+</div>
+<!--l. 413--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">8.6.5 </span> <a 
+ id="x1-1130008.6.5"></a>format 2 specifics</h5>
+<!--l. 415--><p class="noindent" >Format 2 is reducible to format 1. It may be implemented as an additional step prior to and an
+additional post-decode step after a normal format 1 decode.
+<!--l. 418--><p class="noindent" >Format 2 handles &#8217;do not decode&#8217; vectors differently than residue 0 or 1; if all vectors
+are marked &#8217;do not decode&#8217;, no decode occurrs. However, if at least one vector is to be
+decoded, all the vectors are decoded. We then request normal format 1 to decode a single
+vector representing all output channels, rather than a vector for each channel. After
+decode, deinterleave the vector into independent vectors, one for each output channel. That
+is:
+                                                                                    
 
-codebook dimensions = 4  encoded as: [ 0 2 4 6 ], [ 1 3 5 7 ]
+                                                                                    
+<!--l. 426--><p class="noindent" >
+     <ol  class="enumerate1" >
+     <li 
+  class="enumerate" id="x1-113002x1">If all vectors 0 through <span 
+class="cmti-10x-x-109">ch</span>-1 are marked &#8217;do not decode&#8217;, allocate and clear a single
+     vector <span 
+class="cmtt-10x-x-109">[v]</span>of length <span 
+class="cmti-10x-x-109">ch*n </span>and skip step 2 below; proceed directly to the post-decode
+     step.
+     </li>
+     <li 
+  class="enumerate" id="x1-113004x2">Rather than performing format 1 decode to produce <span 
+class="cmti-10x-x-109">ch </span>vectors of length <span 
+class="cmti-10x-x-109">n </span>each, call
+     format 1 decode to produce a single vector <span 
+class="cmtt-10x-x-109">[v] </span>of length <span 
+class="cmti-10x-x-109">ch*n</span>.
+     </li>
+     <li 
+  class="enumerate" id="x1-113006x3">Post decode: Deinterleave the single vector <span 
+class="cmtt-10x-x-109">[v] </span>returned by format 1 decode as
+     described above into <span 
+class="cmti-10x-x-109">ch </span>independent vectors, one for each outputchannel, according
+     to:
+     <div class="fancyvrb" id="fancyvrb43">
+<a 
+ id="x1-113008r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1)</span><span 
+class="cmtt-10">&#x00A0;iterate</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;over</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;range</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;...</span><span 
+class="cmtt-10">&#x00A0;[n]-1</span><span 
+class="cmtt-10">&#x00A0;{</span>
+<br class="fancyvrb" /><a 
+ id="x1-113010r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-113012r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2)</span><span 
+class="cmtt-10">&#x00A0;iterate</span><span 
+class="cmtt-10">&#x00A0;[j]</span><span 
+class="cmtt-10">&#x00A0;over</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;range</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;...</span><span 
+class="cmtt-10">&#x00A0;[ch]-1</span><span 
+class="cmtt-10">&#x00A0;{</span>
+<br class="fancyvrb" /><a 
+ id="x1-113014r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-113016r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;3)</span><span 
+class="cmtt-10">&#x00A0;output</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;number</span><span 
+class="cmtt-10">&#x00A0;[j]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[i]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[v]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;([i]</span><span 
+class="cmtt-10">&#x00A0;*</span><span 
+class="cmtt-10">&#x00A0;[ch]</span><span 
+class="cmtt-10">&#x00A0;+</span><span 
+class="cmtt-10">&#x00A0;[j])</span>
+<br class="fancyvrb" /><a 
+ id="x1-113018r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-113020r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;}</span>
+<br class="fancyvrb" /><a 
+ id="x1-113022r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;}</span>
+<br class="fancyvrb" /><a 
+ id="x1-113024r9"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-113026r10"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;4)</span><span 
+class="cmtt-10">&#x00A0;done</span>
+</div>
+     </li></ol>
+                                                                                    
 
-codebook dimensions = 2  encoded as: [ 0 4 ], [ 1 5 ], [ 2 6 ], [ 3 7 ]
+                                                                                    
+                                                                                    
 
-codebook dimensions = 1  encoded as: [ 0 ], [ 1 ], [ 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ]
+                                                                                    
+<h3 class="sectionHead"><span class="titlemark">9 </span> <a 
+ id="x1-1140009"></a>Helper equations</h3>
+<!--l. 6--><p class="noindent" >
+<h4 class="subsectionHead"><span class="titlemark">9.1 </span> <a 
+ id="x1-1150009.1"></a>Overview</h4>
+<!--l. 8--><p class="noindent" >The equations below are used in multiple places by the Vorbis codec specification. Rather than
+cluttering up the main specification documents, they are defined here and referenced where
+appropriate.
+<!--l. 13--><p class="noindent" >
+<h4 class="subsectionHead"><span class="titlemark">9.2 </span> <a 
+ id="x1-1160009.2"></a>Functions</h4>
+<!--l. 15--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">9.2.1 </span> <a 
+ id="x1-1170009.2.1"></a>ilog</h5>
+<!--l. 17--><p class="noindent" >The &#8221;ilog(x)&#8221; function returns the position number (1 through n) of the highest set bit in the
+two&#8217;s complement integer value <span 
+class="cmtt-10x-x-109">[x]</span>. Values of <span 
+class="cmtt-10x-x-109">[x] </span>less than zero are defined to return
+zero.
+<!--l. 20--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb44">
+<a 
+ id="x1-117002r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1)</span><span 
+class="cmtt-10">&#x00A0;[return_value]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-117004r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;(</span><span 
+class="cmtt-10">&#x00A0;[x]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;greater</span><span 
+class="cmtt-10">&#x00A0;than</span><span 
+class="cmtt-10">&#x00A0;zero</span><span 
+class="cmtt-10">&#x00A0;)</span><span 
+class="cmtt-10">&#x00A0;{</span>
+<br class="fancyvrb" /><a 
+ id="x1-117006r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-117008r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;3)</span><span 
+class="cmtt-10">&#x00A0;increment</span><span 
+class="cmtt-10">&#x00A0;[return_value];</span>
+<br class="fancyvrb" /><a 
+ id="x1-117010r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;4)</span><span 
+class="cmtt-10">&#x00A0;logical</span><span 
+class="cmtt-10">&#x00A0;shift</span><span 
+class="cmtt-10">&#x00A0;[x]</span><span 
+class="cmtt-10">&#x00A0;one</span><span 
+class="cmtt-10">&#x00A0;bit</span><span 
+class="cmtt-10">&#x00A0;to</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;right,</span><span 
+class="cmtt-10">&#x00A0;padding</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;MSb</span><span 
+class="cmtt-10">&#x00A0;with</span><span 
+class="cmtt-10">&#x00A0;zero</span>
+<br class="fancyvrb" /><a 
+ id="x1-117012r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;5)</span><span 
+class="cmtt-10">&#x00A0;repeat</span><span 
+class="cmtt-10">&#x00A0;at</span><span 
+class="cmtt-10">&#x00A0;step</span><span 
+class="cmtt-10">&#x00A0;2)</span>
+<br class="fancyvrb" /><a 
+ id="x1-117014r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-117016r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;}</span>
+<br class="fancyvrb" /><a 
+ id="x1-117018r9"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-117020r10"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;6)</span><span 
+class="cmtt-10">&#x00A0;done</span>
+</div>
+<!--l. 33--><p class="noindent" >Examples:
+                                                                                    
 
-</pre><p>
-It is worth mentioning at this point that no configurable value in the
-residue coding setup is restricted to a power of two.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id343071"></a>8.4. residue 1</h3></div></div></div><p>
-Residue 1 does not interleave VQ encoding.  It represents partition
-vector scalars in order.  As with residue 0, however, partition length
-must be an integer multiple of the codebook dimension, although
-dimension may vary from pass to pass.</p><p>
-As an example, assume a partition vector of size eight, to be encoded
-by residue 0 using codebook sizes of 8, 4, 2 and 1:</p><pre class="programlisting">
+                                                                                    
+     <ul class="itemize1">
+     <li class="itemize">ilog(0) = 0;
+     </li>
+     <li class="itemize">ilog(1) = 1;
+     </li>
+     <li class="itemize">ilog(2) = 2;
+     </li>
+     <li class="itemize">ilog(3) = 2;
+     </li>
+     <li class="itemize">ilog(4) = 3;
+     </li>
+     <li class="itemize">ilog(7) = 3;
+     </li>
+     <li class="itemize">ilog(negative number) = 0;</li></ul>
+<!--l. 48--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">9.2.2 </span> <a 
+ id="x1-1180009.2.2"></a>float32&#x02D9;unpack</h5>
+<!--l. 50--><p class="noindent" >&#8221;float32&#x02D9;unpack(x)&#8221; is intended to translate the packed binary representation of a Vorbis codebook
+float value into the representation used by the decoder for floating point numbers. For
+purposes of this example, we will unpack a Vorbis float32 into a host-native floating point
+number.
+<!--l. 56--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb45">
+<a 
+ id="x1-118002r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1)</span><span 
+class="cmtt-10">&#x00A0;[mantissa]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[x]</span><span 
+class="cmtt-10">&#x00A0;bitwise</span><span 
+class="cmtt-10">&#x00A0;AND</span><span 
+class="cmtt-10">&#x00A0;0x1fffff</span><span 
+class="cmtt-10">&#x00A0;(unsigned</span><span 
+class="cmtt-10">&#x00A0;result)</span>
+<br class="fancyvrb" /><a 
+ id="x1-118004r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2)</span><span 
+class="cmtt-10">&#x00A0;[sign]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[x]</span><span 
+class="cmtt-10">&#x00A0;bitwise</span><span 
+class="cmtt-10">&#x00A0;AND</span><span 
+class="cmtt-10">&#x00A0;0x80000000</span><span 
+class="cmtt-10">&#x00A0;(unsigned</span><span 
+class="cmtt-10">&#x00A0;result)</span>
+<br class="fancyvrb" /><a 
+ id="x1-118006r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;3)</span><span 
+class="cmtt-10">&#x00A0;[exponent]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;(</span><span 
+class="cmtt-10">&#x00A0;[x]</span><span 
+class="cmtt-10">&#x00A0;bitwise</span><span 
+class="cmtt-10">&#x00A0;AND</span><span 
+class="cmtt-10">&#x00A0;0x7fe00000)</span><span 
+class="cmtt-10">&#x00A0;shifted</span><span 
+class="cmtt-10">&#x00A0;right</span><span 
+class="cmtt-10">&#x00A0;21</span><span 
+class="cmtt-10">&#x00A0;bits</span><span 
+class="cmtt-10">&#x00A0;(unsigned</span><span 
+class="cmtt-10">&#x00A0;result)</span>
+<br class="fancyvrb" /><a 
+ id="x1-118008r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;4)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;(</span><span 
+class="cmtt-10">&#x00A0;[sign]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;nonzero</span><span 
+class="cmtt-10">&#x00A0;)</span><span 
+class="cmtt-10">&#x00A0;then</span><span 
+class="cmtt-10">&#x00A0;negate</span><span 
+class="cmtt-10">&#x00A0;[mantissa]</span>
+<br class="fancyvrb" /><a 
+ id="x1-118010r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;5)</span><span 
+class="cmtt-10">&#x00A0;return</span><span 
+class="cmtt-10">&#x00A0;[mantissa]</span><span 
+class="cmtt-10">&#x00A0;*</span><span 
+class="cmtt-10">&#x00A0;(</span><span 
+class="cmtt-10">&#x00A0;2</span><span 
+class="cmtt-10">&#x00A0;^</span><span 
+class="cmtt-10">&#x00A0;(</span><span 
+class="cmtt-10">&#x00A0;[exponent]</span><span 
+class="cmtt-10">&#x00A0;-</span><span 
+class="cmtt-10">&#x00A0;788</span><span 
+class="cmtt-10">&#x00A0;)</span><span 
+class="cmtt-10">&#x00A0;)</span>
+</div>
+<!--l. 66--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">9.2.3 </span> <a 
+ id="x1-1190009.2.3"></a>lookup1&#x02D9;values</h5>
+<!--l. 68--><p class="noindent" >&#8221;lookup1&#x02D9;values(codebook&#x02D9;entries,codebook&#x02D9;dimensions)&#8221; is used to compute the correct length of
+the value index for a codebook VQ lookup table of lookup type 1. The values on this list are
+                                                                                    
 
-            original residue vector: [ 0 1 2 3 4 5 6 7 ]
+                                                                                    
+permuted to construct the VQ vector lookup table of size <span 
+class="cmtt-10x-x-109">[codebook_entries]</span>.
+<!--l. 74--><p class="noindent" >The return value for this function is defined to be &#8217;the greatest integer value for which
+<span 
+class="cmtt-10x-x-109">[return_value] </span>to the power of <span 
+class="cmtt-10x-x-109">[codebook_dimensions] </span>is less than or equal to
+<span 
+class="cmtt-10x-x-109">[codebook_entries]</span>&#8217;.
+<!--l. 81--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">9.2.4 </span> <a 
+ id="x1-1200009.2.4"></a>low&#x02D9;neighbor</h5>
+<!--l. 83--><p class="noindent" >&#8221;low&#x02D9;neighbor(v,x)&#8221; finds the position <span 
+class="cmtt-10x-x-109">n </span>in vector <span 
+class="cmtt-10x-x-109">[v] </span>of the greatest value scalar element
+for which <span 
+class="cmtt-10x-x-109">n </span>is less than <span 
+class="cmtt-10x-x-109">[x] </span>and vector <span 
+class="cmtt-10x-x-109">[v] </span>element <span 
+class="cmtt-10x-x-109">n </span>is less than vector <span 
+class="cmtt-10x-x-109">[v] </span>element
+<span 
+class="cmtt-10x-x-109">[x]</span>.
+<!--l. 88--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">9.2.5 </span> <a 
+ id="x1-1210009.2.5"></a>high&#x02D9;neighbor</h5>
+<!--l. 90--><p class="noindent" >&#8221;high&#x02D9;neighbor(v,x)&#8221; finds the position <span 
+class="cmtt-10x-x-109">n </span>in vector [v] of the lowest value scalar element for
+which <span 
+class="cmtt-10x-x-109">n </span>is less than <span 
+class="cmtt-10x-x-109">[x] </span>and vector <span 
+class="cmtt-10x-x-109">[v] </span>element <span 
+class="cmtt-10x-x-109">n </span>is greater than vector <span 
+class="cmtt-10x-x-109">[v] </span>element
+<span 
+class="cmtt-10x-x-109">[x]</span>.
+<!--l. 97--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">9.2.6 </span> <a 
+ id="x1-1220009.2.6"></a>render&#x02D9;point</h5>
+<!--l. 99--><p class="noindent" >&#8221;render&#x02D9;point(x0,y0,x1,y1,X)&#8221; is used to find the Y value at point X along the line specified by x0,
+x1, y0 and y1. This function uses an integer algorithm to solve for the point directly without
+calculating intervening values along the line.
+<!--l. 104--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb46">
+<a 
+ id="x1-122002r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1)</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;[dy]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[y1]</span><span 
+class="cmtt-10">&#x00A0;-</span><span 
+class="cmtt-10">&#x00A0;[y0]</span>
+<br class="fancyvrb" /><a 
+ id="x1-122004r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2)</span><span 
+class="cmtt-10">&#x00A0;[adx]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[x1]</span><span 
+class="cmtt-10">&#x00A0;-</span><span 
+class="cmtt-10">&#x00A0;[x0]</span>
+<br class="fancyvrb" /><a 
+ id="x1-122006r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;3)</span><span 
+class="cmtt-10">&#x00A0;[ady]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;absolute</span><span 
+class="cmtt-10">&#x00A0;value</span><span 
+class="cmtt-10">&#x00A0;of</span><span 
+class="cmtt-10">&#x00A0;[dy]</span>
+<br class="fancyvrb" /><a 
+ id="x1-122008r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;4)</span><span 
+class="cmtt-10">&#x00A0;[err]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[ady]</span><span 
+class="cmtt-10">&#x00A0;*</span><span 
+class="cmtt-10">&#x00A0;([X]</span><span 
+class="cmtt-10">&#x00A0;-</span><span 
+class="cmtt-10">&#x00A0;[x0])</span>
+<br class="fancyvrb" /><a 
+ id="x1-122010r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;5)</span><span 
+class="cmtt-10">&#x00A0;[off]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[err]</span><span 
+class="cmtt-10">&#x00A0;/</span><span 
+class="cmtt-10">&#x00A0;[adx]</span><span 
+class="cmtt-10">&#x00A0;using</span><span 
+class="cmtt-10">&#x00A0;integer</span><span 
+class="cmtt-10">&#x00A0;division</span>
+<br class="fancyvrb" /><a 
+ id="x1-122012r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;6)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;(</span><span 
+class="cmtt-10">&#x00A0;[dy]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;less</span><span 
+class="cmtt-10">&#x00A0;than</span><span 
+class="cmtt-10">&#x00A0;zero</span><span 
+class="cmtt-10">&#x00A0;)</span><span 
+class="cmtt-10">&#x00A0;{</span>
+<br class="fancyvrb" /><a 
+ id="x1-122014r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-122016r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;7)</span><span 
+class="cmtt-10">&#x00A0;[Y]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[y0]</span><span 
+class="cmtt-10">&#x00A0;-</span><span 
+class="cmtt-10">&#x00A0;[off]</span>
+<br class="fancyvrb" /><a 
+ id="x1-122018r9"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+                                                                                    
 
-codebook dimensions = 8  encoded as: [ 0 1 2 3 4 5 6 7 ]
+                                                                                    
+<br class="fancyvrb" /><a 
+ id="x1-122020r10"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;}</span><span 
+class="cmtt-10">&#x00A0;else</span><span 
+class="cmtt-10">&#x00A0;{</span>
+<br class="fancyvrb" /><a 
+ id="x1-122022r11"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-122024r12"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;8)</span><span 
+class="cmtt-10">&#x00A0;[Y]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[y0]</span><span 
+class="cmtt-10">&#x00A0;+</span><span 
+class="cmtt-10">&#x00A0;[off]</span>
+<br class="fancyvrb" /><a 
+ id="x1-122026r13"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-122028r14"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;}</span>
+<br class="fancyvrb" /><a 
+ id="x1-122030r15"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-122032r16"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;9)</span><span 
+class="cmtt-10">&#x00A0;done</span>
+</div>
+<!--l. 125--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">9.2.7 </span> <a 
+ id="x1-1230009.2.7"></a>render&#x02D9;line</h5>
+<!--l. 127--><p class="noindent" >Floor decode type one uses the integer line drawing algorithm of &#8221;render&#x02D9;line(x0, y0, x1, y1, v)&#8221; to
+construct an integer floor curve for contiguous piecewise line segments. Note that it has not been
+relevant elsewhere, but here we must define integer division as rounding division of both positive
+and negative numbers toward zero.
+<!--l. 134--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb47">
+<a 
+ id="x1-123002r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1)</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;[dy]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[y1]</span><span 
+class="cmtt-10">&#x00A0;-</span><span 
+class="cmtt-10">&#x00A0;[y0]</span>
+<br class="fancyvrb" /><a 
+ id="x1-123004r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2)</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;[adx]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[x1]</span><span 
+class="cmtt-10">&#x00A0;-</span><span 
+class="cmtt-10">&#x00A0;[x0]</span>
+<br class="fancyvrb" /><a 
+ id="x1-123006r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;3)</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;[ady]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;absolute</span><span 
+class="cmtt-10">&#x00A0;value</span><span 
+class="cmtt-10">&#x00A0;of</span><span 
+class="cmtt-10">&#x00A0;[dy]</span>
+<br class="fancyvrb" /><a 
+ id="x1-123008r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;4)</span><span 
+class="cmtt-10">&#x00A0;[base]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[dy]</span><span 
+class="cmtt-10">&#x00A0;/</span><span 
+class="cmtt-10">&#x00A0;[adx]</span><span 
+class="cmtt-10">&#x00A0;using</span><span 
+class="cmtt-10">&#x00A0;integer</span><span 
+class="cmtt-10">&#x00A0;division</span>
+<br class="fancyvrb" /><a 
+ id="x1-123010r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;5)</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;[x]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[x0]</span>
+<br class="fancyvrb" /><a 
+ id="x1-123012r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;6)</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;[y]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[y0]</span>
+<br class="fancyvrb" /><a 
+ id="x1-123014r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;7)</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;[err]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;0</span>
+<br class="fancyvrb" /><a 
+ id="x1-123016r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-123018r9"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;8)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;(</span><span 
+class="cmtt-10">&#x00A0;[dy]</span><span 
+class="cmtt-10">&#x00A0;is</span><span 
+class="cmtt-10">&#x00A0;less</span><span 
+class="cmtt-10">&#x00A0;than</span><span 
+class="cmtt-10">&#x00A0;0</span><span 
+class="cmtt-10">&#x00A0;)</span><span 
+class="cmtt-10">&#x00A0;{</span>
+<br class="fancyvrb" /><a 
+ id="x1-123020r10"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-123022r11"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;9)</span><span 
+class="cmtt-10">&#x00A0;[sy]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[base]</span><span 
+class="cmtt-10">&#x00A0;-</span><span 
+class="cmtt-10">&#x00A0;1</span>
+<br class="fancyvrb" /><a 
+ id="x1-123024r12"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-123026r13"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;}</span><span 
+class="cmtt-10">&#x00A0;else</span><span 
+class="cmtt-10">&#x00A0;{</span>
+<br class="fancyvrb" /><a 
+ id="x1-123028r14"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-123030r15"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;10)</span><span 
+class="cmtt-10">&#x00A0;[sy]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[base]</span><span 
+class="cmtt-10">&#x00A0;+</span><span 
+class="cmtt-10">&#x00A0;1</span>
+<br class="fancyvrb" /><a 
+ id="x1-123032r16"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-123034r17"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;}</span>
+<br class="fancyvrb" /><a 
+ id="x1-123036r18"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-123038r19"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;11)</span><span 
+class="cmtt-10">&#x00A0;[ady]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[ady]</span><span 
+class="cmtt-10">&#x00A0;-</span><span 
+class="cmtt-10">&#x00A0;(absolute</span><span 
+class="cmtt-10">&#x00A0;value</span><span 
+class="cmtt-10">&#x00A0;of</span><span 
+class="cmtt-10">&#x00A0;[base])</span><span 
+class="cmtt-10">&#x00A0;*</span><span 
+class="cmtt-10">&#x00A0;[adx]</span>
+<br class="fancyvrb" /><a 
+ id="x1-123040r20"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;12)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[v]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[x]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[y]</span>
+<br class="fancyvrb" /><a 
+ id="x1-123042r21"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-123044r22"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;13)</span><span 
+class="cmtt-10">&#x00A0;iterate</span><span 
+class="cmtt-10">&#x00A0;[x]</span><span 
+class="cmtt-10">&#x00A0;over</span><span 
+class="cmtt-10">&#x00A0;the</span><span 
+class="cmtt-10">&#x00A0;range</span><span 
+class="cmtt-10">&#x00A0;[x0]+1</span><span 
+class="cmtt-10">&#x00A0;...</span><span 
+class="cmtt-10">&#x00A0;[x1]-1</span><span 
+class="cmtt-10">&#x00A0;{</span>
+<br class="fancyvrb" /><a 
+ id="x1-123046r23"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-123048r24"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;14)</span><span 
+class="cmtt-10">&#x00A0;[err]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[err]</span><span 
+class="cmtt-10">&#x00A0;+</span><span 
+class="cmtt-10">&#x00A0;[ady];</span>
+<br class="fancyvrb" /><a 
+ id="x1-123050r25"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;15)</span><span 
+class="cmtt-10">&#x00A0;if</span><span 
+class="cmtt-10">&#x00A0;(</span><span 
+class="cmtt-10">&#x00A0;[err]</span><span 
+class="cmtt-10">&#x00A0;&#x003E;=</span><span 
+class="cmtt-10">&#x00A0;[adx]</span><span 
+class="cmtt-10">&#x00A0;)</span><span 
+class="cmtt-10">&#x00A0;{</span>
+<br class="fancyvrb" /><a 
+ id="x1-123052r26"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-123054r27"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;16)</span><span 
+class="cmtt-10">&#x00A0;[err]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[err]</span><span 
+class="cmtt-10">&#x00A0;-</span><span 
+class="cmtt-10">&#x00A0;[adx]</span>
+<br class="fancyvrb" /><a 
+ id="x1-123056r28"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;17)</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;[y]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[y]</span><span 
+class="cmtt-10">&#x00A0;+</span><span 
+class="cmtt-10">&#x00A0;[sy]</span>
+                                                                                    
 
-codebook dimensions = 4  encoded as: [ 0 1 2 3 ], [ 4 5 6 7 ]
+                                                                                    
+<br class="fancyvrb" /><a 
+ id="x1-123058r29"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-123060r30"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;}</span><span 
+class="cmtt-10">&#x00A0;else</span><span 
+class="cmtt-10">&#x00A0;{</span>
+<br class="fancyvrb" /><a 
+ id="x1-123062r31"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-123064r32"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;18)</span><span 
+class="cmtt-10">&#x00A0;[y]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[y]</span><span 
+class="cmtt-10">&#x00A0;+</span><span 
+class="cmtt-10">&#x00A0;[base]</span>
+<br class="fancyvrb" /><a 
+ id="x1-123066r33"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-123068r34"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;}</span>
+<br class="fancyvrb" /><a 
+ id="x1-123070r35"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-123072r36"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;19)</span><span 
+class="cmtt-10">&#x00A0;vector</span><span 
+class="cmtt-10">&#x00A0;[v]</span><span 
+class="cmtt-10">&#x00A0;element</span><span 
+class="cmtt-10">&#x00A0;[x]</span><span 
+class="cmtt-10">&#x00A0;=</span><span 
+class="cmtt-10">&#x00A0;[y]</span>
+<br class="fancyvrb" /><a 
+ id="x1-123074r37"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span>
+<br class="fancyvrb" /><a 
+ id="x1-123076r38"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;}</span>
+</div>
+                                                                                    
 
-codebook dimensions = 2  encoded as: [ 0 1 ], [ 2 3 ], [ 4 5 ], [ 6 7 ]
+                                                                                    
+                                                                                    
 
-codebook dimensions = 1  encoded as: [ 0 ], [ 1 ], [ 2 ], [ 3 ], [ 4 ], [ 5 ], [ 6 ], [ 7 ]
+                                                                                    
+<h3 class="sectionHead"><span class="titlemark">10 </span> <a 
+ id="x1-12400010"></a>Tables</h3>
+<!--l. 6--><p class="noindent" >
+<h4 class="subsectionHead"><span class="titlemark">10.1 </span> <a 
+ id="x1-12500010.1"></a>floor1_inverse_dB_table</h4>
+<!--l. 8--><p class="noindent" >The vector <span 
+class="cmtt-10x-x-109">[floor1_inverse_dB_table] </span>is a 256 element static lookup table consiting of the
+following values (read left to right then top to bottom):
+<!--l. 12--><p class="noindent" >
+<div class="fancyvrb" id="fancyvrb48">
+<a 
+ id="x1-125002r1"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1.0649863e-07,</span><span 
+class="cmtt-10">&#x00A0;1.1341951e-07,</span><span 
+class="cmtt-10">&#x00A0;1.2079015e-07,</span><span 
+class="cmtt-10">&#x00A0;1.2863978e-07,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125004r2"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1.3699951e-07,</span><span 
+class="cmtt-10">&#x00A0;1.4590251e-07,</span><span 
+class="cmtt-10">&#x00A0;1.5538408e-07,</span><span 
+class="cmtt-10">&#x00A0;1.6548181e-07,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125006r3"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1.7623575e-07,</span><span 
+class="cmtt-10">&#x00A0;1.8768855e-07,</span><span 
+class="cmtt-10">&#x00A0;1.9988561e-07,</span><span 
+class="cmtt-10">&#x00A0;2.1287530e-07,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125008r4"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2.2670913e-07,</span><span 
+class="cmtt-10">&#x00A0;2.4144197e-07,</span><span 
+class="cmtt-10">&#x00A0;2.5713223e-07,</span><span 
+class="cmtt-10">&#x00A0;2.7384213e-07,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125010r5"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2.9163793e-07,</span><span 
+class="cmtt-10">&#x00A0;3.1059021e-07,</span><span 
+class="cmtt-10">&#x00A0;3.3077411e-07,</span><span 
+class="cmtt-10">&#x00A0;3.5226968e-07,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125012r6"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;3.7516214e-07,</span><span 
+class="cmtt-10">&#x00A0;3.9954229e-07,</span><span 
+class="cmtt-10">&#x00A0;4.2550680e-07,</span><span 
+class="cmtt-10">&#x00A0;4.5315863e-07,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125014r7"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;4.8260743e-07,</span><span 
+class="cmtt-10">&#x00A0;5.1396998e-07,</span><span 
+class="cmtt-10">&#x00A0;5.4737065e-07,</span><span 
+class="cmtt-10">&#x00A0;5.8294187e-07,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125016r8"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;6.2082472e-07,</span><span 
+class="cmtt-10">&#x00A0;6.6116941e-07,</span><span 
+class="cmtt-10">&#x00A0;7.0413592e-07,</span><span 
+class="cmtt-10">&#x00A0;7.4989464e-07,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125018r9"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;7.9862701e-07,</span><span 
+class="cmtt-10">&#x00A0;8.5052630e-07,</span><span 
+class="cmtt-10">&#x00A0;9.0579828e-07,</span><span 
+class="cmtt-10">&#x00A0;9.6466216e-07,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125020r10"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1.0273513e-06,</span><span 
+class="cmtt-10">&#x00A0;1.0941144e-06,</span><span 
+class="cmtt-10">&#x00A0;1.1652161e-06,</span><span 
+class="cmtt-10">&#x00A0;1.2409384e-06,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125022r11"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1.3215816e-06,</span><span 
+class="cmtt-10">&#x00A0;1.4074654e-06,</span><span 
+class="cmtt-10">&#x00A0;1.4989305e-06,</span><span 
+class="cmtt-10">&#x00A0;1.5963394e-06,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125024r12"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1.7000785e-06,</span><span 
+class="cmtt-10">&#x00A0;1.8105592e-06,</span><span 
+class="cmtt-10">&#x00A0;1.9282195e-06,</span><span 
+class="cmtt-10">&#x00A0;2.0535261e-06,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125026r13"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2.1869758e-06,</span><span 
+class="cmtt-10">&#x00A0;2.3290978e-06,</span><span 
+class="cmtt-10">&#x00A0;2.4804557e-06,</span><span 
+class="cmtt-10">&#x00A0;2.6416497e-06,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125028r14"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2.8133190e-06,</span><span 
+class="cmtt-10">&#x00A0;2.9961443e-06,</span><span 
+class="cmtt-10">&#x00A0;3.1908506e-06,</span><span 
+class="cmtt-10">&#x00A0;3.3982101e-06,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125030r15"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;3.6190449e-06,</span><span 
+class="cmtt-10">&#x00A0;3.8542308e-06,</span><span 
+class="cmtt-10">&#x00A0;4.1047004e-06,</span><span 
+class="cmtt-10">&#x00A0;4.3714470e-06,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125032r16"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;4.6555282e-06,</span><span 
+class="cmtt-10">&#x00A0;4.9580707e-06,</span><span 
+class="cmtt-10">&#x00A0;5.2802740e-06,</span><span 
+class="cmtt-10">&#x00A0;5.6234160e-06,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125034r17"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;5.9888572e-06,</span><span 
+class="cmtt-10">&#x00A0;6.3780469e-06,</span><span 
+class="cmtt-10">&#x00A0;6.7925283e-06,</span><span 
+class="cmtt-10">&#x00A0;7.2339451e-06,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125036r18"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;7.7040476e-06,</span><span 
+class="cmtt-10">&#x00A0;8.2047000e-06,</span><span 
+class="cmtt-10">&#x00A0;8.7378876e-06,</span><span 
+class="cmtt-10">&#x00A0;9.3057248e-06,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125038r19"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;9.9104632e-06,</span><span 
+class="cmtt-10">&#x00A0;1.0554501e-05,</span><span 
+class="cmtt-10">&#x00A0;1.1240392e-05,</span><span 
+class="cmtt-10">&#x00A0;1.1970856e-05,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125040r20"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1.2748789e-05,</span><span 
+class="cmtt-10">&#x00A0;1.3577278e-05,</span><span 
+class="cmtt-10">&#x00A0;1.4459606e-05,</span><span 
+class="cmtt-10">&#x00A0;1.5399272e-05,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125042r21"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1.6400004e-05,</span><span 
+class="cmtt-10">&#x00A0;1.7465768e-05,</span><span 
+class="cmtt-10">&#x00A0;1.8600792e-05,</span><span 
+class="cmtt-10">&#x00A0;1.9809576e-05,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125044r22"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2.1096914e-05,</span><span 
+class="cmtt-10">&#x00A0;2.2467911e-05,</span><span 
+class="cmtt-10">&#x00A0;2.3928002e-05,</span><span 
+class="cmtt-10">&#x00A0;2.5482978e-05,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125046r23"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;2.7139006e-05,</span><span 
+class="cmtt-10">&#x00A0;2.8902651e-05,</span><span 
+class="cmtt-10">&#x00A0;3.0780908e-05,</span><span 
+class="cmtt-10">&#x00A0;3.2781225e-05,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125048r24"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;3.4911534e-05,</span><span 
+class="cmtt-10">&#x00A0;3.7180282e-05,</span><span 
+class="cmtt-10">&#x00A0;3.9596466e-05,</span><span 
+class="cmtt-10">&#x00A0;4.2169667e-05,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125050r25"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;4.4910090e-05,</span><span 
+class="cmtt-10">&#x00A0;4.7828601e-05,</span><span 
+class="cmtt-10">&#x00A0;5.0936773e-05,</span><span 
+class="cmtt-10">&#x00A0;5.4246931e-05,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125052r26"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;5.7772202e-05,</span><span 
+class="cmtt-10">&#x00A0;6.1526565e-05,</span><span 
+class="cmtt-10">&#x00A0;6.5524908e-05,</span><span 
+class="cmtt-10">&#x00A0;6.9783085e-05,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125054r27"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;7.4317983e-05,</span><span 
+class="cmtt-10">&#x00A0;7.9147585e-05,</span><span 
+class="cmtt-10">&#x00A0;8.4291040e-05,</span><span 
+class="cmtt-10">&#x00A0;8.9768747e-05,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125056r28"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;9.5602426e-05,</span><span 
+class="cmtt-10">&#x00A0;0.00010181521,</span><span 
+class="cmtt-10">&#x00A0;0.00010843174,</span><span 
+class="cmtt-10">&#x00A0;0.00011547824,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125058r29"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.00012298267,</span><span 
+class="cmtt-10">&#x00A0;0.00013097477,</span><span 
+class="cmtt-10">&#x00A0;0.00013948625,</span><span 
+class="cmtt-10">&#x00A0;0.00014855085,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125060r30"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.00015820453,</span><span 
+class="cmtt-10">&#x00A0;0.00016848555,</span><span 
+class="cmtt-10">&#x00A0;0.00017943469,</span><span 
+class="cmtt-10">&#x00A0;0.00019109536,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125062r31"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.00020351382,</span><span 
+class="cmtt-10">&#x00A0;0.00021673929,</span><span 
+class="cmtt-10">&#x00A0;0.00023082423,</span><span 
+class="cmtt-10">&#x00A0;0.00024582449,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125064r32"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.00026179955,</span><span 
+class="cmtt-10">&#x00A0;0.00027881276,</span><span 
+class="cmtt-10">&#x00A0;0.00029693158,</span><span 
+class="cmtt-10">&#x00A0;0.00031622787,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125066r33"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.00033677814,</span><span 
+class="cmtt-10">&#x00A0;0.00035866388,</span><span 
+class="cmtt-10">&#x00A0;0.00038197188,</span><span 
+class="cmtt-10">&#x00A0;0.00040679456,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125068r34"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.00043323036,</span><span 
+class="cmtt-10">&#x00A0;0.00046138411,</span><span 
+class="cmtt-10">&#x00A0;0.00049136745,</span><span 
+class="cmtt-10">&#x00A0;0.00052329927,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125070r35"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.00055730621,</span><span 
+class="cmtt-10">&#x00A0;0.00059352311,</span><span 
+class="cmtt-10">&#x00A0;0.00063209358,</span><span 
+class="cmtt-10">&#x00A0;0.00067317058,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125072r36"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.00071691700,</span><span 
+class="cmtt-10">&#x00A0;0.00076350630,</span><span 
+class="cmtt-10">&#x00A0;0.00081312324,</span><span 
+class="cmtt-10">&#x00A0;0.00086596457,</span>
+                                                                                    
 
-</pre></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id343096"></a>8.5. residue 2</h3></div></div></div><p>
-Residue type two can be thought of as a variant of residue type 1.
-Rather than encoding multiple passed-in vectors as in residue type 1,
-the <span class="emphasis"><em>ch</em></span> passed in vectors of length <span class="emphasis"><em>n</em></span> are first
-interleaved and flattened into a single vector of length
-<span class="emphasis"><em>ch</em></span>*<span class="emphasis"><em>n</em></span>.  Encoding then proceeds as in type 1. Decoding is
-as in type 1 with decode interleave reversed. If operating on a single
-vector to begin with, residue type 1 and type 2 are equivalent.</p><div class="mediaobject"><img src="residue2.png" alt="[illustration of residue type 2]"></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id343145"></a>8.6. Residue decode</h3></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id343151"></a>8.6.1. header decode</h4></div></div></div><p>
-Header decode for all three residue types is identical.</p><pre class="programlisting">
-  1) [residue_begin] = read 24 bits as unsigned integer
-  2) [residue_end] = read 24 bits as unsigned integer
-  3) [residue_partition_size] = read 24 bits as unsigned integer and add one
-  4) [residue_classifications] = read 6 bits as unsigned integer and add one
-  5) [residue_classbook] = read 8 bits as unsigned integer
-</pre><p>
-<code class="varname">[residue_begin]</code> and
-<code class="varname">[residue_end]</code> select the specific sub-portion of
-each vector that is actually coded; it implements akin to a bandpass
-where, for coding purposes, the vector effectively begins at element
-<code class="varname">[residue_begin]</code> and ends at
-<code class="varname">[residue_end]</code>.  Preceding and following values in
-the unpacked vectors are zeroed.  Note that for residue type 2, these
-values as well as <code class="varname">[residue_partition_size]</code>apply to
-the interleaved vector, not the individual vectors before interleave.
-<code class="varname">[residue_partition_size]</code> is as explained above,
-<code class="varname">[residue_classifications]</code> is the number of possible
-classification to which a partition can belong and
-<code class="varname">[residue_classbook]</code> is the codebook number used to
-code classification codewords.  The number of dimensions in book
-<code class="varname">[residue_classbook]</code> determines how many
-classification values are grouped into a single classification
-codeword.  Note that the number of entries and dimensions in book
-<code class="varname">[residue_classbook]</code>, along with
-<code class="varname">[residue_classifications]</code>, overdetermines to
-possible number of classification codewords.  If
-<code class="varname">[residue_classifications]</code>^<code class="varname">[residue_classbook]</code>.dimensions
-does not equal <code class="varname">[residue_classbook]</code>.entries, the
-bitstream should be regarded to be undecodable. </p><p>
-Next we read a bitmap pattern that specifies which partition classes
-code values in which passes.</p><pre class="programlisting">
-  1) iterate [i] over the range 0 ... [residue_classifications]-1 {
-  
-       2) [high_bits] = 0
-       3) [low_bits] = read 3 bits as unsigned integer
-       4) [bitflag] = read one bit as boolean
-       5) if ( [bitflag] is set ) then [high_bits] = read five bits as unsigned integer
-       6) vector [residue_cascade] element [i] = [high_bits] * 8 + [low_bits]
-     }
-  7) done
-</pre><p>
-Finally, we read in a list of book numbers, each corresponding to
-specific bit set in the cascade bitmap.  We loop over the possible
-codebook classifications and the maximum possible number of encoding
-stages (8 in Vorbis I, as constrained by the elements of the cascade
-bitmap being eight bits):</p><pre class="programlisting">
-  1) iterate [i] over the range 0 ... [residue_classifications]-1 {
-  
-       2) iterate [j] over the range 0 ... 7 {
-  
-            3) if ( vector [residue_cascade] element [i] bit [j] is set ) {
+                                                                                    
+<br class="fancyvrb" /><a 
+ id="x1-125074r37"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.00092223983,</span><span 
+class="cmtt-10">&#x00A0;0.00098217216,</span><span 
+class="cmtt-10">&#x00A0;0.0010459992,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0011139742,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125076r38"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0011863665,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0012634633,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0013455702,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0014330129,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125078r39"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0015261382,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0016253153,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0017309374,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0018434235,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125080r40"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0019632195,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0020908006,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0022266726,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0023713743,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125082r41"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0025254795,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0026895994,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0028643847,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0030505286,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125084r42"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0032487691,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0034598925,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0036847358,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0039241906,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125086r43"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0041792066,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0044507950,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0047400328,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0050480668,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125088r44"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0053761186,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0057254891,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0060975636,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0064938176,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125090r45"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0069158225,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0073652516,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0078438871,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0083536271,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125092r46"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.0088964928,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.009474637,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.010090352,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.010746080,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125094r47"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.011444421,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.012188144,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.012980198,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.013823725,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125096r48"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.014722068,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.015678791,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.016697687,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.017782797,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125098r49"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.018938423,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.020169149,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.021479854,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.022875735,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125100r50"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.024362330,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.025945531,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.027631618,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.029427276,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125102r51"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.031339626,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.033376252,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.035545228,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.037855157,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125104r52"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.040315199,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.042935108,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.045725273,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.048696758,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125106r53"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.051861348,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.055231591,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.058820850,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.062643361,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125108r54"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.066714279,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.071049749,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.075666962,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.080584227,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125110r55"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.085821044,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.091398179,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.097337747,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.10366330,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125112r56"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.11039993,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.11757434,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.12521498,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.13335215,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125114r57"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.14201813,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.15124727,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.16107617,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.17154380,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125116r58"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.18269168,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.19456402,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.20720788,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.22067342,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125118r59"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.23501402,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.25028656,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.26655159,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.28387361,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125120r60"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.30232132,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.32196786,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.34289114,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.36517414,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125122r61"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.38890521,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.41417847,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.44109412,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.46975890,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125124r62"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.50028648,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.53279791,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.56742212,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.60429640,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125126r63"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.64356699,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.68538959,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.72993007,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.77736504,</span>
+<br class="fancyvrb" /><a 
+ id="x1-125128r64"></a><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.82788260,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.88168307,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;0.9389798,</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;</span><span 
+class="cmtt-10">&#x00A0;1.</span>
+</div>
+                                                                                    
 
-                 4) array [residue_books] element [i][j] = read 8 bits as unsigned integer
+                                                                                    
+                                                                                    
 
-               } else {
+                                                                                    
+<h3 class="sectionHead"><span class="titlemark">A </span> <a 
+ id="x1-126000A"></a>Embedding Vorbis into an Ogg stream</h3>
+<!--l. 6--><p class="noindent" >
+<h4 class="subsectionHead"><span class="titlemark">A.1 </span> <a 
+ id="x1-127000A.1"></a>Overview</h4>
+<!--l. 8--><p class="noindent" >This document describes using Ogg logical and physical transport streams to encapsulate Vorbis
+compressed audio packet data into file form.
+<!--l. 12--><p class="noindent" >The <a 
+href="#x1-20001">Section&#x00A0;1<!--tex4ht:ref: vorbis:spec:intro --></a>, &#8220;<a 
+href="#x1-20001">Introduction and Description<!--tex4ht:ref: vorbis:spec:intro --></a>&#8221; provides an overview of the construction of Vorbis
+audio packets.
+<!--l. 15--><p class="noindent" >The <a 
+href="oggstream.html" >Ogg bitstream overview</a> and <a 
+href="framing.html" >Ogg logical bitstream and framing spec</a> provide detailed
+descriptions of Ogg transport streams. This specification document assumes a working
+knowledge of the concepts covered in these named backround documents. Please read them
+first.
+<!--l. 22--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">A.1.1 </span> <a 
+ id="x1-128000A.1.1"></a>Restrictions</h5>
+<!--l. 24--><p class="noindent" >The Ogg/Vorbis I specification currently dictates that Ogg/Vorbis streams use Ogg transport
+streams in degenerate, unmultiplexed form only. That is:
+     <ul class="itemize1">
+     <li class="itemize">A meta-headerless Ogg file encapsulates the Vorbis I packets
+     </li>
+     <li class="itemize">The Ogg stream may be chained, i.e., contain multiple, contigous logical streams (links).
+     </li>
+     <li class="itemize">The Ogg stream must be unmultiplexed (only one stream, a Vorbis audio stream, per
+     link)
+     </li></ul>
+<!--l. 41--><p class="noindent" >This is not to say that it is not currently possible to multiplex Vorbis with other media types into a
+multi-stream Ogg file. At the time this document was written, Ogg was becoming a popular
+container for low-bitrate movies consisting of DivX video and Vorbis audio. However, a &#8217;Vorbis I
+audio file&#8217; is taken to imply Vorbis audio existing alone within a degenerate Ogg stream. A
+compliant &#8217;Vorbis audio player&#8217; is not required to implement Ogg support beyond the specific
+support of Vorbis within a degenrate Ogg stream (naturally, application authors are encouraged to
+support full multiplexed Ogg handling).
+                                                                                    
 
-                 5) array [residue_books] element [i][j] = unused
+                                                                                    
+<!--l. 55--><p class="noindent" >
+<h5 class="subsubsectionHead"><span class="titlemark">A.1.2 </span> <a 
+ id="x1-129000A.1.2"></a>MIME type</h5>
+<!--l. 57--><p class="noindent" >The MIME type of Ogg files depend on the context. Specifically, complex multimedia and
+applications should use <span 
+class="cmtt-10x-x-109">application/ogg</span>, while visual media should use <span 
+class="cmtt-10x-x-109">video/ogg</span>, and audio
+<span 
+class="cmtt-10x-x-109">audio/ogg</span>. Vorbis data encapsulated in Ogg may appear in any of those types. RTP encapsulated
+Vorbis should use <span 
+class="cmtt-10x-x-109">audio/vorbis </span>+ <span 
+class="cmtt-10x-x-109">audio/vorbis-config</span>.
+<!--l. 65--><p class="noindent" >
+<h4 class="subsectionHead"><span class="titlemark">A.2 </span> <a 
+ id="x1-130000A.2"></a>Encapsulation</h4>
+<!--l. 67--><p class="noindent" >Ogg encapsulation of a Vorbis packet stream is straightforward.
+     <ul class="itemize1">
+     <li class="itemize">The first Vorbis packet (the identification header), which uniquely identifies a stream
+     as Vorbis audio, is placed alone in the first page of the logical Ogg stream. This results
+     in a first Ogg page of exactly 58 bytes at the very beginning of the logical stream.
+     </li>
+     <li class="itemize">This first page is marked &#8217;beginning of stream&#8217; in the page flags.
+     </li>
+     <li class="itemize">The second and third vorbis packets (comment and setup headers) may span one or
+     more pages beginning on the second page of the logical stream. However many pages
+     they span, the third header packet finishes the page on which it ends. The next (first
+     audio) packet must begin on a fresh page.
+     </li>
+     <li class="itemize">The granule position of these first pages containing only headers is zero.
+     </li>
+     <li class="itemize">The first audio packet of the logical stream begins a fresh Ogg page.
+     </li>
+     <li class="itemize">Packets are placed into ogg pages in order until the end of stream.
+     </li>
+     <li class="itemize">The last page is marked &#8217;end of stream&#8217; in the page flags.
+     </li>
+     <li class="itemize">Vorbis packets may span page boundaries.
+                                                                                    
 
-               }
-          }
-      }
+                                                                                    
+     </li>
+     <li class="itemize">The granule position of pages containing Vorbis audio is in units of PCM audio samples
+     (per channel; a stereo stream&#8217;s granule position does not increment at twice the speed
+     of a mono stream).
+     </li>
+     <li class="itemize">The granule position of a page represents the end PCM sample position of the last
+     packet <span 
+class="cmti-10x-x-109">completed  </span>on that page. The &#8217;last PCM sample&#8217; is the last complete sample
+     returned by decode, not an internal sample awaiting lapping with a subsequent block. A
+     page that is entirely spanned by a single packet (that completes on a subsequent page)
+     has no granule position, and the granule position is set to &#8217;-1&#8217;.
+     <!--l. 126--><p class="noindent" >Note  that  the  last  decoded  (fully  lapped)  PCM  sample  from  a  packet  is  not
+     necessarily  the  middle  sample  from  that  block.  If,  eg,  the  current  Vorbis  packet
+     encodes a &#8221;long block&#8221; and the next Vorbis packet encodes a &#8221;short block&#8221;, the last
+     decodable sample from the current packet be at position (3*long_block_length/4) -
+     (short_block_length/4).
+     </li>
+     <li class="itemize">The granule (PCM) position of the first page need not indicate that the stream started
+     at position zero. Although the granule position belongs to the last completed packet
+     on the page and a valid granule position must be positive, by inference it may indicate
+     that the PCM position of the beginning of audio is positive or negative.
+          <ul class="itemize2">
+          <li class="itemize">A positive starting value simply indicates that this stream begins at some positive
+          time offset, potentially within a larger program. This is a common case when
+          connecting to the middle of broadcast stream.
+          </li>
+          <li class="itemize">A negative value indicates that output samples preceeding time zero should be
+          discarded  during  decoding;  this  technique  is  used  to  allow  sample-granularity
+          editing of the stream start time of already-encoded Vorbis streams. The number
+          of samples to be discarded must not exceed the overlap-add span of the first two
+          audio packets.
+          </li></ul>
+     <!--l. 161--><p class="noindent" >In both of these cases in which the initial audio PCM starting offset is nonzero, the second
+     finished audio packet must flush the page on which it appears and the third packet begin a
+     fresh page. This allows the decoder to always be able to perform PCM position adjustments
+     before needing to return any PCM data from synthesis, resulting in correct positioning
+     information without any aditional seeking logic.
+     <!--l. 170--><p class="noindent" ><span class="likesubparagraphHead"><a 
+ id="x1-131000A.2"></a><span 
+class="cmbx-10x-x-109">Note:</span></span> Failure to do so should, at worst, cause a decoder implementation to return incorrect
+     positioning information for seeking operations at the very beginning of the stream.
+                                                                                    
 
-  6) done
-</pre><p>
-An end-of-packet condition at any point in header decode renders the
-stream undecodable.  In addition, any codebook number greater than the
-maximum numbered codebook set up in this stream also renders the
-stream undecodable.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id304464"></a>8.6.2. packet decode</h4></div></div></div><p>
-Format 0 and 1 packet decode is identical except for specific
-partition interleave.  Format 2 packet decode can be built out of the
-format 1 decode process.  Thus we describe first the decode
-infrastructure identical to all three formats.</p><p>
-In addition to configuration information, the residue decode process
-is passed the number of vectors in the submap bundle and a vector of
-flags indicating if any of the vectors are not to be decoded.  If the
-passed in number of vectors is 3 and vector number 1 is marked 'do not
-decode', decode skips vector 1 during the decode loop.  However, even
-'do not decode' vectors are allocated and zeroed.</p><p>
-Depending on the values of <code class="varname">[residue_begin]</code> and
-<code class="varname">[residue_end]</code>, it is obvious that the encoded
-portion of a residue vector may be the entire possible residue vector
-or some other strict subset of the actual residue vector size with
-zero padding at either uncoded end.  However, it is also possible to
-set <code class="varname">[residue_begin]</code> and
-<code class="varname">[residue_end]</code> to specify a range partially or
-wholly beyond the maximum vector size.  Before beginning residue
-decode, limit <code class="varname">[residue_begin]</code> and
-<code class="varname">[residue_end]</code> to the maximum possible vector size
-as follows.  We assume that the number of vectors being encoded,
-<code class="varname">[ch]</code> is provided by the higher level decoding
-process.</p><pre class="programlisting">
-  1) [actual_size] = current blocksize/2;
-  2) if residue encoding is format 2
-       3) [actual_size] = [actual_size] * [ch];
-  4) [limit_residue_begin] = maximum of ([residue_begin],[actual_size]);
-  5) [limit_residue_end] = maximum of ([residue_end],[actual_size]);
-</pre><p>
-The following convenience values are conceptually useful to clarifying
-the decode process:</p><pre class="programlisting">
-  1) [classwords_per_codeword] = [codebook_dimensions] value of codebook [residue_classbook]
-  2) [n_to_read] = [limit_residue_end] - [limit_residue_begin]
-  3) [partitions_to_read] = [n_to_read] / [residue_partition_size]
-</pre><p>
-Packet decode proceeds as follows, matching the description offered earlier in the document. </p><pre class="programlisting">
-  1) allocate and zero all vectors that will be returned.
-  2) if ([n_to_read] is zero), stop; there is no residue to decode.
-  3) iterate [pass] over the range 0 ... 7 {
+                                                                                    
+     </li>
+     <li class="itemize">A granule position on the final page in a stream that indicates less audio data than the final
+     packet would normally return is used to end the stream on other than even frame
+     boundaries. The difference between the actual available data returned and the
+     declared amount indicates how many trailing samples to discard from the decoding
+     process.
+     </li></ul>
+                                                                                    
 
-       4) [partition_count] = 0
+                                                                                    
+<h3 class="sectionHead"><span class="titlemark">B </span> <a 
+ id="x1-132000B"></a>Vorbis encapsulation in RTP</h3>
+<!--l. 8--><p class="noindent" >Please consult RFC 5215 <span 
+class="cmti-10x-x-109">&#8220;RTP Payload Format for Vorbis Encoded Audio&#8221; </span>for description of how
+to embed Vorbis audio in an RTP stream.
+                                                                                    
 
-       5) while [partition_count] is less than [partitions_to_read]
+                                                                                    
+                                                                                    
 
-            6) if ([pass] is zero) {
-     
-                 7) iterate [j] over the range 0 .. [ch]-1 {
+                                                                                    
+<h3 class="likesectionHead"><a 
+ id="x1-133000B"></a>Colophon</h3>
+<!--l. 6--><p class="noindent" ><img 
+src="Vorbis_I_spec15x.png" alt="PIC" class="graphics"><!--tex4ht:graphics  
+name="Vorbis_I_spec15x.png" src="xifish.pdf"  
+-->
+<!--l. 10--><p class="noindent" >Ogg is a <a 
+href="http://www.xiph.org/" >Xiph.org Foundation</a> effort to protect essential tenets of Internet multimedia from
+corporate hostage-taking; Open Source is the net&#8217;s greatest tool to keep everyone honest. See <a 
+href="http://www.xiph.org/about.html" >About
+the Xiph.org Foundation</a> for details.
+<!--l. 17--><p class="noindent" >Ogg Vorbis is the first Ogg audio CODEC. Anyone may freely use and distribute the Ogg and
+Vorbis specification, whether in a private, public or corporate capacity. However, the Xiph.org
+Foundation and the Ogg project (xiph.org) reserve the right to set the Ogg Vorbis specification and
+certify specification compliance.
+<!--l. 23--><p class="noindent" >Xiph.org&#8217;s Vorbis software CODEC implementation is distributed under a BSD-like license. This
+does not restrict third parties from distributing independent implementations of Vorbis software
+under other licenses.
+<!--l. 28--><p class="noindent" >Ogg, Vorbis, Xiph.org Foundation and their logos are trademarks (tm) of the <a 
+href="http://www.xiph.org/" >Xiph.org
+Foundation</a>. These pages are copyright (C) 1994-2007 Xiph.org Foundation. All rights
+reserved.
+<!--l. 33--><p class="noindent" >This document is set using <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span 
+class="E">E</span>X</span></span>.
+                                                                                    
 
-                      8) if vector [j] is not marked 'do not decode' {
-
-                           9) [temp] = read from packet using codebook [residue_classbook] in scalar context
-                          10) iterate [i] descending over the range [classwords_per_codeword]-1 ... 0 {
-
-                               11) array [classifications] element [j],([i]+[partition_count]) =
-                                   [temp] integer modulo [residue_classifications]
-                               12) [temp] = [temp] / [residue_classifications] using integer division
-
-                              }
-      
-                         }
-            
-                    }
-          
-               }
-
-           13) iterate [i] over the range 0 .. ([classwords_per_codeword] - 1) while [partition_count] 
-               is also less than [partitions_to_read] {
-
-                 14) iterate [j] over the range 0 .. [ch]-1 {
-   
-                      15) if vector [j] is not marked 'do not decode' {
-   
-                           16) [vqclass] = array [classifications] element [j],[partition_count]
-                           17) [vqbook] = array [residue_books] element [vqclass],[pass]
-                           18) if ([vqbook] is not 'unused') {
-   
-                                19) decode partition into output vector number [j], starting at scalar 
-                                    offset [limit_residue_begin]+[partition_count]*[residue_partition_size] using 
-                                    codebook number [vqbook] in VQ context
-                          }
-                     }
-   
-                 20) increment [partition_count] by one
-
-               }
-          }
-     }
+                                                                                    
+<h3 class="likesectionHead"><a 
+ id="x1-134000B"></a>References</h3>
+<!--l. 129--><p class="noindent" >
+    <div class="thebibliography">
+    <p class="bibitem" ><span class="biblabel">
+  [1]<span class="bibsp">&#x00A0;&#x00A0;&#x00A0;</span></span><a 
+ id="XSporer/Brandenburg/Edler"></a>T.&#x00A0;Sporer,                                                                           K.&#x00A0;Brandenburg
+    and B.&#x00A0;Edler, The use of multirate filter banks for coding of high quality digital audio,
+    <a 
+href="http://www.iocon.com/resource/docs/ps/eusipco_corrected.ps" class="url" ><span 
+class="cmtt-10x-x-109">http://www.iocon.com/resource/docs/ps/eusipco_corrected.ps</span></a>.
+</p>
+    </div>
  
- 21) done
+</body></html> 
 
-</pre><p>
-An end-of-packet condition during packet decode is to be considered a
-nominal occurrence.  Decode returns the result of vector decode up to
-that point.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id326098"></a>8.6.3. format 0 specifics</h4></div></div></div><p>
-Format zero decodes partitions exactly as described earlier in the
-'Residue Format: residue 0' section.  The following pseudocode
-presents the same algorithm. Assume:</p><p>
-</p><div class="itemizedlist"><ul type="disc"><li> <code class="varname">[n]</code> is the value in <code class="varname">[residue_partition_size]</code></li><li><code class="varname">[v]</code> is the residue vector</li><li><code class="varname">[offset]</code> is the beginning read offset in [v]</li></ul></div><p>
-</p><pre class="programlisting">
- 1) [step] = [n] / [codebook_dimensions]
- 2) iterate [i] over the range 0 ... [step]-1 {
+                                                                                    
 
-      3) vector [entry_temp] = read vector from packet using current codebook in VQ context
-      4) iterate [j] over the range 0 ... [codebook_dimensions]-1 {
 
-           5) vector [v] element ([offset]+[i]+[j]*[step]) =
-	        vector [v] element ([offset]+[i]+[j]*[step]) +
-                vector [entry_temp] element [j]
-
-         }
-
-    }
-
-  6) done
-
-</pre></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id307089"></a>8.6.4. format 1 specifics</h4></div></div></div><p>
-Format 1 decodes partitions exactly as described earlier in the
-'Residue Format: residue 1' section.  The following pseudocode
-presents the same algorithm. Assume:</p><p>
-</p><div class="itemizedlist"><ul type="disc"><li> <code class="varname">[n]</code> is the value in
-<code class="varname">[residue_partition_size]</code></li><li><code class="varname">[v]</code> is the residue vector</li><li><code class="varname">[offset]</code> is the beginning read offset in [v]</li></ul></div><p>
-</p><pre class="programlisting">
- 1) [i] = 0
- 2) vector [entry_temp] = read vector from packet using current codebook in VQ context
- 3) iterate [j] over the range 0 ... [codebook_dimensions]-1 {
-
-      4) vector [v] element ([offset]+[i]) =
-	  vector [v] element ([offset]+[i]) +
-          vector [entry_temp] element [j]
-      5) increment [i]
-
-    }
- 
-  6) if ( [i] is less than [n] ) continue at step 2
-  7) done
-</pre></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id307141"></a>8.6.5. format 2 specifics</h4></div></div></div><p>
-Format 2 is reducible to format 1.  It may be implemented as an additional step prior to and an additional post-decode step after a normal format 1 decode.
-</p><p>
-Format 2 handles 'do not decode' vectors differently than residue 0 or
-1; if all vectors are marked 'do not decode', no decode occurrs.
-However, if at least one vector is to be decoded, all the vectors are
-decoded.  We then request normal format 1 to decode a single vector
-representing all output channels, rather than a vector for each
-channel.  After decode, deinterleave the vector into independent vectors, one for each output channel.  That is:</p><div class="orderedlist"><ol type="1"><li>If all vectors 0 through <span class="emphasis"><em>ch</em></span>-1 are marked 'do not decode', allocate and clear a single vector <code class="varname">[v]</code>of length <span class="emphasis"><em>ch*n</em></span> and skip step 2 below; proceed directly to the post-decode step.</li><li>Rather than performing format 1 decode to produce <span class="emphasis"><em>ch</em></span> vectors of length <span class="emphasis"><em>n</em></span> each, call format 1 decode to produce a single vector <code class="varname">[v]</code> of length <span class="emphasis"><em>ch*n</em></span>. </li><li><p>Post decode: Deinterleave the single vector <code class="varname">[v]</code> returned by format 1 decode as described above into <span class="emphasis"><em>ch</em></span> independent vectors, one for each outputchannel, according to:
-  </p><pre class="programlisting">
-  1) iterate [i] over the range 0 ... [n]-1 {
-
-       2) iterate [j] over the range 0 ... [ch]-1 {
-
-            3) output vector number [j] element [i] = vector [v] element ([i] * [ch] + [j])
-
-          }
-     }
-
-  4) done
-  </pre><p>
- </p></li></ol></div></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="vorbis-spec-helper"></a>9. Helper equations</h2></div><div><p class="releaseinfo">
- $Id: 09-helper.xml 7186 2004-07-20 07:19:25Z xiphmont $
-</p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id325073"></a>9.1. Overview</h3></div></div></div><p>
-The equations below are used in multiple places by the Vorbis codec
-specification.  Rather than cluttering up the main specification
-documents, they are defined here and referenced where appropriate.
-</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id306980"></a>9.2. Functions</h3></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="vorbis-spec-ilog"></a>9.2.1. ilog</h4></div></div></div><p>
-The "ilog(x)" function returns the position number (1 through n) of the highest set bit in the two's complement integer value
-<code class="varname">[x]</code>.  Values of <code class="varname">[x]</code> less than zero are defined to return zero.</p><pre class="programlisting">
-  1) [return_value] = 0;
-  2) if ( [x] is greater than zero ){
-      
-       3) increment [return_value];
-       4) logical shift [x] one bit to the right, padding the MSb with zero
-       5) repeat at step 2)
-
-     }
-
-   6) done
-</pre><p>
-Examples:
-
-</p><div class="itemizedlist"><ul type="disc"><li>ilog(0) = 0;</li><li>ilog(1) = 1;</li><li>ilog(2) = 2;</li><li>ilog(3) = 2;</li><li>ilog(4) = 3;</li><li>ilog(7) = 3;</li><li>ilog(negative number) = 0;</li></ul></div><p>
-</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="vorbis-spec-float32_unpack"></a>9.2.2. float32_unpack</h4></div></div></div><p>
-"float32_unpack(x)" is intended to translate the packed binary
-representation of a Vorbis codebook float value into the
-representation used by the decoder for floating point numbers.  For
-purposes of this example, we will unpack a Vorbis float32 into a
-host-native floating point number.</p><pre class="programlisting">
-  1) [mantissa] = [x] bitwise AND 0x1fffff (unsigned result)
-  2) [sign] = [x] bitwise AND 0x80000000 (unsigned result)
-  3) [exponent] = ( [x] bitwise AND 0x7fe00000) shifted right 21 bits (unsigned result)
-  4) if ( [sign] is nonzero ) then negate [mantissa]
-  5) return [mantissa] * ( 2 ^ ( [exponent] - 788 ) )
-</pre></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="vorbis-spec-lookup1_values"></a>9.2.3. lookup1_values</h4></div></div></div><p>
-"lookup1_values(codebook_entries,codebook_dimensions)" is used to
-compute the correct length of the value index for a codebook VQ lookup
-table of lookup type 1.  The values on this list are permuted to
-construct the VQ vector lookup table of size
-<code class="varname">[codebook_entries]</code>.</p><p>
-The return value for this function is defined to be 'the greatest
-integer value for which <code class="varname">[return_value] to the power of
-[codebook_dimensions] is less than or equal to
-[codebook_entries]</code>'.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="vorbis-spec-low_neighbor"></a>9.2.4. low_neighbor</h4></div></div></div><p>
-"low_neighbor(v,x)" finds the position <code class="varname">n</code> in vector <code class="varname">[v]</code> of
-the greatest value scalar element for which <code class="varname">n</code> is less than
-<code class="varname">[x]</code> and vector <code class="varname">[v]</code> element <code class="varname">n</code> is less
-than vector <code class="varname">[v]</code> element <code class="varname">[x]</code>.</p><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="vorbis-spec-high_neighbor"></a>9.2.4.1. high_neighbor</h5></div></div></div><p>
-"high_neighbor(v,x)" finds the position <code class="varname">n</code> in vector [v] of
-the lowest value scalar element for which <code class="varname">n</code> is less than
-<code class="varname">[x]</code> and vector <code class="varname">[v]</code> element <code class="varname">n</code> is greater
-than vector <code class="varname">[v]</code> element <code class="varname">[x]</code>.</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="vorbis-spec-render_point"></a>9.2.4.2. render_point</h5></div></div></div><p>
-"render_point(x0,y0,x1,y1,X)" is used to find the Y value at point X
-along the line specified by x0, x1, y0 and y1.  This function uses an
-integer algorithm to solve for the point directly without calculating
-intervening values along the line.</p><pre class="programlisting">
-  1)  [dy] = [y1] - [y0]
-  2) [adx] = [x1] - [x0]
-  3) [ady] = absolute value of [dy]
-  4) [err] = [ady] * ([X] - [x0])
-  5) [off] = [err] / [adx] using integer division
-  6) if ( [dy] is less than zero ) {
-
-       7) [Y] = [y0] - [off]
-
-     } else {
-
-       8) [Y] = [y0] + [off]
-  
-     }
-
-  9) done
-</pre></div><div class="section" lang="en"><div class="titlepage"><div><div><h5 class="title"><a name="vorbis-spec-render_line"></a>9.2.4.3. render_line</h5></div></div></div><p>
-Floor decode type one uses the integer line drawing algorithm of
-"render_line(x0, y0, x1, y1, v)" to construct an integer floor
-curve for contiguous piecewise line segments. Note that it has not
-been relevant elsewhere, but here we must define integer division as
-rounding division of both positive and negative numbers toward zero.
-</p><pre class="programlisting">
-  1)   [dy] = [y1] - [y0]
-  2)  [adx] = [x1] - [x0]
-  3)  [ady] = absolute value of [dy]
-  4) [base] = [dy] / [adx] using integer division
-  5)    [x] = [x0]
-  6)    [y] = [y0]
-  7)  [err] = 0
-
-  8) if ( [dy] is less than 0 ) {
-
-        9) [sy] = [base] - 1
-
-     } else {
-
-       10) [sy] = [base] + 1
-
-     }
-
- 11) [ady] = [ady] - (absolute value of [base]) * [adx]
- 12) vector [v] element [x] = [y]
-
- 13) iterate [x] over the range [x0]+1 ... [x1]-1 {
-
-       14) [err] = [err] + [ady];
-       15) if ( [err] &gt;= [adx] ) {
-
-             16) [err] = [err] - [adx]
-             17)   [y] = [y] + [sy]
-
-           } else {
-
-             18) [y] = [y] + [base]
-   
-           }
-
-       19) vector [v] element [x] = [y]
-
-     }
-</pre></div></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="vorbis-spec-tables"></a>10. Tables</h2></div><div><p class="releaseinfo">
-  $Id: 10-tables.xml 7186 2004-07-20 07:19:25Z xiphmont $
- </p></div></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="vorbis-spec-floor1_inverse_dB_table"></a>10.1. floor1_inverse_dB_table</h3></div></div></div><p>
-The vector <code class="varname">[floor1_inverse_dB_table]</code> is a 256 element static
-lookup table consiting of the following values (read left to right
-then top to bottom):</p><pre class="screen">
-  1.0649863e-07, 1.1341951e-07, 1.2079015e-07, 1.2863978e-07, 
-  1.3699951e-07, 1.4590251e-07, 1.5538408e-07, 1.6548181e-07, 
-  1.7623575e-07, 1.8768855e-07, 1.9988561e-07, 2.1287530e-07, 
-  2.2670913e-07, 2.4144197e-07, 2.5713223e-07, 2.7384213e-07, 
-  2.9163793e-07, 3.1059021e-07, 3.3077411e-07, 3.5226968e-07, 
-  3.7516214e-07, 3.9954229e-07, 4.2550680e-07, 4.5315863e-07, 
-  4.8260743e-07, 5.1396998e-07, 5.4737065e-07, 5.8294187e-07, 
-  6.2082472e-07, 6.6116941e-07, 7.0413592e-07, 7.4989464e-07, 
-  7.9862701e-07, 8.5052630e-07, 9.0579828e-07, 9.6466216e-07, 
-  1.0273513e-06, 1.0941144e-06, 1.1652161e-06, 1.2409384e-06, 
-  1.3215816e-06, 1.4074654e-06, 1.4989305e-06, 1.5963394e-06, 
-  1.7000785e-06, 1.8105592e-06, 1.9282195e-06, 2.0535261e-06, 
-  2.1869758e-06, 2.3290978e-06, 2.4804557e-06, 2.6416497e-06, 
-  2.8133190e-06, 2.9961443e-06, 3.1908506e-06, 3.3982101e-06, 
-  3.6190449e-06, 3.8542308e-06, 4.1047004e-06, 4.3714470e-06, 
-  4.6555282e-06, 4.9580707e-06, 5.2802740e-06, 5.6234160e-06, 
-  5.9888572e-06, 6.3780469e-06, 6.7925283e-06, 7.2339451e-06, 
-  7.7040476e-06, 8.2047000e-06, 8.7378876e-06, 9.3057248e-06, 
-  9.9104632e-06, 1.0554501e-05, 1.1240392e-05, 1.1970856e-05, 
-  1.2748789e-05, 1.3577278e-05, 1.4459606e-05, 1.5399272e-05, 
-  1.6400004e-05, 1.7465768e-05, 1.8600792e-05, 1.9809576e-05, 
-  2.1096914e-05, 2.2467911e-05, 2.3928002e-05, 2.5482978e-05, 
-  2.7139006e-05, 2.8902651e-05, 3.0780908e-05, 3.2781225e-05, 
-  3.4911534e-05, 3.7180282e-05, 3.9596466e-05, 4.2169667e-05, 
-  4.4910090e-05, 4.7828601e-05, 5.0936773e-05, 5.4246931e-05, 
-  5.7772202e-05, 6.1526565e-05, 6.5524908e-05, 6.9783085e-05, 
-  7.4317983e-05, 7.9147585e-05, 8.4291040e-05, 8.9768747e-05, 
-  9.5602426e-05, 0.00010181521, 0.00010843174, 0.00011547824, 
-  0.00012298267, 0.00013097477, 0.00013948625, 0.00014855085, 
-  0.00015820453, 0.00016848555, 0.00017943469, 0.00019109536, 
-  0.00020351382, 0.00021673929, 0.00023082423, 0.00024582449, 
-  0.00026179955, 0.00027881276, 0.00029693158, 0.00031622787, 
-  0.00033677814, 0.00035866388, 0.00038197188, 0.00040679456, 
-  0.00043323036, 0.00046138411, 0.00049136745, 0.00052329927, 
-  0.00055730621, 0.00059352311, 0.00063209358, 0.00067317058, 
-  0.00071691700, 0.00076350630, 0.00081312324, 0.00086596457, 
-  0.00092223983, 0.00098217216, 0.0010459992,  0.0011139742, 
-  0.0011863665,  0.0012634633,  0.0013455702,  0.0014330129, 
-  0.0015261382,  0.0016253153,  0.0017309374,  0.0018434235, 
-  0.0019632195,  0.0020908006,  0.0022266726,  0.0023713743, 
-  0.0025254795,  0.0026895994,  0.0028643847,  0.0030505286, 
-  0.0032487691,  0.0034598925,  0.0036847358,  0.0039241906, 
-  0.0041792066,  0.0044507950,  0.0047400328,  0.0050480668, 
-  0.0053761186,  0.0057254891,  0.0060975636,  0.0064938176, 
-  0.0069158225,  0.0073652516,  0.0078438871,  0.0083536271, 
-  0.0088964928,  0.009474637,   0.010090352,   0.010746080, 
-  0.011444421,   0.012188144,   0.012980198,   0.013823725, 
-  0.014722068,   0.015678791,   0.016697687,   0.017782797, 
-  0.018938423,   0.020169149,   0.021479854,   0.022875735, 
-  0.024362330,   0.025945531,   0.027631618,   0.029427276, 
-  0.031339626,   0.033376252,   0.035545228,   0.037855157, 
-  0.040315199,   0.042935108,   0.045725273,   0.048696758, 
-  0.051861348,   0.055231591,   0.058820850,   0.062643361, 
-  0.066714279,   0.071049749,   0.075666962,   0.080584227, 
-  0.085821044,   0.091398179,   0.097337747,   0.10366330, 
-  0.11039993,    0.11757434,    0.12521498,    0.13335215, 
-  0.14201813,    0.15124727,    0.16107617,    0.17154380, 
-  0.18269168,    0.19456402,    0.20720788,    0.22067342, 
-  0.23501402,    0.25028656,    0.26655159,    0.28387361, 
-  0.30232132,    0.32196786,    0.34289114,    0.36517414, 
-  0.38890521,    0.41417847,    0.44109412,    0.46975890, 
-  0.50028648,    0.53279791,    0.56742212,    0.60429640, 
-  0.64356699,    0.68538959,    0.72993007,    0.77736504, 
-  0.82788260,    0.88168307,    0.9389798,     1.
-</pre></div></div><div class="appendix" lang="en"><h2 class="title" style="clear: both"><a name="vorbis-over-ogg"></a>1. Embedding Vorbis into an Ogg stream</h2><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id312362"></a>1.1. Overview</h3></div></div></div><p>
-This document describes using Ogg logical and physical transport
-streams to encapsulate Vorbis compressed audio packet data into file
-form.</p><p>
-The <a href="#vorbis-spec-intro" title="1. Introduction and Description">Section 1, &#8220;Introduction and Description&#8221;</a> provides an overview of the construction
-of Vorbis audio packets.</p><p>
-The <a href="oggstream.html" target="_top">Ogg
-bitstream overview</a> and <a href="framing.html" target="_top">Ogg logical
-bitstream and framing spec</a> provide detailed descriptions of Ogg
-transport streams. This specification document assumes a working
-knowledge of the concepts covered in these named backround
-documents.  Please read them first.</p><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id336032"></a>1.1.1. Restrictions</h4></div></div></div><p>
-The Ogg/Vorbis I specification currently dictates that Ogg/Vorbis
-streams use Ogg transport streams in degenerate, unmultiplexed
-form only. That is:
-
-</p><div class="itemizedlist"><ul type="disc"><li>
-  A meta-headerless Ogg file encapsulates the Vorbis I packets
- </li><li>
-  The Ogg stream may be chained, i.e. contain multiple, contigous logical streams (links).
- </li><li>
-  The Ogg stream must be unmultiplexed (only one stream, a Vorbis audio stream, per link)
- </li></ul></div><p>
-</p><p>
-This is not to say that it is not currently possible to multiplex
-Vorbis with other media types into a multi-stream Ogg file.  At the
-time this document was written, Ogg was becoming a popular container
-for low-bitrate movies consisting of DivX video and Vorbis audio.
-However, a 'Vorbis I audio file' is taken to imply Vorbis audio
-existing alone within a degenerate Ogg stream.  A compliant 'Vorbis
-audio player' is not required to implement Ogg support beyond the
-specific support of Vorbis within a degenrate Ogg stream (naturally,
-application authors are encouraged to support full multiplexed Ogg
-handling).
-</p></div><div class="section" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id319459"></a>1.1.2. MIME type</h4></div></div></div><p>
-The MIME type of Ogg files depend on the context.  Specifically, complex
-multimedia and applications should use <code class="literal">application/ogg</code>,
-while visual media should use <code class="literal">video/ogg</code>, and audio
-<code class="literal">audio/ogg</code>.  Vorbis data encapsulated in Ogg may appear
-in any of those types.  RTP encapsulated Vorbis should use
-<code class="literal">audio/vorbis</code> + <code class="literal">audio/vorbis-config</code>.</p></div></div><div class="section" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id317588"></a>1.2. Encapsulation</h3></div></div></div><p>
-Ogg encapsulation of a Vorbis packet stream is straightforward.</p><div class="itemizedlist"><ul type="disc"><li>
-  The first Vorbis packet (the identification header), which
-  uniquely identifies a stream as Vorbis audio, is placed alone in the
-  first page of the logical Ogg stream.  This results in a first Ogg
-  page of exactly 58 bytes at the very beginning of the logical stream.
-</li><li>
-  This first page is marked 'beginning of stream' in the page flags.
-</li><li>
-  The second and third vorbis packets (comment and setup
-  headers) may span one or more pages beginning on the second page of
-  the logical stream.  However many pages they span, the third header
-  packet finishes the page on which it ends.  The next (first audio) packet
-  must begin on a fresh page.
-</li><li>
-  The granule position of these first pages containing only headers is zero.
-</li><li>
-  The first audio packet of the logical stream begins a fresh Ogg page.
-</li><li>
-  Packets are placed into ogg pages in order until the end of stream.
-</li><li>
-  The last page is marked 'end of stream' in the page flags.
-</li><li>
-  Vorbis packets may span page boundaries.
-</li><li>
-  The granule position of pages containing Vorbis audio is in units
-  of PCM audio samples (per channel; a stereo stream's granule position
-  does not increment at twice the speed of a mono stream).
-</li><li><p>
-  The granule position of a page represents the end PCM sample
-  position of the last packet <span class="emphasis"><em>completed</em></span> on that
-  page.  The 'last PCM sample' is the last complete sample returned by
-  decode, not an internal sample awaiting lapping with a
-  subsequent block.  A page that is entirely spanned by a single
-  packet (that completes on a subsequent page) has no granule
-  position, and the granule position is set to '-1'.  </p><p>
-  Note that the last decoded (fully lapped) PCM sample from a packet
-  is not necessarily the middle sample from that block. If, eg, the
-  current Vorbis packet encodes a "long block" and the next Vorbis
-  packet encodes a "short block", the last decodable sample from the
-  current packet be at position (3*long_block_length/4) -
-  (short_block_length/4).
-</p></li><li><p>
-    The granule (PCM) position of the first page need not indicate
-    that the stream started at position zero.  Although the granule
-    position belongs to the last completed packet on the page and a 
-    valid granule position must be positive, by
-    inference it may indicate that the PCM position of the beginning
-    of audio is positive or negative.
-  </p><div class="itemizedlist"><ul type="circle"><li>
-        A positive starting value simply indicates that this stream begins at
-        some positive time offset, potentially within a larger
-        program. This is a common case when connecting to the middle
-        of broadcast stream.
-    </li><li>
-        A negative value indicates that
-        output samples preceeding time zero should be discarded during
-        decoding; this technique is used to allow sample-granularity
-        editing of the stream start time of already-encoded Vorbis
-        streams.  The number of samples to be discarded must not exceed 
-        the overlap-add span of the first two audio packets.
-    </li></ul></div><p>
-    In both of these cases in which the initial audio PCM starting
-    offset is nonzero, the second finished audio packet must flush the
-    page on which it appears and the third packet begin a fresh page.
-    This allows the decoder to always be able to perform PCM position
-    adjustments before needing to return any PCM data from synthesis, 
-    resulting in correct positioning information without any aditional
-    seeking logic.
-  </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
-    Failure to do so should, at worst, cause a
-    decoder implementation to return incorrect positioning information
-    for seeking operations at the very beginning of the stream.
-  </p></div></li><li>
-  A granule position on the final page in a stream that indicates
-  less audio data than the final packet would normally return is used to
-  end the stream on other than even frame boundaries.  The difference
-  between the actual available data returned and the declared amount
-  indicates how many trailing samples to discard from the decoding
-  process.
- </li></ul></div></div></div><div class="appendix" lang="en"><h2 class="title" style="clear: both"><a name="vorbis-over-rtp"></a>2. Vorbis encapsulation in RTP</h2><pre class="literallayout">
-
-
-
-    <p>Please consult RFC 5215 <em class="citetitle">RTP Payload Format for Vorbis Encoded Audio</em> for description of how to embed Vorbis audio in an RTP stream.</p>
-  
-</pre></div><div class="appendix" lang="en"><h2 class="title" style="clear: both"><a name="footer"></a>3. Colophon</h2><div class="mediaobject"><img src="white-xifish.png" alt="[Xiph.org logo]"></div><p>
-Ogg is a <a href="http://www.xiph.org/" target="_top">Xiph.Org Foundation</a> effort
-to protect essential tenets of Internet multimedia from corporate
-hostage-taking; Open Source is the net's greatest tool to keep
-everyone honest. See <a href="http://www.xiph.org/about.html" target="_top">About
-the Xiph.org Foundation</a> for details.
-</p><p>
-Ogg Vorbis is the first Ogg audio CODEC.  Anyone may freely use and
-distribute the Ogg and Vorbis specification, whether in a private,
-public or corporate capacity.  However, the Xiph.org Foundation and
-the Ogg project (xiph.org) reserve the right to set the Ogg Vorbis
-specification and certify specification compliance.</p><p>
-Xiph.org's Vorbis software CODEC implementation is distributed under a
-BSD-like license.  This does not restrict third parties from
-distributing independent implementations of Vorbis software under
-other licenses.</p><p>
-Ogg, Vorbis, Xiph.org Foundation and their logos are trademarks (tm)
-of the <a href="http://www.xiph.org/" target="_top">Xiph.org Foundation</a>.  These
-pages are copyright (C) 1994-2007 Xiph.org Foundation. All rights
-reserved.</p><p>
-This document is set in DocBook XML.
-</p></div></div></body></html>

Modified: trunk/vorbis/doc/Vorbis_I_spec.pdf
===================================================================
(Binary files differ)

Added: trunk/vorbis/doc/Vorbis_I_spec.tex
===================================================================
--- trunk/vorbis/doc/Vorbis_I_spec.tex	                        (rev 0)
+++ trunk/vorbis/doc/Vorbis_I_spec.tex	2009-03-06 18:54:13 UTC (rev 15748)
@@ -0,0 +1,138 @@
+% $Id$
+% latex2html -show_section_numbers -split 0 -html_version 4.0 Vorbis_I_spec.tex
+%\documentclass[a4paper]{article}
+\documentclass[a4paper]{scrartcl}
+%\documentclass[twoside,idxtotoc,bibtotoc,a4paper,12pt,BCOR12mm,DIV13]{scrbook}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Packages
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% ...
+%\usepackage[margin=3cm]{geometry}
+\usepackage{a4wide}
+
+% ...
+\usepackage{enumitem}
+
+% ...
+\usepackage[english]{babel}
+
+%\usepackage[latin1]{inputenc}
+%\usepackage[T1]{fontenc}
+
+% Do not indent paragraphs, instead separate them via vertical spacing
+\usepackage{parskip}
+
+% Support for graphics, provides \includegraphics
+\usepackage{graphicx}
+%\graphicspath{{images/}}	% Specify subdir containing the images
+
+% Hyperref enriches the generated PDF with clickable links,
+% and provides many other useful features.
+\usepackage{hyperref}
+%\usepackage[colorlinks]{hyperref}
+%\usepackage[pdfborder={0 0 0}]{hyperref}
+\def\sectionautorefname{Section}	% Write section with capital 'S'
+\def\subsectionautorefname{Subsection}	% Write subsection with capital 'S'
+
+
+% provides the 'comment' env, which is useful to temporarily comment out a block of code
+\usepackage{verbatim}
+
+% ...
+%\usepackage{listings}
+%\lstset{language=Pascal} 
+
+% The fancyvrb package provides the "Verbatim" environment, which,
+% unlike the built-in "verbatim", allows embedding TeX commands, as
+% well as tons of other neat stuff (line numbers, formatting adjustments, ...)
+\usepackage{fancyvrb}
+%\fvset{tabsize=4,fontsize=\scriptsize,numbers=left}
+\fvset{tabsize=4,fontsize=\small}
+%\fvset{tabsize=4}
+
+% ...
+\usepackage{color}      % Colored text, used for \TODO macro
+
+% ...
+\usepackage[nohyphen]{underscore}
+
+% ...
+\usepackage{capt-of}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Custom commands
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+% Custom ref command, using hyperrefs autoref & nameref, to simulate the 
+% behavior of DocBooks's 'xref'.
+\newcommand{\xref}[1]{\autoref{#1}, ``\nameref{#1}''}
+
+%...
+\newcommand{\link}[2]{\hyperref[#1]{#2}}
+
+% Redefine \~ to generate something that looks more appropriate when used in text.
+\renewcommand{\~}{$\sim$}
+
+% ...
+\newenvironment{note}{\subparagraph*{Note:}}{}
+
+% ...
+\let\programlisting\Verbatim
+\let\endprogramlisting\endVerbatim
+
+% ...
+\newcommand{\function}[1]{\texttt{#1}}
+\newcommand{\filename}[1]{\texttt{#1}}
+\newcommand{\varname}[1]{\texttt{#1}}
+\newcommand{\literal}[1]{\texttt{#1}}
+
+% ...
+\newcommand{\TODO}[1]{\textcolor{red}{*** #1 ***}}
+\newcommand{\NOTE}[1]{\textcolor{blue}{*** #1 ***}}
+
+\DeclareGraphicsExtensions{.pdf,.png}
+
+
+% TODO/FIXME: Things to watch out for:
+% - Translate some chars: ~ -> $\sim$,  % -> \%, & -> \&, ...
+
+\begin{document}
+
+
+\title{Vorbis I specification}
+\author{Xiph.org Foundation}
+\maketitle
+
+\tableofcontents
+
+\include{01-introduction}
+\include{02-bitpacking}
+\include{03-codebook}
+\include{04-codec}
+\include{05-comment}
+\include{06-floor0}
+\include{07-floor1}
+\include{08-residue}
+\include{09-helper}
+\include{10-tables}
+
+\appendix
+\include{a1-encapsulation-ogg}
+\include{a2-encapsulation-rtp}
+
+\include{footer}
+
+ 
+% TODO: Use a bibliography, as in the example below?
+\begin{thebibliography}{99} 
+ 
+\bibitem{Sporer/Brandenburg/Edler} T.~Sporer, K.~Brandenburg and B.~Edler, 
+The use of multirate filter banks for coding of high quality digital audio,
+\url{http://www.iocon.com/resource/docs/ps/eusipco_corrected.ps}.
+
+
+\end{thebibliography}
+
+\end{document}

Added: trunk/vorbis/doc/a1-encapsulation-ogg.tex
===================================================================
--- trunk/vorbis/doc/a1-encapsulation-ogg.tex	                        (rev 0)
+++ trunk/vorbis/doc/a1-encapsulation-ogg.tex	2009-03-06 18:54:13 UTC (rev 15748)
@@ -0,0 +1,185 @@
+% -*- mode: latex; TeX-master: "Vorbis_I_spec"; -*-
+%!TEX root = Vorbis_I_spec.tex
+% $Id$
+\section{Embedding Vorbis into an Ogg stream} \label{vorbis:over:ogg}
+
+\subsection{Overview}
+
+This document describes using Ogg logical and physical transport
+streams to encapsulate Vorbis compressed audio packet data into file
+form.
+
+The \xref{vorbis:spec:intro} provides an overview of the construction
+of Vorbis audio packets.
+
+The \href{oggstream.html}{Ogg
+bitstream overview} and \href{framing.html}{Ogg logical
+bitstream and framing spec} provide detailed descriptions of Ogg
+transport streams. This specification document assumes a working
+knowledge of the concepts covered in these named backround
+documents.  Please read them first.
+
+\subsubsection{Restrictions}
+
+The Ogg/Vorbis I specification currently dictates that Ogg/Vorbis
+streams use Ogg transport streams in degenerate, unmultiplexed
+form only. That is:
+
+\begin{itemize}
+ \item
+  A meta-headerless Ogg file encapsulates the Vorbis I packets
+
+ \item
+  The Ogg stream may be chained, i.e., contain multiple, contigous logical streams (links).
+
+ \item
+  The Ogg stream must be unmultiplexed (only one stream, a Vorbis audio stream, per link)
+
+\end{itemize}
+
+
+This is not to say that it is not currently possible to multiplex
+Vorbis with other media types into a multi-stream Ogg file.  At the
+time this document was written, Ogg was becoming a popular container
+for low-bitrate movies consisting of DivX video and Vorbis audio.
+However, a 'Vorbis I audio file' is taken to imply Vorbis audio
+existing alone within a degenerate Ogg stream.  A compliant 'Vorbis
+audio player' is not required to implement Ogg support beyond the
+specific support of Vorbis within a degenrate Ogg stream (naturally,
+application authors are encouraged to support full multiplexed Ogg
+handling).
+
+
+
+
+\subsubsection{MIME type}
+
+The MIME type of Ogg files depend on the context.  Specifically, complex
+multimedia and applications should use \literal{application/ogg},
+while visual media should use \literal{video/ogg}, and audio
+\literal{audio/ogg}.  Vorbis data encapsulated in Ogg may appear
+in any of those types.  RTP encapsulated Vorbis should use
+\literal{audio/vorbis} + \literal{audio/vorbis-config}.
+
+
+\subsection{Encapsulation}
+
+Ogg encapsulation of a Vorbis packet stream is straightforward.
+
+\begin{itemize}
+
+\item
+  The first Vorbis packet (the identification header), which
+  uniquely identifies a stream as Vorbis audio, is placed alone in the
+  first page of the logical Ogg stream.  This results in a first Ogg
+  page of exactly 58 bytes at the very beginning of the logical stream.
+
+
+\item
+  This first page is marked 'beginning of stream' in the page flags.
+
+
+\item
+  The second and third vorbis packets (comment and setup
+  headers) may span one or more pages beginning on the second page of
+  the logical stream.  However many pages they span, the third header
+  packet finishes the page on which it ends.  The next (first audio) packet
+  must begin on a fresh page.
+
+
+\item
+  The granule position of these first pages containing only headers is zero.
+
+
+\item
+  The first audio packet of the logical stream begins a fresh Ogg page.
+
+
+\item
+  Packets are placed into ogg pages in order until the end of stream.
+
+
+\item
+  The last page is marked 'end of stream' in the page flags.
+
+
+\item
+  Vorbis packets may span page boundaries.
+
+
+\item
+  The granule position of pages containing Vorbis audio is in units
+  of PCM audio samples (per channel; a stereo stream's granule position
+  does not increment at twice the speed of a mono stream).
+
+
+\item
+  The granule position of a page represents the end PCM sample
+  position of the last packet \emph{completed} on that
+  page.  The 'last PCM sample' is the last complete sample returned by
+  decode, not an internal sample awaiting lapping with a
+  subsequent block.  A page that is entirely spanned by a single
+  packet (that completes on a subsequent page) has no granule
+  position, and the granule position is set to '-1'.
+
+
+  Note that the last decoded (fully lapped) PCM sample from a packet
+  is not necessarily the middle sample from that block. If, eg, the
+  current Vorbis packet encodes a "long block" and the next Vorbis
+  packet encodes a "short block", the last decodable sample from the
+  current packet be at position (3*long\_block\_length/4) -
+  (short\_block\_length/4).
+
+
+\item
+    The granule (PCM) position of the first page need not indicate
+    that the stream started at position zero.  Although the granule
+    position belongs to the last completed packet on the page and a
+    valid granule position must be positive, by
+    inference it may indicate that the PCM position of the beginning
+    of audio is positive or negative.
+
+
+  \begin{itemize}
+    \item
+        A positive starting value simply indicates that this stream begins at
+        some positive time offset, potentially within a larger
+        program. This is a common case when connecting to the middle
+        of broadcast stream.
+
+    \item
+        A negative value indicates that
+        output samples preceeding time zero should be discarded during
+        decoding; this technique is used to allow sample-granularity
+        editing of the stream start time of already-encoded Vorbis
+        streams.  The number of samples to be discarded must not exceed
+        the overlap-add span of the first two audio packets.
+
+  \end{itemize}
+
+
+    In both of these cases in which the initial audio PCM starting
+    offset is nonzero, the second finished audio packet must flush the
+    page on which it appears and the third packet begin a fresh page.
+    This allows the decoder to always be able to perform PCM position
+    adjustments before needing to return any PCM data from synthesis,
+    resulting in correct positioning information without any aditional
+    seeking logic.
+
+
+  \begin{note}
+    Failure to do so should, at worst, cause a
+    decoder implementation to return incorrect positioning information
+    for seeking operations at the very beginning of the stream.
+  \end{note}
+
+
+\item
+  A granule position on the final page in a stream that indicates
+  less audio data than the final packet would normally return is used to
+  end the stream on other than even frame boundaries.  The difference
+  between the actual available data returned and the declared amount
+  indicates how many trailing samples to discard from the decoding
+  process.
+
+\end{itemize}

Added: trunk/vorbis/doc/a2-encapsulation-rtp.tex
===================================================================
--- trunk/vorbis/doc/a2-encapsulation-rtp.tex	                        (rev 0)
+++ trunk/vorbis/doc/a2-encapsulation-rtp.tex	2009-03-06 18:54:13 UTC (rev 15748)
@@ -0,0 +1,9 @@
+% -*- mode: latex; TeX-master: "Vorbis_I_spec"; -*-
+%!TEX root = Vorbis_I_spec.tex
+% $Id$
+\section{Vorbis encapsulation in RTP} \label{vorbis:over:rtp}
+
+% TODO: Include draft-rtp.xml somehow?
+
+Please consult RFC 5215 \textit{``RTP Payload Format for Vorbis Encoded
+    Audio''} for description of how to embed Vorbis audio in an RTP stream.

Added: trunk/vorbis/doc/footer.tex
===================================================================
--- trunk/vorbis/doc/footer.tex	                        (rev 0)
+++ trunk/vorbis/doc/footer.tex	2009-03-06 18:54:13 UTC (rev 15748)
@@ -0,0 +1,33 @@
+% -*- mode: latex; TeX-master: "Vorbis_I_spec"; -*-
+%!TEX root = Vorbis_I_spec.tex
+% $Id$
+\section*{Colophon}
+
+\includegraphics{xifish} \label{footer}
+%\TODO{display xifish.pdf, [Xiph.org logo]}
+
+
+Ogg is a \href{http://www.xiph.org/}{Xiph.org Foundation} effort
+to protect essential tenets of Internet multimedia from corporate
+hostage-taking; Open Source is the net's greatest tool to keep
+everyone honest. See \href{http://www.xiph.org/about.html}{About
+the Xiph.org Foundation} for details.
+
+
+Ogg Vorbis is the first Ogg audio CODEC.  Anyone may freely use and
+distribute the Ogg and Vorbis specification, whether in a private,
+public or corporate capacity.  However, the Xiph.org Foundation and
+the Ogg project (xiph.org) reserve the right to set the Ogg Vorbis
+specification and certify specification compliance.
+
+Xiph.org's Vorbis software CODEC implementation is distributed under a
+BSD-like license.  This does not restrict third parties from
+distributing independent implementations of Vorbis software under
+other licenses.
+
+Ogg, Vorbis, Xiph.org Foundation and their logos are trademarks (tm)
+of the \href{http://www.xiph.org/}{Xiph.org Foundation}.  These
+pages are copyright (C) 1994-2007 Xiph.org Foundation. All rights
+reserved.
+
+This document is set using \LaTeX.
\ No newline at end of file



More information about the commits mailing list