rhubarb-lip-sync/rhubarb/lib/vorbis-1.3.6/doc/Vorbis_I_spec.html

13244 lines
566 KiB
HTML
Raw Normal View History

2018-07-13 20:44:37 +00:00
<!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.tug.org/tex4ht/)">
<meta name="originator" content="TeX4ht (http://www.tug.org/tex4ht/)">
<!-- html -->
<meta name="src" content="Vorbis_I_spec.tex">
<meta name="date" content="2015-02-27 13:18:00">
<link rel="stylesheet" type="text/css" href="Vorbis_I_spec.css">
</head><body
>
<div class="maketitle">
<h2 class="titleHead">Vorbis I specification</h2>
<div class="author" ><span
class="cmr-17">Xiph.Org Foundation</span></div><br />
<div class="date" ><span
class="cmr-17">February 27, 2015</span></div>
</div>
<h3 class="likesectionHead"><a
id="x1-1000"></a>Contents</h3>
<div class="tableofcontents">
&#x00A0;<span class="sectionToc" >1 <a
href="#x1-20001" id="QQ2-1-2">Introduction and Description</a></span>
<br />&#x00A0;&#x00A0;<span class="subsectionToc" >1.1 <a
href="#x1-30001.1" id="QQ2-1-3">Overview</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >1.1.1 <a
href="#x1-40001.1.1" id="QQ2-1-4">Application</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >1.1.2 <a
href="#x1-50001.1.2" id="QQ2-1-5">Classification</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >1.1.3 <a
href="#x1-60001.1.3" id="QQ2-1-6">Assumptions</a></span>
<br />&#x00A0;&#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;&#x00A0;<span class="subsubsectionToc" >1.1.5 <a
href="#x1-90001.1.5" id="QQ2-1-9">Format Specification</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >1.1.6 <a
href="#x1-100001.1.6" id="QQ2-1-10">Hardware Profile</a></span>
<br />&#x00A0;&#x00A0;<span class="subsectionToc" >1.2 <a
href="#x1-110001.2" id="QQ2-1-11">Decoder Configuration</a></span>
<br />&#x00A0;&#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;&#x00A0;<span class="subsubsectionToc" >1.2.2 <a
href="#x1-130001.2.2" id="QQ2-1-14">Mode</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >1.2.3 <a
href="#x1-140001.2.3" id="QQ2-1-15">Mapping</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >1.2.4 <a
href="#x1-150001.2.4" id="QQ2-1-16">Floor</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >1.2.5 <a
href="#x1-160001.2.5" id="QQ2-1-17">Residue</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >1.2.6 <a
href="#x1-170001.2.6" id="QQ2-1-18">Codebooks</a></span>
<br />&#x00A0;&#x00A0;<span class="subsectionToc" >1.3 <a
href="#x1-180001.3" id="QQ2-1-19">High-level Decode Process</a></span>
<br />&#x00A0;&#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;&#x00A0;<span class="subsubsectionToc" >1.3.2 <a
href="#x1-230001.3.2" id="QQ2-1-24">Decode Procedure</a></span>
<br />&#x00A0;<span class="sectionToc" >2 <a
href="#x1-360002" id="QQ2-1-39">Bitpacking Convention</a></span>
<br />&#x00A0;&#x00A0;<span class="subsectionToc" >2.1 <a
href="#x1-370002.1" id="QQ2-1-40">Overview</a></span>
<br />&#x00A0;&#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;&#x00A0;<span class="subsubsectionToc" >2.1.2 <a
href="#x1-390002.1.2" id="QQ2-1-42">bit order</a></span>
<br />&#x00A0;&#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;&#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;&#x00A0;<span class="subsubsectionToc" >2.1.5 <a
href="#x1-420002.1.5" id="QQ2-1-45">signedness</a></span>
<br />&#x00A0;&#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;&#x00A0;<span class="subsubsectionToc" >2.1.7 <a
href="#x1-440002.1.7" id="QQ2-1-47">decoding example</a></span>
<br />&#x00A0;&#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;&#x00A0;<span class="subsubsectionToc" >2.1.9 <a
href="#x1-460002.1.9" id="QQ2-1-49">reading zero bits</a></span>
<br />&#x00A0;<span class="sectionToc" >3 <a
href="#x1-470003" id="QQ2-1-50">Probability Model and Codebooks</a></span>
<br />&#x00A0;&#x00A0;<span class="subsectionToc" >3.1 <a
href="#x1-480003.1" id="QQ2-1-51">Overview</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >3.1.1 <a
href="#x1-490003.1.1" id="QQ2-1-52">Bitwise operation</a></span>
<br />&#x00A0;&#x00A0;<span class="subsectionToc" >3.2 <a
href="#x1-500003.2" id="QQ2-1-53">Packed codebook format</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >3.2.1 <a
href="#x1-510003.2.1" id="QQ2-1-54">codebook decode</a></span>
<br />&#x00A0;&#x00A0;<span class="subsectionToc" >3.3 <a
href="#x1-580003.3" id="QQ2-1-63">Use of the codebook abstraction</a></span>
<br />&#x00A0;<span class="sectionToc" >4 <a
href="#x1-590004" id="QQ2-1-64">Codec Setup and Packet Decode</a></span>
<br />&#x00A0;&#x00A0;<span class="subsectionToc" >4.1 <a
href="#x1-600004.1" id="QQ2-1-65">Overview</a></span>
<br />&#x00A0;&#x00A0;<span class="subsectionToc" >4.2 <a
href="#x1-610004.2" id="QQ2-1-66">Header decode and decode setup</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >4.2.1 <a
href="#x1-620004.2.1" id="QQ2-1-67">Common header decode</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >4.2.2 <a
href="#x1-630004.2.2" id="QQ2-1-68">Identification header</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >4.2.3 <a
href="#x1-640004.2.3" id="QQ2-1-69">Comment header</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >4.2.4 <a
href="#x1-650004.2.4" id="QQ2-1-70">Setup header</a></span>
<br />&#x00A0;&#x00A0;<span class="subsectionToc" >4.3 <a
href="#x1-720004.3" id="QQ2-1-78">Audio packet decode and synthesis</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >4.3.1 <a
href="#x1-730004.3.1" id="QQ2-1-79">packet type, mode and window decode</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >4.3.2 <a
href="#x1-740004.3.2" id="QQ2-1-80">floor curve decode</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >4.3.3 <a
href="#x1-750004.3.3" id="QQ2-1-81">nonzero vector propagate</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >4.3.4 <a
href="#x1-760004.3.4" id="QQ2-1-82">residue decode</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >4.3.5 <a
href="#x1-770004.3.5" id="QQ2-1-83">inverse coupling</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >4.3.6 <a
href="#x1-780004.3.6" id="QQ2-1-84">dot product</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >4.3.7 <a
href="#x1-790004.3.7" id="QQ2-1-85">inverse MDCT</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >4.3.8 <a
href="#x1-800004.3.8" id="QQ2-1-86">overlap_add</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >4.3.9 <a
href="#x1-810004.3.9" id="QQ2-1-87">output channel order</a></span>
<br />&#x00A0;<span class="sectionToc" >5 <a
href="#x1-820005" id="QQ2-1-88">comment field and header specification</a></span>
<br />&#x00A0;&#x00A0;<span class="subsectionToc" >5.1 <a
href="#x1-830005.1" id="QQ2-1-89">Overview</a></span>
<br />&#x00A0;&#x00A0;<span class="subsectionToc" >5.2 <a
href="#x1-840005.2" id="QQ2-1-90">Comment encoding</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >5.2.1 <a
href="#x1-850005.2.1" id="QQ2-1-91">Structure</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >5.2.2 <a
href="#x1-860005.2.2" id="QQ2-1-92">Content vector format</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >5.2.3 <a
href="#x1-890005.2.3" id="QQ2-1-95">Encoding</a></span>
<br />&#x00A0;<span class="sectionToc" >6 <a
href="#x1-900006" id="QQ2-1-96">Floor type 0 setup and decode</a></span>
<br />&#x00A0;&#x00A0;<span class="subsectionToc" >6.1 <a
href="#x1-910006.1" id="QQ2-1-97">Overview</a></span>
<br />&#x00A0;&#x00A0;<span class="subsectionToc" >6.2 <a
href="#x1-920006.2" id="QQ2-1-98">Floor 0 format</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >6.2.1 <a
href="#x1-930006.2.1" id="QQ2-1-99">header decode</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >6.2.2 <a
href="#x1-940006.2.2" id="QQ2-1-100">packet decode</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >6.2.3 <a
href="#x1-950006.2.3" id="QQ2-1-101">curve computation</a></span>
<br />&#x00A0;<span class="sectionToc" >7 <a
href="#x1-970007" id="QQ2-1-103">Floor type 1 setup and decode</a></span>
<br />&#x00A0;&#x00A0;<span class="subsectionToc" >7.1 <a
href="#x1-980007.1" id="QQ2-1-104">Overview</a></span>
<br />&#x00A0;&#x00A0;<span class="subsectionToc" >7.2 <a
href="#x1-990007.2" id="QQ2-1-105">Floor 1 format</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >7.2.1 <a
href="#x1-1000007.2.1" id="QQ2-1-106">model</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >7.2.2 <a
href="#x1-1010007.2.2" id="QQ2-1-111">header decode</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >7.2.3 <a
href="#x1-1020007.2.3" id="QQ2-1-112">packet decode</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >7.2.4 <a
href="#x1-1030007.2.4" id="QQ2-1-113">curve computation</a></span>
<br />&#x00A0;<span class="sectionToc" >8 <a
href="#x1-1040008" id="QQ2-1-114">Residue setup and decode</a></span>
<br />&#x00A0;&#x00A0;<span class="subsectionToc" >8.1 <a
href="#x1-1050008.1" id="QQ2-1-115">Overview</a></span>
<br />&#x00A0;&#x00A0;<span class="subsectionToc" >8.2 <a
href="#x1-1060008.2" id="QQ2-1-116">Residue format</a></span>
<br />&#x00A0;&#x00A0;<span class="subsectionToc" >8.3 <a
href="#x1-1070008.3" id="QQ2-1-118">residue 0</a></span>
<br />&#x00A0;&#x00A0;<span class="subsectionToc" >8.4 <a
href="#x1-1080008.4" id="QQ2-1-119">residue 1</a></span>
<br />&#x00A0;&#x00A0;<span class="subsectionToc" >8.5 <a
href="#x1-1090008.5" id="QQ2-1-120">residue 2</a></span>
<br />&#x00A0;&#x00A0;<span class="subsectionToc" >8.6 <a
href="#x1-1100008.6" id="QQ2-1-122">Residue decode</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >8.6.1 <a
href="#x1-1110008.6.1" id="QQ2-1-123">header decode</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >8.6.2 <a
href="#x1-1120008.6.2" id="QQ2-1-124">packet decode</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >8.6.3 <a
href="#x1-1130008.6.3" id="QQ2-1-125">format 0 specifics</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >8.6.4 <a
href="#x1-1140008.6.4" id="QQ2-1-126">format 1 specifics</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >8.6.5 <a
href="#x1-1150008.6.5" id="QQ2-1-127">format 2 specifics</a></span>
<br />&#x00A0;<span class="sectionToc" >9 <a
href="#x1-1160009" id="QQ2-1-128">Helper equations</a></span>
<br />&#x00A0;&#x00A0;<span class="subsectionToc" >9.1 <a
href="#x1-1170009.1" id="QQ2-1-129">Overview</a></span>
<br />&#x00A0;&#x00A0;<span class="subsectionToc" >9.2 <a
href="#x1-1180009.2" id="QQ2-1-130">Functions</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >9.2.1 <a
href="#x1-1190009.2.1" id="QQ2-1-131">ilog</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >9.2.2 <a
href="#x1-1200009.2.2" id="QQ2-1-132">float32_unpack</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >9.2.3 <a
href="#x1-1210009.2.3" id="QQ2-1-133">lookup1_values</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >9.2.4 <a
href="#x1-1220009.2.4" id="QQ2-1-134">low_neighbor</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >9.2.5 <a
href="#x1-1230009.2.5" id="QQ2-1-135">high_neighbor</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >9.2.6 <a
href="#x1-1240009.2.6" id="QQ2-1-136">render_point</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >9.2.7 <a
href="#x1-1250009.2.7" id="QQ2-1-137">render_line</a></span>
<br />&#x00A0;<span class="sectionToc" >10 <a
href="#x1-12600010" id="QQ2-1-138">Tables</a></span>
<br />&#x00A0;&#x00A0;<span class="subsectionToc" >10.1 <a
href="#x1-12700010.1" id="QQ2-1-139">floor1_inverse_dB_table</a></span>
<br />&#x00A0;<span class="sectionToc" >A <a
href="#x1-128000A" id="QQ2-1-140">Embedding Vorbis into an Ogg stream</a></span>
<br />&#x00A0;&#x00A0;<span class="subsectionToc" >A.1 <a
href="#x1-129000A.1" id="QQ2-1-141">Overview</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >A.1.1 <a
href="#x1-130000A.1.1" id="QQ2-1-142">Restrictions</a></span>
<br />&#x00A0;&#x00A0;&#x00A0;<span class="subsubsectionToc" >A.1.2 <a
href="#x1-131000A.1.2" id="QQ2-1-143">MIME type</a></span>
<br />&#x00A0;&#x00A0;<span class="subsectionToc" >A.2 <a
href="#x1-132000A.2" id="QQ2-1-144">Encapsulation</a></span>
<br />&#x00A0;<span class="sectionToc" >B <a
href="#x1-134000B" id="QQ2-1-146">Vorbis encapsulation in RTP</a></span>
</div>
<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-590004">section&#x00A0;4</a>, &#8220;<a
href="#x1-590004">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>
<!--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-128000A">section&#x00A0;A</a>,
&#8220;<a
href="#x1-128000A">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.
<!--l. 95--><p class="noindent" ><span class="likesubparagraphHead"><a
id="x1-80001.1.4"></a><span
class="cmbx-12">Note:</span></span> Vorbis <span
class="cmti-12">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
arrangement is roughly as follows:
<div class="center"
>
<!--l. 141--><p class="noindent" >
<!--l. 142--><p class="noindent" ><img
src="components.png" alt="PIC"
>
<br /> <div class="caption"
><span class="id">Figure&#x00A0;1: </span><span
class="content">decoder pipeline configuration</span></div><!--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>
<!--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.
<!--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 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-12">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-12">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-820005">section&#x00A0;5</a>, &#8220;<a
href="#x1-820005">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-12">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.
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
1. </dt><dd
class="enumerate-enumitem">decode packet type flag
</dd><dt class="enumerate-enumitem">
2. </dt><dd
class="enumerate-enumitem">decode mode number
</dd><dt class="enumerate-enumitem">
3. </dt><dd
class="enumerate-enumitem">decode window shape (long windows only)
</dd><dt class="enumerate-enumitem">
4. </dt><dd
class="enumerate-enumitem">decode floor
</dd><dt class="enumerate-enumitem">
5. </dt><dd
class="enumerate-enumitem">decode residue into residue vectors
</dd><dt class="enumerate-enumitem">
6. </dt><dd
class="enumerate-enumitem">inverse channel coupling of residue vectors
</dd><dt class="enumerate-enumitem">
7. </dt><dd
class="enumerate-enumitem">generate floor curve from decoded floor data
</dd><dt class="enumerate-enumitem">
8. </dt><dd
class="enumerate-enumitem">compute dot product of floor and residue, producing audio spectrum vector
</dd><dt class="enumerate-enumitem">
9. </dt><dd
class="enumerate-enumitem">inverse monolithic transform of audio spectrum vector, always an MDCT in Vorbis
I
</dd><dt class="enumerate-enumitem">
10. </dt><dd
class="enumerate-enumitem">overlap/add left-hand output of transform with right-hand output of previous frame
</dd><dt class="enumerate-enumitem">
11. </dt><dd
class="enumerate-enumitem">store right hand-data from transform of current frame for future lapping
</dd><dt class="enumerate-enumitem">
12. </dt><dd
class="enumerate-enumitem">if not first frame, return results of overlap/add as audio result of current frame</dd></dl>
<!--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-12">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-12">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-12">a non-audio packet when audio is</span>
<span
class="cmti-12">expected indicates stream corruption or a non-compliant stream. The decoder must ignore the</span>
<span
class="cmti-12">packet 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-12">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.
<!--l. 341--><p class="noindent" ><span class="paragraphHead"><a
id="x1-260001.3.2"></a><span
class="cmbx-12">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" >
<!--l. 357--><p class="noindent" ><img
src="window1.png" alt="PIC"
>
<br /> <div class="caption"
><span class="id">Figure&#x00A0;2: </span><span
class="content">overlap of two equal-sized windows</span></div><!--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" >
<!--l. 365--><p class="noindent" ><img
src="window2.png" alt="PIC"
>
<br /> <div class="caption"
><span class="id">Figure&#x00A0;3: </span><span
class="content">overlap of a long and a short window</span></div><!--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-12">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-12">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-12">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-12">generate floor curve</span></span>
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-12">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-120">~</span>140dB (<span
class="cmsy-10x-x-120">~</span>24 bits unsigned), and the audio spectrum
vector should represent a minimum of 120dB (<span
class="cmsy-10x-x-120">~</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-120">-</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-120">-</span>140dB to +0dB.
Thus, in order to handle full range dynamics, a residue vector may span <span
class="cmsy-10x-x-120">-</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-12">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.
<!--l. 492--><p class="noindent" ><span class="paragraphHead"><a
id="x1-330001.3.2"></a><span
class="cmbx-12">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-12">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-12">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="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#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).
<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
opposite end of the byte. Bits in a byte are numbered from zero at the LSb to <span
class="cmmi-12">n </span>(<span
class="cmmi-12">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-12">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>
<!--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="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;|</span><br class="fancyvrb" /><a
id="x1-43004r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;V</span><br class="fancyvrb" /><a
id="x1-43006r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-43008r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;7</span><span
class="cmtt-8">&#x00A0;6</span><span
class="cmtt-8">&#x00A0;5</span><span
class="cmtt-8">&#x00A0;4</span><span
class="cmtt-8">&#x00A0;3</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;0</span><br class="fancyvrb" /><a
id="x1-43010r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;[0</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;0]</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;&#x003C;-</span><br class="fancyvrb" /><a
id="x1-43012r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;]</span>
<br class="fancyvrb" /><a
id="x1-43014r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;]</span><br class="fancyvrb" /><a
id="x1-43016r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;3</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;]</span><br class="fancyvrb" /><a
id="x1-43018r9"></a><span
class="cmr-6">9</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;...</span><br class="fancyvrb" /><a
id="x1-43020r10"></a><span
class="cmr-6">10</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;n</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;]</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;bytestream</span><span
class="cmtt-8">&#x00A0;length</span><span
class="cmtt-8">&#x00A0;==</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;byte</span><br class="fancyvrb" /><a
id="x1-43022r11"></a><span
class="cmr-6">11</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#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="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;|</span><br class="fancyvrb" /><a
id="x1-43026r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;V</span><br class="fancyvrb" /><a
id="x1-43028r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-43030r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;7</span><span
class="cmtt-8">&#x00A0;6</span><span
class="cmtt-8">&#x00A0;5</span><span
class="cmtt-8">&#x00A0;4</span><span
class="cmtt-8">&#x00A0;3</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;0</span><br class="fancyvrb" /><a
id="x1-43032r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;[0</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;0]</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;&#x003C;-</span><br class="fancyvrb" /><a
id="x1-43034r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;]</span>
<br class="fancyvrb" /><a
id="x1-43036r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;]</span><br class="fancyvrb" /><a
id="x1-43038r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;3</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;]</span><br class="fancyvrb" /><a
id="x1-43040r9"></a><span
class="cmr-6">9</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;...</span><br class="fancyvrb" /><a
id="x1-43042r10"></a><span
class="cmr-6">10</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;n</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;]</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;bytestream</span><span
class="cmtt-8">&#x00A0;length</span><span
class="cmtt-8">&#x00A0;==</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#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" >
<div class="fancyvrb" id="fancyvrb4"><a
id="x1-43044r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;|</span><br class="fancyvrb" /><a
id="x1-43046r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;V</span><br class="fancyvrb" /><a
id="x1-43048r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-43050r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;7</span><span
class="cmtt-8">&#x00A0;6</span><span
class="cmtt-8">&#x00A0;5</span><span
class="cmtt-8">&#x00A0;4</span><span
class="cmtt-8">&#x00A0;3</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;0</span><br class="fancyvrb" /><a
id="x1-43052r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;[1</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;0]</span><br class="fancyvrb" /><a
id="x1-43054r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;[0</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;0]</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;&#x003C;-</span><br class="fancyvrb" /><a
id="x1-43056r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;]</span>
<br class="fancyvrb" /><a
id="x1-43058r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;3</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;]</span><br class="fancyvrb" /><a
id="x1-43060r9"></a><span
class="cmr-6">9</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;...</span><br class="fancyvrb" /><a
id="x1-43062r10"></a><span
class="cmr-6">10</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;n</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;]</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;bytestream</span><span
class="cmtt-8">&#x00A0;length</span><span
class="cmtt-8">&#x00A0;==</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;bytes</span><br class="fancyvrb" /><a
id="x1-43064r11"></a><span
class="cmr-6">11</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;bit</span><span
class="cmtt-8">&#x00A0;cursor</span><span
class="cmtt-8">&#x00A0;==</span><span
class="cmtt-8">&#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="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;|</span><br class="fancyvrb" /><a
id="x1-43068r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;V</span><br class="fancyvrb" /><a
id="x1-43070r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-43072r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;7</span><span
class="cmtt-8">&#x00A0;6</span><span
class="cmtt-8">&#x00A0;5</span><span
class="cmtt-8">&#x00A0;4</span><span
class="cmtt-8">&#x00A0;3</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;0</span><br class="fancyvrb" /><a
id="x1-43074r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;[1</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;0]</span><br class="fancyvrb" /><a
id="x1-43076r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;[0</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;0]</span>
<br class="fancyvrb" /><a
id="x1-43078r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;[1</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;0]</span><br class="fancyvrb" /><a
id="x1-43080r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;3</span><span
class="cmtt-8">&#x00A0;[0</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;0]</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;&#x003C;-</span><br class="fancyvrb" /><a
id="x1-43082r9"></a><span
class="cmr-6">9</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;...</span><br class="fancyvrb" /><a
id="x1-43084r10"></a><span
class="cmr-6">10</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;n</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;]</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;bytestream</span><span
class="cmtt-8">&#x00A0;length</span><span
class="cmtt-8">&#x00A0;==</span><span
class="cmtt-8">&#x00A0;4</span><span
class="cmtt-8">&#x00A0;bytes</span><br class="fancyvrb" /><a
id="x1-43086r11"></a><span
class="cmr-6">11</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#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="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;|</span><br class="fancyvrb" /><a
id="x1-44004r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;V</span><br class="fancyvrb" /><a
id="x1-44006r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-44008r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;7</span><span
class="cmtt-8">&#x00A0;6</span><span
class="cmtt-8">&#x00A0;5</span><span
class="cmtt-8">&#x00A0;4</span><span
class="cmtt-8">&#x00A0;3</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;0</span><br class="fancyvrb" /><a
id="x1-44010r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;[1</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;0]</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;&#x003C;-</span>
<br class="fancyvrb" /><a
id="x1-44012r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;[0</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;0]</span><br class="fancyvrb" /><a
id="x1-44014r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;[1</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;0]</span><br class="fancyvrb" /><a
id="x1-44016r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;3</span><span
class="cmtt-8">&#x00A0;[0</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;0]</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;bytestream</span><span
class="cmtt-8">&#x00A0;length</span><span
class="cmtt-8">&#x00A0;==</span><span
class="cmtt-8">&#x00A0;4</span><span
class="cmtt-8">&#x00A0;bytes</span><br class="fancyvrb" /><a
id="x1-44018r9"></a><span
class="cmr-6">9</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#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
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;.
<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</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</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" >
<div class="fancyvrb" id="fancyvrb7"><a
id="x1-51002r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;0:</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;]</span><span
class="cmtt-8">&#x00A0;(0x42)</span><br class="fancyvrb" /><a
id="x1-51004r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;1:</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;]</span><span
class="cmtt-8">&#x00A0;(0x43)</span><br class="fancyvrb" /><a
id="x1-51006r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;2:</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;]</span><span
class="cmtt-8">&#x00A0;(0x56)</span></div>
<!--l. 44--><p class="noindent" >16 bit <span
class="cmtt-12">[codebook_dimensions] </span>and 24 bit <span
class="cmtt-12">[codebook_entries] </span>fields:
<!--l. 46--><p class="noindent" >
<div class="fancyvrb" id="fancyvrb8"><a
id="x1-51008r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-51010r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;3:</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;]</span><br class="fancyvrb" /><a
id="x1-51012r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;4:</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;]</span><span
class="cmtt-8">&#x00A0;[codebook_dimensions]</span><span
class="cmtt-8">&#x00A0;(16</span><span
class="cmtt-8">&#x00A0;bit</span><span
class="cmtt-8">&#x00A0;unsigned)</span><br class="fancyvrb" /><a
id="x1-51014r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-51016r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;5:</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;]</span><br class="fancyvrb" /><a
id="x1-51018r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;6:</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;]</span><br class="fancyvrb" /><a
id="x1-51020r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;7:</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;]</span><span
class="cmtt-8">&#x00A0;[codebook_entries]</span><span
class="cmtt-8">&#x00A0;(24</span><span
class="cmtt-8">&#x00A0;bit</span><span
class="cmtt-8">&#x00A0;unsigned)</span><br class="fancyvrb" /><a
id="x1-51022r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span></div>
<!--l. 57--><p class="noindent" >Next is the <span
class="cmtt-12">[ordered] </span>bit flag:
<!--l. 59--><p class="noindent" >
<div class="fancyvrb" id="fancyvrb9"><a
id="x1-51024r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-51026r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;8:</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;]</span><span
class="cmtt-8">&#x00A0;[ordered]</span><span
class="cmtt-8">&#x00A0;(1</span><span
class="cmtt-8">&#x00A0;bit)</span><br class="fancyvrb" /><a
id="x1-51028r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span></div>
<!--l. 65--><p class="noindent" >Each entry, numbering a total of <span
class="cmtt-12">[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-12">[codebook_codeword_lengths]</span>. Decode of lengths is according to whether the <span
class="cmtt-12">[ordered] </span>flag
is set or unset.
<ul class="itemize1">
<li class="itemize">If the <span
class="cmtt-12">[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-12">[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="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;byte</span><span
class="cmtt-8">&#x00A0;8:</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;X</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;]</span><span
class="cmtt-8">&#x00A0;[sparse]</span><span
class="cmtt-8">&#x00A0;flag</span><span
class="cmtt-8">&#x00A0;(1</span><span
class="cmtt-8">&#x00A0;bit)</span></div>
<!--l. 86--><p class="noindent" >The decoder now performs for each of the <span
class="cmtt-12">[codebook_entries] </span>codebook entries:
<!--l. 89--><p class="noindent" >
<div class="fancyvrb" id="fancyvrb11"><a
id="x1-51032r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-51034r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1)</span><span
class="cmtt-8">&#x00A0;if([sparse]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;set)</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span><br class="fancyvrb" /><a
id="x1-51036r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-51038r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2)</span><span
class="cmtt-8">&#x00A0;[flag]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;one</span><span
class="cmtt-8">&#x00A0;bit;</span><br class="fancyvrb" /><a
id="x1-51040r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;3)</span><span
class="cmtt-8">&#x00A0;if([flag]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;set)</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span><br class="fancyvrb" /><a
id="x1-51042r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-51044r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;4)</span><span
class="cmtt-8">&#x00A0;[length]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;a</span><span
class="cmtt-8">&#x00A0;five</span><span
class="cmtt-8">&#x00A0;bit</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer;</span><br class="fancyvrb" /><a
id="x1-51046r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;5)</span><span
class="cmtt-8">&#x00A0;codeword</span><span
class="cmtt-8">&#x00A0;length</span><span
class="cmtt-8">&#x00A0;for</span><span
class="cmtt-8">&#x00A0;this</span><span
class="cmtt-8">&#x00A0;entry</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;[length]+1;</span><br class="fancyvrb" /><a
id="x1-51048r9"></a><span
class="cmr-6">9</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-51050r10"></a><span
class="cmr-6">10</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><span
class="cmtt-8">&#x00A0;else</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span><br class="fancyvrb" /><a
id="x1-51052r11"></a><span
class="cmr-6">11</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-51054r12"></a><span
class="cmr-6">12</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;6)</span><span
class="cmtt-8">&#x00A0;this</span><span
class="cmtt-8">&#x00A0;entry</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;unused.</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;mark</span><span
class="cmtt-8">&#x00A0;it</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;such.</span><br class="fancyvrb" /><a
id="x1-51056r13"></a><span
class="cmr-6">13</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-51058r14"></a><span
class="cmr-6">14</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><br class="fancyvrb" /><a
id="x1-51060r15"></a><span
class="cmr-6">15</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-51062r16"></a><span
class="cmr-6">16</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><span
class="cmtt-8">&#x00A0;else</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;sparse</span><span
class="cmtt-8">&#x00A0;flag</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;not</span><span
class="cmtt-8">&#x00A0;set</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span>
<br class="fancyvrb" /><a
id="x1-51064r17"></a><span
class="cmr-6">17</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-51066r18"></a><span
class="cmr-6">18</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;7)</span><span
class="cmtt-8">&#x00A0;[length]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;a</span><span
class="cmtt-8">&#x00A0;five</span><span
class="cmtt-8">&#x00A0;bit</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer;</span><br class="fancyvrb" /><a
id="x1-51068r19"></a><span
class="cmr-6">19</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;8)</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;codeword</span><span
class="cmtt-8">&#x00A0;length</span><span
class="cmtt-8">&#x00A0;for</span><span
class="cmtt-8">&#x00A0;this</span><span
class="cmtt-8">&#x00A0;entry</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;[length]+1;</span><br class="fancyvrb" /><a
id="x1-51070r20"></a><span
class="cmr-6">20</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-51072r21"></a><span
class="cmr-6">21</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><br class="fancyvrb" /><a
id="x1-51074r22"></a><span
class="cmr-6">22</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span></div>
</li>
<li class="itemize">If the <span
class="cmtt-12">[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="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1)</span><span
class="cmtt-8">&#x00A0;[current_entry]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;0;</span><br class="fancyvrb" /><a
id="x1-51078r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2)</span><span
class="cmtt-8">&#x00A0;[current_length]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;a</span><span
class="cmtt-8">&#x00A0;five</span><span
class="cmtt-8">&#x00A0;bit</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span><span
class="cmtt-8">&#x00A0;and</span><span
class="cmtt-8">&#x00A0;add</span><span
class="cmtt-8">&#x00A0;1;</span>
<br class="fancyvrb" /><a
id="x1-51080r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;3)</span><span
class="cmtt-8">&#x00A0;[number]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;</span><a
href="#x1-1190009.2.1"><span
class="cmtt-8">ilog</span></a><span
class="cmtt-8">([codebook_entries]</span><span
class="cmtt-8">&#x00A0;-</span><span
class="cmtt-8">&#x00A0;[current_entry])</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;an</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span>
<br class="fancyvrb" /><a
id="x1-51082r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;4)</span><span
class="cmtt-8">&#x00A0;set</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;entries</span><span
class="cmtt-8">&#x00A0;[current_entry]</span><span
class="cmtt-8">&#x00A0;through</span><span
class="cmtt-8">&#x00A0;[current_entry]+[number]-1,</span><span
class="cmtt-8">&#x00A0;inclusive,</span>
<br class="fancyvrb" /><a
id="x1-51084r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;of</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;[codebook_codeword_lengths]</span><span
class="cmtt-8">&#x00A0;array</span><span
class="cmtt-8">&#x00A0;to</span><span
class="cmtt-8">&#x00A0;[current_length]</span>
<br class="fancyvrb" /><a
id="x1-51086r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;5)</span><span
class="cmtt-8">&#x00A0;set</span><span
class="cmtt-8">&#x00A0;[current_entry]</span><span
class="cmtt-8">&#x00A0;to</span><span
class="cmtt-8">&#x00A0;[number]</span><span
class="cmtt-8">&#x00A0;+</span><span
class="cmtt-8">&#x00A0;[current_entry]</span><br class="fancyvrb" /><a
id="x1-51088r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;6)</span><span
class="cmtt-8">&#x00A0;increment</span><span
class="cmtt-8">&#x00A0;[current_length]</span><span
class="cmtt-8">&#x00A0;by</span><span
class="cmtt-8">&#x00A0;1</span>
<br class="fancyvrb" /><a
id="x1-51090r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;7)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;[current_entry]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;greater</span><span
class="cmtt-8">&#x00A0;than</span><span
class="cmtt-8">&#x00A0;[codebook_entries]</span><span
class="cmtt-8">&#x00A0;ERROR</span><span
class="cmtt-8">&#x00A0;CONDITION;</span><br class="fancyvrb" /><a
id="x1-51092r9"></a><span
class="cmr-6">9</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;decoder</span><span
class="cmtt-8">&#x00A0;will</span><span
class="cmtt-8">&#x00A0;not</span><span
class="cmtt-8">&#x00A0;be</span><span
class="cmtt-8">&#x00A0;able</span><span
class="cmtt-8">&#x00A0;to</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;this</span><span
class="cmtt-8">&#x00A0;stream.</span>
<br class="fancyvrb" /><a
id="x1-51094r10"></a><span
class="cmr-6">10</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;8)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;[current_entry]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;less</span><span
class="cmtt-8">&#x00A0;than</span><span
class="cmtt-8">&#x00A0;[codebook_entries],</span><span
class="cmtt-8">&#x00A0;repeat</span><span
class="cmtt-8">&#x00A0;process</span><span
class="cmtt-8">&#x00A0;starting</span><span
class="cmtt-8">&#x00A0;at</span><span
class="cmtt-8">&#x00A0;3)</span><br class="fancyvrb" /><a
id="x1-51096r11"></a><span
class="cmr-6">11</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;9)</span><span
class="cmtt-8">&#x00A0;done.</span></div>
</li></ul>
<!--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:
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
1. </dt><dd
class="enumerate-enumitem">No lookup
</dd><dt class="enumerate-enumitem">
2. </dt><dd
class="enumerate-enumitem">Implicitly populated value mapping (lattice VQ)
</dd><dt class="enumerate-enumitem">
3. </dt><dd
class="enumerate-enumitem">Explicitly populated value mapping (tessellated or &#8217;foam&#8217; VQ)</dd></dl>
<!--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-51101r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1)</span><span
class="cmtt-8">&#x00A0;[codebook_lookup_type]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;four</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;an</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span></div>
<!--l. 154--><p class="noindent" >Codebook decode precedes according to <span
class="cmtt-12">[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-12">[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-51103r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1)</span><span
class="cmtt-8">&#x00A0;[codebook_minimum_value]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;</span><a
href="#x1-1200009.2.2"><span
class="cmtt-8">float32_unpack</span></a><span
class="cmtt-8">(</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;32</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;an</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer)</span>
<br class="fancyvrb" /><a
id="x1-51105r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2)</span><span
class="cmtt-8">&#x00A0;[codebook_delta_value]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;</span><a
href="#x1-1200009.2.2"><span
class="cmtt-8">float32_unpack</span></a><span
class="cmtt-8">(</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;32</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;an</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer)</span>
<br class="fancyvrb" /><a
id="x1-51107r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;3)</span><span
class="cmtt-8">&#x00A0;[codebook_value_bits]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;4</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;an</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span><span
class="cmtt-8">&#x00A0;and</span><span
class="cmtt-8">&#x00A0;add</span><span
class="cmtt-8">&#x00A0;1</span><br class="fancyvrb" /><a
id="x1-51109r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;4)</span><span
class="cmtt-8">&#x00A0;[codebook_sequence_p]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;bit</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;a</span><span
class="cmtt-8">&#x00A0;boolean</span><span
class="cmtt-8">&#x00A0;flag</span><br class="fancyvrb" /><a
id="x1-51111r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-51113r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;(</span><span
class="cmtt-8">&#x00A0;[codebook_lookup_type]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;)</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span><br class="fancyvrb" /><a
id="x1-51115r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-51117r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;5)</span><span
class="cmtt-8">&#x00A0;[codebook_lookup_values]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;</span><a
href="#x1-1210009.2.3"><span
class="cmtt-8">lookup1_values</span></a><span
class="cmtt-8">([codebook_entries],</span><span
class="cmtt-8">&#x00A0;[codebook_dimensions]</span><span
class="cmtt-8">&#x00A0;)</span>
<br class="fancyvrb" /><a
id="x1-51119r9"></a><span
class="cmr-6">9</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-51121r10"></a><span
class="cmr-6">10</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><span
class="cmtt-8">&#x00A0;else</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span><br class="fancyvrb" /><a
id="x1-51123r11"></a><span
class="cmr-6">11</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-51125r12"></a><span
class="cmr-6">12</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;6)</span><span
class="cmtt-8">&#x00A0;[codebook_lookup_values]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[codebook_entries]</span><span
class="cmtt-8">&#x00A0;*</span><span
class="cmtt-8">&#x00A0;[codebook_dimensions]</span><br class="fancyvrb" /><a
id="x1-51127r13"></a><span
class="cmr-6">13</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-51129r14"></a><span
class="cmr-6">14</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><br class="fancyvrb" /><a
id="x1-51131r15"></a><span
class="cmr-6">15</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-51133r16"></a><span
class="cmr-6">16</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;7)</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;a</span><span
class="cmtt-8">&#x00A0;total</span><span
class="cmtt-8">&#x00A0;of</span><span
class="cmtt-8">&#x00A0;[codebook_lookup_values]</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integers</span><span
class="cmtt-8">&#x00A0;of</span><span
class="cmtt-8">&#x00A0;[codebook_value_bits]</span><span
class="cmtt-8">&#x00A0;each;</span>
<br class="fancyvrb" /><a
id="x1-51135r17"></a><span
class="cmr-6">17</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;store</span><span
class="cmtt-8">&#x00A0;these</span><span
class="cmtt-8">&#x00A0;in</span><span
class="cmtt-8">&#x00A0;order</span><span
class="cmtt-8">&#x00A0;in</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;array</span><span
class="cmtt-8">&#x00A0;[codebook_multiplicands]</span></div>
</li>
<li class="itemize">A <span
class="cmtt-12">[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-12">Huffman decision tree representation</span></span>
The <span
class="cmtt-12">[codebook_codeword_lengths] </span>array and <span
class="cmtt-12">[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="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;entry</span><span
class="cmtt-8">&#x00A0;0:</span><span
class="cmtt-8">&#x00A0;length</span><span
class="cmtt-8">&#x00A0;2</span><br class="fancyvrb" /><a
id="x1-52004r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;entry</span><span
class="cmtt-8">&#x00A0;1:</span><span
class="cmtt-8">&#x00A0;length</span><span
class="cmtt-8">&#x00A0;4</span><br class="fancyvrb" /><a
id="x1-52006r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;entry</span><span
class="cmtt-8">&#x00A0;2:</span><span
class="cmtt-8">&#x00A0;length</span><span
class="cmtt-8">&#x00A0;4</span><br class="fancyvrb" /><a
id="x1-52008r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;entry</span><span
class="cmtt-8">&#x00A0;3:</span><span
class="cmtt-8">&#x00A0;length</span><span
class="cmtt-8">&#x00A0;4</span><br class="fancyvrb" /><a
id="x1-52010r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;entry</span><span
class="cmtt-8">&#x00A0;4:</span><span
class="cmtt-8">&#x00A0;length</span><span
class="cmtt-8">&#x00A0;4</span><br class="fancyvrb" /><a
id="x1-52012r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;entry</span><span
class="cmtt-8">&#x00A0;5:</span><span
class="cmtt-8">&#x00A0;length</span><span
class="cmtt-8">&#x00A0;2</span>
<br class="fancyvrb" /><a
id="x1-52014r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;entry</span><span
class="cmtt-8">&#x00A0;6:</span><span
class="cmtt-8">&#x00A0;length</span><span
class="cmtt-8">&#x00A0;3</span><br class="fancyvrb" /><a
id="x1-52016r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;entry</span><span
class="cmtt-8">&#x00A0;7:</span><span
class="cmtt-8">&#x00A0;length</span><span
class="cmtt-8">&#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="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;entry</span><span
class="cmtt-8">&#x00A0;0:</span><span
class="cmtt-8">&#x00A0;length</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;codeword</span><span
class="cmtt-8">&#x00A0;00</span><br class="fancyvrb" /><a
id="x1-52020r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;entry</span><span
class="cmtt-8">&#x00A0;1:</span><span
class="cmtt-8">&#x00A0;length</span><span
class="cmtt-8">&#x00A0;4</span><span
class="cmtt-8">&#x00A0;codeword</span><span
class="cmtt-8">&#x00A0;0100</span><br class="fancyvrb" /><a
id="x1-52022r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;entry</span><span
class="cmtt-8">&#x00A0;2:</span><span
class="cmtt-8">&#x00A0;length</span><span
class="cmtt-8">&#x00A0;4</span><span
class="cmtt-8">&#x00A0;codeword</span><span
class="cmtt-8">&#x00A0;0101</span><br class="fancyvrb" /><a
id="x1-52024r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;entry</span><span
class="cmtt-8">&#x00A0;3:</span><span
class="cmtt-8">&#x00A0;length</span><span
class="cmtt-8">&#x00A0;4</span><span
class="cmtt-8">&#x00A0;codeword</span><span
class="cmtt-8">&#x00A0;0110</span>
<br class="fancyvrb" /><a
id="x1-52026r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;entry</span><span
class="cmtt-8">&#x00A0;4:</span><span
class="cmtt-8">&#x00A0;length</span><span
class="cmtt-8">&#x00A0;4</span><span
class="cmtt-8">&#x00A0;codeword</span><span
class="cmtt-8">&#x00A0;0111</span><br class="fancyvrb" /><a
id="x1-52028r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;entry</span><span
class="cmtt-8">&#x00A0;5:</span><span
class="cmtt-8">&#x00A0;length</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;codeword</span><span
class="cmtt-8">&#x00A0;10</span><br class="fancyvrb" /><a
id="x1-52030r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;entry</span><span
class="cmtt-8">&#x00A0;6:</span><span
class="cmtt-8">&#x00A0;length</span><span
class="cmtt-8">&#x00A0;3</span><span
class="cmtt-8">&#x00A0;codeword</span><span
class="cmtt-8">&#x00A0;110</span><br class="fancyvrb" /><a
id="x1-52032r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;entry</span><span
class="cmtt-8">&#x00A0;7:</span><span
class="cmtt-8">&#x00A0;length</span><span
class="cmtt-8">&#x00A0;3</span><span
class="cmtt-8">&#x00A0;codeword</span><span
class="cmtt-8">&#x00A0;111</span></div>
<!--l. 235--><p class="noindent" ><span class="likesubparagraphHead"><a
id="x1-530003.2.1"></a><span
class="cmbx-12">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" >
<!--l. 248--><p class="noindent" ><img
src="hufftree.png" alt="PIC"
>
<br /> <div class="caption"
><span class="id">Figure&#x00A0;4: </span><span
class="content">huffman tree illustration</span></div><!--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" >
<!--l. 261--><p class="noindent" ><img
src="hufftree-under.png" alt="PIC"
>
<br /> <div class="caption"
><span class="id">Figure&#x00A0;5: </span><span
class="content">underspecified huffman tree illustration</span></div><!--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. 276--><p class="noindent" ><span class="paragraphHead"><a
id="x1-540003.2.1"></a><span
class="cmbx-12">Errata 20150226: Single entry codebooks</span></span>
A &#8217;single-entry codebook&#8217; is a codebook with one active codeword entry. A single-entry codebook
may be either a fully populated codebook with only one declared entry, or a sparse codebook
with only one entry marked used. The Vorbis I spec provides no means to specify a codeword
length of zero, and as a result, a single-entry codebook is inherently malformed because it is
underpopulated. The original specification did not address directly the matter of single-entry
codebooks; they were implicitly illegal as it was not possible to write such a codebook with a
valid tree structure.
<!--l. 288--><p class="noindent" >In r14811 of the libvorbis reference implementation, Xiph added an additional check to the
codebook implementation to reject underpopulated Huffman trees. This change led to the
discovery of single-entry books used &#8217;in the wild&#8217; when the new, stricter checks rejected a number
of apparently working streams.
<!--l. 294--><p class="noindent" >In order to minimize breakage of deployed (if technically erroneous) streams, r16073 of the
reference implementation explicitly special-cased single-entry codebooks to tolerate the
single-entry case. Commit r16073 also added the following to the specification:
<!--l. 303--><p class="noindent" >&#8220;<span class="sout">Take special care that a codebook with a single used entry is handled properly; it consists of a
single codework of zero bits and reading a value out of such a codebook always returns the single
used value and sinks zero bits. </span>&#8221;
<!--l. 305--><p class="noindent" >The intent was to clarify the spec and codify current practice. However, this addition is
erroneously at odds with the intent of preserving usability of existing streams using single-entry
codebooks, disagrees with the code changes that reinstated decoding, and does not address how
single-entry codebooks should be encoded.
<!--l. 311--><p class="noindent" >As such, the above addition made in r16037 is struck from the specification and replaced by the
following:
<!--l. 330--><p class="noindent" >
<div class="quote">
<!--l. 330--><p class="noindent" >It is possible to declare a Vorbis codebook containing a single codework
entry. A single-entry codebook may be either a fully populated codebook with
<span
class="cmtt-12">[codebook_entries] </span>set to 1, or a sparse codebook marking only one entry
used. Note that it is not possible to also encode a <span
class="cmtt-12">[codeword_length] </span>of zero
for the single used codeword, as the unsigned value written to the stream
is <span
class="cmtt-12">[codeword_length]-1</span>. Instead, encoder implementations should indicate a
<span
class="cmtt-12">[codeword_length] </span>of 1 and &#8217;write&#8217; the codeword to a stream during audio
encoding by writing a single zero bit.
<!--l. 330--><p class="noindent" >Decoder implementations shall reject a codebook if it contains only one used
entry and the encoded <span
class="cmtt-12">[codeword_length] </span>of that entry is not 1. &#8217;Reading&#8217; a
value from single-entry codebook always returns the single used codeword value
and sinks one bit. Decoders should tolerate that the bit read from the stream
be &#8217;1&#8217; instead of &#8217;0&#8217;; both values shall return the single used codeword.</div>
<!--l. 332--><p class="noindent" ><span class="paragraphHead"><a
id="x1-550003.2.1"></a><span
class="cmbx-12">VQ lookup table vector representation</span></span>
Unpacking the VQ lookup table vectors relies on the following values:
<div class="fancyvrb" id="fancyvrb17"><a
id="x1-55002r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;[codebook\_multiplicands]</span><span
class="cmtt-8">&#x00A0;array</span><br class="fancyvrb" /><a
id="x1-55004r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;[codebook\_minimum\_value]</span><br class="fancyvrb" /><a
id="x1-55006r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;[codebook\_delta\_value]</span><br class="fancyvrb" /><a
id="x1-55008r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;[codebook\_sequence\_p]</span>
<br class="fancyvrb" /><a
id="x1-55010r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;[codebook\_lookup\_type]</span><br class="fancyvrb" /><a
id="x1-55012r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;[codebook\_entries]</span><br class="fancyvrb" /><a
id="x1-55014r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;[codebook\_dimensions]</span><br class="fancyvrb" /><a
id="x1-55016r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;[codebook\_lookup\_values]</span></div>
<!--l. 348--><p class="noindent" >Decoding (unpacking) a specific vector in the vector lookup table proceeds according to
<span
class="cmtt-12">[codebook_lookup_type]</span>. The unpacked vector values are what a codebook would return
during audio packet decode in a VQ context.
<!--l. 353--><p class="noindent" ><span class="paragraphHead"><a
id="x1-560003.2.1"></a><span
class="cmbx-12">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-12">[codebook_multiplicands] </span>as follows (<span
class="cmtt-12">[value_vector] </span>is the output
vector representing the vector of values for entry number <span
class="cmtt-12">[lookup_offset] </span>in this
codebook):
<!--l. 362--><p class="noindent" >
<div class="fancyvrb" id="fancyvrb18"><a
id="x1-56002r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1)</span><span
class="cmtt-8">&#x00A0;[last]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;0;</span><br class="fancyvrb" /><a
id="x1-56004r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2)</span><span
class="cmtt-8">&#x00A0;[index_divisor]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;1;</span><br class="fancyvrb" /><a
id="x1-56006r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;3)</span><span
class="cmtt-8">&#x00A0;iterate</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;over</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;range</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;...</span><span
class="cmtt-8">&#x00A0;[codebook_dimensions]-1</span><span
class="cmtt-8">&#x00A0;(once</span><span
class="cmtt-8">&#x00A0;for</span><span
class="cmtt-8">&#x00A0;each</span><span
class="cmtt-8">&#x00A0;scalar</span><span
class="cmtt-8">&#x00A0;value</span><span
class="cmtt-8">&#x00A0;in</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;value</span><span
class="cmtt-8">&#x00A0;vector)</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span>
<br class="fancyvrb" /><a
id="x1-56008r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-56010r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;4)</span><span
class="cmtt-8">&#x00A0;[multiplicand_offset]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;(</span><span
class="cmtt-8">&#x00A0;[lookup_offset]</span><span
class="cmtt-8">&#x00A0;divided</span><span
class="cmtt-8">&#x00A0;by</span><span
class="cmtt-8">&#x00A0;[index_divisor]</span><span
class="cmtt-8">&#x00A0;using</span><span
class="cmtt-8">&#x00A0;integer</span>
<br class="fancyvrb" /><a
id="x1-56012r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;division</span><span
class="cmtt-8">&#x00A0;)</span><span
class="cmtt-8">&#x00A0;integer</span><span
class="cmtt-8">&#x00A0;modulo</span><span
class="cmtt-8">&#x00A0;[codebook_lookup_values]</span><br class="fancyvrb" /><a
id="x1-56014r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-56016r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;5)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[value_vector]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;=</span>
<br class="fancyvrb" /><a
id="x1-56018r9"></a><span
class="cmr-6">9</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;(</span><span
class="cmtt-8">&#x00A0;[codebook_multiplicands]</span><span
class="cmtt-8">&#x00A0;array</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;number</span><span
class="cmtt-8">&#x00A0;[multiplicand_offset]</span><span
class="cmtt-8">&#x00A0;)</span><span
class="cmtt-8">&#x00A0;*</span>
<br class="fancyvrb" /><a
id="x1-56020r10"></a><span
class="cmr-6">10</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;[codebook_delta_value]</span><span
class="cmtt-8">&#x00A0;+</span><span
class="cmtt-8">&#x00A0;[codebook_minimum_value]</span><span
class="cmtt-8">&#x00A0;+</span><span
class="cmtt-8">&#x00A0;[last];</span><br class="fancyvrb" /><a
id="x1-56022r11"></a><span
class="cmr-6">11</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-56024r12"></a><span
class="cmr-6">12</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;6)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;(</span><span
class="cmtt-8">&#x00A0;[codebook_sequence_p]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;set</span><span
class="cmtt-8">&#x00A0;)</span><span
class="cmtt-8">&#x00A0;then</span><span
class="cmtt-8">&#x00A0;set</span><span
class="cmtt-8">&#x00A0;[last]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[value_vector]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[i]</span><br class="fancyvrb" /><a
id="x1-56026r13"></a><span
class="cmr-6">13</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-56028r14"></a><span
class="cmr-6">14</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;7)</span><span
class="cmtt-8">&#x00A0;[index_divisor]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[index_divisor]</span><span
class="cmtt-8">&#x00A0;*</span><span
class="cmtt-8">&#x00A0;[codebook_lookup_values]</span><br class="fancyvrb" /><a
id="x1-56030r15"></a><span
class="cmr-6">15</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-56032r16"></a><span
class="cmr-6">16</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><br class="fancyvrb" /><a
id="x1-56034r17"></a><span
class="cmr-6">17</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-56036r18"></a><span
class="cmr-6">18</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;8)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;calculation</span><span
class="cmtt-8">&#x00A0;completed.</span></div>
<!--l. 385--><p class="noindent" ><span class="paragraphHead"><a
id="x1-570003.2.1"></a><span
class="cmbx-12">Vector value decode: Lookup type 2</span></span>
Lookup type two specifies a VQ lookup table in which each scalar in each vector is explicitly set
by the <span
class="cmtt-12">[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-12">[codebook_multiplicands] </span>as follows
(<span
class="cmtt-12">[value_vector] </span>is the output vector representing the vector of values for entry number
<span
class="cmtt-12">[lookup_offset] </span>in this codebook):
<!--l. 395--><p class="noindent" >
<div class="fancyvrb" id="fancyvrb19"><a
id="x1-57002r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1)</span><span
class="cmtt-8">&#x00A0;[last]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;0;</span><br class="fancyvrb" /><a
id="x1-57004r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2)</span><span
class="cmtt-8">&#x00A0;[multiplicand_offset]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[lookup_offset]</span><span
class="cmtt-8">&#x00A0;*</span><span
class="cmtt-8">&#x00A0;[codebook_dimensions]</span>
<br class="fancyvrb" /><a
id="x1-57006r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;3)</span><span
class="cmtt-8">&#x00A0;iterate</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;over</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;range</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;...</span><span
class="cmtt-8">&#x00A0;[codebook_dimensions]-1</span><span
class="cmtt-8">&#x00A0;(once</span><span
class="cmtt-8">&#x00A0;for</span><span
class="cmtt-8">&#x00A0;each</span><span
class="cmtt-8">&#x00A0;scalar</span><span
class="cmtt-8">&#x00A0;value</span><span
class="cmtt-8">&#x00A0;in</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;value</span><span
class="cmtt-8">&#x00A0;vector)</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span><br class="fancyvrb" /><a
id="x1-57008r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-57010r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;4)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[value_vector]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;=</span><br class="fancyvrb" /><a
id="x1-57012r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;(</span><span
class="cmtt-8">&#x00A0;[codebook_multiplicands]</span><span
class="cmtt-8">&#x00A0;array</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;number</span><span
class="cmtt-8">&#x00A0;[multiplicand_offset]</span><span
class="cmtt-8">&#x00A0;)</span><span
class="cmtt-8">&#x00A0;*</span>
<br class="fancyvrb" /><a
id="x1-57014r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;[codebook_delta_value]</span><span
class="cmtt-8">&#x00A0;+</span><span
class="cmtt-8">&#x00A0;[codebook_minimum_value]</span><span
class="cmtt-8">&#x00A0;+</span><span
class="cmtt-8">&#x00A0;[last];</span><br class="fancyvrb" /><a
id="x1-57016r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-57018r9"></a><span
class="cmr-6">9</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;5)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;(</span><span
class="cmtt-8">&#x00A0;[codebook_sequence_p]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;set</span><span
class="cmtt-8">&#x00A0;)</span><span
class="cmtt-8">&#x00A0;then</span><span
class="cmtt-8">&#x00A0;set</span><span
class="cmtt-8">&#x00A0;[last]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[value_vector]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[i]</span><br class="fancyvrb" /><a
id="x1-57020r10"></a><span
class="cmr-6">10</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-57022r11"></a><span
class="cmr-6">11</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;6)</span><span
class="cmtt-8">&#x00A0;increment</span><span
class="cmtt-8">&#x00A0;[multiplicand_offset]</span><br class="fancyvrb" /><a
id="x1-57024r12"></a><span
class="cmr-6">12</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-57026r13"></a><span
class="cmr-6">13</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><br class="fancyvrb" /><a
id="x1-57028r14"></a><span
class="cmr-6">14</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-57030r15"></a><span
class="cmr-6">15</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;7)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;calculation</span><span
class="cmtt-8">&#x00A0;completed.</span></div>
<!--l. 421--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">3.3. </span> <a
id="x1-580003.3"></a>Use of the codebook abstraction</h4>
<!--l. 423--><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. 433--><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. 440--><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 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. 452--><p class="noindent" >When used in a scalar context, the resulting codeword entry is the desired return
value.
<!--l. 455--><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.
<h3 class="sectionHead"><span class="titlemark">4. </span> <a
id="x1-590004"></a>Codec Setup and Packet Decode</h3>
<!--l. 7--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">4.1. </span> <a
id="x1-600004.1"></a>Overview</h4>
<!--l. 9--><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</a>, &#8220;<a
href="#x1-20001">Introduction and Description<!--tex4ht:ref: vorbis:spec:intro --></a>&#8221;. <a
href="#x1-360002">section&#x00A0;2</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. 17--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">4.2. </span> <a
id="x1-610004.2"></a>Header decode and decode setup</h4>
<!--l. 19--><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. 26--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">4.2.1. </span> <a
id="x1-620004.2.1"></a>Common header decode</h5>
<!--l. 28--><p class="noindent" >Each header packet begins with the same header fields.
<!--l. 31--><p class="noindent" >
<div class="fancyvrb" id="fancyvrb20"><a
id="x1-62002r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1)</span><span
class="cmtt-8">&#x00A0;[packet_type]</span><span
class="cmtt-8">&#x00A0;:</span><span
class="cmtt-8">&#x00A0;8</span><span
class="cmtt-8">&#x00A0;bit</span><span
class="cmtt-8">&#x00A0;value</span><br class="fancyvrb" /><a
id="x1-62004r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2)</span><span
class="cmtt-8">&#x00A0;0x76,</span><span
class="cmtt-8">&#x00A0;0x6f,</span><span
class="cmtt-8">&#x00A0;0x72,</span><span
class="cmtt-8">&#x00A0;0x62,</span><span
class="cmtt-8">&#x00A0;0x69,</span><span
class="cmtt-8">&#x00A0;0x73:</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;characters</span><span
class="cmtt-8">&#x00A0;&#8217;v&#8217;,&#8217;o&#8217;,&#8217;r&#8217;,&#8217;b&#8217;,&#8217;i&#8217;,&#8217;s&#8217;</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;six</span><span
class="cmtt-8">&#x00A0;octets</span></div>
<!--l. 36--><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.
<!--l. 44--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">4.2.2. </span> <a
id="x1-630004.2.2"></a>Identification header</h5>
<!--l. 46--><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. 51--><p class="noindent" >
<div class="fancyvrb" id="fancyvrb21"><a
id="x1-63002r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1)</span><span
class="cmtt-8">&#x00A0;[vorbis_version]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;32</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span><br class="fancyvrb" /><a
id="x1-63004r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2)</span><span
class="cmtt-8">&#x00A0;[audio_channels]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;8</span><span
class="cmtt-8">&#x00A0;bit</span><span
class="cmtt-8">&#x00A0;integer</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;unsigned</span>
<br class="fancyvrb" /><a
id="x1-63006r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;3)</span><span
class="cmtt-8">&#x00A0;[audio_sample_rate]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;32</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span><br class="fancyvrb" /><a
id="x1-63008r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;4)</span><span
class="cmtt-8">&#x00A0;[bitrate_maximum]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;32</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;signed</span><span
class="cmtt-8">&#x00A0;integer</span>
<br class="fancyvrb" /><a
id="x1-63010r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;5)</span><span
class="cmtt-8">&#x00A0;[bitrate_nominal]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;32</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;signed</span><span
class="cmtt-8">&#x00A0;integer</span><br class="fancyvrb" /><a
id="x1-63012r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;6)</span><span
class="cmtt-8">&#x00A0;[bitrate_minimum]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;32</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;signed</span><span
class="cmtt-8">&#x00A0;integer</span>
<br class="fancyvrb" /><a
id="x1-63014r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;7)</span><span
class="cmtt-8">&#x00A0;[blocksize_0]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;exponent</span><span
class="cmtt-8">&#x00A0;(read</span><span
class="cmtt-8">&#x00A0;4</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer)</span><br class="fancyvrb" /><a
id="x1-63016r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;8)</span><span
class="cmtt-8">&#x00A0;[blocksize_1]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;exponent</span><span
class="cmtt-8">&#x00A0;(read</span><span
class="cmtt-8">&#x00A0;4</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer)</span>
<br class="fancyvrb" /><a
id="x1-63018r9"></a><span
class="cmr-6">9</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;9)</span><span
class="cmtt-8">&#x00A0;[framing_flag]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;one</span><span
class="cmtt-8">&#x00A0;bit</span></div>
<!--l. 63--><p class="noindent" ><span
class="cmtt-12">[vorbis_version] </span>is to read &#8217;0&#8217; in order to be compatible with this document. Both
<span
class="cmtt-12">[audio_channels] </span>and <span
class="cmtt-12">[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-12">[blocksize_0]</span>
must be less than or equal to <span
class="cmtt-12">[blocksize_1]</span>. The framing bit must be nonzero. Failure to meet
any of these conditions renders a stream undecodable.
<!--l. 71--><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. 85--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">4.2.3. </span> <a
id="x1-640004.2.3"></a>Comment header</h5>
<!--l. 86--><p class="noindent" >Comment header decode and data specification is covered in <a
href="#x1-820005">section&#x00A0;5</a>, &#8220;<a
href="#x1-820005">comment field and
header specification<!--tex4ht:ref: vorbis:spec:comment --></a>&#8221;.
<!--l. 90--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">4.2.4. </span> <a
id="x1-650004.2.4"></a>Setup header</h5>
<!--l. 92--><p class="noindent" >Vorbis codec setup is configurable to an extreme degree:
<div class="center"
>
<!--l. 94--><p class="noindent" >
<!--l. 95--><p class="noindent" ><img
src="components.png" alt="PIC"
>
<br /> <div class="caption"
><span class="id">Figure&#x00A0;6: </span><span
class="content">decoder pipeline configuration</span></div><!--tex4ht:label?: x1-650016 -->
</div>
<!--l. 100--><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. 108--><p class="noindent" ><span class="paragraphHead"><a
id="x1-660004.2.4"></a><span
class="cmbx-12">Codebooks</span></span>
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
1. </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[vorbis_codebook_count] </span>= read eight bits as unsigned integer and add one
</dd><dt class="enumerate-enumitem">
2. </dt><dd
class="enumerate-enumitem">Decode <span
class="cmtt-12">[vorbis_codebook_count] </span>codebooks in order as defined in <a
href="#x1-470003">section&#x00A0;3</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-12">[vorbis_codebook_configurations]</span>.</dd></dl>
<!--l. 120--><p class="noindent" ><span class="paragraphHead"><a
id="x1-670004.2.4"></a><span
class="cmbx-12">Time domain transforms</span></span>
These hooks are placeholders in Vorbis I. Nevertheless, the configuration placeholder values must
be read to maintain bitstream sync.
<!--l. 127--><p class="noindent" >
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
1. </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[vorbis_time_count] </span>= read 6 bits as unsigned integer and add one
</dd><dt class="enumerate-enumitem">
2. </dt><dd
class="enumerate-enumitem">read <span
class="cmtt-12">[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.</dd></dl>
<!--l. 133--><p class="noindent" ><span class="paragraphHead"><a
id="x1-680004.2.4"></a><span
class="cmbx-12">Floors</span></span>
Vorbis uses two floor types; header decode is handed to the decode abstraction of the appropriate
type.
<!--l. 139--><p class="noindent" >
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
1. </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[vorbis_floor_count] </span>= read 6 bits as unsigned integer and add one
</dd><dt class="enumerate-enumitem">
2. </dt><dd
class="enumerate-enumitem">For each <span
class="cmtt-12">[i] </span>of <span
class="cmtt-12">[vorbis_floor_count] </span>floor numbers:
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
a) </dt><dd
class="enumerate-enumitem">read the floor type: vector <span
class="cmtt-12">[vorbis_floor_types] </span>element <span
class="cmtt-12">[i] </span>= read 16 bits
as unsigned integer
</dd><dt class="enumerate-enumitem">
b) </dt><dd
class="enumerate-enumitem">If the floor type is zero, decode the floor configuration as defined in <a
href="#x1-900006">section&#x00A0;6</a>,
&#8220;<a
href="#x1-900006">Floor type 0 setup and decode<!--tex4ht:ref: vorbis:spec:floor0 --></a>&#8221;; save this configuration in slot <span
class="cmtt-12">[i] </span>of the floor
configuration array <span
class="cmtt-12">[vorbis_floor_configurations]</span>.
</dd><dt class="enumerate-enumitem">
c) </dt><dd
class="enumerate-enumitem">If the floor type is one, decode the floor configuration as defined in <a
href="#x1-970007">section&#x00A0;7</a>,
&#8220;<a
href="#x1-970007">Floor type 1 setup and decode<!--tex4ht:ref: vorbis:spec:floor1 --></a>&#8221;; save this configuration in slot <span
class="cmtt-12">[i] </span>of the floor
configuration array <span
class="cmtt-12">[vorbis_floor_configurations]</span>.
</dd><dt class="enumerate-enumitem">
d) </dt><dd
class="enumerate-enumitem">If the the floor type is greater than one, this stream is undecodable; ERROR
CONDITION</dd></dl>
</dd></dl>
<!--l. 157--><p class="noindent" ><span class="paragraphHead"><a
id="x1-690004.2.4"></a><span
class="cmbx-12">Residues</span></span>
Vorbis uses three residue types; header decode of each type is identical.
<!--l. 163--><p class="noindent" >
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
1. </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[vorbis_residue_count] </span>= read 6 bits as unsigned integer and add one
</dd><dt class="enumerate-enumitem">
2. </dt><dd
class="enumerate-enumitem">For each of <span
class="cmtt-12">[vorbis_residue_count] </span>residue numbers:
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
a) </dt><dd
class="enumerate-enumitem">read the residue type; vector <span
class="cmtt-12">[vorbis_residue_types] </span>element <span
class="cmtt-12">[i] </span>= read 16
bits as unsigned integer
</dd><dt class="enumerate-enumitem">
b) </dt><dd
class="enumerate-enumitem">If the residue type is zero, one or two, decode the residue configuration as defined
in <a
href="#x1-1040008">section&#x00A0;8</a>, &#8220;<a
href="#x1-1040008">Residue setup and decode<!--tex4ht:ref: vorbis:spec:residue --></a>&#8221;; save this configuration in slot <span
class="cmtt-12">[i] </span>of
the residue configuration array <span
class="cmtt-12">[vorbis_residue_configurations]</span>.
</dd><dt class="enumerate-enumitem">
c) </dt><dd
class="enumerate-enumitem">If the the residue type is greater than two, this stream is undecodable; ERROR
CONDITION</dd></dl>
</dd></dl>
<!--l. 177--><p class="noindent" ><span class="paragraphHead"><a
id="x1-700004.2.4"></a><span
class="cmbx-12">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. 188--><p class="noindent" >
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
1. </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[vorbis_mapping_count] </span>= read 6 bits as unsigned integer and add one
</dd><dt class="enumerate-enumitem">
2. </dt><dd
class="enumerate-enumitem">For each <span
class="cmtt-12">[i] </span>of <span
class="cmtt-12">[vorbis_mapping_count] </span>mapping numbers:
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
a) </dt><dd
class="enumerate-enumitem">read the mapping type: 16 bits as unsigned integer. There&#8217;s no reason to save
the mapping type in Vorbis I.
</dd><dt class="enumerate-enumitem">
b) </dt><dd
class="enumerate-enumitem">If the mapping type is nonzero, the stream is undecodable
</dd><dt class="enumerate-enumitem">
c) </dt><dd
class="enumerate-enumitem">If the mapping type is zero:
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
i. </dt><dd
class="enumerate-enumitem">read 1 bit as a boolean flag
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
A. </dt><dd
class="enumerate-enumitem">if set, <span
class="cmtt-12">[vorbis_mapping_submaps] </span>= read 4 bits as unsigned integer
and add one
</dd><dt class="enumerate-enumitem">
B. </dt><dd
class="enumerate-enumitem">if unset, <span
class="cmtt-12">[vorbis_mapping_submaps] </span>= 1</dd></dl>
</dd><dt class="enumerate-enumitem">
ii. </dt><dd
class="enumerate-enumitem">read 1 bit as a boolean flag
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
A. </dt><dd
class="enumerate-enumitem">if set, square polar channel mapping is in use:
<ul class="itemize1">
<li class="itemize"><span
class="cmtt-12">[vorbis_mapping_coupling_steps] </span>= read 8 bits as unsigned
integer and add one
</li>
<li class="itemize">for <span
class="cmtt-12">[j] </span>each of <span
class="cmtt-12">[vorbis_mapping_coupling_steps] </span>steps:
<ul class="itemize2">
<li class="itemize">vector <span
class="cmtt-12">[vorbis_mapping_magnitude] </span>element <span
class="cmtt-12">[j]</span>= read
<a
href="#x1-1190009.2.1">ilog</a>(<span
class="cmtt-12">[audio_channels] </span>- 1) bits as unsigned integer
</li>
<li class="itemize">vector <span
class="cmtt-12">[vorbis_mapping_angle] </span>element <span
class="cmtt-12">[j]</span>= read
<a
href="#x1-1190009.2.1">ilog</a>(<span
class="cmtt-12">[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-12">[audio_channels]</span>-1, or
the angle channel is greater than <span
class="cmtt-12">[audio_channels]</span>-1, the stream
is undecodable.</li></ul>
</li></ul>
</dd><dt class="enumerate-enumitem">
B. </dt><dd
class="enumerate-enumitem">if unset, <span
class="cmtt-12">[vorbis_mapping_coupling_steps] </span>= 0</dd></dl>
</dd><dt class="enumerate-enumitem">
iii. </dt><dd
class="enumerate-enumitem">read 2 bits (reserved field); if the value is nonzero, the stream is undecodable
</dd><dt class="enumerate-enumitem">
iv. </dt><dd
class="enumerate-enumitem">if <span
class="cmtt-12">[vorbis_mapping_submaps] </span>is greater than one, we read channel multiplex
settings. For each <span
class="cmtt-12">[j] </span>of <span
class="cmtt-12">[audio_channels] </span>channels:
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
A. </dt><dd
class="enumerate-enumitem">vector <span
class="cmtt-12">[vorbis_mapping_mux] </span>element <span
class="cmtt-12">[j] </span>= read 4 bits as unsigned
integer
</dd><dt class="enumerate-enumitem">
B. </dt><dd
class="enumerate-enumitem">if the value is greater than the highest numbered submap
(<span
class="cmtt-12">[vorbis_mapping_submaps] </span>- 1), this in an error condition rendering
the stream undecodable</dd></dl>
</dd><dt class="enumerate-enumitem">
v. </dt><dd
class="enumerate-enumitem">for each submap <span
class="cmtt-12">[j] </span>of <span
class="cmtt-12">[vorbis_mapping_submaps] </span>submaps, read the floor and
residue numbers for use in decoding that submap:
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
A. </dt><dd
class="enumerate-enumitem">read and discard 8 bits (the unused time configuration placeholder)
</dd><dt class="enumerate-enumitem">
B. </dt><dd
class="enumerate-enumitem">read 8 bits as unsigned integer for the floor number; save in vector
<span
class="cmtt-12">[vorbis_mapping_submap_floor] </span>element <span
class="cmtt-12">[j]</span>
</dd><dt class="enumerate-enumitem">
C. </dt><dd
class="enumerate-enumitem">verify the floor number is not greater than the highest number floor
configured for the bitstream. If it is, the bitstream is undecodable
</dd><dt class="enumerate-enumitem">
D. </dt><dd
class="enumerate-enumitem">read 8 bits as unsigned integer for the residue number; save in vector
<span
class="cmtt-12">[vorbis_mapping_submap_residue] </span>element <span
class="cmtt-12">[j]</span>
</dd><dt class="enumerate-enumitem">
E. </dt><dd
class="enumerate-enumitem">verify the residue number is not greater than the highest number residue
configured for the bitstream. If it is, the bitstream is undecodable</dd></dl>
</dd><dt class="enumerate-enumitem">
vi. </dt><dd
class="enumerate-enumitem">save this mapping configuration in slot <span
class="cmtt-12">[i] </span>of the mapping configuration array
<span
class="cmtt-12">[vorbis_mapping_configurations]</span>.</dd></dl>
</dd></dl>
</dd></dl>
<!--l. 247--><p class="noindent" ><span class="paragraphHead"><a
id="x1-710004.2.4"></a><span
class="cmbx-12">Modes</span></span>
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
1. </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[vorbis_mode_count] </span>= read 6 bits as unsigned integer and add one
</dd><dt class="enumerate-enumitem">
2. </dt><dd
class="enumerate-enumitem">For each of <span
class="cmtt-12">[vorbis_mode_count] </span>mode numbers:
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
a) </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[vorbis_mode_blockflag] </span>= read 1 bit
</dd><dt class="enumerate-enumitem">
b) </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[vorbis_mode_windowtype] </span>= read 16 bits as unsigned integer
</dd><dt class="enumerate-enumitem">
c) </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[vorbis_mode_transformtype] </span>= read 16 bits as unsigned integer
</dd><dt class="enumerate-enumitem">
d) </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[vorbis_mode_mapping] </span>= read 8 bits as unsigned integer
</dd><dt class="enumerate-enumitem">
e) </dt><dd
class="enumerate-enumitem">verify ranges; zero is the only legal value in
Vorbis I for <span
class="cmtt-12">[vorbis_mode_windowtype] </span>and <span
class="cmtt-12">[vorbis_mode_transformtype]</span>.
<span
class="cmtt-12">[vorbis_mode_mapping] </span>must not be greater than the highest number mapping
in use. Any illegal values render the stream undecodable.
</dd><dt class="enumerate-enumitem">
f) </dt><dd
class="enumerate-enumitem">save this mode configuration in slot <span
class="cmtt-12">[i] </span>of the mode configuration array
<span
class="cmtt-12">[vorbis_mode_configurations]</span>.</dd></dl>
</dd><dt class="enumerate-enumitem">
3. </dt><dd
class="enumerate-enumitem">read 1 bit as a framing flag. If unset, a framing error occurred and the stream is not
decodable.</dd></dl>
<!--l. 268--><p class="noindent" >After reading mode descriptions, setup header decode is complete.
<!--l. 277--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">4.3. </span> <a
id="x1-720004.3"></a>Audio packet decode and synthesis</h4>
<!--l. 279--><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-12">A non-audio packet when audio is</span>
<span
class="cmti-12">expected indicates stream corruption or a non-compliant stream. The decoder must ignore the</span>
<span
class="cmti-12">packet and not attempt decoding it to audio</span>.
<!--l. 286--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">4.3.1. </span> <a
id="x1-730004.3.1"></a>packet type, mode and window decode</h5>
<!--l. 289--><p class="noindent" >
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
1. </dt><dd
class="enumerate-enumitem">read 1 bit <span
class="cmtt-12">[packet_type]</span>; check that packet type is 0 (audio)
</dd><dt class="enumerate-enumitem">
2. </dt><dd
class="enumerate-enumitem">read <a
href="#x1-1190009.2.1">ilog</a>([vorbis_mode_count]-1) bits <span
class="cmtt-12">[mode_number]</span>
</dd><dt class="enumerate-enumitem">
3. </dt><dd
class="enumerate-enumitem">decode blocksize <span
class="cmtt-12">[n] </span>is equal to <span
class="cmtt-12">[blocksize_0] </span>if <span
class="cmtt-12">[vorbis_mode_blockflag] </span>is 0,
else <span
class="cmtt-12">[n] </span>is equal to <span
class="cmtt-12">[blocksize_1]</span>.
</dd><dt class="enumerate-enumitem">
4. </dt><dd
class="enumerate-enumitem">perform window selection and setup; this window is used later by the inverse
MDCT:
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
a) </dt><dd
class="enumerate-enumitem">if this is a long window (the <span
class="cmtt-12">[vorbis_mode_blockflag] </span>flag of this mode is
set):
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
i. </dt><dd
class="enumerate-enumitem">read 1 bit for <span
class="cmtt-12">[previous_window_flag]</span>
</dd><dt class="enumerate-enumitem">
ii. </dt><dd
class="enumerate-enumitem">read 1 bit for <span
class="cmtt-12">[next_window_flag]</span>
</dd><dt class="enumerate-enumitem">
iii. </dt><dd
class="enumerate-enumitem">if <span
class="cmtt-12">[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="#paragraph.1" >paragraph&#x00A0;<a
href="#x1-260001.3.2">1.3.2</a></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.
</dd><dt class="enumerate-enumitem">
iv. </dt><dd
class="enumerate-enumitem">if <span
class="cmtt-12">[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</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.</dd></dl>
</dd><dt class="enumerate-enumitem">
b) </dt><dd
class="enumerate-enumitem">if this is a short window, the window is always the same short-window
shape.</dd></dl>
</dd></dl>
<!--l. 321--><p class="noindent" >Vorbis windows all use the slope function <span
class="cmmi-12">y </span>= sin(<img
src="Vorbis_I_spec1x.png" alt="&#x03C0;
2" class="frac" align="middle"> <span
class="cmsy-10x-x-120">*</span> sin <sup><span
class="cmr-8">2</span></sup>((<span
class="cmmi-12">x </span>+ 0<span
class="cmmi-12">.</span>5)<span
class="cmmi-12">&#x2215;n </span><span
class="cmsy-10x-x-120">* </span><span
class="cmmi-12">&#x03C0;</span>)), where <span
class="cmmi-12">n </span>is window
size and <span
class="cmmi-12">x </span>ranges 0<span
class="cmmi-12">&#x2026;</span><span
class="cmmi-12">n</span><span
class="cmsy-10x-x-120">- </span>1, but dissimilar lapping requirements can affect overall shape. Window
generation proceeds as follows:
<!--l. 327--><p class="noindent" >
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
1. </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[window_center] </span>= <span
class="cmtt-12">[n] </span>/ 2
</dd><dt class="enumerate-enumitem">
2. </dt><dd
class="enumerate-enumitem">if (<span
class="cmtt-12">[vorbis_mode_blockflag] </span>is set and <span
class="cmtt-12">[previous_window_flag] </span>is not set)
then
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
a) </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[left_window_start] </span>= <span
class="cmtt-12">[n]</span>/4 - <span
class="cmtt-12">[blocksize_0]</span>/4
</dd><dt class="enumerate-enumitem">
b) </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[left_window_end] </span>= <span
class="cmtt-12">[n]</span>/4 + <span
class="cmtt-12">[blocksize_0]</span>/4
</dd><dt class="enumerate-enumitem">
c) </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[left_n] </span>= <span
class="cmtt-12">[blocksize_0]</span>/2</dd></dl>
<!--l. 336--><p class="noindent" >else
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
a) </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[left_window_start] </span>= 0
</dd><dt class="enumerate-enumitem">
b) </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[left_window_end] </span>= <span
class="cmtt-12">[window_center]</span>
</dd><dt class="enumerate-enumitem">
c) </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[left_n] </span>= <span
class="cmtt-12">[n]</span>/2</dd></dl>
</dd><dt class="enumerate-enumitem">
3. </dt><dd
class="enumerate-enumitem">if (<span
class="cmtt-12">[vorbis_mode_blockflag] </span>is set and <span
class="cmtt-12">[next_window_flag] </span>is not set) then
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
a) </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[right_window_start] </span>= <span
class="cmtt-12">[n]*3</span>/4 - <span
class="cmtt-12">[blocksize_0]</span>/4
</dd><dt class="enumerate-enumitem">
b) </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[right_window_end] </span>= <span
class="cmtt-12">[n]*3</span>/4 + <span
class="cmtt-12">[blocksize_0]</span>/4
</dd><dt class="enumerate-enumitem">
c) </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[right_n] </span>= <span
class="cmtt-12">[blocksize_0]</span>/2</dd></dl>
<!--l. 352--><p class="noindent" >else
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
a) </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[right_window_start] </span>= <span
class="cmtt-12">[window_center]</span>
</dd><dt class="enumerate-enumitem">
b) </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[right_window_end] </span>= <span
class="cmtt-12">[n]</span>
</dd><dt class="enumerate-enumitem">
c) </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[right_n] </span>= <span
class="cmtt-12">[n]</span>/2</dd></dl>
</dd><dt class="enumerate-enumitem">
4. </dt><dd
class="enumerate-enumitem">window from range 0 ... <span
class="cmtt-12">[left_window_start]</span>-1 inclusive is zero
</dd><dt class="enumerate-enumitem">
5. </dt><dd
class="enumerate-enumitem">for <span
class="cmtt-12">[i] </span>in range <span
class="cmtt-12">[left_window_start] </span>... <span
class="cmtt-12">[left_window_end]</span>-1, window(<span
class="cmtt-12">[i]</span>) =
sin(<img
src="Vorbis_I_spec2x.png" alt="&#x03C0;
2" class="frac" align="middle"> <span
class="cmsy-10x-x-120">*</span> sin <sup><span
class="cmr-8">2</span></sup>( (<span
class="cmtt-12">[i]</span>-<span
class="cmtt-12">[left_window_start]</span>+0.5) / <span
class="cmtt-12">[left_n] </span><span
class="cmsy-10x-x-120">*</span><img
src="Vorbis_I_spec3x.png" alt="&#x03C0;
2" class="frac" align="middle">) )
</dd><dt class="enumerate-enumitem">
6. </dt><dd
class="enumerate-enumitem">window from range <span
class="cmtt-12">[left_window_end] </span>... <span
class="cmtt-12">[right_window_start]</span>-1 inclusive is
one
</dd><dt class="enumerate-enumitem">
7. </dt><dd
class="enumerate-enumitem">for <span
class="cmtt-12">[i] </span>in range <span
class="cmtt-12">[right_window_start] </span>... <span
class="cmtt-12">[right_window_end]</span>-1, window(<span
class="cmtt-12">[i]</span>) =
sin(<img
src="Vorbis_I_spec4x.png" alt="&#x03C0;2" class="frac" align="middle"> <span
class="cmsy-10x-x-120">*</span> sin <sup><span
class="cmr-8">2</span></sup>( (<span
class="cmtt-12">[i]</span>-<span
class="cmtt-12">[right_window_start]</span>+0.5) / <span
class="cmtt-12">[right_n] </span><span
class="cmsy-10x-x-120">*</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">) )
</dd><dt class="enumerate-enumitem">
8. </dt><dd
class="enumerate-enumitem">window from range <span
class="cmtt-12">[right_window_start] </span>... <span
class="cmtt-12">[n]</span>-1 is zero</dd></dl>
<!--l. 368--><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. 375--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">4.3.2. </span> <a
id="x1-740004.3.2"></a>floor curve decode</h5>
<!--l. 377--><p class="noindent" >From this point on, we assume out decode context is using mode number <span
class="cmtt-12">[mode_number]</span>
from configuration array <span
class="cmtt-12">[vorbis_mode_configurations] </span>and the map number
<span
class="cmtt-12">[vorbis_mode_mapping] </span>(specified by the current mode) taken from the mapping configuration
array <span
class="cmtt-12">[vorbis_mapping_configurations]</span>.
<!--l. 384--><p class="noindent" >Floor curves are decoded one-by-one in channel order.
<!--l. 386--><p class="noindent" >For each floor <span
class="cmtt-12">[i] </span>of <span
class="cmtt-12">[audio_channels]</span>
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
1. </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[submap_number] </span>= element <span
class="cmtt-12">[i] </span>of vector [vorbis_mapping_mux]
</dd><dt class="enumerate-enumitem">
2. </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[floor_number] </span>= element <span
class="cmtt-12">[submap_number] </span>of vector [vorbis_submap_floor]
</dd><dt class="enumerate-enumitem">
3. </dt><dd
class="enumerate-enumitem">if the floor type of this floor (vector
<span
class="cmtt-12">[vorbis_floor_types] </span>element <span
class="cmtt-12">[floor_number]</span>) is zero then decode the floor for
channel <span
class="cmtt-12">[i] </span>according to the <a
href="#x1-940006.2.2">subsubsection&#x00A0;6.2.2</a>, &#8220;<a
href="#x1-940006.2.2">packet decode<!--tex4ht:ref: vorbis:spec:floor0-decode --></a>&#8221;
</dd><dt class="enumerate-enumitem">
4. </dt><dd
class="enumerate-enumitem">if the type of this floor is one then decode the floor for channel <span
class="cmtt-12">[i] </span>according to the
<a
href="#x1-1020007.2.3">subsubsection&#x00A0;7.2.3</a>, &#8220;<a
href="#x1-1020007.2.3">packet decode<!--tex4ht:ref: vorbis:spec:floor1-decode --></a>&#8221;
</dd><dt class="enumerate-enumitem">
5. </dt><dd
class="enumerate-enumitem">save the needed decoded floor information for channel for later synthesis
</dd><dt class="enumerate-enumitem">
6. </dt><dd
class="enumerate-enumitem">if the decoded floor returned &#8217;unused&#8217;, set vector <span
class="cmtt-12">[no_residue] </span>element <span
class="cmtt-12">[i] </span>to true,
else set vector <span
class="cmtt-12">[no_residue] </span>element <span
class="cmtt-12">[i] </span>to false</dd></dl>
<!--l. 406--><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. 412--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">4.3.3. </span> <a
id="x1-750004.3.3"></a>nonzero vector propagate</h5>
<!--l. 414--><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. 421--><p class="noindent" >for each <span
class="cmtt-12">[i] </span>from 0 ... <span
class="cmtt-12">[vorbis_mapping_coupling_steps]</span>-1
<!--l. 424--><p class="noindent" >
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
1. </dt><dd
class="enumerate-enumitem">if either <span
class="cmtt-12">[no_residue] </span>entry for channel (<span
class="cmtt-12">[vorbis_mapping_magnitude] </span>element
<span
class="cmtt-12">[i]</span>) or channel (<span
class="cmtt-12">[vorbis_mapping_angle] </span>element <span
class="cmtt-12">[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.</dd></dl>
<!--l. 436--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">4.3.4. </span> <a
id="x1-760004.3.4"></a>residue decode</h5>
<!--l. 438--><p class="noindent" >Unlike floors, which are decoded in channel order, the residue vectors are decoded in submap
order.
<!--l. 441--><p class="noindent" >for each submap <span
class="cmtt-12">[i] </span>in order from 0 ... <span
class="cmtt-12">[vorbis_mapping_submaps]</span>-1
<!--l. 444--><p class="noindent" >
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
1. </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[ch] </span>= 0
</dd><dt class="enumerate-enumitem">
2. </dt><dd
class="enumerate-enumitem">for each channel <span
class="cmtt-12">[j] </span>in order from 0 ... <span
class="cmtt-12">[audio_channels] </span>- 1
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
a) </dt><dd
class="enumerate-enumitem">if channel <span
class="cmtt-12">[j] </span>in submap <span
class="cmtt-12">[i] </span>(vector <span
class="cmtt-12">[vorbis_mapping_mux] </span>element <span
class="cmtt-12">[j] </span>is equal to
<span
class="cmtt-12">[i]</span>)
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
i. </dt><dd
class="enumerate-enumitem">if vector <span
class="cmtt-12">[no_residue] </span>element <span
class="cmtt-12">[j] </span>is true
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
A. </dt><dd
class="enumerate-enumitem">vector <span
class="cmtt-12">[do_not_decode_flag] </span>element <span
class="cmtt-12">[ch] </span>is set</dd></dl>
<!--l. 453--><p class="noindent" >else
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
A. </dt><dd
class="enumerate-enumitem">vector <span
class="cmtt-12">[do_not_decode_flag] </span>element <span
class="cmtt-12">[ch] </span>is unset</dd></dl>
</dd><dt class="enumerate-enumitem">
ii. </dt><dd
class="enumerate-enumitem">increment <span
class="cmtt-12">[ch]</span></dd></dl>
</dd></dl>
</dd><dt class="enumerate-enumitem">
3. </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[residue_number] </span>= vector <span
class="cmtt-12">[vorbis_mapping_submap_residue] </span>element <span
class="cmtt-12">[i]</span>
</dd><dt class="enumerate-enumitem">
4. </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[residue_type] </span>= vector <span
class="cmtt-12">[vorbis_residue_types] </span>element <span
class="cmtt-12">[residue_number]</span>
</dd><dt class="enumerate-enumitem">
5. </dt><dd
class="enumerate-enumitem">decode <span
class="cmtt-12">[ch] </span>vectors using residue <span
class="cmtt-12">[residue_number]</span>, according to type <span
class="cmtt-12">[residue_type]</span>,
also passing vector <span
class="cmtt-12">[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-12">[n]</span>/2.
</dd><dt class="enumerate-enumitem">
6. </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[ch] </span>= 0
</dd><dt class="enumerate-enumitem">
7. </dt><dd
class="enumerate-enumitem">for each channel <span
class="cmtt-12">[j] </span>in order from 0 ... <span
class="cmtt-12">[audio_channels]</span>
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
a) </dt><dd
class="enumerate-enumitem">if channel <span
class="cmtt-12">[j] </span>is in submap <span
class="cmtt-12">[i] </span>(vector <span
class="cmtt-12">[vorbis_mapping_mux] </span>element <span
class="cmtt-12">[j] </span>is equal
to <span
class="cmtt-12">[i]</span>)
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
i. </dt><dd
class="enumerate-enumitem">residue vector for channel <span
class="cmtt-12">[j] </span>is set to decoded residue vector <span
class="cmtt-12">[ch]</span>
</dd><dt class="enumerate-enumitem">
ii. </dt><dd
class="enumerate-enumitem">increment <span
class="cmtt-12">[ch]</span></dd></dl>
</dd></dl>
</dd></dl>
<!--l. 480--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">4.3.5. </span> <a
id="x1-770004.3.5"></a>inverse coupling</h5>
<!--l. 482--><p class="noindent" >for each <span
class="cmtt-12">[i] </span>from <span
class="cmtt-12">[vorbis_mapping_coupling_steps]</span>-1 descending to 0
<!--l. 485--><p class="noindent" >
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
1. </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[magnitude_vector] </span>= the residue vector for channel (vector
<span
class="cmtt-12">[vorbis_mapping_magnitude] </span>element <span
class="cmtt-12">[i]</span>)
</dd><dt class="enumerate-enumitem">
2. </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[angle_vector] </span>= the residue vector for channel (vector <span
class="cmtt-12">[vorbis_mapping_angle]</span>
element <span
class="cmtt-12">[i]</span>)
</dd><dt class="enumerate-enumitem">
3. </dt><dd
class="enumerate-enumitem">for each scalar value <span
class="cmtt-12">[M] </span>in vector <span
class="cmtt-12">[magnitude_vector] </span>and the corresponding scalar value
<span
class="cmtt-12">[A] </span>in vector <span
class="cmtt-12">[angle_vector]</span>:
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
a) </dt><dd
class="enumerate-enumitem">if (<span
class="cmtt-12">[M] </span>is greater than zero)
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
i. </dt><dd
class="enumerate-enumitem">if (<span
class="cmtt-12">[A] </span>is greater than zero)
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
A. </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[new_M] </span>= <span
class="cmtt-12">[M]</span>
</dd><dt class="enumerate-enumitem">
B. </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[new_A] </span>= <span
class="cmtt-12">[M]</span>-<span
class="cmtt-12">[A]</span></dd></dl>
<!--l. 498--><p class="noindent" >else
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
A. </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[new_A] </span>= <span
class="cmtt-12">[M]</span>
</dd><dt class="enumerate-enumitem">
B. </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[new_M] </span>= <span
class="cmtt-12">[M]</span>+<span
class="cmtt-12">[A]</span></dd></dl>
</dd></dl>
<!--l. 505--><p class="noindent" >else
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
i. </dt><dd
class="enumerate-enumitem">if (<span
class="cmtt-12">[A] </span>is greater than zero)
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
A. </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[new_M] </span>= <span
class="cmtt-12">[M]</span>
</dd><dt class="enumerate-enumitem">
B. </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[new_A] </span>= <span
class="cmtt-12">[M]</span>+<span
class="cmtt-12">[A]</span></dd></dl>
<!--l. 512--><p class="noindent" >else
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
A. </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[new_A] </span>= <span
class="cmtt-12">[M]</span>
</dd><dt class="enumerate-enumitem">
B. </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[new_M] </span>= <span
class="cmtt-12">[M]</span>-<span
class="cmtt-12">[A]</span></dd></dl>
</dd></dl>
</dd><dt class="enumerate-enumitem">
b) </dt><dd
class="enumerate-enumitem">set scalar value <span
class="cmtt-12">[M] </span>in vector <span
class="cmtt-12">[magnitude_vector] </span>to <span
class="cmtt-12">[new_M]</span>
</dd><dt class="enumerate-enumitem">
c) </dt><dd
class="enumerate-enumitem">set scalar value <span
class="cmtt-12">[A] </span>in vector <span
class="cmtt-12">[angle_vector] </span>to <span
class="cmtt-12">[new_A]</span></dd></dl>
</dd></dl>
<!--l. 529--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">4.3.6. </span> <a
id="x1-780004.3.6"></a>dot product</h5>
<!--l. 531--><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-12">[n]</span>/2.
<!--l. 535--><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-12">[n]</span>/2 audio spectrum for each
channel.
<!--l. 543--><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. 550--><p class="noindent" >However, floor vector values can span <span
class="cmsy-10x-x-120">~</span>140dB (<span
class="cmsy-10x-x-120">~</span>24 bits unsigned), and the audio spectrum
vector should represent a minimum of 120dB (<span
class="cmsy-10x-x-120">~</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-120">-</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-120">-</span>140dB to +0dB.
Thus, in order to handle full range dynamics, a residue vector may span <span
class="cmsy-10x-x-120">-</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. 567--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">4.3.7. </span> <a
id="x1-790004.3.7"></a>inverse MDCT</h5>
<!--l. 569--><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. 576--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">4.3.8. </span> <a
id="x1-800004.3.8"></a>overlap_add</h5>
<!--l. 578--><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</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. 592--><p class="noindent" >
<div class="fancyvrb" id="fancyvrb22"><a
id="x1-80002r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;window_blocksize(previous_window)/4+window_blocksize(current_window)/4</span></div>
<!--l. 596--><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. 599--><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. 606--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">4.3.9. </span> <a
id="x1-810004.3.9"></a>output channel order</h5>
<!--l. 608--><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. As of revision 16781 (20100113), the
specification adds defined channel locations for 6.1 and 7.1 surround. Ordering/location for
greater-than-eight channels remains &#8217;left to the implementation&#8217;.
<!--l. 614--><p class="noindent" >These channel orderings refer to order within the encoded stream. It is naturally possible for a
decoder to produce output with channels in any order. Any such decoder should explicitly
document channel reordering behavior.
<!--l. 620--><p class="noindent" >
<dl class="description"><dt class="description">
<span
class="cmssbx-10x-x-120">one channel</span> </dt><dd
class="description">the stream is monophonic
</dd><dt class="description">
<span
class="cmssbx-10x-x-120">two channels</span> </dt><dd
class="description">the stream is stereo. channel order: left, right
</dd><dt class="description">
<span
class="cmssbx-10x-x-120">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-120">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-120">five channels</span> </dt><dd
class="description">the stream is five-channel surround. channel order: front left, center, front
right, rear left, rear right
</dd><dt class="description">
<span
class="cmssbx-10x-x-120">six channels</span> </dt><dd
class="description">the stream is 5.1 surround. channel order: front left, center, front right, rear
left, rear right, LFE
</dd><dt class="description">
<span
class="cmssbx-10x-x-120">seven channels</span> </dt><dd
class="description">the stream is 6.1 surround. channel order: front left, center, front right,
side left, side right, rear center, LFE
</dd><dt class="description">
<span
class="cmssbx-10x-x-120">eight channels</span> </dt><dd
class="description">the stream is 7.1 surround. channel order: front left, center, front right,
side left, side right, rear left, rear right, LFE
</dd><dt class="description">
<span
class="cmssbx-10x-x-120">greater than eight channels</span> </dt><dd
class="description">channel use and order is defined by the application
</dd></dl>
<!--l. 656--><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.
<h3 class="sectionHead"><span class="titlemark">5. </span> <a
id="x1-820005"></a>comment field and header specification</h3>
<!--l. 6--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">5.1. </span> <a
id="x1-830005.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-12">&#8220;I&#8217;m Still Around&#8221;</span>, opening
for Moxy Fr<46>vous, 1997.</div>
<!--l. 29--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">5.2. </span> <a
id="x1-840005.2"></a>Comment encoding</h4>
<!--l. 31--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">5.2.1. </span> <a
id="x1-850005.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-120">- </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-120">- </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;.
<!--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-85002r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1)</span><span
class="cmtt-8">&#x00A0;[vendor\_length]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;an</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span><span
class="cmtt-8">&#x00A0;of</span><span
class="cmtt-8">&#x00A0;32</span><span
class="cmtt-8">&#x00A0;bits</span><br class="fancyvrb" /><a
id="x1-85004r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2)</span><span
class="cmtt-8">&#x00A0;[vendor\_string]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;a</span><span
class="cmtt-8">&#x00A0;UTF-8</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;[vendor\_length]</span><span
class="cmtt-8">&#x00A0;octets</span>
<br class="fancyvrb" /><a
id="x1-85006r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;3)</span><span
class="cmtt-8">&#x00A0;[user\_comment\_list\_length]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;an</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span><span
class="cmtt-8">&#x00A0;of</span><span
class="cmtt-8">&#x00A0;32</span><span
class="cmtt-8">&#x00A0;bits</span><br class="fancyvrb" /><a
id="x1-85008r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;4)</span><span
class="cmtt-8">&#x00A0;iterate</span><span
class="cmtt-8">&#x00A0;[user\_comment\_list\_length]</span><span
class="cmtt-8">&#x00A0;times</span><span
class="cmtt-8">&#x00A0;{</span>
<br class="fancyvrb" /><a
id="x1-85010r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;5)</span><span
class="cmtt-8">&#x00A0;[length]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;an</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span><span
class="cmtt-8">&#x00A0;of</span><span
class="cmtt-8">&#x00A0;32</span><span
class="cmtt-8">&#x00A0;bits</span><br class="fancyvrb" /><a
id="x1-85012r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;6)</span><span
class="cmtt-8">&#x00A0;this</span><span
class="cmtt-8">&#x00A0;iteration&#8217;s</span><span
class="cmtt-8">&#x00A0;user</span><span
class="cmtt-8">&#x00A0;comment</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;a</span><span
class="cmtt-8">&#x00A0;UTF-8</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;[length]</span><span
class="cmtt-8">&#x00A0;octets</span>
<br class="fancyvrb" /><a
id="x1-85014r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;}</span><br class="fancyvrb" /><a
id="x1-85016r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;7)</span><span
class="cmtt-8">&#x00A0;[framing\_bit]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;a</span><span
class="cmtt-8">&#x00A0;single</span><span
class="cmtt-8">&#x00A0;bit</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;boolean</span><br class="fancyvrb" /><a
id="x1-85018r9"></a><span
class="cmr-6">9</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;8)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;(</span><span
class="cmtt-8">&#x00A0;[framing\_bit]</span><span
class="cmtt-8">&#x00A0;unset</span><span
class="cmtt-8">&#x00A0;or</span><span
class="cmtt-8">&#x00A0;end-of-packet</span><span
class="cmtt-8">&#x00A0;)</span><span
class="cmtt-8">&#x00A0;then</span><span
class="cmtt-8">&#x00A0;ERROR</span><br class="fancyvrb" /><a
id="x1-85020r10"></a><span
class="cmr-6">10</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;9)</span><span
class="cmtt-8">&#x00A0;done.</span></div>
<!--l. 64--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">5.2.2. </span> <a
id="x1-860005.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-86002r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;comment[0]="ARTIST=me";</span><br class="fancyvrb" /><a
id="x1-86004r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;comment[1]="TITLE=the</span><span
class="cmtt-8">&#x00A0;sound</span><span
class="cmtt-8">&#x00A0;of</span><span
class="cmtt-8">&#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.
<!--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-870005.2.2"></a><span
class="cmbx-12">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-120">TITLE</span> </dt><dd
class="description">Track/Work name
</dd><dt class="description">
<span
class="cmssbx-10x-x-120">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-120">ALBUM</span> </dt><dd
class="description">The collection name to which this track belongs
</dd><dt class="description">
<span
class="cmssbx-10x-x-120">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-120">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-120">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-120">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-120">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_licenses/eff_oal.html for details&#8217;), etc.
</dd><dt class="description">
<span
class="cmssbx-10x-x-120">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-120">DESCRIPTION</span> </dt><dd
class="description">A short text description of the contents
</dd><dt class="description">
<span
class="cmssbx-10x-x-120">GENRE</span> </dt><dd
class="description">A short text indication of music genre
</dd><dt class="description">
<span
class="cmssbx-10x-x-120">DATE</span> </dt><dd
class="description">Date the track was recorded
</dd><dt class="description">
<span
class="cmssbx-10x-x-120">LOCATION</span> </dt><dd
class="description">Location where track was recorded
</dd><dt class="description">
<span
class="cmssbx-10x-x-120">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-120">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-880005.2.2"></a><span
class="cmbx-12">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-12">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-88002r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;ARTIST=Dizzy</span><span
class="cmtt-8">&#x00A0;Gillespie</span><br class="fancyvrb" /><a
id="x1-88004r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;ARTIST=Sonny</span><span
class="cmtt-8">&#x00A0;Rollins</span><br class="fancyvrb" /><a
id="x1-88006r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;ARTIST=Sonny</span><span
class="cmtt-8">&#x00A0;Stitt</span></div>
</div>
<!--l. 197--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">5.2.3. </span> <a
id="x1-890005.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" >
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
1. </dt><dd
class="enumerate-enumitem">Vendor string length (32 bit unsigned quantity specifying number of octets)
</dd><dt class="enumerate-enumitem">
2. </dt><dd
class="enumerate-enumitem">Vendor string ([vendor string length] octets coded from beginning of string to end of
string, not null terminated)
</dd><dt class="enumerate-enumitem">
3. </dt><dd
class="enumerate-enumitem">Number of comment fields (32 bit unsigned quantity specifying number of fields)
</dd><dt class="enumerate-enumitem">
4. </dt><dd
class="enumerate-enumitem">Comment field 0 length (if [Number of comment fields] <span
class="cmmi-12">&#x003E; </span>0; 32 bit unsigned quantity
specifying number of octets)
</dd><dt class="enumerate-enumitem">
5. </dt><dd
class="enumerate-enumitem">Comment field 0 ([Comment field 0 length] octets coded from beginning of string to
end of string, not null terminated)
</dd><dt class="enumerate-enumitem">
6. </dt><dd
class="enumerate-enumitem">Comment field 1 length (if [Number of comment fields] <span
class="cmmi-12">&#x003E; </span>1...)...
</dd></dl>
<!--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-12">vorbis/lib/info.c</span>, <span
class="cmtt-12">_vorbis_pack_comment() </span>and <span
class="cmtt-12">_vorbis_unpack_comment()</span>.
<h3 class="sectionHead"><span class="titlemark">6. </span> <a
id="x1-900006"></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-910006.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-920006.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-930006.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-93002r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1)</span><span
class="cmtt-8">&#x00A0;[floor0_order]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;an</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span><span
class="cmtt-8">&#x00A0;of</span><span
class="cmtt-8">&#x00A0;8</span><span
class="cmtt-8">&#x00A0;bits</span><br class="fancyvrb" /><a
id="x1-93004r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2)</span><span
class="cmtt-8">&#x00A0;[floor0_rate]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;an</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span><span
class="cmtt-8">&#x00A0;of</span><span
class="cmtt-8">&#x00A0;16</span><span
class="cmtt-8">&#x00A0;bits</span>
<br class="fancyvrb" /><a
id="x1-93006r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;3)</span><span
class="cmtt-8">&#x00A0;[floor0_bark_map_size]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;an</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span><span
class="cmtt-8">&#x00A0;of</span><span
class="cmtt-8">&#x00A0;16</span><span
class="cmtt-8">&#x00A0;bits</span><br class="fancyvrb" /><a
id="x1-93008r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;4)</span><span
class="cmtt-8">&#x00A0;[floor0_amplitude_bits]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;an</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span><span
class="cmtt-8">&#x00A0;of</span><span
class="cmtt-8">&#x00A0;six</span><span
class="cmtt-8">&#x00A0;bits</span>
<br class="fancyvrb" /><a
id="x1-93010r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;5)</span><span
class="cmtt-8">&#x00A0;[floor0_amplitude_offset]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;an</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span><span
class="cmtt-8">&#x00A0;of</span><span
class="cmtt-8">&#x00A0;eight</span><span
class="cmtt-8">&#x00A0;bits</span>
<br class="fancyvrb" /><a
id="x1-93012r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;6)</span><span
class="cmtt-8">&#x00A0;[floor0_number_of_books]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;an</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span><span
class="cmtt-8">&#x00A0;of</span><span
class="cmtt-8">&#x00A0;four</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;and</span><span
class="cmtt-8">&#x00A0;add</span><span
class="cmtt-8">&#x00A0;1</span>
<br class="fancyvrb" /><a
id="x1-93014r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;7)</span><span
class="cmtt-8">&#x00A0;array</span><span
class="cmtt-8">&#x00A0;[floor0_book_list]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;a</span><span
class="cmtt-8">&#x00A0;list</span><span
class="cmtt-8">&#x00A0;of</span><span
class="cmtt-8">&#x00A0;[floor0_number_of_books]</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integers</span><span
class="cmtt-8">&#x00A0;of</span><span
class="cmtt-8">&#x00A0;eight</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;each;</span></div>
<!--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-12">[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-940006.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-12">[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-94002r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1)</span><span
class="cmtt-8">&#x00A0;[amplitude]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;an</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span><span
class="cmtt-8">&#x00A0;of</span><span
class="cmtt-8">&#x00A0;[floor0_amplitude_bits]</span><span
class="cmtt-8">&#x00A0;bits</span><br class="fancyvrb" /><a
id="x1-94004r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;(</span><span
class="cmtt-8">&#x00A0;[amplitude]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;greater</span><span
class="cmtt-8">&#x00A0;than</span><span
class="cmtt-8">&#x00A0;zero</span><span
class="cmtt-8">&#x00A0;)</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span>
<br class="fancyvrb" /><a
id="x1-94006r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;3)</span><span
class="cmtt-8">&#x00A0;[coefficients]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;an</span><span
class="cmtt-8">&#x00A0;empty,</span><span
class="cmtt-8">&#x00A0;zero</span><span
class="cmtt-8">&#x00A0;length</span><span
class="cmtt-8">&#x00A0;vector</span><br class="fancyvrb" /><a
id="x1-94008r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;4)</span><span
class="cmtt-8">&#x00A0;[booknumber]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;an</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span><span
class="cmtt-8">&#x00A0;of</span><span
class="cmtt-8">&#x00A0;</span><a
href="#x1-1190009.2.1"><span
class="cmtt-8">ilog</span></a><span
class="cmtt-8">(</span><span
class="cmtt-8">&#x00A0;[floor0_number_of_books]</span><span
class="cmtt-8">&#x00A0;)</span><span
class="cmtt-8">&#x00A0;bits</span>
<br class="fancyvrb" /><a
id="x1-94010r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;5)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;(</span><span
class="cmtt-8">&#x00A0;[booknumber]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;greater</span><span
class="cmtt-8">&#x00A0;than</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;highest</span><span
class="cmtt-8">&#x00A0;number</span><span
class="cmtt-8">&#x00A0;decode</span><span
class="cmtt-8">&#x00A0;codebook</span><span
class="cmtt-8">&#x00A0;)</span><span
class="cmtt-8">&#x00A0;then</span><span
class="cmtt-8">&#x00A0;packet</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;undecodable</span><br class="fancyvrb" /><a
id="x1-94012r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;6)</span><span
class="cmtt-8">&#x00A0;[last]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;zero;</span>
<br class="fancyvrb" /><a
id="x1-94014r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;7)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[temp_vector]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;from</span><span
class="cmtt-8">&#x00A0;bitstream</span><span
class="cmtt-8">&#x00A0;using</span><span
class="cmtt-8">&#x00A0;codebook</span><span
class="cmtt-8">&#x00A0;number</span><span
class="cmtt-8">&#x00A0;[floor0_book_list]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[booknumber]</span><span
class="cmtt-8">&#x00A0;in</span><span
class="cmtt-8">&#x00A0;VQ</span><span
class="cmtt-8">&#x00A0;context.</span>
<br class="fancyvrb" /><a
id="x1-94016r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;8)</span><span
class="cmtt-8">&#x00A0;add</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;scalar</span><span
class="cmtt-8">&#x00A0;value</span><span
class="cmtt-8">&#x00A0;[last]</span><span
class="cmtt-8">&#x00A0;to</span><span
class="cmtt-8">&#x00A0;each</span><span
class="cmtt-8">&#x00A0;scalar</span><span
class="cmtt-8">&#x00A0;in</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[temp_vector]</span><br class="fancyvrb" /><a
id="x1-94018r9"></a><span
class="cmr-6">9</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;9)</span><span
class="cmtt-8">&#x00A0;[last]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;value</span><span
class="cmtt-8">&#x00A0;of</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;last</span><span
class="cmtt-8">&#x00A0;scalar</span><span
class="cmtt-8">&#x00A0;in</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[temp_vector]</span>
<br class="fancyvrb" /><a
id="x1-94020r10"></a><span
class="cmr-6">10</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;10)</span><span
class="cmtt-8">&#x00A0;concatenate</span><span
class="cmtt-8">&#x00A0;[temp_vector]</span><span
class="cmtt-8">&#x00A0;onto</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;end</span><span
class="cmtt-8">&#x00A0;of</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;[coefficients]</span><span
class="cmtt-8">&#x00A0;vector</span>
<br class="fancyvrb" /><a
id="x1-94022r11"></a><span
class="cmr-6">11</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;11)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;(length</span><span
class="cmtt-8">&#x00A0;of</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[coefficients]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;less</span><span
class="cmtt-8">&#x00A0;than</span><span
class="cmtt-8">&#x00A0;[floor0_order],</span><span
class="cmtt-8">&#x00A0;continue</span><span
class="cmtt-8">&#x00A0;at</span><span
class="cmtt-8">&#x00A0;step</span><span
class="cmtt-8">&#x00A0;6</span><br class="fancyvrb" /><a
id="x1-94024r12"></a><span
class="cmr-6">12</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-94026r13"></a><span
class="cmr-6">13</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><br class="fancyvrb" /><a
id="x1-94028r14"></a><span
class="cmr-6">14</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-94030r15"></a><span
class="cmr-6">15</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;12)</span><span
class="cmtt-8">&#x00A0;done.</span><br class="fancyvrb" /><a
id="x1-94032r16"></a><span
class="cmr-6">16</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#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-12">[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-12">[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-1190009.2.1">ilog</a>(
<span
class="cmtt-12">[floor0_number_of_books] </span>- 1 ) bits. Nevertheless, the above specification is correct
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-12">[coefficients] </span>may be greater
than <span
class="cmtt-12">[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-12">[codebook_dimensions] </span>value of three and <span
class="cmtt-12">[floor0_order] </span>is ten, the only way to
fill all the needed scalars in <span
class="cmtt-12">[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-950006.2.3"></a>curve computation</h5>
<!--l. 106--><p class="noindent" >Given an <span
class="cmtt-12">[amplitude] </span>integer and <span
class="cmtt-12">[coefficients] </span>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 <span
class="cmtt-12">[n] </span>specified by the
decode process, we compute a floor output vector.
<!--l. 113--><p class="noindent" >If the value <span
class="cmtt-12">[amplitude] </span>is zero, the return value is a length <span
class="cmtt-12">[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=" {
map = min (floor0_bark_map_size - 1,f oobar) for i &#x2208; [0, n - 1]
i - 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;
( floor0_rate--&#x22C5; i) floor0_bark_map_size----
f oobar = bark 2n &#x22C5; bark(.5 &#x22C5; floor0_rate )
" class="par-math-display" ></center>
<!--l. 137--><p class="nopar" >
<!--l. 139--><p class="noindent" >and
<center class="par-math-display" >
<img
src="Vorbis_I_spec9x.png" alt=" 2
bark(x) = 13.1arctan (.00074x ) + 2.24 arctan(.0000000185x ) + .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-12">[output] </span>on a log (dB) amplitude scale, mapping it to linear amplitude in the last
step:
<!--l. 151--><p class="noindent" >
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
1. </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[i] </span>= 0
</dd><dt class="enumerate-enumitem">
2. </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[</span><span
class="cmmi-12">&#x03C9;</span><span
class="cmtt-12">] </span>= <span
class="cmmi-12">&#x03C0; </span>* map element <span
class="cmtt-12">[i] </span>/ <span
class="cmtt-12">[floor0_bark_map_size]</span>
</dd><dt class="enumerate-enumitem">
3. </dt><dd
class="enumerate-enumitem">if ( <span
class="cmtt-12">[floor0_order] </span>is odd )
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
a) </dt><dd
class="enumerate-enumitem">calculate <span
class="cmtt-12">[p] </span>and <span
class="cmtt-12">[q] </span>according to: <div class="eqnarray">
<center class="math-display" >
<img
src="Vorbis_I_spec10x.png" alt=" floor0&#x220F;_2order-3
p = (1 - cos2&#x03C9;) 4(cos([coefficients ]2j+1) - cos&#x03C9; )2
j=0
floor0_order-1
1 &#x220F;2 2
q = 4- 4(cos([coefficients ]2j) - cos&#x03C9; )
j=0
" class="math-display" ></center>
</div>
</dd></dl>
<!--l. 162--><p class="noindent" >else <span
class="cmtt-12">[floor0_order] </span>is even
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
a) </dt><dd
class="enumerate-enumitem">calculate <span
class="cmtt-12">[p] </span>and <span
class="cmtt-12">[q] </span>according to: <div class="eqnarray">
<center class="math-display" >
<img
src="Vorbis_I_spec11x.png" alt=" floor0_order-2
(1 - cos&#x03C9; ) ---&#x220F;2-----
p = ----------- 4(cos([coefficients ]2j+1) - cos&#x03C9;)2
2 j=0
floor0_order--2
(1-+-cos&#x03C9;-) &#x220F;2 2
q = 2 4(cos([coefficients ]2j) - cos &#x03C9;)
j=0
" class="math-display" ></center>
</div>
</dd></dl>
</dd><dt class="enumerate-enumitem">
4. </dt><dd
class="enumerate-enumitem">calculate <span
class="cmtt-12">[linear_floor_value] </span>according to:
<center class="math-display" >
<img
src="Vorbis_I_spec12x.png" alt=" ( ( ))
amplitude---&#x22C5; floor0_amplitute_offset---
exp .11512925 (2floor0_amplitude_bits - 1)&#x221A;p--+-q - floor0_amplitude_offset
" class="math-display" ></center>
<!--l. 177--><p class="nopar" >
</dd><dt class="enumerate-enumitem">
5. </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[iteration_condition] </span>= map element <span
class="cmtt-12">[i]</span>
</dd><dt class="enumerate-enumitem">
6. </dt><dd
class="enumerate-enumitem"><span
class="cmtt-12">[output] </span>element <span
class="cmtt-12">[i] </span>= <span
class="cmtt-12">[linear_floor_value]</span>
</dd><dt class="enumerate-enumitem">
7. </dt><dd
class="enumerate-enumitem">increment <span
class="cmtt-12">[i]</span>
</dd><dt class="enumerate-enumitem">
8. </dt><dd
class="enumerate-enumitem">if ( map element <span
class="cmtt-12">[i] </span>is equal to <span
class="cmtt-12">[iteration_condition] </span>) continue at step
5
</dd><dt class="enumerate-enumitem">
9. </dt><dd
class="enumerate-enumitem">if ( <span
class="cmtt-12">[i] </span>is less than <span
class="cmtt-12">[n] </span>) continue at step 2
</dd><dt class="enumerate-enumitem">
10. </dt><dd
class="enumerate-enumitem">done</dd></dl>
<!--l. 187--><p class="noindent" ><span class="paragraphHead"><a
id="x1-960006.2.3"></a><span
class="cmbx-12">Errata 20150227: Bark scale computation</span></span>
Due to a typo when typesetting this version of the specification from the original HTML
document, the Bark scale computation previously erroneously read:
<center class="par-math-display" >
<img
src="Vorbis_I_spec13x.png" alt=" 2
bark(x) = 13.1arctan (.00074x ) + 2.24 arctan(.0000000185x + .0001x )
" class="par-math-display" ></center>
<!--l. 195--><p class="nopar" >
<!--l. 197--><p class="noindent" >Note that the last parenthesis is misplaced. This document now uses the correct equation as it
appeared in the original HTML spec document:
<center class="par-math-display" >
<img
src="Vorbis_I_spec14x.png" alt="bark(x) = 13.1arctan (.00074x ) + 2.24 arctan(.0000000185x2 ) + .0001x
" class="par-math-display" ></center>
<!--l. 201--><p class="nopar" >
<h3 class="sectionHead"><span class="titlemark">7. </span> <a
id="x1-970007"></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-980007.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-990007.2"></a>Floor 1 format</h4>
<!--l. 18--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">7.2.1. </span> <a
id="x1-1000007.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.
</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" >
<!--l. 60--><p class="noindent" ><img
src="floor1-1.png" alt="PIC"
>
<br /> <div class="caption"
><span class="id">Figure&#x00A0;7: </span><span
class="content">graph of example floor</span></div><!--tex4ht:label?: x1-1000017 -->
</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" >
<!--l. 68--><p class="noindent" ><img
src="floor1-2.png" alt="PIC"
>
<br /> <div class="caption"
><span class="id">Figure&#x00A0;8: </span><span
class="content">graph of example floor</span></div><!--tex4ht:label?: x1-1000028 -->
</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" >
<!--l. 77--><p class="noindent" ><img
src="floor1-3.png" alt="PIC"
>
<br /> <div class="caption"
><span class="id">Figure&#x00A0;9: </span><span
class="content">graph of example floor</span></div><!--tex4ht:label?: x1-1000039 -->
</div>
<div class="center"
>
<!--l. 81--><p class="noindent" >
<!--l. 82--><p class="noindent" ><img
src="floor1-4.png" alt="PIC"
>
<br /> <div class="caption"
><span class="id">Figure&#x00A0;10: </span><span
class="content">graph of example floor</span></div><!--tex4ht:label?: x1-10000410 -->
</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-1010007.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-101002r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-101004r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1)</span><span
class="cmtt-8">&#x00A0;[floor1_partitions]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;5</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span><br class="fancyvrb" /><a
id="x1-101006r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2)</span><span
class="cmtt-8">&#x00A0;[maximum_class]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;-1</span><br class="fancyvrb" /><a
id="x1-101008r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;3)</span><span
class="cmtt-8">&#x00A0;iterate</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;over</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;range</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;...</span><span
class="cmtt-8">&#x00A0;[floor1_partitions]-1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span>
<br class="fancyvrb" /><a
id="x1-101010r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-101012r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;4)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_partition_class_list]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;4</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span><br class="fancyvrb" /><a
id="x1-101014r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-101016r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><br class="fancyvrb" /><a
id="x1-101018r9"></a><span
class="cmr-6">9</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-101020r10"></a><span
class="cmr-6">10</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;5)</span><span
class="cmtt-8">&#x00A0;[maximum_class]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;largest</span><span
class="cmtt-8">&#x00A0;integer</span><span
class="cmtt-8">&#x00A0;scalar</span><span
class="cmtt-8">&#x00A0;value</span><span
class="cmtt-8">&#x00A0;in</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_partition_class_list]</span><br class="fancyvrb" /><a
id="x1-101022r11"></a><span
class="cmr-6">11</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;6)</span><span
class="cmtt-8">&#x00A0;iterate</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;over</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;range</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;...</span><span
class="cmtt-8">&#x00A0;[maximum_class]</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span>
<br class="fancyvrb" /><a
id="x1-101024r12"></a><span
class="cmr-6">12</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-101026r13"></a><span
class="cmr-6">13</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;7)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_class_dimensions]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;3</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span><span
class="cmtt-8">&#x00A0;and</span><span
class="cmtt-8">&#x00A0;add</span><span
class="cmtt-8">&#x00A0;1</span>
<br class="fancyvrb" /><a
id="x1-101028r14"></a><span
class="cmr-6">14</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0; 8)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_class_subclasses]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span>
<br class="fancyvrb" /><a
id="x1-101030r15"></a><span
class="cmr-6">15</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;9)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;(</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_class_subclasses]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;nonzero</span><span
class="cmtt-8">&#x00A0;)</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span><br class="fancyvrb" /><a
id="x1-101032r16"></a><span
class="cmr-6">16</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-101034r17"></a><span
class="cmr-6">17</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;10)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_class_masterbooks]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;8</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span><br class="fancyvrb" /><a
id="x1-101036r18"></a><span
class="cmr-6">18</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-101038r19"></a><span
class="cmr-6">19</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><br class="fancyvrb" /><a
id="x1-101040r20"></a><span
class="cmr-6">20</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-101042r21"></a><span
class="cmr-6">21</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;11)</span><span
class="cmtt-8">&#x00A0;iterate</span><span
class="cmtt-8">&#x00A0;[j]</span><span
class="cmtt-8">&#x00A0;over</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;range</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;...</span><span
class="cmtt-8">&#x00A0;(2</span><span
class="cmtt-8">&#x00A0;exponent</span><span
class="cmtt-8">&#x00A0;[floor1_class_subclasses]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[i])</span><span
class="cmtt-8">&#x00A0;-</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span><br class="fancyvrb" /><a
id="x1-101044r22"></a><span
class="cmr-6">22</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-101046r23"></a><span
class="cmr-6">23</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;12)</span><span
class="cmtt-8">&#x00A0;array</span><span
class="cmtt-8">&#x00A0;[floor1_subclass_books]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[i],[j]</span><span
class="cmtt-8">&#x00A0;=</span><br class="fancyvrb" /><a
id="x1-101048r24"></a><span
class="cmr-6">24</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;8</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span><span
class="cmtt-8">&#x00A0;and</span><span
class="cmtt-8">&#x00A0;subtract</span><span
class="cmtt-8">&#x00A0;one</span><br class="fancyvrb" /><a
id="x1-101050r25"></a><span
class="cmr-6">25</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span>
<br class="fancyvrb" /><a
id="x1-101052r26"></a><span
class="cmr-6">26</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><br class="fancyvrb" /><a
id="x1-101054r27"></a><span
class="cmr-6">27</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-101056r28"></a><span
class="cmr-6">28</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;13)</span><span
class="cmtt-8">&#x00A0;[floor1_multiplier]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span><span
class="cmtt-8">&#x00A0;and</span><span
class="cmtt-8">&#x00A0;add</span><span
class="cmtt-8">&#x00A0;one</span><br class="fancyvrb" /><a
id="x1-101058r29"></a><span
class="cmr-6">29</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;14)</span><span
class="cmtt-8">&#x00A0;[rangebits]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;4</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span>
<br class="fancyvrb" /><a
id="x1-101060r30"></a><span
class="cmr-6">30</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;15)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_X_list]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[0]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;0</span><br class="fancyvrb" /><a
id="x1-101062r31"></a><span
class="cmr-6">31</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;16)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_X_list]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[1]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;exponent</span><span
class="cmtt-8">&#x00A0;[rangebits];</span>
<br class="fancyvrb" /><a
id="x1-101064r32"></a><span
class="cmr-6">32</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;17)</span><span
class="cmtt-8">&#x00A0;[floor1_values]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;2</span><br class="fancyvrb" /><a
id="x1-101066r33"></a><span
class="cmr-6">33</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;18)</span><span
class="cmtt-8">&#x00A0;iterate</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;over</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;range</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;...</span><span
class="cmtt-8">&#x00A0;[floor1_partitions]-1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span>
<br class="fancyvrb" /><a
id="x1-101068r34"></a><span
class="cmr-6">34</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-101070r35"></a><span
class="cmr-6">35</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;19)</span><span
class="cmtt-8">&#x00A0;[current_class_number]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_partition_class_list]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[i]</span>
<br class="fancyvrb" /><a
id="x1-101072r36"></a><span
class="cmr-6">36</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;20)</span><span
class="cmtt-8">&#x00A0;iterate</span><span
class="cmtt-8">&#x00A0;[j]</span><span
class="cmtt-8">&#x00A0;over</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;range</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;...</span><span
class="cmtt-8">&#x00A0;([floor1_class_dimensions]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[current_class_number])-1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span>
<br class="fancyvrb" /><a
id="x1-101074r37"></a><span
class="cmr-6">37</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;21)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_X_list]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;([floor1_values])</span><span
class="cmtt-8">&#x00A0;=</span><br class="fancyvrb" /><a
id="x1-101076r38"></a><span
class="cmr-6">38</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;[rangebits]</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span>
<br class="fancyvrb" /><a
id="x1-101078r39"></a><span
class="cmr-6">39</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;22)</span><span
class="cmtt-8">&#x00A0;increment</span><span
class="cmtt-8">&#x00A0;[floor1_values]</span><span
class="cmtt-8">&#x00A0;by</span><span
class="cmtt-8">&#x00A0;one</span><br class="fancyvrb" /><a
id="x1-101080r40"></a><span
class="cmr-6">40</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><br class="fancyvrb" /><a
id="x1-101082r41"></a><span
class="cmr-6">41</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><br class="fancyvrb" /><a
id="x1-101084r42"></a><span
class="cmr-6">42</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-101086r43"></a><span
class="cmr-6">43</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;23)</span><span
class="cmtt-8">&#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-12">[floor1_class_masterbooks] </span>or
<span
class="cmtt-12">[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. Vector
[floor1_x_list] is limited to a maximum length of 65 elements; a setup indicating more than 65
total elements (including elements 0 and 1 set prior to the read loop) renders the stream
undecodable. All vector [floor1_x_list] element values must be unique within the vector; a
non-unique value renders the stream undecodable.
<!--l. 170--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">7.2.3. </span> <a
id="x1-1020007.2.3"></a>packet decode</h5>
<!--l. 172--><p class="noindent" >Packet decode begins by checking the <span
class="cmtt-12">[nonzero] </span>flag:
<!--l. 174--><p class="noindent" >
<div class="fancyvrb" id="fancyvrb29"><a
id="x1-102002r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1)</span><span
class="cmtt-8">&#x00A0;[nonzero]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;bit</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;boolean</span></div>
<!--l. 178--><p class="noindent" >If <span
class="cmtt-12">[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. 186--><p class="noindent" >Assuming <span
class="cmtt-12">[nonzero] </span>is set, decode proceeds as follows:
<!--l. 188--><p class="noindent" >
<div class="fancyvrb" id="fancyvrb30"><a
id="x1-102004r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1)</span><span
class="cmtt-8">&#x00A0;[range]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span><span
class="cmtt-8">&#x00A0;256,</span><span
class="cmtt-8">&#x00A0;128,</span><span
class="cmtt-8">&#x00A0;86,</span><span
class="cmtt-8">&#x00A0;64</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;([floor1_multiplier]-1)</span>
<br class="fancyvrb" /><a
id="x1-102006r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_Y]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[0]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;</span><a
href="#x1-1190009.2.1"><span
class="cmtt-8">ilog</span></a><span
class="cmtt-8">([range]-1)</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span>
<br class="fancyvrb" /><a
id="x1-102008r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;3)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_Y]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[1]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;</span><a
href="#x1-1190009.2.1"><span
class="cmtt-8">ilog</span></a><span
class="cmtt-8">([range]-1)</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span>
<br class="fancyvrb" /><a
id="x1-102010r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;4)</span><span
class="cmtt-8">&#x00A0;[offset]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;2;</span><br class="fancyvrb" /><a
id="x1-102012r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;5)</span><span
class="cmtt-8">&#x00A0;iterate</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;over</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;range</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;...</span><span
class="cmtt-8">&#x00A0;[floor1_partitions]-1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span><br class="fancyvrb" /><a
id="x1-102014r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-102016r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;6)</span><span
class="cmtt-8">&#x00A0;[class]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_partition_class]</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[i]</span><br class="fancyvrb" /><a
id="x1-102018r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;7)</span><span
class="cmtt-8">&#x00A0;[cdim]</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_class_dimensions]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[class]</span>
<br class="fancyvrb" /><a
id="x1-102020r9"></a><span
class="cmr-6">9</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;8)</span><span
class="cmtt-8">&#x00A0;[cbits]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_class_subclasses]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[class]</span><br class="fancyvrb" /><a
id="x1-102022r10"></a><span
class="cmr-6">10</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;9)</span><span
class="cmtt-8">&#x00A0;[csub]</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;(2</span><span
class="cmtt-8">&#x00A0;exponent</span><span
class="cmtt-8">&#x00A0;[cbits])-1</span><br class="fancyvrb" /><a
id="x1-102024r11"></a><span
class="cmr-6">11</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;10)</span><span
class="cmtt-8">&#x00A0;[cval]</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;0</span>
<br class="fancyvrb" /><a
id="x1-102026r12"></a><span
class="cmr-6">12</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;11)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;(</span><span
class="cmtt-8">&#x00A0;[cbits]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;greater</span><span
class="cmtt-8">&#x00A0;than</span><span
class="cmtt-8">&#x00A0;zero</span><span
class="cmtt-8">&#x00A0;)</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span><br class="fancyvrb" /><a
id="x1-102028r13"></a><span
class="cmr-6">13</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-102030r14"></a><span
class="cmr-6">14</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;12)</span><span
class="cmtt-8">&#x00A0;[cval]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;from</span><span
class="cmtt-8">&#x00A0;packet</span><span
class="cmtt-8">&#x00A0;using</span><span
class="cmtt-8">&#x00A0;codebook</span><span
class="cmtt-8">&#x00A0;number</span>
<br class="fancyvrb" /><a
id="x1-102032r15"></a><span
class="cmr-6">15</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;(vector</span><span
class="cmtt-8">&#x00A0;[floor1_class_masterbooks]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[class])</span><span
class="cmtt-8">&#x00A0;in</span><span
class="cmtt-8">&#x00A0;scalar</span><span
class="cmtt-8">&#x00A0;context</span>
<br class="fancyvrb" /><a
id="x1-102034r16"></a><span
class="cmr-6">16</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><br class="fancyvrb" /><a
id="x1-102036r17"></a><span
class="cmr-6">17</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-102038r18"></a><span
class="cmr-6">18</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;13)</span><span
class="cmtt-8">&#x00A0;iterate</span><span
class="cmtt-8">&#x00A0;[j]</span><span
class="cmtt-8">&#x00A0;over</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;range</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;...</span><span
class="cmtt-8">&#x00A0;[cdim]-1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span><br class="fancyvrb" /><a
id="x1-102040r19"></a><span
class="cmr-6">19</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-102042r20"></a><span
class="cmr-6">20</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;14)</span><span
class="cmtt-8">&#x00A0;[book]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;array</span><span
class="cmtt-8">&#x00A0;[floor1_subclass_books]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[class],([cval]</span><span
class="cmtt-8">&#x00A0;bitwise</span><span
class="cmtt-8">&#x00A0;AND</span><span
class="cmtt-8">&#x00A0;[csub])</span>
<br class="fancyvrb" /><a
id="x1-102044r21"></a><span
class="cmr-6">21</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;15)</span><span
class="cmtt-8">&#x00A0;[cval]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[cval]</span><span
class="cmtt-8">&#x00A0;right</span><span
class="cmtt-8">&#x00A0;shifted</span><span
class="cmtt-8">&#x00A0;[cbits]</span><span
class="cmtt-8">&#x00A0;bits</span><br class="fancyvrb" /><a
id="x1-102046r22"></a><span
class="cmr-6">22</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0; </span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;16)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;(</span><span
class="cmtt-8">&#x00A0;[book]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;not</span><span
class="cmtt-8">&#x00A0;less</span><span
class="cmtt-8">&#x00A0;than</span><span
class="cmtt-8">&#x00A0;zero</span><span
class="cmtt-8">&#x00A0;)</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span><br class="fancyvrb" /><a
id="x1-102048r23"></a><span
class="cmr-6">23</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-102050r24"></a><span
class="cmr-6">24</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0; </span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;17)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_Y]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;([j]+[offset])</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;from</span><span
class="cmtt-8">&#x00A0;packet</span><span
class="cmtt-8">&#x00A0;using</span><span
class="cmtt-8">&#x00A0;codebook</span><br class="fancyvrb" /><a
id="x1-102052r25"></a><span
class="cmr-6">25</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;[book]</span><span
class="cmtt-8">&#x00A0;in</span><span
class="cmtt-8">&#x00A0;scalar</span><span
class="cmtt-8">&#x00A0;context</span>
<br class="fancyvrb" /><a
id="x1-102054r26"></a><span
class="cmr-6">26</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-102056r27"></a><span
class="cmr-6">27</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><span
class="cmtt-8">&#x00A0;else</span><span
class="cmtt-8">&#x00A0;[book]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;less</span><span
class="cmtt-8">&#x00A0;than</span><span
class="cmtt-8">&#x00A0;zero</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span><br class="fancyvrb" /><a
id="x1-102058r28"></a><span
class="cmr-6">28</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-102060r29"></a><span
class="cmr-6">29</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0; </span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;18)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_Y]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;([j]+[offset])</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;0</span>
<br class="fancyvrb" /><a
id="x1-102062r30"></a><span
class="cmr-6">30</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-102064r31"></a><span
class="cmr-6">31</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><br class="fancyvrb" /><a
id="x1-102066r32"></a><span
class="cmr-6">32</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><br class="fancyvrb" /><a
id="x1-102068r33"></a><span
class="cmr-6">33</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-102070r34"></a><span
class="cmr-6">34</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;19)</span><span
class="cmtt-8">&#x00A0;[offset]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[offset]</span><span
class="cmtt-8">&#x00A0;+</span><span
class="cmtt-8">&#x00A0;[cdim]</span><br class="fancyvrb" /><a
id="x1-102072r35"></a><span
class="cmr-6">35</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-102074r36"></a><span
class="cmr-6">36</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><br class="fancyvrb" /><a
id="x1-102076r37"></a><span
class="cmr-6">37</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-102078r38"></a><span
class="cmr-6">38</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;20)</span><span
class="cmtt-8">&#x00A0;done</span></div>
<!--l. 229--><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-12">[nonzero] </span>flag had been unset at the beginning of decode.
<!--l. 235--><p class="noindent" >Vector <span
class="cmtt-12">[floor1_Y] </span>contains the values from packet decode needed for floor 1 synthesis.
<!--l. 240--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">7.2.4. </span> <a
id="x1-1030007.2.4"></a>curve computation</h5>
<!--l. 242--><p class="noindent" >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. 250--><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. 255--><p class="noindent" ><span
class="cmti-12">Additional note: </span>Although <span
class="cmtt-12">[floor1_final_Y] </span>values in the prediction loop and at the end of
step 1 are inherently limited by the prediction algorithm to [0, <span
class="cmtt-12">[range]</span>), it is possible to abuse
the setup and codebook machinery to produce negative or over-range results. We suggest that
decoder implementations guard the values in vector <span
class="cmtt-12">[floor1_final_Y] </span>by clamping each
element to [0, <span
class="cmtt-12">[range]</span>) after step 1. Variants of this suggestion are acceptable as valid floor1
setups cannot produce out of range values.
<!--l. 266--><p class="noindent" >
<dl class="description"><dt class="description">
<span
class="cmssbx-10x-x-120">step 1: amplitude value synthesis</span> </dt><dd
class="description">
<!--l. 268--><p class="noindent" >Unwrap the always-positive-or-zero values read from the packet into +/- difference
values, then apply to line prediction.
<!--l. 271--><p class="noindent" >
<div class="fancyvrb" id="fancyvrb31"><a
id="x1-103002r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1)</span><span
class="cmtt-8">&#x00A0;[range]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span><span
class="cmtt-8">&#x00A0;256,</span><span
class="cmtt-8">&#x00A0;128,</span><span
class="cmtt-8">&#x00A0;86,</span><span
class="cmtt-8">&#x00A0;64</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;([floor1_multiplier]-1)</span><br class="fancyvrb" /><a
id="x1-103004r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_step2_flag]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[0]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;set</span>
<br class="fancyvrb" /><a
id="x1-103006r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;3)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_step2_flag]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[1]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;set</span><br class="fancyvrb" /><a
id="x1-103008r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;4)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_final_Y]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[0]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_Y]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[0]</span>
<br class="fancyvrb" /><a
id="x1-103010r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;5)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_final_Y]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[1]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_Y]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[1]</span><br class="fancyvrb" /><a
id="x1-103012r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;6)</span><span
class="cmtt-8">&#x00A0;iterate</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;over</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;range</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;...</span><span
class="cmtt-8">&#x00A0;[floor1_values]-1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span><br class="fancyvrb" /><a
id="x1-103014r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-103016r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;7)</span><span
class="cmtt-8">&#x00A0;[low_neighbor_offset]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;</span><a
href="#x1-1220009.2.4"><span
class="cmtt-8">low_neighbor</span></a><span
class="cmtt-8">([floor1_X_list],[i])</span><br class="fancyvrb" /><a
id="x1-103018r9"></a><span
class="cmr-6">9</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;8)</span><span
class="cmtt-8">&#x00A0;[high_neighbor_offset]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;</span><a
href="#x1-1230009.2.5"><span
class="cmtt-8">high_neighbor</span></a><span
class="cmtt-8">([floor1_X_list],[i])</span>
<br class="fancyvrb" /><a
id="x1-103020r10"></a><span
class="cmr-6">10</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-103022r11"></a><span
class="cmr-6">11</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;9)</span><span
class="cmtt-8">&#x00A0;[predicted]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;</span><a
href="#x1-1240009.2.6"><span
class="cmtt-8">render_point</span></a><span
class="cmtt-8">(</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_X_list]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[low_neighbor_offset],</span>
<br class="fancyvrb" /><a
id="x1-103024r12"></a><span
class="cmr-6">12</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0; </span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_final_Y]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[low_neighbor_offset],</span>
<br class="fancyvrb" /><a
id="x1-103026r13"></a><span
class="cmr-6">13</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_X_list]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[high_neighbor_offset],</span>
<br class="fancyvrb" /><a
id="x1-103028r14"></a><span
class="cmr-6">14</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0; </span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_final_Y]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[high_neighbor_offset],</span>
<br class="fancyvrb" /><a
id="x1-103030r15"></a><span
class="cmr-6">15</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_X_list]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;)</span><br class="fancyvrb" /><a
id="x1-103032r16"></a><span
class="cmr-6">16</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-103034r17"></a><span
class="cmr-6">17</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;10)</span><span
class="cmtt-8">&#x00A0;[val]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_Y]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[i]</span>
<br class="fancyvrb" /><a
id="x1-103036r18"></a><span
class="cmr-6">18</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;11)</span><span
class="cmtt-8">&#x00A0;[highroom]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[range]</span><span
class="cmtt-8">&#x00A0;-</span><span
class="cmtt-8">&#x00A0;[predicted]</span><br class="fancyvrb" /><a
id="x1-103038r19"></a><span
class="cmr-6">19</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;12)</span><span
class="cmtt-8">&#x00A0;[lowroom]</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[predicted]</span>
<br class="fancyvrb" /><a
id="x1-103040r20"></a><span
class="cmr-6">20</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;13)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;(</span><span
class="cmtt-8">&#x00A0;[highroom]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;less</span><span
class="cmtt-8">&#x00A0;than</span><span
class="cmtt-8">&#x00A0;[lowroom]</span><span
class="cmtt-8">&#x00A0;)</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span><br class="fancyvrb" /><a
id="x1-103042r21"></a><span
class="cmr-6">21</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-103044r22"></a><span
class="cmr-6">22</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;14)</span><span
class="cmtt-8">&#x00A0;[room]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[highroom]</span><span
class="cmtt-8">&#x00A0;*</span><span
class="cmtt-8">&#x00A0;2</span><br class="fancyvrb" /><a
id="x1-103046r23"></a><span
class="cmr-6">23</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-103048r24"></a><span
class="cmr-6">24</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><span
class="cmtt-8">&#x00A0;else</span><span
class="cmtt-8">&#x00A0;[highroom]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;not</span><span
class="cmtt-8">&#x00A0;less</span><span
class="cmtt-8">&#x00A0;than</span><span
class="cmtt-8">&#x00A0;[lowroom]</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span><br class="fancyvrb" /><a
id="x1-103050r25"></a><span
class="cmr-6">25</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-103052r26"></a><span
class="cmr-6">26</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;15)</span><span
class="cmtt-8">&#x00A0;[room]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[lowroom]</span><span
class="cmtt-8">&#x00A0;*</span><span
class="cmtt-8">&#x00A0;2</span><br class="fancyvrb" /><a
id="x1-103054r27"></a><span
class="cmr-6">27</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-103056r28"></a><span
class="cmr-6">28</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><br class="fancyvrb" /><a
id="x1-103058r29"></a><span
class="cmr-6">29</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-103060r30"></a><span
class="cmr-6">30</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;16)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;(</span><span
class="cmtt-8">&#x00A0;[val]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;nonzero</span><span
class="cmtt-8">&#x00A0;)</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span><br class="fancyvrb" /><a
id="x1-103062r31"></a><span
class="cmr-6">31</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-103064r32"></a><span
class="cmr-6">32</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;17)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_step2_flag]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[low_neighbor_offset]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;set</span>
<br class="fancyvrb" /><a
id="x1-103066r33"></a><span
class="cmr-6">33</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;18)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_step2_flag]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[high_neighbor_offset]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;set</span>
<br class="fancyvrb" /><a
id="x1-103068r34"></a><span
class="cmr-6">34</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;19)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_step2_flag]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;set</span><br class="fancyvrb" /><a
id="x1-103070r35"></a><span
class="cmr-6">35</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;20)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;(</span><span
class="cmtt-8">&#x00A0;[val]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;greater</span><span
class="cmtt-8">&#x00A0;than</span><span
class="cmtt-8">&#x00A0;or</span><span
class="cmtt-8">&#x00A0;equal</span><span
class="cmtt-8">&#x00A0;to</span><span
class="cmtt-8">&#x00A0;[room]</span><span
class="cmtt-8">&#x00A0;)</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span>
<br class="fancyvrb" /><a
id="x1-103072r36"></a><span
class="cmr-6">36</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-103074r37"></a><span
class="cmr-6">37</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;21)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;(</span><span
class="cmtt-8">&#x00A0;[highroom]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;greater</span><span
class="cmtt-8">&#x00A0;than</span><span
class="cmtt-8">&#x00A0;[lowroom]</span><span
class="cmtt-8">&#x00A0;)</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span><br class="fancyvrb" /><a
id="x1-103076r38"></a><span
class="cmr-6">38</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-103078r39"></a><span
class="cmr-6">39</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;22)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_final_Y]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[val]</span><span
class="cmtt-8">&#x00A0;-</span><span
class="cmtt-8">&#x00A0;[lowroom]</span><span
class="cmtt-8">&#x00A0;+</span><span
class="cmtt-8">&#x00A0;[predicted]</span>
<br class="fancyvrb" /><a
id="x1-103080r40"></a><span
class="cmr-6">40</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-103082r41"></a><span
class="cmr-6">41</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0; </span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><span
class="cmtt-8">&#x00A0;else</span><span
class="cmtt-8">&#x00A0;[highroom]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;not</span><span
class="cmtt-8">&#x00A0;greater</span><span
class="cmtt-8">&#x00A0;than</span><span
class="cmtt-8">&#x00A0;[lowroom]</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span><br class="fancyvrb" /><a
id="x1-103084r42"></a><span
class="cmr-6">42</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-103086r43"></a><span
class="cmr-6">43</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;23)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_final_Y]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[predicted]</span><span
class="cmtt-8">&#x00A0;-</span><span
class="cmtt-8">&#x00A0;[val]</span><span
class="cmtt-8">&#x00A0;+</span><span
class="cmtt-8">&#x00A0;[highroom]</span><span
class="cmtt-8">&#x00A0;-</span><span
class="cmtt-8">&#x00A0;1</span>
<br class="fancyvrb" /><a
id="x1-103088r44"></a><span
class="cmr-6">44</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-103090r45"></a><span
class="cmr-6">45</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><br class="fancyvrb" /><a
id="x1-103092r46"></a><span
class="cmr-6">46</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-103094r47"></a><span
class="cmr-6">47</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><span
class="cmtt-8">&#x00A0;else</span><span
class="cmtt-8">&#x00A0;[val]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;less</span><span
class="cmtt-8">&#x00A0;than</span><span
class="cmtt-8">&#x00A0;[room]</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span><br class="fancyvrb" /><a
id="x1-103096r48"></a><span
class="cmr-6">48</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-103098r49"></a><span
class="cmr-6">49</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;24)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;([val]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;odd)</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span><br class="fancyvrb" /><a
id="x1-103100r50"></a><span
class="cmr-6">50</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-103102r51"></a><span
class="cmr-6">51</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;25)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_final_Y]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;=</span>
<br class="fancyvrb" /><a
id="x1-103104r52"></a><span
class="cmr-6">52</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;[predicted]</span><span
class="cmtt-8">&#x00A0;-</span><span
class="cmtt-8">&#x00A0;(([val]</span><span
class="cmtt-8">&#x00A0;+</span><span
class="cmtt-8">&#x00A0;1)</span><span
class="cmtt-8">&#x00A0;divided</span><span
class="cmtt-8">&#x00A0;by</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;using</span><span
class="cmtt-8">&#x00A0;integer</span><span
class="cmtt-8">&#x00A0;division)</span><br class="fancyvrb" /><a
id="x1-103106r53"></a><span
class="cmr-6">53</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-103108r54"></a><span
class="cmr-6">54</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><span
class="cmtt-8">&#x00A0;else</span><span
class="cmtt-8">&#x00A0;[val]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;even</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span><br class="fancyvrb" /><a
id="x1-103110r55"></a><span
class="cmr-6">55</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-103112r56"></a><span
class="cmr-6">56</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;26)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_final_Y]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;=</span>
<br class="fancyvrb" /><a
id="x1-103114r57"></a><span
class="cmr-6">57</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;[predicted]</span><span
class="cmtt-8">&#x00A0;+</span><span
class="cmtt-8">&#x00A0;([val]</span><span
class="cmtt-8">&#x00A0;/</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;using</span><span
class="cmtt-8">&#x00A0;integer</span><span
class="cmtt-8">&#x00A0;division)</span><br class="fancyvrb" /><a
id="x1-103116r58"></a><span
class="cmr-6">58</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-103118r59"></a><span
class="cmr-6">59</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><br class="fancyvrb" /><a
id="x1-103120r60"></a><span
class="cmr-6">60</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-103122r61"></a><span
class="cmr-6">61</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><br class="fancyvrb" /><a
id="x1-103124r62"></a><span
class="cmr-6">62</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-103126r63"></a><span
class="cmr-6">63</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><span
class="cmtt-8">&#x00A0;else</span><span
class="cmtt-8">&#x00A0;[val]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;zero</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span><br class="fancyvrb" /><a
id="x1-103128r64"></a><span
class="cmr-6">64</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-103130r65"></a><span
class="cmr-6">65</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;27)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_step2_flag]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;unset</span>
<br class="fancyvrb" /><a
id="x1-103132r66"></a><span
class="cmr-6">66</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;28)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_final_Y]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[predicted]</span><br class="fancyvrb" /><a
id="x1-103134r67"></a><span
class="cmr-6">67</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-103136r68"></a><span
class="cmr-6">68</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><br class="fancyvrb" /><a
id="x1-103138r69"></a><span
class="cmr-6">69</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-103140r70"></a><span
class="cmr-6">70</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><br class="fancyvrb" /><a
id="x1-103142r71"></a><span
class="cmr-6">71</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-103144r72"></a><span
class="cmr-6">72</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;29)</span><span
class="cmtt-8">&#x00A0;done</span><br class="fancyvrb" /><a
id="x1-103146r73"></a><span
class="cmr-6">73</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span></div>
</dd><dt class="description">
<span
class="cmssbx-10x-x-120">step 2: curve synthesis</span> </dt><dd
class="description">
<!--l. 351--><p class="noindent" >Curve synthesis generates a return vector <span
class="cmtt-12">[floor] </span>of length <span
class="cmtt-12">[n] </span>(where <span
class="cmtt-12">[n] </span>is provided by
the decode process calling to floor decode). Floor 1 curve synthesis makes use of the
<span
class="cmtt-12">[floor1_X_list]</span>, <span
class="cmtt-12">[floor1_final_Y] </span>and <span
class="cmtt-12">[floor1_step2_flag] </span>vectors, as well as
[floor1_multiplier] and [floor1_values] values.
<!--l. 358--><p class="noindent" >Decode begins by sorting the scalars from vectors <span
class="cmtt-12">[floor1_X_list]</span>, <span
class="cmtt-12">[floor1_final_Y] </span>and
<span
class="cmtt-12">[floor1_step2_flag] </span>together into new vectors <span
class="cmtt-12">[floor1_X_list]&#8217;</span>, <span
class="cmtt-12">[floor1_final_Y]&#8217;</span>
and <span
class="cmtt-12">[floor1_step2_flag]&#8217; </span>according to ascending sort order of the values in
<span
class="cmtt-12">[floor1_X_list]</span>. That is, sort the values of <span
class="cmtt-12">[floor1_X_list] </span>and then apply the same
permutation to elements of the other two vectors so that the X, Y and step2_flag values
still match.
<!--l. 368--><p class="noindent" >Then compute the final curve in one pass:
<!--l. 370--><p class="noindent" >
<div class="fancyvrb" id="fancyvrb32"><a
id="x1-103148r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1)</span><span
class="cmtt-8">&#x00A0;[hx]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;0</span><br class="fancyvrb" /><a
id="x1-103150r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2)</span><span
class="cmtt-8">&#x00A0;[lx]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;0</span><br class="fancyvrb" /><a
id="x1-103152r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;3)</span><span
class="cmtt-8">&#x00A0;[ly]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor1_final_Y]&#8217;</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[0]</span><span
class="cmtt-8">&#x00A0;*</span><span
class="cmtt-8">&#x00A0;[floor1_multiplier]</span>
<br class="fancyvrb" /><a
id="x1-103154r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;4)</span><span
class="cmtt-8">&#x00A0;iterate</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;over</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;range</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;...</span><span
class="cmtt-8">&#x00A0;[floor1_values]-1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span><br class="fancyvrb" /><a
id="x1-103156r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-103158r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;5)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;(</span><span
class="cmtt-8">&#x00A0;[floor1_step2_flag]&#8217;</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;set</span><span
class="cmtt-8">&#x00A0;)</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span><br class="fancyvrb" /><a
id="x1-103160r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-103162r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;6)</span><span
class="cmtt-8">&#x00A0;[hy]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[floor1_final_Y]&#8217;</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;*</span><span
class="cmtt-8">&#x00A0;[floor1_multiplier]</span><br class="fancyvrb" /><a
id="x1-103164r9"></a><span
class="cmr-6">9</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0; </span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;7)</span><span
class="cmtt-8">&#x00A0;[hx]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[floor1_X_list]&#8217;</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[i]</span>
<br class="fancyvrb" /><a
id="x1-103166r10"></a><span
class="cmr-6">10</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;8)</span><span
class="cmtt-8">&#x00A0;</span><a
href="#x1-1250009.2.7"><span
class="cmtt-8">render_line</span></a><span
class="cmtt-8">(</span><span
class="cmtt-8">&#x00A0;[lx],</span><span
class="cmtt-8">&#x00A0;[ly],</span><span
class="cmtt-8">&#x00A0;[hx],</span><span
class="cmtt-8">&#x00A0;[hy],</span><span
class="cmtt-8">&#x00A0;[floor]</span><span
class="cmtt-8">&#x00A0;)</span><br class="fancyvrb" /><a
id="x1-103168r11"></a><span
class="cmr-6">11</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;9)</span><span
class="cmtt-8">&#x00A0;[lx]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[hx]</span><br class="fancyvrb" /><a
id="x1-103170r12"></a><span
class="cmr-6">12</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0; </span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;10)</span><span
class="cmtt-8">&#x00A0;[ly]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[hy]</span>
<br class="fancyvrb" /><a
id="x1-103172r13"></a><span
class="cmr-6">13</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><br class="fancyvrb" /><a
id="x1-103174r14"></a><span
class="cmr-6">14</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><br class="fancyvrb" /><a
id="x1-103176r15"></a><span
class="cmr-6">15</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-103178r16"></a><span
class="cmr-6">16</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;11)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;(</span><span
class="cmtt-8">&#x00A0;[hx]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;less</span><span
class="cmtt-8">&#x00A0;than</span><span
class="cmtt-8">&#x00A0;[n]</span><span
class="cmtt-8">&#x00A0;)</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span><br class="fancyvrb" /><a
id="x1-103180r17"></a><span
class="cmr-6">17</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-103182r18"></a><span
class="cmr-6">18</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;12)</span><span
class="cmtt-8">&#x00A0;</span><a
href="#x1-1250009.2.7"><span
class="cmtt-8">render_line</span></a><span
class="cmtt-8">(</span><span
class="cmtt-8">&#x00A0;[hx],</span><span
class="cmtt-8">&#x00A0;[hy],</span><span
class="cmtt-8">&#x00A0;[n],</span><span
class="cmtt-8">&#x00A0;[hy],</span><span
class="cmtt-8">&#x00A0;[floor]</span><span
class="cmtt-8">&#x00A0;)</span>
<br class="fancyvrb" /><a
id="x1-103184r19"></a><span
class="cmr-6">19</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-103186r20"></a><span
class="cmr-6">20</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><br class="fancyvrb" /><a
id="x1-103188r21"></a><span
class="cmr-6">21</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-103190r22"></a><span
class="cmr-6">22</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;13)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;(</span><span
class="cmtt-8">&#x00A0;[hx]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;greater</span><span
class="cmtt-8">&#x00A0;than</span><span
class="cmtt-8">&#x00A0;[n]</span><span
class="cmtt-8">&#x00A0;)</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">{</span><br class="fancyvrb" /><a
id="x1-103192r23"></a><span
class="cmr-6">23</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-103194r24"></a><span
class="cmr-6">24</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;14)</span><span
class="cmtt-8">&#x00A0;truncate</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor]</span><span
class="cmtt-8">&#x00A0;to</span><span
class="cmtt-8">&#x00A0;[n]</span><span
class="cmtt-8">&#x00A0;elements</span>
<br class="fancyvrb" /><a
id="x1-103196r25"></a><span
class="cmr-6">25</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-103198r26"></a><span
class="cmr-6">26</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmsy-8">}</span><br class="fancyvrb" /><a
id="x1-103200r27"></a><span
class="cmr-6">27</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-103202r28"></a><span
class="cmr-6">28</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;15)</span><span
class="cmtt-8">&#x00A0;for</span><span
class="cmtt-8">&#x00A0;each</span><span
class="cmtt-8">&#x00A0;scalar</span><span
class="cmtt-8">&#x00A0;in</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[floor],</span><span
class="cmtt-8">&#x00A0;perform</span><span
class="cmtt-8">&#x00A0;a</span><span
class="cmtt-8">&#x00A0;lookup</span><span
class="cmtt-8">&#x00A0;substitution</span><span
class="cmtt-8">&#x00A0;using</span>
<br class="fancyvrb" /><a
id="x1-103204r29"></a><span
class="cmr-6">29</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;scalar</span><span
class="cmtt-8">&#x00A0;value</span><span
class="cmtt-8">&#x00A0;from</span><span
class="cmtt-8">&#x00A0;[floor]</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;an</span><span
class="cmtt-8">&#x00A0;offset</span><span
class="cmtt-8">&#x00A0;into</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;</span><a
href="#x1-12700010.1"><span
class="cmtt-8">[floor1_inverse_dB_static_table]</span></a><br class="fancyvrb" /><a
id="x1-103206r30"></a><span
class="cmr-6">30</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-103208r31"></a><span
class="cmr-6">31</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;16)</span><span
class="cmtt-8">&#x00A0;done</span><br class="fancyvrb" /><a
id="x1-103210r32"></a><span
class="cmr-6">32</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span></div>
</dd></dl>
<h3 class="sectionHead"><span class="titlemark">8. </span> <a
id="x1-1040008"></a>Residue setup and decode</h3>
<!--l. 6--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">8.1. </span> <a
id="x1-1050008.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-1060008.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-12">n</span>, a partition size <span
class="cmti-12">residue</span><span
class="cmti-12">_partition</span><span
class="cmti-12">_size</span>,
and a total of <span
class="cmti-12">ch </span>residue vectors, the total number of partitioned chunks coded
is <span
class="cmti-12">n</span>/<span
class="cmti-12">residue</span><span
class="cmti-12">_partition</span><span
class="cmti-12">_size</span>*<span
class="cmti-12">ch</span>. It is important to note that the integer division
truncates. In the below example, we assume an example <span
class="cmti-12">residue</span><span
class="cmti-12">_partition</span><span
class="cmti-12">_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 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" >
<!--l. 71--><p class="noindent" ><img
src="residue-pack.png" alt="PIC"
>
<br /> <div class="caption"
><span class="id">Figure&#x00A0;11: </span><span
class="content">illustration of residue vector format</span></div><!--tex4ht:label?: x1-10600111 -->
</div>
<!--l. 77--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">8.3. </span> <a
id="x1-1070008.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-107002r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-107004r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;original</span><span
class="cmtt-8">&#x00A0;residue</span><span
class="cmtt-8">&#x00A0;vector:</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;3</span><span
class="cmtt-8">&#x00A0;4</span><span
class="cmtt-8">&#x00A0;5</span><span
class="cmtt-8">&#x00A0;6</span><span
class="cmtt-8">&#x00A0;7</span><span
class="cmtt-8">&#x00A0;]</span><br class="fancyvrb" /><a
id="x1-107006r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-107008r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;codebook</span><span
class="cmtt-8">&#x00A0;dimensions</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;encoded</span><span
class="cmtt-8">&#x00A0;as:</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;3</span><span
class="cmtt-8">&#x00A0;4</span><span
class="cmtt-8">&#x00A0;5</span><span
class="cmtt-8">&#x00A0;6</span><span
class="cmtt-8">&#x00A0;7</span><span
class="cmtt-8">&#x00A0;]</span><br class="fancyvrb" /><a
id="x1-107010r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-107012r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;codebook</span><span
class="cmtt-8">&#x00A0;dimensions</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;encoded</span><span
class="cmtt-8">&#x00A0;as:</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;4</span><span
class="cmtt-8">&#x00A0;6</span><span
class="cmtt-8">&#x00A0;],</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;3</span><span
class="cmtt-8">&#x00A0;5</span><span
class="cmtt-8">&#x00A0;7</span><span
class="cmtt-8">&#x00A0;]</span><br class="fancyvrb" /><a
id="x1-107014r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-107016r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;codebook</span><span
class="cmtt-8">&#x00A0;dimensions</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;encoded</span><span
class="cmtt-8">&#x00A0;as:</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;4</span><span
class="cmtt-8">&#x00A0;],</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;5</span><span
class="cmtt-8">&#x00A0;],</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;6</span><span
class="cmtt-8">&#x00A0;],</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;3</span><span
class="cmtt-8">&#x00A0;7</span><span
class="cmtt-8">&#x00A0;]</span>
<br class="fancyvrb" /><a
id="x1-107018r9"></a><span
class="cmr-6">9</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-107020r10"></a><span
class="cmr-6">10</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;codebook</span><span
class="cmtt-8">&#x00A0;dimensions</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;encoded</span><span
class="cmtt-8">&#x00A0;as:</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;],</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;],</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;],</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;3</span><span
class="cmtt-8">&#x00A0;],</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;4</span><span
class="cmtt-8">&#x00A0;],</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;5</span><span
class="cmtt-8">&#x00A0;],</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;6</span><span
class="cmtt-8">&#x00A0;],</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;7</span><span
class="cmtt-8">&#x00A0;]</span><br class="fancyvrb" /><a
id="x1-107022r11"></a><span
class="cmr-6">11</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#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-1080008.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-108002r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-108004r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;original</span><span
class="cmtt-8">&#x00A0;residue</span><span
class="cmtt-8">&#x00A0;vector:</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;3</span><span
class="cmtt-8">&#x00A0;4</span><span
class="cmtt-8">&#x00A0;5</span><span
class="cmtt-8">&#x00A0;6</span><span
class="cmtt-8">&#x00A0;7</span><span
class="cmtt-8">&#x00A0;]</span><br class="fancyvrb" /><a
id="x1-108006r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-108008r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;codebook</span><span
class="cmtt-8">&#x00A0;dimensions</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;encoded</span><span
class="cmtt-8">&#x00A0;as:</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;3</span><span
class="cmtt-8">&#x00A0;4</span><span
class="cmtt-8">&#x00A0;5</span><span
class="cmtt-8">&#x00A0;6</span><span
class="cmtt-8">&#x00A0;7</span><span
class="cmtt-8">&#x00A0;]</span><br class="fancyvrb" /><a
id="x1-108010r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-108012r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;codebook</span><span
class="cmtt-8">&#x00A0;dimensions</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;encoded</span><span
class="cmtt-8">&#x00A0;as:</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;3</span><span
class="cmtt-8">&#x00A0;],</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;4</span><span
class="cmtt-8">&#x00A0;5</span><span
class="cmtt-8">&#x00A0;6</span><span
class="cmtt-8">&#x00A0;7</span><span
class="cmtt-8">&#x00A0;]</span><br class="fancyvrb" /><a
id="x1-108014r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-108016r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;codebook</span><span
class="cmtt-8">&#x00A0;dimensions</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;encoded</span><span
class="cmtt-8">&#x00A0;as:</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;],</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;3</span><span
class="cmtt-8">&#x00A0;],</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;4</span><span
class="cmtt-8">&#x00A0;5</span><span
class="cmtt-8">&#x00A0;],</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;6</span><span
class="cmtt-8">&#x00A0;7</span><span
class="cmtt-8">&#x00A0;]</span>
<br class="fancyvrb" /><a
id="x1-108018r9"></a><span
class="cmr-6">9</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-108020r10"></a><span
class="cmr-6">10</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;codebook</span><span
class="cmtt-8">&#x00A0;dimensions</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;encoded</span><span
class="cmtt-8">&#x00A0;as:</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;],</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;1</span><span
class="cmtt-8">&#x00A0;],</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;],</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;3</span><span
class="cmtt-8">&#x00A0;],</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;4</span><span
class="cmtt-8">&#x00A0;],</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;5</span><span
class="cmtt-8">&#x00A0;],</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;6</span><span
class="cmtt-8">&#x00A0;],</span><span
class="cmtt-8">&#x00A0;[</span><span
class="cmtt-8">&#x00A0;7</span><span
class="cmtt-8">&#x00A0;]</span><br class="fancyvrb" /><a
id="x1-108022r11"></a><span
class="cmr-6">11</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span></div>
<!--l. 137--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">8.5. </span> <a
id="x1-1090008.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-12">ch </span>passed in vectors of length <span
class="cmti-12">n </span>are first interleaved
and flattened into a single vector of length <span
class="cmti-12">ch</span>*<span
class="cmti-12">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" >
<!--l. 148--><p class="noindent" ><img
src="residue2.png" alt="PIC"
>
<br /> <div class="caption"
><span class="id">Figure&#x00A0;12: </span><span
class="content">illustration of residue type 2</span></div><!--tex4ht:label?: x1-10900112 -->
</div>
<!--l. 153--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">8.6. </span> <a
id="x1-1100008.6"></a>Residue decode</h4>
<!--l. 155--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">8.6.1. </span> <a
id="x1-1110008.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-111002r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1)</span><span
class="cmtt-8">&#x00A0;[residue\_begin]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;24</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span><br class="fancyvrb" /><a
id="x1-111004r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2)</span><span
class="cmtt-8">&#x00A0;[residue\_end]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;24</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span>
<br class="fancyvrb" /><a
id="x1-111006r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;3)</span><span
class="cmtt-8">&#x00A0;[residue\_partition\_size]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;24</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span><span
class="cmtt-8">&#x00A0;and</span><span
class="cmtt-8">&#x00A0;add</span><span
class="cmtt-8">&#x00A0;one</span>
<br class="fancyvrb" /><a
id="x1-111008r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;4)</span><span
class="cmtt-8">&#x00A0;[residue\_classifications]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;6</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span><span
class="cmtt-8">&#x00A0;and</span><span
class="cmtt-8">&#x00A0;add</span><span
class="cmtt-8">&#x00A0;one</span><br class="fancyvrb" /><a
id="x1-111010r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;5)</span><span
class="cmtt-8">&#x00A0;[residue\_classbook]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;8</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span></div>
<!--l. 166--><p class="noindent" ><span
class="cmtt-12">[residue_begin] </span>and <span
class="cmtt-12">[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-12">[residue_begin] </span>and ends at <span
class="cmtt-12">[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-12">[residue_partition_size]</span>apply to the interleaved vector, not the
individual vectors before interleave. <span
class="cmtt-12">[residue_partition_size] </span>is as explained above,
<span
class="cmtt-12">[residue_classifications] </span>is the number of possible classification to which a partition can
belong and <span
class="cmtt-12">[residue_classbook] </span>is the codebook number used to code classification
codewords. The number of dimensions in book <span
class="cmtt-12">[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-12">[residue_classbook]</span>, along with
<span
class="cmtt-12">[residue_classifications]</span>, overdetermines to possible number of classification
codewords. If <span
class="cmtt-12">[residue_classifications]</span>&#x02C6;<span
class="cmtt-12">[residue_classbook]</span>.dimensions exceeds
<span
class="cmtt-12">[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-111012r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1)</span><span
class="cmtt-8">&#x00A0;iterate</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;over</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;range</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;...</span><span
class="cmtt-8">&#x00A0;[residue\_classifications]-1</span><span
class="cmtt-8">&#x00A0;{</span><br class="fancyvrb" /><a
id="x1-111014r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-111016r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2)</span><span
class="cmtt-8">&#x00A0;[high\_bits]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;0</span>
<br class="fancyvrb" /><a
id="x1-111018r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;3)</span><span
class="cmtt-8">&#x00A0;[low\_bits]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;3</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span><br class="fancyvrb" /><a
id="x1-111020r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;4)</span><span
class="cmtt-8">&#x00A0;[bitflag]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;one</span><span
class="cmtt-8">&#x00A0;bit</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;boolean</span>
<br class="fancyvrb" /><a
id="x1-111022r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;5)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;(</span><span
class="cmtt-8">&#x00A0;[bitflag]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;set</span><span
class="cmtt-8">&#x00A0;)</span><span
class="cmtt-8">&#x00A0;then</span><span
class="cmtt-8">&#x00A0;[high\_bits]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;five</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span>
<br class="fancyvrb" /><a
id="x1-111024r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;6)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[residue\_cascade]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[high\_bits]</span><span
class="cmtt-8">&#x00A0;*</span><span
class="cmtt-8">&#x00A0;8</span><span
class="cmtt-8">&#x00A0;+</span><span
class="cmtt-8">&#x00A0;[low\_bits]</span><br class="fancyvrb" /><a
id="x1-111026r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;}</span><br class="fancyvrb" /><a
id="x1-111028r9"></a><span
class="cmr-6">9</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;7)</span><span
class="cmtt-8">&#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-111030r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1)</span><span
class="cmtt-8">&#x00A0;iterate</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;over</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;range</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;...</span><span
class="cmtt-8">&#x00A0;[residue\_classifications]-1</span><span
class="cmtt-8">&#x00A0;{</span><br class="fancyvrb" /><a
id="x1-111032r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-111034r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2)</span><span
class="cmtt-8">&#x00A0;iterate</span><span
class="cmtt-8">&#x00A0;[j]</span><span
class="cmtt-8">&#x00A0;over</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;range</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;...</span><span
class="cmtt-8">&#x00A0;7</span><span
class="cmtt-8">&#x00A0;{</span>
<br class="fancyvrb" /><a
id="x1-111036r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-111038r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;3)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;(</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[residue\_cascade]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;bit</span><span
class="cmtt-8">&#x00A0;[j]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;set</span><span
class="cmtt-8">&#x00A0;)</span><span
class="cmtt-8">&#x00A0;{</span><br class="fancyvrb" /><a
id="x1-111040r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-111042r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;4)</span><span
class="cmtt-8">&#x00A0;array</span><span
class="cmtt-8">&#x00A0;[residue\_books]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[i][j]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;8</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;as</span><span
class="cmtt-8">&#x00A0;unsigned</span><span
class="cmtt-8">&#x00A0;integer</span><br class="fancyvrb" /><a
id="x1-111044r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-111046r9"></a><span
class="cmr-6">9</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;}</span><span
class="cmtt-8">&#x00A0;else</span><span
class="cmtt-8">&#x00A0;{</span><br class="fancyvrb" /><a
id="x1-111048r10"></a><span
class="cmr-6">10</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-111050r11"></a><span
class="cmr-6">11</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;5)</span><span
class="cmtt-8">&#x00A0;array</span><span
class="cmtt-8">&#x00A0;[residue\_books]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[i][j]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;unused</span><br class="fancyvrb" /><a
id="x1-111052r12"></a><span
class="cmr-6">12</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-111054r13"></a><span
class="cmr-6">13</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;}</span><br class="fancyvrb" /><a
id="x1-111056r14"></a><span
class="cmr-6">14</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;}</span><br class="fancyvrb" /><a
id="x1-111058r15"></a><span
class="cmr-6">15</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;}</span><br class="fancyvrb" /><a
id="x1-111060r16"></a><span
class="cmr-6">16</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-111062r17"></a><span
class="cmr-6">17</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;6)</span><span
class="cmtt-8">&#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 addition, any codebook number greater than the maximum numbered codebook
set up in this stream also renders the stream undecodable. All codebooks in array
[residue_books] are required to have a value mapping. The presence of codebook in array
[residue_books] without a value mapping (maptype equals zero) renders the stream
undecodable.
<!--l. 241--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">8.6.2. </span> <a
id="x1-1120008.6.2"></a>packet decode</h5>
<!--l. 243--><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. 248--><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. 255--><p class="noindent" >Depending on the values of <span
class="cmtt-12">[residue_begin] </span>and <span
class="cmtt-12">[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-12">[residue_begin] </span>and <span
class="cmtt-12">[residue_end] </span>to specify a range partially or wholly
beyond the maximum vector size. Before beginning residue decode, limit <span
class="cmtt-12">[residue_begin]</span>
and <span
class="cmtt-12">[residue_end] </span>to the maximum possible vector size as follows. We assume that
the number of vectors being encoded, <span
class="cmtt-12">[ch] </span>is provided by the higher level decoding
process.
<!--l. 269--><p class="noindent" >
<div class="fancyvrb" id="fancyvrb38"><a
id="x1-112002r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1)</span><span
class="cmtt-8">&#x00A0;[actual\_size]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;current</span><span
class="cmtt-8">&#x00A0;blocksize/2;</span><br class="fancyvrb" /><a
id="x1-112004r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;residue</span><span
class="cmtt-8">&#x00A0;encoding</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;format</span><span
class="cmtt-8">&#x00A0;2</span>
<br class="fancyvrb" /><a
id="x1-112006r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;3)</span><span
class="cmtt-8">&#x00A0;[actual\_size]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[actual\_size]</span><span
class="cmtt-8">&#x00A0;*</span><span
class="cmtt-8">&#x00A0;[ch];</span><br class="fancyvrb" /><a
id="x1-112008r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;4)</span><span
class="cmtt-8">&#x00A0;[limit\_residue\_begin]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;minimum</span><span
class="cmtt-8">&#x00A0;of</span><span
class="cmtt-8">&#x00A0;([residue\_begin],[actual\_size]);</span>
<br class="fancyvrb" /><a
id="x1-112010r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;5)</span><span
class="cmtt-8">&#x00A0;[limit\_residue\_end]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;minimum</span><span
class="cmtt-8">&#x00A0;of</span><span
class="cmtt-8">&#x00A0;([residue\_end],[actual\_size]);</span></div>
<!--l. 277--><p class="noindent" >The following convenience values are conceptually useful to clarifying the decode process:
<!--l. 280--><p class="noindent" >
<div class="fancyvrb" id="fancyvrb39"><a
id="x1-112012r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1)</span><span
class="cmtt-8">&#x00A0;[classwords\_per\_codeword]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[codebook\_dimensions]</span><span
class="cmtt-8">&#x00A0;value</span><span
class="cmtt-8">&#x00A0;of</span><span
class="cmtt-8">&#x00A0;codebook</span><span
class="cmtt-8">&#x00A0;[residue\_classbook]</span>
<br class="fancyvrb" /><a
id="x1-112014r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2)</span><span
class="cmtt-8">&#x00A0;[n\_to\_read]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[limit\_residue\_end]</span><span
class="cmtt-8">&#x00A0;-</span><span
class="cmtt-8">&#x00A0;[limit\_residue\_begin]</span><br class="fancyvrb" /><a
id="x1-112016r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;3)</span><span
class="cmtt-8">&#x00A0;[partitions\_to\_read]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[n\_to\_read]</span><span
class="cmtt-8">&#x00A0;/</span><span
class="cmtt-8">&#x00A0;[residue\_partition\_size]</span></div>
<!--l. 286--><p class="noindent" >Packet decode proceeds as follows, matching the description offered earlier in the document.
<div class="fancyvrb" id="fancyvrb40"><a
id="x1-112018r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1)</span><span
class="cmtt-8">&#x00A0;allocate</span><span
class="cmtt-8">&#x00A0;and</span><span
class="cmtt-8">&#x00A0;zero</span><span
class="cmtt-8">&#x00A0;all</span><span
class="cmtt-8">&#x00A0;vectors</span><span
class="cmtt-8">&#x00A0;that</span><span
class="cmtt-8">&#x00A0;will</span><span
class="cmtt-8">&#x00A0;be</span><span
class="cmtt-8">&#x00A0;returned.</span><br class="fancyvrb" /><a
id="x1-112020r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;([n\_to\_read]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;zero),</span><span
class="cmtt-8">&#x00A0;stop;</span><span
class="cmtt-8">&#x00A0;there</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;no</span><span
class="cmtt-8">&#x00A0;residue</span><span
class="cmtt-8">&#x00A0;to</span><span
class="cmtt-8">&#x00A0;decode.</span>
<br class="fancyvrb" /><a
id="x1-112022r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;3)</span><span
class="cmtt-8">&#x00A0;iterate</span><span
class="cmtt-8">&#x00A0;[pass]</span><span
class="cmtt-8">&#x00A0;over</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;range</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;...</span><span
class="cmtt-8">&#x00A0;7</span><span
class="cmtt-8">&#x00A0;{</span><br class="fancyvrb" /><a
id="x1-112024r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-112026r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;4)</span><span
class="cmtt-8">&#x00A0;[partition\_count]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;0</span><br class="fancyvrb" /><a
id="x1-112028r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-112030r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;5)</span><span
class="cmtt-8">&#x00A0;while</span><span
class="cmtt-8">&#x00A0;[partition\_count]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;less</span><span
class="cmtt-8">&#x00A0;than</span><span
class="cmtt-8">&#x00A0;[partitions\_to\_read]</span><br class="fancyvrb" /><a
id="x1-112032r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-112034r9"></a><span
class="cmr-6">9</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;6)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;([pass]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;zero)</span><span
class="cmtt-8">&#x00A0;{</span><br class="fancyvrb" /><a
id="x1-112036r10"></a><span
class="cmr-6">10</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-112038r11"></a><span
class="cmr-6">11</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;7)</span><span
class="cmtt-8">&#x00A0;iterate</span><span
class="cmtt-8">&#x00A0;[j]</span><span
class="cmtt-8">&#x00A0;over</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;range</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;..</span><span
class="cmtt-8">&#x00A0;[ch]-1</span><span
class="cmtt-8">&#x00A0;{</span><br class="fancyvrb" /><a
id="x1-112040r12"></a><span
class="cmr-6">12</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-112042r13"></a><span
class="cmr-6">13</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;8)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[j]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;not</span><span
class="cmtt-8">&#x00A0;marked</span><span
class="cmtt-8">&#x00A0;&#8217;do</span><span
class="cmtt-8">&#x00A0;not</span><span
class="cmtt-8">&#x00A0;decode&#8217;</span><span
class="cmtt-8">&#x00A0;{</span>
<br class="fancyvrb" /><a
id="x1-112044r14"></a><span
class="cmr-6">14</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-112046r15"></a><span
class="cmr-6">15</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;9)</span><span
class="cmtt-8">&#x00A0;[temp]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;from</span><span
class="cmtt-8">&#x00A0;packet</span><span
class="cmtt-8">&#x00A0;using</span><span
class="cmtt-8">&#x00A0;codebook</span><span
class="cmtt-8">&#x00A0;[residue\_classbook]</span><span
class="cmtt-8">&#x00A0;in</span><span
class="cmtt-8">&#x00A0;scalar</span><span
class="cmtt-8">&#x00A0;context</span>
<br class="fancyvrb" /><a
id="x1-112048r16"></a><span
class="cmr-6">16</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;10)</span><span
class="cmtt-8">&#x00A0;iterate</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;descending</span><span
class="cmtt-8">&#x00A0;over</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;range</span><span
class="cmtt-8">&#x00A0;[classwords\_per\_codeword]-1</span><span
class="cmtt-8">&#x00A0;...</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;{</span>
<br class="fancyvrb" /><a
id="x1-112050r17"></a><span
class="cmr-6">17</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-112052r18"></a><span
class="cmr-6">18</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;11)</span><span
class="cmtt-8">&#x00A0;array</span><span
class="cmtt-8">&#x00A0;[classifications]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[j],([i]+[partition\_count])</span><span
class="cmtt-8">&#x00A0;=</span>
<br class="fancyvrb" /><a
id="x1-112054r19"></a><span
class="cmr-6">19</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;[temp]</span><span
class="cmtt-8">&#x00A0;integer</span><span
class="cmtt-8">&#x00A0;modulo</span><span
class="cmtt-8">&#x00A0;[residue\_classifications]</span>
<br class="fancyvrb" /><a
id="x1-112056r20"></a><span
class="cmr-6">20</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;12)</span><span
class="cmtt-8">&#x00A0;[temp]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[temp]</span><span
class="cmtt-8">&#x00A0;/</span><span
class="cmtt-8">&#x00A0;[residue\_classifications]</span><span
class="cmtt-8">&#x00A0;using</span><span
class="cmtt-8">&#x00A0;integer</span><span
class="cmtt-8">&#x00A0;division</span><br class="fancyvrb" /><a
id="x1-112058r21"></a><span
class="cmr-6">21</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-112060r22"></a><span
class="cmr-6">22</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;}</span><br class="fancyvrb" /><a
id="x1-112062r23"></a><span
class="cmr-6">23</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-112064r24"></a><span
class="cmr-6">24</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;}</span><br class="fancyvrb" /><a
id="x1-112066r25"></a><span
class="cmr-6">25</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-112068r26"></a><span
class="cmr-6">26</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;}</span><br class="fancyvrb" /><a
id="x1-112070r27"></a><span
class="cmr-6">27</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-112072r28"></a><span
class="cmr-6">28</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;}</span><br class="fancyvrb" /><a
id="x1-112074r29"></a><span
class="cmr-6">29</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-112076r30"></a><span
class="cmr-6">30</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;13)</span><span
class="cmtt-8">&#x00A0;iterate</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;over</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;range</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;..</span><span
class="cmtt-8">&#x00A0;([classwords\_per\_codeword]</span><span
class="cmtt-8">&#x00A0;-</span><span
class="cmtt-8">&#x00A0;1)</span><span
class="cmtt-8">&#x00A0;while</span><span
class="cmtt-8">&#x00A0;[partition\_count]</span>
<br class="fancyvrb" /><a
id="x1-112078r31"></a><span
class="cmr-6">31</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;also</span><span
class="cmtt-8">&#x00A0;less</span><span
class="cmtt-8">&#x00A0;than</span><span
class="cmtt-8">&#x00A0;[partitions\_to\_read]</span><span
class="cmtt-8">&#x00A0;{</span><br class="fancyvrb" /><a
id="x1-112080r32"></a><span
class="cmr-6">32</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-112082r33"></a><span
class="cmr-6">33</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;14)</span><span
class="cmtt-8">&#x00A0;iterate</span><span
class="cmtt-8">&#x00A0;[j]</span><span
class="cmtt-8">&#x00A0;over</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;range</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;..</span><span
class="cmtt-8">&#x00A0;[ch]-1</span><span
class="cmtt-8">&#x00A0;{</span>
<br class="fancyvrb" /><a
id="x1-112084r34"></a><span
class="cmr-6">34</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-112086r35"></a><span
class="cmr-6">35</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;15)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[j]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;not</span><span
class="cmtt-8">&#x00A0;marked</span><span
class="cmtt-8">&#x00A0;&#8217;do</span><span
class="cmtt-8">&#x00A0;not</span><span
class="cmtt-8">&#x00A0;decode&#8217;</span><span
class="cmtt-8">&#x00A0;{</span><br class="fancyvrb" /><a
id="x1-112088r36"></a><span
class="cmr-6">36</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-112090r37"></a><span
class="cmr-6">37</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;16)</span><span
class="cmtt-8">&#x00A0;[vqclass]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;array</span><span
class="cmtt-8">&#x00A0;[classifications]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[j],[partition\_count]</span>
<br class="fancyvrb" /><a
id="x1-112092r38"></a><span
class="cmr-6">38</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;17)</span><span
class="cmtt-8">&#x00A0;[vqbook]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;array</span><span
class="cmtt-8">&#x00A0;[residue\_books]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[vqclass],[pass]</span><br class="fancyvrb" /><a
id="x1-112094r39"></a><span
class="cmr-6">39</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;18)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;([vqbook]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;not</span><span
class="cmtt-8">&#x00A0;&#8217;unused&#8217;)</span><span
class="cmtt-8">&#x00A0;{</span>
<br class="fancyvrb" /><a
id="x1-112096r40"></a><span
class="cmr-6">40</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-112098r41"></a><span
class="cmr-6">41</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;19)</span><span
class="cmtt-8">&#x00A0;decode</span><span
class="cmtt-8">&#x00A0;partition</span><span
class="cmtt-8">&#x00A0;into</span><span
class="cmtt-8">&#x00A0;output</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;number</span><span
class="cmtt-8">&#x00A0;[j],</span><span
class="cmtt-8">&#x00A0;starting</span><span
class="cmtt-8">&#x00A0;at</span><span
class="cmtt-8">&#x00A0;scalar</span>
<br class="fancyvrb" /><a
id="x1-112100r42"></a><span
class="cmr-6">42</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;offset</span><span
class="cmtt-8">&#x00A0;[limit\_residue\_begin]+[partition\_count]*[residue\_partition\_size]</span><span
class="cmtt-8">&#x00A0;using</span>
<br class="fancyvrb" /><a
id="x1-112102r43"></a><span
class="cmr-6">43</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;codebook</span><span
class="cmtt-8">&#x00A0;number</span><span
class="cmtt-8">&#x00A0;[vqbook]</span><span
class="cmtt-8">&#x00A0;in</span><span
class="cmtt-8">&#x00A0;VQ</span><span
class="cmtt-8">&#x00A0;context</span><br class="fancyvrb" /><a
id="x1-112104r44"></a><span
class="cmr-6">44</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;}</span><br class="fancyvrb" /><a
id="x1-112106r45"></a><span
class="cmr-6">45</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;}</span>
<br class="fancyvrb" /><a
id="x1-112108r46"></a><span
class="cmr-6">46</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-112110r47"></a><span
class="cmr-6">47</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;20)</span><span
class="cmtt-8">&#x00A0;increment</span><span
class="cmtt-8">&#x00A0;[partition\_count]</span><span
class="cmtt-8">&#x00A0;by</span><span
class="cmtt-8">&#x00A0;one</span><br class="fancyvrb" /><a
id="x1-112112r48"></a><span
class="cmr-6">48</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-112114r49"></a><span
class="cmr-6">49</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;}</span><br class="fancyvrb" /><a
id="x1-112116r50"></a><span
class="cmr-6">50</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;}</span><br class="fancyvrb" /><a
id="x1-112118r51"></a><span
class="cmr-6">51</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;}</span><br class="fancyvrb" /><a
id="x1-112120r52"></a><span
class="cmr-6">52</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-112122r53"></a><span
class="cmr-6">53</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;21)</span><span
class="cmtt-8">&#x00A0;done</span><br class="fancyvrb" /><a
id="x1-112124r54"></a><span
class="cmr-6">54</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span></div>
<!--l. 344--><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. 350--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">8.6.3. </span> <a
id="x1-1130008.6.3"></a>format 0 specifics</h5>
<!--l. 352--><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-12">[n] </span>is the value in <span
class="cmtt-12">[residue_partition_size]</span>
</li>
<li class="itemize"><span
class="cmtt-12">[v] </span>is the residue vector
</li>
<li class="itemize"><span
class="cmtt-12">[offset] </span>is the beginning read offset in [v]</li></ul>
<!--l. 363--><p class="noindent" >
<div class="fancyvrb" id="fancyvrb41"><a
id="x1-113002r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1)</span><span
class="cmtt-8">&#x00A0;[step]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[n]</span><span
class="cmtt-8">&#x00A0;/</span><span
class="cmtt-8">&#x00A0;[codebook\_dimensions]</span><br class="fancyvrb" /><a
id="x1-113004r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2)</span><span
class="cmtt-8">&#x00A0;iterate</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;over</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;range</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;...</span><span
class="cmtt-8">&#x00A0;[step]-1</span><span
class="cmtt-8">&#x00A0;{</span><br class="fancyvrb" /><a
id="x1-113006r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-113008r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;3)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[entry\_temp]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;from</span><span
class="cmtt-8">&#x00A0;packet</span><span
class="cmtt-8">&#x00A0;using</span><span
class="cmtt-8">&#x00A0;current</span><span
class="cmtt-8">&#x00A0;codebook</span><span
class="cmtt-8">&#x00A0;in</span><span
class="cmtt-8">&#x00A0;VQ</span><span
class="cmtt-8">&#x00A0;context</span>
<br class="fancyvrb" /><a
id="x1-113010r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;4)</span><span
class="cmtt-8">&#x00A0;iterate</span><span
class="cmtt-8">&#x00A0;[j]</span><span
class="cmtt-8">&#x00A0;over</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;range</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;...</span><span
class="cmtt-8">&#x00A0;[codebook\_dimensions]-1</span><span
class="cmtt-8">&#x00A0;{</span><br class="fancyvrb" /><a
id="x1-113012r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-113014r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;5)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[v]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;([offset]+[i]+[j]*[step])</span><span
class="cmtt-8">&#x00A0;=</span>
<br class="fancyvrb" /><a
id="x1-113016r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0; </span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[v]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;([offset]+[i]+[j]*[step])</span><span
class="cmtt-8">&#x00A0;+</span><br class="fancyvrb" /><a
id="x1-113018r9"></a><span
class="cmr-6">9</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[entry\_temp]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[j]</span><br class="fancyvrb" /><a
id="x1-113020r10"></a><span
class="cmr-6">10</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-113022r11"></a><span
class="cmr-6">11</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;}</span><br class="fancyvrb" /><a
id="x1-113024r12"></a><span
class="cmr-6">12</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-113026r13"></a><span
class="cmr-6">13</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;}</span><br class="fancyvrb" /><a
id="x1-113028r14"></a><span
class="cmr-6">14</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-113030r15"></a><span
class="cmr-6">15</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;6)</span><span
class="cmtt-8">&#x00A0;done</span><br class="fancyvrb" /><a
id="x1-113032r16"></a><span
class="cmr-6">16</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span></div>
<!--l. 384--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">8.6.4. </span> <a
id="x1-1140008.6.4"></a>format 1 specifics</h5>
<!--l. 386--><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-12">[n] </span>is the value in <span
class="cmtt-12">[residue_partition_size]</span>
</li>
<li class="itemize"><span
class="cmtt-12">[v] </span>is the residue vector
</li>
<li class="itemize"><span
class="cmtt-12">[offset] </span>is the beginning read offset in [v]</li></ul>
<!--l. 398--><p class="noindent" >
<div class="fancyvrb" id="fancyvrb42"><a
id="x1-114002r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1)</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;0</span><br class="fancyvrb" /><a
id="x1-114004r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[entry\_temp]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;read</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;from</span><span
class="cmtt-8">&#x00A0;packet</span><span
class="cmtt-8">&#x00A0;using</span><span
class="cmtt-8">&#x00A0;current</span><span
class="cmtt-8">&#x00A0;codebook</span><span
class="cmtt-8">&#x00A0;in</span><span
class="cmtt-8">&#x00A0;VQ</span><span
class="cmtt-8">&#x00A0;context</span>
<br class="fancyvrb" /><a
id="x1-114006r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;3)</span><span
class="cmtt-8">&#x00A0;iterate</span><span
class="cmtt-8">&#x00A0;[j]</span><span
class="cmtt-8">&#x00A0;over</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;range</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;...</span><span
class="cmtt-8">&#x00A0;[codebook\_dimensions]-1</span><span
class="cmtt-8">&#x00A0;{</span><br class="fancyvrb" /><a
id="x1-114008r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-114010r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;4)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[v]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;([offset]+[i])</span><span
class="cmtt-8">&#x00A0;=</span>
<br class="fancyvrb" /><a
id="x1-114012r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0; </span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[v]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;([offset]+[i])</span><span
class="cmtt-8">&#x00A0;+</span><br class="fancyvrb" /><a
id="x1-114014r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[entry\_temp]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[j]</span><br class="fancyvrb" /><a
id="x1-114016r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;5)</span><span
class="cmtt-8">&#x00A0;increment</span><span
class="cmtt-8">&#x00A0;[i]</span><br class="fancyvrb" /><a
id="x1-114018r9"></a><span
class="cmr-6">9</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-114020r10"></a><span
class="cmr-6">10</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;}</span><br class="fancyvrb" /><a
id="x1-114022r11"></a><span
class="cmr-6">11</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-114024r12"></a><span
class="cmr-6">12</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;6)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;(</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;less</span><span
class="cmtt-8">&#x00A0;than</span><span
class="cmtt-8">&#x00A0;[n]</span><span
class="cmtt-8">&#x00A0;)</span><span
class="cmtt-8">&#x00A0;continue</span><span
class="cmtt-8">&#x00A0;at</span><span
class="cmtt-8">&#x00A0;step</span><span
class="cmtt-8">&#x00A0;2</span><br class="fancyvrb" /><a
id="x1-114026r13"></a><span
class="cmr-6">13</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;7)</span><span
class="cmtt-8">&#x00A0;done</span></div>
<!--l. 416--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">8.6.5. </span> <a
id="x1-1150008.6.5"></a>format 2 specifics</h5>
<!--l. 418--><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. 421--><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:
<!--l. 429--><p class="noindent" >
<dl class="enumerate-enumitem"><dt class="enumerate-enumitem">
1. </dt><dd
class="enumerate-enumitem">If all vectors 0 through <span
class="cmti-12">ch</span>-1 are marked &#8217;do not decode&#8217;, allocate and clear a single
vector <span
class="cmtt-12">[v]</span>of length <span
class="cmti-12">ch*n </span>and skip step 2 below; proceed directly to the post-decode
step.
</dd><dt class="enumerate-enumitem">
2. </dt><dd
class="enumerate-enumitem">Rather than performing format 1 decode to produce <span
class="cmti-12">ch </span>vectors of length <span
class="cmti-12">n </span>each, call
format 1 decode to produce a single vector <span
class="cmtt-12">[v] </span>of length <span
class="cmti-12">ch*n</span>.
</dd><dt class="enumerate-enumitem">
3. </dt><dd
class="enumerate-enumitem">Post decode: Deinterleave the single vector <span
class="cmtt-12">[v] </span>returned by format 1 decode as
described above into <span
class="cmti-12">ch </span>independent vectors, one for each outputchannel, according
to:
<div class="fancyvrb" id="fancyvrb43"><a
id="x1-115005r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1)</span><span
class="cmtt-8">&#x00A0;iterate</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;over</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;range</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;...</span><span
class="cmtt-8">&#x00A0;[n]-1</span><span
class="cmtt-8">&#x00A0;{</span><br class="fancyvrb" /><a
id="x1-115007r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-115009r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2)</span><span
class="cmtt-8">&#x00A0;iterate</span><span
class="cmtt-8">&#x00A0;[j]</span><span
class="cmtt-8">&#x00A0;over</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;range</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;...</span><span
class="cmtt-8">&#x00A0;[ch]-1</span><span
class="cmtt-8">&#x00A0;{</span><br class="fancyvrb" /><a
id="x1-115011r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-115013r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;3)</span><span
class="cmtt-8">&#x00A0;output</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;number</span><span
class="cmtt-8">&#x00A0;[j]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[i]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[v]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;([i]</span><span
class="cmtt-8">&#x00A0;*</span><span
class="cmtt-8">&#x00A0;[ch]</span><span
class="cmtt-8">&#x00A0;+</span><span
class="cmtt-8">&#x00A0;[j])</span><br class="fancyvrb" /><a
id="x1-115015r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-115017r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;}</span><br class="fancyvrb" /><a
id="x1-115019r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;}</span><br class="fancyvrb" /><a
id="x1-115021r9"></a><span
class="cmr-6">9</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-115023r10"></a><span
class="cmr-6">10</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;4)</span><span
class="cmtt-8">&#x00A0;done</span></div>
</dd></dl>
<h3 class="sectionHead"><span class="titlemark">9. </span> <a
id="x1-1160009"></a>Helper equations</h3>
<!--l. 6--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">9.1. </span> <a
id="x1-1170009.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-1180009.2"></a>Functions</h4>
<!--l. 15--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">9.2.1. </span> <a
id="x1-1190009.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-12">[x]</span>. Values of <span
class="cmtt-12">[x] </span>less than zero are defined to return
zero.
<!--l. 20--><p class="noindent" >
<div class="fancyvrb" id="fancyvrb44"><a
id="x1-119002r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1)</span><span
class="cmtt-8">&#x00A0;[return\_value]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;0;</span><br class="fancyvrb" /><a
id="x1-119004r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;(</span><span
class="cmtt-8">&#x00A0;[x]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;greater</span><span
class="cmtt-8">&#x00A0;than</span><span
class="cmtt-8">&#x00A0;zero</span><span
class="cmtt-8">&#x00A0;)</span><span
class="cmtt-8">&#x00A0;{</span><br class="fancyvrb" /><a
id="x1-119006r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-119008r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;3)</span><span
class="cmtt-8">&#x00A0;increment</span><span
class="cmtt-8">&#x00A0;[return\_value];</span>
<br class="fancyvrb" /><a
id="x1-119010r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;4)</span><span
class="cmtt-8">&#x00A0;logical</span><span
class="cmtt-8">&#x00A0;shift</span><span
class="cmtt-8">&#x00A0;[x]</span><span
class="cmtt-8">&#x00A0;one</span><span
class="cmtt-8">&#x00A0;bit</span><span
class="cmtt-8">&#x00A0;to</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;right,</span><span
class="cmtt-8">&#x00A0;padding</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;MSb</span><span
class="cmtt-8">&#x00A0;with</span><span
class="cmtt-8">&#x00A0;zero</span><br class="fancyvrb" /><a
id="x1-119012r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;5)</span><span
class="cmtt-8">&#x00A0;repeat</span><span
class="cmtt-8">&#x00A0;at</span><span
class="cmtt-8">&#x00A0;step</span><span
class="cmtt-8">&#x00A0;2)</span><br class="fancyvrb" /><a
id="x1-119014r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-119016r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;}</span><br class="fancyvrb" /><a
id="x1-119018r9"></a><span
class="cmr-6">9</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-119020r10"></a><span
class="cmr-6">10</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;6)</span><span
class="cmtt-8">&#x00A0;done</span></div>
<!--l. 33--><p class="noindent" >Examples:
<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-1200009.2.2"></a>float32_unpack</h5>
<!--l. 50--><p class="noindent" >&#8221;float32_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-120002r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1)</span><span
class="cmtt-8">&#x00A0;[mantissa]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[x]</span><span
class="cmtt-8">&#x00A0;bitwise</span><span
class="cmtt-8">&#x00A0;AND</span><span
class="cmtt-8">&#x00A0;0x1fffff</span><span
class="cmtt-8">&#x00A0;(unsigned</span><span
class="cmtt-8">&#x00A0;result)</span><br class="fancyvrb" /><a
id="x1-120004r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2)</span><span
class="cmtt-8">&#x00A0;[sign]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[x]</span><span
class="cmtt-8">&#x00A0;bitwise</span><span
class="cmtt-8">&#x00A0;AND</span><span
class="cmtt-8">&#x00A0;0x80000000</span><span
class="cmtt-8">&#x00A0;(unsigned</span><span
class="cmtt-8">&#x00A0;result)</span>
<br class="fancyvrb" /><a
id="x1-120006r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;3)</span><span
class="cmtt-8">&#x00A0;[exponent]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;(</span><span
class="cmtt-8">&#x00A0;[x]</span><span
class="cmtt-8">&#x00A0;bitwise</span><span
class="cmtt-8">&#x00A0;AND</span><span
class="cmtt-8">&#x00A0;0x7fe00000)</span><span
class="cmtt-8">&#x00A0;shifted</span><span
class="cmtt-8">&#x00A0;right</span><span
class="cmtt-8">&#x00A0;21</span><span
class="cmtt-8">&#x00A0;bits</span><span
class="cmtt-8">&#x00A0;(unsigned</span><span
class="cmtt-8">&#x00A0;result)</span>
<br class="fancyvrb" /><a
id="x1-120008r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;4)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;(</span><span
class="cmtt-8">&#x00A0;[sign]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;nonzero</span><span
class="cmtt-8">&#x00A0;)</span><span
class="cmtt-8">&#x00A0;then</span><span
class="cmtt-8">&#x00A0;negate</span><span
class="cmtt-8">&#x00A0;[mantissa]</span><br class="fancyvrb" /><a
id="x1-120010r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;5)</span><span
class="cmtt-8">&#x00A0;return</span><span
class="cmtt-8">&#x00A0;[mantissa]</span><span
class="cmtt-8">&#x00A0;*</span><span
class="cmtt-8">&#x00A0;(</span><span
class="cmtt-8">&#x00A0;2</span><span
class="cmtt-8">&#x00A0;^</span><span
class="cmtt-8">&#x00A0;(</span><span
class="cmtt-8">&#x00A0;[exponent]</span><span
class="cmtt-8">&#x00A0;-</span><span
class="cmtt-8">&#x00A0;788</span><span
class="cmtt-8">&#x00A0;)</span><span
class="cmtt-8">&#x00A0;)</span></div>
<!--l. 66--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">9.2.3. </span> <a
id="x1-1210009.2.3"></a>lookup1_values</h5>
<!--l. 68--><p class="noindent" >&#8221;lookup1_values(codebook_entries,codebook_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 permuted to construct the VQ vector lookup table of size
<span
class="cmtt-12">[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-12">[return_value] </span>to the power of <span
class="cmtt-12">[codebook_dimensions] </span>is less than or equal to
<span
class="cmtt-12">[codebook_entries]</span>&#8217;.
<!--l. 81--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">9.2.4. </span> <a
id="x1-1220009.2.4"></a>low_neighbor</h5>
<!--l. 83--><p class="noindent" >&#8221;low_neighbor(v,x)&#8221; finds the position <span
class="cmtt-12">n </span>in vector <span
class="cmtt-12">[v] </span>of the greatest value scalar element for
which <span
class="cmtt-12">n </span>is less than <span
class="cmtt-12">[x] </span>and vector <span
class="cmtt-12">[v] </span>element <span
class="cmtt-12">n </span>is less than vector <span
class="cmtt-12">[v] </span>element
<span
class="cmtt-12">[x]</span>.
<!--l. 88--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">9.2.5. </span> <a
id="x1-1230009.2.5"></a>high_neighbor</h5>
<!--l. 90--><p class="noindent" >&#8221;high_neighbor(v,x)&#8221; finds the position <span
class="cmtt-12">n </span>in vector [v] of the lowest value scalar element for
which <span
class="cmtt-12">n </span>is less than <span
class="cmtt-12">[x] </span>and vector <span
class="cmtt-12">[v] </span>element <span
class="cmtt-12">n </span>is greater than vector <span
class="cmtt-12">[v] </span>element
<span
class="cmtt-12">[x]</span>.
<!--l. 97--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">9.2.6. </span> <a
id="x1-1240009.2.6"></a>render_point</h5>
<!--l. 99--><p class="noindent" >&#8221;render_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-124002r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1)</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;[dy]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[y1]</span><span
class="cmtt-8">&#x00A0;-</span><span
class="cmtt-8">&#x00A0;[y0]</span><br class="fancyvrb" /><a
id="x1-124004r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2)</span><span
class="cmtt-8">&#x00A0;[adx]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[x1]</span><span
class="cmtt-8">&#x00A0;-</span><span
class="cmtt-8">&#x00A0;[x0]</span><br class="fancyvrb" /><a
id="x1-124006r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;3)</span><span
class="cmtt-8">&#x00A0;[ady]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;absolute</span><span
class="cmtt-8">&#x00A0;value</span><span
class="cmtt-8">&#x00A0;of</span><span
class="cmtt-8">&#x00A0;[dy]</span><br class="fancyvrb" /><a
id="x1-124008r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;4)</span><span
class="cmtt-8">&#x00A0;[err]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[ady]</span><span
class="cmtt-8">&#x00A0;*</span><span
class="cmtt-8">&#x00A0;([X]</span><span
class="cmtt-8">&#x00A0;-</span><span
class="cmtt-8">&#x00A0;[x0])</span>
<br class="fancyvrb" /><a
id="x1-124010r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;5)</span><span
class="cmtt-8">&#x00A0;[off]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[err]</span><span
class="cmtt-8">&#x00A0;/</span><span
class="cmtt-8">&#x00A0;[adx]</span><span
class="cmtt-8">&#x00A0;using</span><span
class="cmtt-8">&#x00A0;integer</span><span
class="cmtt-8">&#x00A0;division</span><br class="fancyvrb" /><a
id="x1-124012r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;6)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;(</span><span
class="cmtt-8">&#x00A0;[dy]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;less</span><span
class="cmtt-8">&#x00A0;than</span><span
class="cmtt-8">&#x00A0;zero</span><span
class="cmtt-8">&#x00A0;)</span><span
class="cmtt-8">&#x00A0;{</span><br class="fancyvrb" /><a
id="x1-124014r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-124016r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;7)</span><span
class="cmtt-8">&#x00A0;[Y]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[y0]</span><span
class="cmtt-8">&#x00A0;-</span><span
class="cmtt-8">&#x00A0;[off]</span>
<br class="fancyvrb" /><a
id="x1-124018r9"></a><span
class="cmr-6">9</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-124020r10"></a><span
class="cmr-6">10</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;}</span><span
class="cmtt-8">&#x00A0;else</span><span
class="cmtt-8">&#x00A0;{</span><br class="fancyvrb" /><a
id="x1-124022r11"></a><span
class="cmr-6">11</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-124024r12"></a><span
class="cmr-6">12</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;8)</span><span
class="cmtt-8">&#x00A0;[Y]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[y0]</span><span
class="cmtt-8">&#x00A0;+</span><span
class="cmtt-8">&#x00A0;[off]</span><br class="fancyvrb" /><a
id="x1-124026r13"></a><span
class="cmr-6">13</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-124028r14"></a><span
class="cmr-6">14</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;}</span><br class="fancyvrb" /><a
id="x1-124030r15"></a><span
class="cmr-6">15</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-124032r16"></a><span
class="cmr-6">16</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;9)</span><span
class="cmtt-8">&#x00A0;done</span></div>
<!--l. 125--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">9.2.7. </span> <a
id="x1-1250009.2.7"></a>render_line</h5>
<!--l. 127--><p class="noindent" >Floor decode type one uses the integer line drawing algorithm of &#8221;render_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-125002r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1)</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;[dy]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[y1]</span><span
class="cmtt-8">&#x00A0;-</span><span
class="cmtt-8">&#x00A0;[y0]</span><br class="fancyvrb" /><a
id="x1-125004r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2)</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;[adx]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[x1]</span><span
class="cmtt-8">&#x00A0;-</span><span
class="cmtt-8">&#x00A0;[x0]</span><br class="fancyvrb" /><a
id="x1-125006r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;3)</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;[ady]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;absolute</span><span
class="cmtt-8">&#x00A0;value</span><span
class="cmtt-8">&#x00A0;of</span><span
class="cmtt-8">&#x00A0;[dy]</span><br class="fancyvrb" /><a
id="x1-125008r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;4)</span><span
class="cmtt-8">&#x00A0;[base]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[dy]</span><span
class="cmtt-8">&#x00A0;/</span><span
class="cmtt-8">&#x00A0;[adx]</span><span
class="cmtt-8">&#x00A0;using</span><span
class="cmtt-8">&#x00A0;integer</span><span
class="cmtt-8">&#x00A0;division</span>
<br class="fancyvrb" /><a
id="x1-125010r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;5)</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;[x]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[x0]</span><br class="fancyvrb" /><a
id="x1-125012r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;6)</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;[y]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[y0]</span><br class="fancyvrb" /><a
id="x1-125014r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;7)</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;[err]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;0</span><br class="fancyvrb" /><a
id="x1-125016r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-125018r9"></a><span
class="cmr-6">9</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;8)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;(</span><span
class="cmtt-8">&#x00A0;[dy]</span><span
class="cmtt-8">&#x00A0;is</span><span
class="cmtt-8">&#x00A0;less</span><span
class="cmtt-8">&#x00A0;than</span><span
class="cmtt-8">&#x00A0;0</span><span
class="cmtt-8">&#x00A0;)</span><span
class="cmtt-8">&#x00A0;{</span><br class="fancyvrb" /><a
id="x1-125020r10"></a><span
class="cmr-6">10</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-125022r11"></a><span
class="cmr-6">11</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;9)</span><span
class="cmtt-8">&#x00A0;[sy]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[base]</span><span
class="cmtt-8">&#x00A0;-</span><span
class="cmtt-8">&#x00A0;1</span>
<br class="fancyvrb" /><a
id="x1-125024r12"></a><span
class="cmr-6">12</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-125026r13"></a><span
class="cmr-6">13</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;}</span><span
class="cmtt-8">&#x00A0;else</span><span
class="cmtt-8">&#x00A0;{</span><br class="fancyvrb" /><a
id="x1-125028r14"></a><span
class="cmr-6">14</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-125030r15"></a><span
class="cmr-6">15</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;10)</span><span
class="cmtt-8">&#x00A0;[sy]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[base]</span><span
class="cmtt-8">&#x00A0;+</span><span
class="cmtt-8">&#x00A0;1</span><br class="fancyvrb" /><a
id="x1-125032r16"></a><span
class="cmr-6">16</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-125034r17"></a><span
class="cmr-6">17</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;}</span><br class="fancyvrb" /><a
id="x1-125036r18"></a><span
class="cmr-6">18</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-125038r19"></a><span
class="cmr-6">19</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;11)</span><span
class="cmtt-8">&#x00A0;[ady]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[ady]</span><span
class="cmtt-8">&#x00A0;-</span><span
class="cmtt-8">&#x00A0;(absolute</span><span
class="cmtt-8">&#x00A0;value</span><span
class="cmtt-8">&#x00A0;of</span><span
class="cmtt-8">&#x00A0;[base])</span><span
class="cmtt-8">&#x00A0;*</span><span
class="cmtt-8">&#x00A0;[adx]</span>
<br class="fancyvrb" /><a
id="x1-125040r20"></a><span
class="cmr-6">20</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;12)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[v]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[x]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[y]</span><br class="fancyvrb" /><a
id="x1-125042r21"></a><span
class="cmr-6">21</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-125044r22"></a><span
class="cmr-6">22</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;13)</span><span
class="cmtt-8">&#x00A0;iterate</span><span
class="cmtt-8">&#x00A0;[x]</span><span
class="cmtt-8">&#x00A0;over</span><span
class="cmtt-8">&#x00A0;the</span><span
class="cmtt-8">&#x00A0;range</span><span
class="cmtt-8">&#x00A0;[x0]+1</span><span
class="cmtt-8">&#x00A0;...</span><span
class="cmtt-8">&#x00A0;[x1]-1</span><span
class="cmtt-8">&#x00A0;{</span><br class="fancyvrb" /><a
id="x1-125046r23"></a><span
class="cmr-6">23</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-125048r24"></a><span
class="cmr-6">24</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;14)</span><span
class="cmtt-8">&#x00A0;[err]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[err]</span><span
class="cmtt-8">&#x00A0;+</span><span
class="cmtt-8">&#x00A0;[ady];</span>
<br class="fancyvrb" /><a
id="x1-125050r25"></a><span
class="cmr-6">25</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;15)</span><span
class="cmtt-8">&#x00A0;if</span><span
class="cmtt-8">&#x00A0;(</span><span
class="cmtt-8">&#x00A0;[err]</span><span
class="cmtt-8">&#x00A0;&#x003E;=</span><span
class="cmtt-8">&#x00A0;[adx]</span><span
class="cmtt-8">&#x00A0;)</span><span
class="cmtt-8">&#x00A0;{</span><br class="fancyvrb" /><a
id="x1-125052r26"></a><span
class="cmr-6">26</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-125054r27"></a><span
class="cmr-6">27</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;16)</span><span
class="cmtt-8">&#x00A0;[err]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[err]</span><span
class="cmtt-8">&#x00A0;-</span><span
class="cmtt-8">&#x00A0;[adx]</span><br class="fancyvrb" /><a
id="x1-125056r28"></a><span
class="cmr-6">28</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;17)</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;[y]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[y]</span><span
class="cmtt-8">&#x00A0;+</span><span
class="cmtt-8">&#x00A0;[sy]</span><br class="fancyvrb" /><a
id="x1-125058r29"></a><span
class="cmr-6">29</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span>
<br class="fancyvrb" /><a
id="x1-125060r30"></a><span
class="cmr-6">30</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;}</span><span
class="cmtt-8">&#x00A0;else</span><span
class="cmtt-8">&#x00A0;{</span><br class="fancyvrb" /><a
id="x1-125062r31"></a><span
class="cmr-6">31</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-125064r32"></a><span
class="cmr-6">32</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;18)</span><span
class="cmtt-8">&#x00A0;[y]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[y]</span><span
class="cmtt-8">&#x00A0;+</span><span
class="cmtt-8">&#x00A0;[base]</span><br class="fancyvrb" /><a
id="x1-125066r33"></a><span
class="cmr-6">33</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-125068r34"></a><span
class="cmr-6">34</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;}</span><br class="fancyvrb" /><a
id="x1-125070r35"></a><span
class="cmr-6">35</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-125072r36"></a><span
class="cmr-6">36</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;19)</span><span
class="cmtt-8">&#x00A0;vector</span><span
class="cmtt-8">&#x00A0;[v]</span><span
class="cmtt-8">&#x00A0;element</span><span
class="cmtt-8">&#x00A0;[x]</span><span
class="cmtt-8">&#x00A0;=</span><span
class="cmtt-8">&#x00A0;[y]</span><br class="fancyvrb" /><a
id="x1-125074r37"></a><span
class="cmr-6">37</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><br class="fancyvrb" /><a
id="x1-125076r38"></a><span
class="cmr-6">38</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;}</span></div>
<h3 class="sectionHead"><span class="titlemark">10. </span> <a
id="x1-12600010"></a>Tables</h3>
<!--l. 6--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">10.1. </span> <a
id="x1-12700010.1"></a>floor1_inverse_dB_table</h4>
<!--l. 8--><p class="noindent" >The vector <span
class="cmtt-12">[floor1_inverse_dB_table] </span>is a 256 element static lookup table consisting 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-127002r1"></a><span
class="cmr-6">1</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1.0649863e-07,</span><span
class="cmtt-8">&#x00A0;1.1341951e-07,</span><span
class="cmtt-8">&#x00A0;1.2079015e-07,</span><span
class="cmtt-8">&#x00A0;1.2863978e-07,</span><br class="fancyvrb" /><a
id="x1-127004r2"></a><span
class="cmr-6">2</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1.3699951e-07,</span><span
class="cmtt-8">&#x00A0;1.4590251e-07,</span><span
class="cmtt-8">&#x00A0;1.5538408e-07,</span><span
class="cmtt-8">&#x00A0;1.6548181e-07,</span>
<br class="fancyvrb" /><a
id="x1-127006r3"></a><span
class="cmr-6">3</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1.7623575e-07,</span><span
class="cmtt-8">&#x00A0;1.8768855e-07,</span><span
class="cmtt-8">&#x00A0;1.9988561e-07,</span><span
class="cmtt-8">&#x00A0;2.1287530e-07,</span><br class="fancyvrb" /><a
id="x1-127008r4"></a><span
class="cmr-6">4</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2.2670913e-07,</span><span
class="cmtt-8">&#x00A0;2.4144197e-07,</span><span
class="cmtt-8">&#x00A0;2.5713223e-07,</span><span
class="cmtt-8">&#x00A0;2.7384213e-07,</span>
<br class="fancyvrb" /><a
id="x1-127010r5"></a><span
class="cmr-6">5</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2.9163793e-07,</span><span
class="cmtt-8">&#x00A0;3.1059021e-07,</span><span
class="cmtt-8">&#x00A0;3.3077411e-07,</span><span
class="cmtt-8">&#x00A0;3.5226968e-07,</span><br class="fancyvrb" /><a
id="x1-127012r6"></a><span
class="cmr-6">6</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;3.7516214e-07,</span><span
class="cmtt-8">&#x00A0;3.9954229e-07,</span><span
class="cmtt-8">&#x00A0;4.2550680e-07,</span><span
class="cmtt-8">&#x00A0;4.5315863e-07,</span>
<br class="fancyvrb" /><a
id="x1-127014r7"></a><span
class="cmr-6">7</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;4.8260743e-07,</span><span
class="cmtt-8">&#x00A0;5.1396998e-07,</span><span
class="cmtt-8">&#x00A0;5.4737065e-07,</span><span
class="cmtt-8">&#x00A0;5.8294187e-07,</span><br class="fancyvrb" /><a
id="x1-127016r8"></a><span
class="cmr-6">8</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;6.2082472e-07,</span><span
class="cmtt-8">&#x00A0;6.6116941e-07,</span><span
class="cmtt-8">&#x00A0;7.0413592e-07,</span><span
class="cmtt-8">&#x00A0;7.4989464e-07,</span>
<br class="fancyvrb" /><a
id="x1-127018r9"></a><span
class="cmr-6">9</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;7.9862701e-07,</span><span
class="cmtt-8">&#x00A0;8.5052630e-07,</span><span
class="cmtt-8">&#x00A0;9.0579828e-07,</span><span
class="cmtt-8">&#x00A0;9.6466216e-07,</span><br class="fancyvrb" /><a
id="x1-127020r10"></a><span
class="cmr-6">10</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1.0273513e-06,</span><span
class="cmtt-8">&#x00A0;1.0941144e-06,</span><span
class="cmtt-8">&#x00A0;1.1652161e-06,</span><span
class="cmtt-8">&#x00A0;1.2409384e-06,</span>
<br class="fancyvrb" /><a
id="x1-127022r11"></a><span
class="cmr-6">11</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1.3215816e-06,</span><span
class="cmtt-8">&#x00A0;1.4074654e-06,</span><span
class="cmtt-8">&#x00A0;1.4989305e-06,</span><span
class="cmtt-8">&#x00A0;1.5963394e-06,</span><br class="fancyvrb" /><a
id="x1-127024r12"></a><span
class="cmr-6">12</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1.7000785e-06,</span><span
class="cmtt-8">&#x00A0;1.8105592e-06,</span><span
class="cmtt-8">&#x00A0;1.9282195e-06,</span><span
class="cmtt-8">&#x00A0;2.0535261e-06,</span>
<br class="fancyvrb" /><a
id="x1-127026r13"></a><span
class="cmr-6">13</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2.1869758e-06,</span><span
class="cmtt-8">&#x00A0;2.3290978e-06,</span><span
class="cmtt-8">&#x00A0;2.4804557e-06,</span><span
class="cmtt-8">&#x00A0;2.6416497e-06,</span><br class="fancyvrb" /><a
id="x1-127028r14"></a><span
class="cmr-6">14</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2.8133190e-06,</span><span
class="cmtt-8">&#x00A0;2.9961443e-06,</span><span
class="cmtt-8">&#x00A0;3.1908506e-06,</span><span
class="cmtt-8">&#x00A0;3.3982101e-06,</span>
<br class="fancyvrb" /><a
id="x1-127030r15"></a><span
class="cmr-6">15</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;3.6190449e-06,</span><span
class="cmtt-8">&#x00A0;3.8542308e-06,</span><span
class="cmtt-8">&#x00A0;4.1047004e-06,</span><span
class="cmtt-8">&#x00A0;4.3714470e-06,</span><br class="fancyvrb" /><a
id="x1-127032r16"></a><span
class="cmr-6">16</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;4.6555282e-06,</span><span
class="cmtt-8">&#x00A0;4.9580707e-06,</span><span
class="cmtt-8">&#x00A0;5.2802740e-06,</span><span
class="cmtt-8">&#x00A0;5.6234160e-06,</span>
<br class="fancyvrb" /><a
id="x1-127034r17"></a><span
class="cmr-6">17</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;5.9888572e-06,</span><span
class="cmtt-8">&#x00A0;6.3780469e-06,</span><span
class="cmtt-8">&#x00A0;6.7925283e-06,</span><span
class="cmtt-8">&#x00A0;7.2339451e-06,</span><br class="fancyvrb" /><a
id="x1-127036r18"></a><span
class="cmr-6">18</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;7.7040476e-06,</span><span
class="cmtt-8">&#x00A0;8.2047000e-06,</span><span
class="cmtt-8">&#x00A0;8.7378876e-06,</span><span
class="cmtt-8">&#x00A0;9.3057248e-06,</span>
<br class="fancyvrb" /><a
id="x1-127038r19"></a><span
class="cmr-6">19</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;9.9104632e-06,</span><span
class="cmtt-8">&#x00A0;1.0554501e-05,</span><span
class="cmtt-8">&#x00A0;1.1240392e-05,</span><span
class="cmtt-8">&#x00A0;1.1970856e-05,</span><br class="fancyvrb" /><a
id="x1-127040r20"></a><span
class="cmr-6">20</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1.2748789e-05,</span><span
class="cmtt-8">&#x00A0;1.3577278e-05,</span><span
class="cmtt-8">&#x00A0;1.4459606e-05,</span><span
class="cmtt-8">&#x00A0;1.5399272e-05,</span>
<br class="fancyvrb" /><a
id="x1-127042r21"></a><span
class="cmr-6">21</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1.6400004e-05,</span><span
class="cmtt-8">&#x00A0;1.7465768e-05,</span><span
class="cmtt-8">&#x00A0;1.8600792e-05,</span><span
class="cmtt-8">&#x00A0;1.9809576e-05,</span><br class="fancyvrb" /><a
id="x1-127044r22"></a><span
class="cmr-6">22</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2.1096914e-05,</span><span
class="cmtt-8">&#x00A0;2.2467911e-05,</span><span
class="cmtt-8">&#x00A0;2.3928002e-05,</span><span
class="cmtt-8">&#x00A0;2.5482978e-05,</span>
<br class="fancyvrb" /><a
id="x1-127046r23"></a><span
class="cmr-6">23</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;2.7139006e-05,</span><span
class="cmtt-8">&#x00A0;2.8902651e-05,</span><span
class="cmtt-8">&#x00A0;3.0780908e-05,</span><span
class="cmtt-8">&#x00A0;3.2781225e-05,</span><br class="fancyvrb" /><a
id="x1-127048r24"></a><span
class="cmr-6">24</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;3.4911534e-05,</span><span
class="cmtt-8">&#x00A0;3.7180282e-05,</span><span
class="cmtt-8">&#x00A0;3.9596466e-05,</span><span
class="cmtt-8">&#x00A0;4.2169667e-05,</span>
<br class="fancyvrb" /><a
id="x1-127050r25"></a><span
class="cmr-6">25</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;4.4910090e-05,</span><span
class="cmtt-8">&#x00A0;4.7828601e-05,</span><span
class="cmtt-8">&#x00A0;5.0936773e-05,</span><span
class="cmtt-8">&#x00A0;5.4246931e-05,</span><br class="fancyvrb" /><a
id="x1-127052r26"></a><span
class="cmr-6">26</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;5.7772202e-05,</span><span
class="cmtt-8">&#x00A0;6.1526565e-05,</span><span
class="cmtt-8">&#x00A0;6.5524908e-05,</span><span
class="cmtt-8">&#x00A0;6.9783085e-05,</span>
<br class="fancyvrb" /><a
id="x1-127054r27"></a><span
class="cmr-6">27</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;7.4317983e-05,</span><span
class="cmtt-8">&#x00A0;7.9147585e-05,</span><span
class="cmtt-8">&#x00A0;8.4291040e-05,</span><span
class="cmtt-8">&#x00A0;8.9768747e-05,</span><br class="fancyvrb" /><a
id="x1-127056r28"></a><span
class="cmr-6">28</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;9.5602426e-05,</span><span
class="cmtt-8">&#x00A0;0.00010181521,</span><span
class="cmtt-8">&#x00A0;0.00010843174,</span><span
class="cmtt-8">&#x00A0;0.00011547824,</span>
<br class="fancyvrb" /><a
id="x1-127058r29"></a><span
class="cmr-6">29</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.00012298267,</span><span
class="cmtt-8">&#x00A0;0.00013097477,</span><span
class="cmtt-8">&#x00A0;0.00013948625,</span><span
class="cmtt-8">&#x00A0;0.00014855085,</span><br class="fancyvrb" /><a
id="x1-127060r30"></a><span
class="cmr-6">30</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.00015820453,</span><span
class="cmtt-8">&#x00A0;0.00016848555,</span><span
class="cmtt-8">&#x00A0;0.00017943469,</span><span
class="cmtt-8">&#x00A0;0.00019109536,</span>
<br class="fancyvrb" /><a
id="x1-127062r31"></a><span
class="cmr-6">31</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.00020351382,</span><span
class="cmtt-8">&#x00A0;0.00021673929,</span><span
class="cmtt-8">&#x00A0;0.00023082423,</span><span
class="cmtt-8">&#x00A0;0.00024582449,</span><br class="fancyvrb" /><a
id="x1-127064r32"></a><span
class="cmr-6">32</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.00026179955,</span><span
class="cmtt-8">&#x00A0;0.00027881276,</span><span
class="cmtt-8">&#x00A0;0.00029693158,</span><span
class="cmtt-8">&#x00A0;0.00031622787,</span>
<br class="fancyvrb" /><a
id="x1-127066r33"></a><span
class="cmr-6">33</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.00033677814,</span><span
class="cmtt-8">&#x00A0;0.00035866388,</span><span
class="cmtt-8">&#x00A0;0.00038197188,</span><span
class="cmtt-8">&#x00A0;0.00040679456,</span><br class="fancyvrb" /><a
id="x1-127068r34"></a><span
class="cmr-6">34</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.00043323036,</span><span
class="cmtt-8">&#x00A0;0.00046138411,</span><span
class="cmtt-8">&#x00A0;0.00049136745,</span><span
class="cmtt-8">&#x00A0;0.00052329927,</span>
<br class="fancyvrb" /><a
id="x1-127070r35"></a><span
class="cmr-6">35</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.00055730621,</span><span
class="cmtt-8">&#x00A0;0.00059352311,</span><span
class="cmtt-8">&#x00A0;0.00063209358,</span><span
class="cmtt-8">&#x00A0;0.00067317058,</span><br class="fancyvrb" /><a
id="x1-127072r36"></a><span
class="cmr-6">36</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.00071691700,</span><span
class="cmtt-8">&#x00A0;0.00076350630,</span><span
class="cmtt-8">&#x00A0;0.00081312324,</span><span
class="cmtt-8">&#x00A0;0.00086596457,</span>
<br class="fancyvrb" /><a
id="x1-127074r37"></a><span
class="cmr-6">37</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.00092223983,</span><span
class="cmtt-8">&#x00A0;0.00098217216,</span><span
class="cmtt-8">&#x00A0;0.0010459992,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0011139742,</span><br class="fancyvrb" /><a
id="x1-127076r38"></a><span
class="cmr-6">38</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0011863665,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0012634633,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0013455702,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0014330129,</span>
<br class="fancyvrb" /><a
id="x1-127078r39"></a><span
class="cmr-6">39</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0015261382,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0016253153,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0017309374,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0018434235,</span><br class="fancyvrb" /><a
id="x1-127080r40"></a><span
class="cmr-6">40</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0019632195,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0020908006,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0022266726,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0023713743,</span>
<br class="fancyvrb" /><a
id="x1-127082r41"></a><span
class="cmr-6">41</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0025254795,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0026895994,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0028643847,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0030505286,</span><br class="fancyvrb" /><a
id="x1-127084r42"></a><span
class="cmr-6">42</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0032487691,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0034598925,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0036847358,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0039241906,</span>
<br class="fancyvrb" /><a
id="x1-127086r43"></a><span
class="cmr-6">43</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0041792066,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0044507950,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0047400328,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0050480668,</span><br class="fancyvrb" /><a
id="x1-127088r44"></a><span
class="cmr-6">44</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0053761186,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0057254891,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0060975636,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0064938176,</span>
<br class="fancyvrb" /><a
id="x1-127090r45"></a><span
class="cmr-6">45</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0069158225,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0073652516,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0078438871,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0083536271,</span><br class="fancyvrb" /><a
id="x1-127092r46"></a><span
class="cmr-6">46</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.0088964928,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.009474637,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.010090352,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.010746080,</span>
<br class="fancyvrb" /><a
id="x1-127094r47"></a><span
class="cmr-6">47</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.011444421,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.012188144,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.012980198,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.013823725,</span><br class="fancyvrb" /><a
id="x1-127096r48"></a><span
class="cmr-6">48</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.014722068,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.015678791,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.016697687,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.017782797,</span>
<br class="fancyvrb" /><a
id="x1-127098r49"></a><span
class="cmr-6">49</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.018938423,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.020169149,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.021479854,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.022875735,</span><br class="fancyvrb" /><a
id="x1-127100r50"></a><span
class="cmr-6">50</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.024362330,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.025945531,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.027631618,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.029427276,</span>
<br class="fancyvrb" /><a
id="x1-127102r51"></a><span
class="cmr-6">51</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.031339626,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.033376252,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.035545228,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.037855157,</span><br class="fancyvrb" /><a
id="x1-127104r52"></a><span
class="cmr-6">52</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.040315199,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.042935108,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.045725273,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.048696758,</span>
<br class="fancyvrb" /><a
id="x1-127106r53"></a><span
class="cmr-6">53</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.051861348,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.055231591,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.058820850,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.062643361,</span><br class="fancyvrb" /><a
id="x1-127108r54"></a><span
class="cmr-6">54</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.066714279,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.071049749,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.075666962,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.080584227,</span>
<br class="fancyvrb" /><a
id="x1-127110r55"></a><span
class="cmr-6">55</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.085821044,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.091398179,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.097337747,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.10366330,</span><br class="fancyvrb" /><a
id="x1-127112r56"></a><span
class="cmr-6">56</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.11039993,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.11757434,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.12521498,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.13335215,</span>
<br class="fancyvrb" /><a
id="x1-127114r57"></a><span
class="cmr-6">57</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.14201813,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.15124727,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.16107617,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.17154380,</span><br class="fancyvrb" /><a
id="x1-127116r58"></a><span
class="cmr-6">58</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.18269168,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.19456402,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.20720788,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.22067342,</span>
<br class="fancyvrb" /><a
id="x1-127118r59"></a><span
class="cmr-6">59</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.23501402,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.25028656,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.26655159,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.28387361,</span><br class="fancyvrb" /><a
id="x1-127120r60"></a><span
class="cmr-6">60</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.30232132,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.32196786,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.34289114,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.36517414,</span>
<br class="fancyvrb" /><a
id="x1-127122r61"></a><span
class="cmr-6">61</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.38890521,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.41417847,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.44109412,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.46975890,</span><br class="fancyvrb" /><a
id="x1-127124r62"></a><span
class="cmr-6">62</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.50028648,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.53279791,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.56742212,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.60429640,</span>
<br class="fancyvrb" /><a
id="x1-127126r63"></a><span
class="cmr-6">63</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.64356699,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.68538959,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.72993007,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.77736504,</span><br class="fancyvrb" /><a
id="x1-127128r64"></a><span
class="cmr-6">64</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.82788260,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.88168307,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;0.9389798,</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;</span><span
class="cmtt-8">&#x00A0;1.</span></div>
<h3 class="sectionHead"><span class="titlemark">A. </span> <a
id="x1-128000A"></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-129000A.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</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-130000A.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).
<!--l. 55--><p class="noindent" >
<h5 class="subsubsectionHead"><span class="titlemark">A.1.2. </span> <a
id="x1-131000A.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-12">application/ogg</span>, while visual media should use <span
class="cmtt-12">video/ogg</span>, and audio
<span
class="cmtt-12">audio/ogg</span>. Vorbis data encapsulated in Ogg may appear in any of those types. RTP
encapsulated Vorbis should use <span
class="cmtt-12">audio/vorbis </span>+ <span
class="cmtt-12">audio/vorbis-config</span>.
<!--l. 65--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">A.2. </span> <a
id="x1-132000A.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-12">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-133000A.2"></a><span
class="cmbx-12">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.
</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>
<h3 class="sectionHead"><span class="titlemark">B. </span> <a
id="x1-134000B"></a>Vorbis encapsulation in RTP</h3>
<!--l. 8--><p class="noindent" >Please consult RFC 5215 <span
class="cmti-12">&#8220;RTP Payload Format for Vorbis Encoded Audio&#8221; </span>for description of
how to embed Vorbis audio in an RTP stream.
<h3 class="likesectionHead"><a
id="x1-135000B"></a>Colophon</h3>
<!--l. 6--><p class="noindent" ><img
src="fish_xiph_org.png" alt="PIC"
>
<!--l. 9--><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. 16--><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. 22--><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. 27--><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-2015 Xiph.Org Foundation. All rights
reserved.
<!--l. 32--><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>.
<h3 class="likesectionHead"><a
id="x1-136000B"></a>References</h3>
<!--l. 133--><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-12">http://www.iocon.com/resource/docs/ps/eusipco_corrected.ps</span></a>.
</p>
</div>
</body></html>