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.
Due to a typo when typesetting this version of the specification from the original HTML document, the Bark scale computation previously erroneously read: