1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
4 <head><title>Vorbis I specification</title>
5 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6 <meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)">
7 <meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)">
9 <meta name="src" content="Vorbis_I_spec.tex">
10 <meta name="date" content="2009-04-07 21:43:00">
11 <link rel="stylesheet" type="text/css" href="Vorbis_I_spec.css">
14 <div class="maketitle">
22 <h2 class="titleHead">Vorbis I specification</h2>
23 <div class="author" ><span
24 class="cmr-12x-x-120">Xiph.org Foundation</span></div>
26 <div class="date" ><span
27 class="cmr-12x-x-120">April 7, 2009</span></div>
29 <h3 class="likesectionHead"><a
30 id="x1-1000"></a>Contents</h3>
31 <div class="tableofcontents">
32  <span class="sectionToc" >1 <a
33 href="#x1-20001" id="QQ2-1-2">Introduction and Description</a></span>
34 <br />  <span class="subsectionToc" >1.1 <a
35 href="#x1-30001.1" id="QQ2-1-3">Overview</a></span>
36 <br />   <span class="subsubsectionToc" >1.1.1 <a
37 href="#x1-40001.1.1" id="QQ2-1-4">Application</a></span>
38 <br />   <span class="subsubsectionToc" >1.1.2 <a
39 href="#x1-50001.1.2" id="QQ2-1-5">Classification</a></span>
40 <br />   <span class="subsubsectionToc" >1.1.3 <a
41 href="#x1-60001.1.3" id="QQ2-1-6">Assumptions</a></span>
42 <br />   <span class="subsubsectionToc" >1.1.4 <a
43 href="#x1-70001.1.4" id="QQ2-1-7">Codec Setup and Probability Model</a></span>
44 <br />   <span class="subsubsectionToc" >1.1.5 <a
45 href="#x1-90001.1.5" id="QQ2-1-9">Format Specification</a></span>
46 <br />   <span class="subsubsectionToc" >1.1.6 <a
47 href="#x1-100001.1.6" id="QQ2-1-10">Hardware Profile</a></span>
48 <br />  <span class="subsectionToc" >1.2 <a
49 href="#x1-110001.2" id="QQ2-1-11">Decoder Configuration</a></span>
50 <br />   <span class="subsubsectionToc" >1.2.1 <a
51 href="#x1-120001.2.1" id="QQ2-1-13">Global Config</a></span>
52 <br />   <span class="subsubsectionToc" >1.2.2 <a
53 href="#x1-130001.2.2" id="QQ2-1-14">Mode</a></span>
54 <br />   <span class="subsubsectionToc" >1.2.3 <a
55 href="#x1-140001.2.3" id="QQ2-1-15">Mapping</a></span>
56 <br />   <span class="subsubsectionToc" >1.2.4 <a
57 href="#x1-150001.2.4" id="QQ2-1-16">Floor</a></span>
58 <br />   <span class="subsubsectionToc" >1.2.5 <a
59 href="#x1-160001.2.5" id="QQ2-1-17">Residue</a></span>
60 <br />   <span class="subsubsectionToc" >1.2.6 <a
61 href="#x1-170001.2.6" id="QQ2-1-18">Codebooks</a></span>
65 <br />  <span class="subsectionToc" >1.3 <a
66 href="#x1-180001.3" id="QQ2-1-19">High-level Decode Process</a></span>
67 <br />   <span class="subsubsectionToc" >1.3.1 <a
68 href="#x1-190001.3.1" id="QQ2-1-20">Decode Setup</a></span>
69 <br />   <span class="subsubsectionToc" >1.3.2 <a
70 href="#x1-230001.3.2" id="QQ2-1-24">Decode Procedure</a></span>
71 <br /> <span class="sectionToc" >2 <a
72 href="#x1-360002" id="QQ2-1-39">Bitpacking Convention</a></span>
73 <br />  <span class="subsectionToc" >2.1 <a
74 href="#x1-370002.1" id="QQ2-1-40">Overview</a></span>
75 <br />   <span class="subsubsectionToc" >2.1.1 <a
76 href="#x1-380002.1.1" id="QQ2-1-41">octets, bytes and words</a></span>
77 <br />   <span class="subsubsectionToc" >2.1.2 <a
78 href="#x1-390002.1.2" id="QQ2-1-42">bit order</a></span>
79 <br />   <span class="subsubsectionToc" >2.1.3 <a
80 href="#x1-400002.1.3" id="QQ2-1-43">byte order</a></span>
81 <br />   <span class="subsubsectionToc" >2.1.4 <a
82 href="#x1-410002.1.4" id="QQ2-1-44">coding bits into byte sequences</a></span>
83 <br />   <span class="subsubsectionToc" >2.1.5 <a
84 href="#x1-420002.1.5" id="QQ2-1-45">signedness</a></span>
85 <br />   <span class="subsubsectionToc" >2.1.6 <a
86 href="#x1-430002.1.6" id="QQ2-1-46">coding example</a></span>
87 <br />   <span class="subsubsectionToc" >2.1.7 <a
88 href="#x1-440002.1.7" id="QQ2-1-47">decoding example</a></span>
89 <br />   <span class="subsubsectionToc" >2.1.8 <a
90 href="#x1-450002.1.8" id="QQ2-1-48">end-of-packet alignment</a></span>
91 <br />   <span class="subsubsectionToc" >2.1.9 <a
92 href="#x1-460002.1.9" id="QQ2-1-49">reading zero bits</a></span>
93 <br /> <span class="sectionToc" >3 <a
94 href="#x1-470003" id="QQ2-1-50">Probability Model and Codebooks</a></span>
95 <br />  <span class="subsectionToc" >3.1 <a
96 href="#x1-480003.1" id="QQ2-1-51">Overview</a></span>
97 <br />   <span class="subsubsectionToc" >3.1.1 <a
98 href="#x1-490003.1.1" id="QQ2-1-52">Bitwise operation</a></span>
99 <br />  <span class="subsectionToc" >3.2 <a
100 href="#x1-500003.2" id="QQ2-1-53">Packed codebook format</a></span>
101 <br />   <span class="subsubsectionToc" >3.2.1 <a
102 href="#x1-510003.2.1" id="QQ2-1-54">codebook decode</a></span>
103 <br />  <span class="subsectionToc" >3.3 <a
104 href="#x1-570003.3" id="QQ2-1-62">Use of the codebook abstraction</a></span>
105 <br /> <span class="sectionToc" >4 <a
106 href="#x1-580004" id="QQ2-1-63">Codec Setup and Packet Decode</a></span>
107 <br />  <span class="subsectionToc" >4.1 <a
108 href="#x1-590004.1" id="QQ2-1-64">Overview</a></span>
109 <br />  <span class="subsectionToc" >4.2 <a
110 href="#x1-600004.2" id="QQ2-1-65">Header decode and decode setup</a></span>
111 <br />   <span class="subsubsectionToc" >4.2.1 <a
112 href="#x1-610004.2.1" id="QQ2-1-66">Common header decode</a></span>
113 <br />   <span class="subsubsectionToc" >4.2.2 <a
114 href="#x1-620004.2.2" id="QQ2-1-67">Identification header</a></span>
115 <br />   <span class="subsubsectionToc" >4.2.3 <a
116 href="#x1-630004.2.3" id="QQ2-1-68">Comment header</a></span>
117 <br />   <span class="subsubsectionToc" >4.2.4 <a
118 href="#x1-640004.2.4" id="QQ2-1-69">Setup header</a></span>
119 <br />  <span class="subsectionToc" >4.3 <a
120 href="#x1-710004.3" id="QQ2-1-77">Audio packet decode and synthesis</a></span>
121 <br />   <span class="subsubsectionToc" >4.3.1 <a
122 href="#x1-720004.3.1" id="QQ2-1-78">packet type, mode and window decode</a></span>
123 <br />   <span class="subsubsectionToc" >4.3.2 <a
124 href="#x1-730004.3.2" id="QQ2-1-79">floor curve decode</a></span>
125 <br />   <span class="subsubsectionToc" >4.3.3 <a
126 href="#x1-740004.3.3" id="QQ2-1-80">nonzero vector propagate</a></span>
130 <br />   <span class="subsubsectionToc" >4.3.4 <a
131 href="#x1-750004.3.4" id="QQ2-1-81">residue decode</a></span>
132 <br />   <span class="subsubsectionToc" >4.3.5 <a
133 href="#x1-760004.3.5" id="QQ2-1-82">inverse coupling</a></span>
134 <br />   <span class="subsubsectionToc" >4.3.6 <a
135 href="#x1-770004.3.6" id="QQ2-1-83">dot product</a></span>
136 <br />   <span class="subsubsectionToc" >4.3.7 <a
137 href="#x1-780004.3.7" id="QQ2-1-84">inverse MDCT</a></span>
138 <br />   <span class="subsubsectionToc" >4.3.8 <a
139 href="#x1-790004.3.8" id="QQ2-1-85">overlap˙add</a></span>
140 <br />   <span class="subsubsectionToc" >4.3.9 <a
141 href="#x1-800004.3.9" id="QQ2-1-86">output channel order</a></span>
142 <br /> <span class="sectionToc" >5 <a
143 href="#x1-810005" id="QQ2-1-87">comment field and header specification</a></span>
144 <br />  <span class="subsectionToc" >5.1 <a
145 href="#x1-820005.1" id="QQ2-1-88">Overview</a></span>
146 <br />  <span class="subsectionToc" >5.2 <a
147 href="#x1-830005.2" id="QQ2-1-89">Comment encoding</a></span>
148 <br />   <span class="subsubsectionToc" >5.2.1 <a
149 href="#x1-840005.2.1" id="QQ2-1-90">Structure</a></span>
150 <br />   <span class="subsubsectionToc" >5.2.2 <a
151 href="#x1-850005.2.2" id="QQ2-1-91">Content vector format</a></span>
152 <br />   <span class="subsubsectionToc" >5.2.3 <a
153 href="#x1-880005.2.3" id="QQ2-1-94">Encoding</a></span>
154 <br /> <span class="sectionToc" >6 <a
155 href="#x1-890006" id="QQ2-1-95">Floor type 0 setup and decode</a></span>
156 <br />  <span class="subsectionToc" >6.1 <a
157 href="#x1-900006.1" id="QQ2-1-96">Overview</a></span>
158 <br />  <span class="subsectionToc" >6.2 <a
159 href="#x1-910006.2" id="QQ2-1-97">Floor 0 format</a></span>
160 <br />   <span class="subsubsectionToc" >6.2.1 <a
161 href="#x1-920006.2.1" id="QQ2-1-98">header decode</a></span>
162 <br />   <span class="subsubsectionToc" >6.2.2 <a
163 href="#x1-930006.2.2" id="QQ2-1-99">packet decode</a></span>
164 <br />   <span class="subsubsectionToc" >6.2.3 <a
165 href="#x1-940006.2.3" id="QQ2-1-100">curve computation</a></span>
166 <br /> <span class="sectionToc" >7 <a
167 href="#x1-950007" id="QQ2-1-101">Floor type 1 setup and decode</a></span>
168 <br />  <span class="subsectionToc" >7.1 <a
169 href="#x1-960007.1" id="QQ2-1-102">Overview</a></span>
170 <br />  <span class="subsectionToc" >7.2 <a
171 href="#x1-970007.2" id="QQ2-1-103">Floor 1 format</a></span>
172 <br />   <span class="subsubsectionToc" >7.2.1 <a
173 href="#x1-980007.2.1" id="QQ2-1-104">model</a></span>
174 <br />   <span class="subsubsectionToc" >7.2.2 <a
175 href="#x1-990007.2.2" id="QQ2-1-109">header decode</a></span>
176 <br /> <span class="sectionToc" >8 <a
177 href="#x1-1020008" id="QQ2-1-112">Residue setup and decode</a></span>
178 <br />  <span class="subsectionToc" >8.1 <a
179 href="#x1-1030008.1" id="QQ2-1-113">Overview</a></span>
180 <br />  <span class="subsectionToc" >8.2 <a
181 href="#x1-1040008.2" id="QQ2-1-114">Residue format</a></span>
182 <br />  <span class="subsectionToc" >8.3 <a
183 href="#x1-1050008.3" id="QQ2-1-116">residue 0</a></span>
184 <br />  <span class="subsectionToc" >8.4 <a
185 href="#x1-1060008.4" id="QQ2-1-117">residue 1</a></span>
186 <br />  <span class="subsectionToc" >8.5 <a
187 href="#x1-1070008.5" id="QQ2-1-118">residue 2</a></span>
188 <br />  <span class="subsectionToc" >8.6 <a
189 href="#x1-1080008.6" id="QQ2-1-120">Residue decode</a></span>
190 <br />   <span class="subsubsectionToc" >8.6.1 <a
191 href="#x1-1090008.6.1" id="QQ2-1-121">header decode</a></span>
195 <br />   <span class="subsubsectionToc" >8.6.2 <a
196 href="#x1-1100008.6.2" id="QQ2-1-122">packet decode</a></span>
197 <br />   <span class="subsubsectionToc" >8.6.3 <a
198 href="#x1-1110008.6.3" id="QQ2-1-123">format 0 specifics</a></span>
199 <br />   <span class="subsubsectionToc" >8.6.4 <a
200 href="#x1-1120008.6.4" id="QQ2-1-124">format 1 specifics</a></span>
201 <br />   <span class="subsubsectionToc" >8.6.5 <a
202 href="#x1-1130008.6.5" id="QQ2-1-125">format 2 specifics</a></span>
203 <br /> <span class="sectionToc" >9 <a
204 href="#x1-1140009" id="QQ2-1-126">Helper equations</a></span>
205 <br />  <span class="subsectionToc" >9.1 <a
206 href="#x1-1150009.1" id="QQ2-1-127">Overview</a></span>
207 <br />  <span class="subsectionToc" >9.2 <a
208 href="#x1-1160009.2" id="QQ2-1-128">Functions</a></span>
209 <br />   <span class="subsubsectionToc" >9.2.1 <a
210 href="#x1-1170009.2.1" id="QQ2-1-129">ilog</a></span>
211 <br />   <span class="subsubsectionToc" >9.2.2 <a
212 href="#x1-1180009.2.2" id="QQ2-1-130">float32˙unpack</a></span>
213 <br />   <span class="subsubsectionToc" >9.2.3 <a
214 href="#x1-1190009.2.3" id="QQ2-1-131">lookup1˙values</a></span>
215 <br />   <span class="subsubsectionToc" >9.2.4 <a
216 href="#x1-1200009.2.4" id="QQ2-1-132">low˙neighbor</a></span>
217 <br />   <span class="subsubsectionToc" >9.2.5 <a
218 href="#x1-1210009.2.5" id="QQ2-1-133">high˙neighbor</a></span>
219 <br />   <span class="subsubsectionToc" >9.2.6 <a
220 href="#x1-1220009.2.6" id="QQ2-1-134">render˙point</a></span>
221 <br />   <span class="subsubsectionToc" >9.2.7 <a
222 href="#x1-1230009.2.7" id="QQ2-1-135">render˙line</a></span>
223 <br /> <span class="sectionToc" >10 <a
224 href="#x1-12400010" id="QQ2-1-136">Tables</a></span>
225 <br />  <span class="subsectionToc" >10.1 <a
226 href="#x1-12500010.1" id="QQ2-1-137">floor1_inverse_dB_table</a></span>
227 <br /> <span class="sectionToc" >A <a
228 href="#x1-126000A" id="QQ2-1-138">Embedding Vorbis into an Ogg stream</a></span>
229 <br />  <span class="subsectionToc" >A.1 <a
230 href="#x1-127000A.1" id="QQ2-1-139">Overview</a></span>
231 <br />   <span class="subsubsectionToc" >A.1.1 <a
232 href="#x1-128000A.1.1" id="QQ2-1-140">Restrictions</a></span>
233 <br />   <span class="subsubsectionToc" >A.1.2 <a
234 href="#x1-129000A.1.2" id="QQ2-1-141">MIME type</a></span>
235 <br />  <span class="subsectionToc" >A.2 <a
236 href="#x1-130000A.2" id="QQ2-1-142">Encapsulation</a></span>
237 <br /> <span class="sectionToc" >B <a
238 href="#x1-132000B" id="QQ2-1-144">Vorbis encapsulation in RTP</a></span>
243 <h3 class="sectionHead"><span class="titlemark">1 </span> <a
244 id="x1-20001"></a>Introduction and Description</h3>
245 <!--l. 6--><p class="noindent" >
246 <h4 class="subsectionHead"><span class="titlemark">1.1 </span> <a
247 id="x1-30001.1"></a>Overview</h4>
248 <!--l. 8--><p class="noindent" >This document provides a high level description of the Vorbis codec’s construction. A bit-by-bit
249 specification appears beginning in <a
250 href="#x1-580004">Section 4<!--tex4ht:ref: vorbis:spec:codec --></a>, “<a
251 href="#x1-580004">Codec Setup and Packet Decode<!--tex4ht:ref: vorbis:spec:codec --></a>”. The later
252 sections assume a high-level understanding of the Vorbis decode process, which is provided
254 <!--l. 15--><p class="noindent" >
255 <h5 class="subsubsectionHead"><span class="titlemark">1.1.1 </span> <a
256 id="x1-40001.1.1"></a>Application</h5>
257 <!--l. 16--><p class="noindent" >Vorbis is a general purpose perceptual audio CODEC intended to allow maximum encoder
258 flexibility, thus allowing it to scale competitively over an exceptionally wide range of bitrates. At the
259 high quality/bitrate end of the scale (CD or DAT rate stereo, 16/24 bits) it is in the same league as
260 MPEG-2 and MPC. Similarly, the 1.0 encoder can encode high-quality CD and DAT rate stereo at
261 below 48kbps without resampling to a lower rate. Vorbis is also intended for lower and higher
262 sample rates (from 8kHz telephony to 192kHz digital masters) and a range of channel
263 representations (monaural, polyphonic, stereo, quadraphonic, 5.1, ambisonic, or up to 255 discrete
265 <!--l. 29--><p class="noindent" >
266 <h5 class="subsubsectionHead"><span class="titlemark">1.1.2 </span> <a
267 id="x1-50001.1.2"></a>Classification</h5>
268 <!--l. 30--><p class="noindent" >Vorbis I is a forward-adaptive monolithic transform CODEC based on the Modified Discrete Cosine
269 Transform. The codec is structured to allow addition of a hybrid wavelet filterbank in Vorbis II to
270 offer better transient response and reproduction using a transform better suited to localized time
272 <!--l. 37--><p class="noindent" >
273 <h5 class="subsubsectionHead"><span class="titlemark">1.1.3 </span> <a
274 id="x1-60001.1.3"></a>Assumptions</h5>
278 <!--l. 39--><p class="noindent" >The Vorbis CODEC design assumes a complex, psychoacoustically-aware encoder and simple,
279 low-complexity decoder. Vorbis decode is computationally simpler than mp3, although it does
280 require more working memory as Vorbis has no static probability model; the vector codebooks used
281 in the first stage of decoding from the bitstream are packed in their entirety into the Vorbis
282 bitstream headers. In packed form, these codebooks occupy only a few kilobytes; the extent
283 to which they are pre-decoded into a cache is the dominant factor in decoder memory
285 <!--l. 50--><p class="noindent" >Vorbis provides none of its own framing, synchronization or protection against errors; it is solely a
286 method of accepting input audio, dividing it into individual frames and compressing these frames
287 into raw, unformatted ’packets’. The decoder then accepts these raw packets in sequence, decodes
288 them, synthesizes audio frames from them, and reassembles the frames into a facsimile of the
289 original audio stream. Vorbis is a free-form variable bit rate (VBR) codec and packets have no
290 minimum size, maximum size, or fixed/expected size. Packets are designed that they may be
291 truncated (or padded) and remain decodable; this is not to be considered an error condition and is
292 used extensively in bitrate management in peeling. Both the transport mechanism and
293 decoder must allow that a packet may be any size, or end before or after packet decode
295 <!--l. 64--><p class="noindent" >Vorbis packets are thus intended to be used with a transport mechanism that provides free-form
296 framing, sync, positioning and error correction in accordance with these design assumptions, such as
297 Ogg (for file transport) or RTP (for network multicast). For purposes of a few examples in this
298 document, we will assume that Vorbis is to be embedded in an Ogg stream specifically,
299 although this is by no means a requirement or fundamental assumption in the Vorbis
301 <!--l. 72--><p class="noindent" >The specification for embedding Vorbis into an Ogg transport stream is in <a
302 href="#x1-126000A">Section A<!--tex4ht:ref: vorbis:over:ogg --></a>, “<a
303 href="#x1-126000A">Embedding
304 Vorbis into an Ogg stream<!--tex4ht:ref: vorbis:over:ogg --></a>”.
305 <!--l. 77--><p class="noindent" >
306 <h5 class="subsubsectionHead"><span class="titlemark">1.1.4 </span> <a
307 id="x1-70001.1.4"></a>Codec Setup and Probability Model</h5>
308 <!--l. 79--><p class="noindent" >Vorbis’ heritage is as a research CODEC and its current design reflects a desire to allow multiple
309 decades of continuous encoder improvement before running out of room within the codec
310 specification. For these reasons, configurable aspects of codec setup intentionally lean toward the
311 extreme of forward adaptive.
312 <!--l. 85--><p class="noindent" >The single most controversial design decision in Vorbis (and the most unusual for a Vorbis developer
313 to keep in mind) is that the entire probability model of the codec, the Huffman and
314 VQ codebooks, is packed into the bitstream header along with extensive CODEC setup
315 parameters (often several hundred fields). This makes it impossible, as it would be with
316 MPEG audio layers, to embed a simple frame type flag in each audio packet, or begin
317 decode at any frame in the stream without having previously fetched the codec setup
322 <!--l. 95--><p class="noindent" ><span class="likesubparagraphHead"><a
323 id="x1-80001.1.4"></a><span
324 class="cmbx-10x-x-109">Note:</span></span> Vorbis <span
325 class="cmti-10x-x-109">can </span>initiate decode at any arbitrary packet within a bitstream so long as the codec
326 has been initialized/setup with the setup headers.
327 <!--l. 101--><p class="noindent" >Thus, Vorbis headers are both required for decode to begin and relatively large as bitstream headers
328 go. The header size is unbounded, although for streaming a rule-of-thumb of 4kB or less is
329 recommended (and Xiph.Org’s Vorbis encoder follows this suggestion).
330 <!--l. 106--><p class="noindent" >Our own design work indicates the primary liability of the required header is in mindshare; it is an
331 unusual design and thus causes some amount of complaint among engineers as this runs against
332 current design trends (and also points out limitations in some existing software/interface designs,
333 such as Windows’ ACM codec framework). However, we find that it does not fundamentally limit
334 Vorbis’ suitable application space.
335 <!--l. 115--><p class="noindent" >
336 <h5 class="subsubsectionHead"><span class="titlemark">1.1.5 </span> <a
337 id="x1-90001.1.5"></a>Format Specification</h5>
338 <!--l. 116--><p class="noindent" >The Vorbis format is well-defined by its decode specification; any encoder that produces
339 packets that are correctly decoded by the reference Vorbis decoder described below may be
340 considered a proper Vorbis encoder. A decoder must faithfully and completely implement
341 the specification defined below (except where noted) to be considered a proper Vorbis
343 <!--l. 123--><p class="noindent" >
344 <h5 class="subsubsectionHead"><span class="titlemark">1.1.6 </span> <a
345 id="x1-100001.1.6"></a>Hardware Profile</h5>
346 <!--l. 124--><p class="noindent" >Although Vorbis decode is computationally simple, it may still run into specific limitations of an
347 embedded design. For this reason, embedded designs are allowed to deviate in limited ways from the
348 ‘full’ decode specification yet still be certified compliant. These optional omissions are labelled in
349 the spec where relevant.
350 <!--l. 131--><p class="noindent" >
351 <h4 class="subsectionHead"><span class="titlemark">1.2 </span> <a
352 id="x1-110001.2"></a>Decoder Configuration</h4>
353 <!--l. 133--><p class="noindent" >Decoder setup consists of configuration of multiple, self-contained component abstractions that
354 perform specific functions in the decode pipeline. Each different component instance of a specific
355 type is semantically interchangeable; decoder configuration consists both of internal component
356 configuration, as well as arrangement of specific instances into a decode pipeline. Componentry
360 arrangement is roughly as follows:
363 <!--l. 141--><p class="noindent" >
365 <!--l. 142--><p class="noindent" ><img
366 src="components.png" alt="PIC"
368 <br /> <table class="caption"
369 ><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 1: </td><td
370 class="content">decoder pipeline configuration</td></tr></table><!--tex4ht:label?: x1-110011 -->
372 <!--l. 146--><p class="noindent" >
373 <h5 class="subsubsectionHead"><span class="titlemark">1.2.1 </span> <a
374 id="x1-120001.2.1"></a>Global Config</h5>
375 <!--l. 147--><p class="noindent" >Global codec configuration consists of a few audio related fields (sample rate, channels), Vorbis
376 version (always ’0’ in Vorbis I), bitrate hints, and the lists of component instances. All other
377 configuration is in the context of specific components.
378 <!--l. 152--><p class="noindent" >
379 <h5 class="subsubsectionHead"><span class="titlemark">1.2.2 </span> <a
380 id="x1-130001.2.2"></a>Mode</h5>
381 <!--l. 154--><p class="noindent" >Each Vorbis frame is coded according to a master ’mode’. A bitstream may use one or many
383 <!--l. 157--><p class="noindent" >The mode mechanism is used to encode a frame according to one of multiple possible
384 methods with the intention of choosing a method best suited to that frame. Different
385 modes are, e.g. how frame size is changed from frame to frame. The mode number of a
386 frame serves as a top level configuration switch for all other specific aspects of frame
388 <!--l. 164--><p class="noindent" >A ’mode’ configuration consists of a frame size setting, window type (always 0, the Vorbis window,
389 in Vorbis I), transform type (always type 0, the MDCT, in Vorbis I) and a mapping number. The
390 mapping number specifies which mapping configuration instance to use for low-level packet decode
392 <!--l. 171--><p class="noindent" >
393 <h5 class="subsubsectionHead"><span class="titlemark">1.2.3 </span> <a
394 id="x1-140001.2.3"></a>Mapping</h5>
398 <!--l. 173--><p class="noindent" >A mapping contains a channel coupling description and a list of ’submaps’ that bundle
399 sets of channel vectors together for grouped encoding and decoding. These submaps
400 are not references to external components; the submap list is internal and specific to a
402 <!--l. 178--><p class="noindent" >A ’submap’ is a configuration/grouping that applies to a subset of floor and residue vectors within a
403 mapping. The submap functions as a last layer of indirection such that specific special floor or
404 residue settings can be applied not only to all the vectors in a given mode, but also
405 specific vectors in a specific mode. Each submap specifies the proper floor and residue
406 instance number to use for decoding that submap’s spectral floor and spectral residue
408 <!--l. 186--><p class="noindent" >As an example:
409 <!--l. 188--><p class="noindent" >Assume a Vorbis stream that contains six channels in the standard 5.1 format. The sixth channel, as
410 is normal in 5.1, is bass only. Therefore it would be wasteful to encode a full-spectrum version of it
411 as with the other channels. The submapping mechanism can be used to apply a full range floor and
412 residue encoding to channels 0 through 4, and a bass-only representation to the bass channel,
413 thus saving space. In this example, channels 0-4 belong to submap 0 (which indicates
414 use of a full-range floor) and channel 5 belongs to submap 1, which uses a bass-only
416 <!--l. 199--><p class="noindent" >
417 <h5 class="subsubsectionHead"><span class="titlemark">1.2.4 </span> <a
418 id="x1-150001.2.4"></a>Floor</h5>
419 <!--l. 201--><p class="noindent" >Vorbis encodes a spectral ’floor’ vector for each PCM channel. This vector is a low-resolution
420 representation of the audio spectrum for the given channel in the current frame, generally used akin
421 to a whitening filter. It is named a ’floor’ because the Xiph.Org reference encoder has historically
422 used it as a unit-baseline for spectral resolution.
423 <!--l. 208--><p class="noindent" >A floor encoding may be of two types. Floor 0 uses a packed LSP representation on a dB
424 amplitude scale and Bark frequency scale. Floor 1 represents the curve as a piecewise linear
425 interpolated representation on a dB amplitude scale and linear frequency scale. The two floors
426 are semantically interchangeable in encoding/decoding. However, floor type 1 provides
427 more stable inter-frame behavior, and so is the preferred choice in all coupled-stereo
428 and high bitrate modes. Floor 1 is also considerably less expensive to decode than floor
430 <!--l. 218--><p class="noindent" >Floor 0 is not to be considered deprecated, but it is of limited modern use. No known Vorbis
431 encoder past Xiph.org’s own beta 4 makes use of floor 0.
432 <!--l. 222--><p class="noindent" >The values coded/decoded by a floor are both compactly formatted and make use of
433 entropy coding to save space. For this reason, a floor configuration generally refers to
434 multiple codebooks in the codebook component list. Entropy coding is thus provided as an
435 abstraction, and each floor instance may choose from any and all available codebooks when
440 <!--l. 230--><p class="noindent" >
441 <h5 class="subsubsectionHead"><span class="titlemark">1.2.5 </span> <a
442 id="x1-160001.2.5"></a>Residue</h5>
443 <!--l. 231--><p class="noindent" >The spectral residue is the fine structure of the audio spectrum once the floor curve
444 has been subtracted out. In simplest terms, it is coded in the bitstream using cascaded
445 (multi-pass) vector quantization according to one of three specific packing/coding algorithms
446 numbered 0 through 2. The packing algorithm details are configured by residue instance.
447 As with the floor components, the final VQ/entropy encoding is provided by external
448 codebook instances and each residue instance may choose from any and all available
450 <!--l. 241--><p class="noindent" >
451 <h5 class="subsubsectionHead"><span class="titlemark">1.2.6 </span> <a
452 id="x1-170001.2.6"></a>Codebooks</h5>
453 <!--l. 243--><p class="noindent" >Codebooks are a self-contained abstraction that perform entropy decoding and, optionally, use the
454 entropy-decoded integer value as an offset into an index of output value vectors, returning the
455 indicated vector of values.
456 <!--l. 248--><p class="noindent" >The entropy coding in a Vorbis I codebook is provided by a standard Huffman binary tree
457 representation. This tree is tightly packed using one of several methods, depending on whether
458 codeword lengths are ordered or unordered, or the tree is sparse.
459 <!--l. 253--><p class="noindent" >The codebook vector index is similarly packed according to index characteristic. Most commonly,
460 the vector index is encoded as a single list of values of possible values that are then permuted into a
461 list of n-dimensional rows (lattice VQ).
462 <!--l. 260--><p class="noindent" >
463 <h4 class="subsectionHead"><span class="titlemark">1.3 </span> <a
464 id="x1-180001.3"></a>High-level Decode Process</h4>
465 <!--l. 262--><p class="noindent" >
466 <h5 class="subsubsectionHead"><span class="titlemark">1.3.1 </span> <a
467 id="x1-190001.3.1"></a>Decode Setup</h5>
468 <!--l. 264--><p class="noindent" >Before decoding can begin, a decoder must initialize using the bitstream headers matching the
469 stream to be decoded. Vorbis uses three header packets; all are required, in-order, by this
473 specification. Once set up, decode may begin at any audio packet belonging to the Vorbis stream. In
474 Vorbis I, all packets after the three initial headers are audio packets.
475 <!--l. 271--><p class="noindent" >The header packets are, in order, the identification header, the comments header, and the setup
477 <!--l. 274--><p class="noindent" ><span class="paragraphHead"><a
478 id="x1-200001.3.1"></a><span
479 class="cmbx-10x-x-109">Identification Header</span></span>
480 The identification header identifies the bitstream as Vorbis, Vorbis version, and the simple audio
481 characteristics of the stream such as sample rate and number of channels.
482 <!--l. 279--><p class="noindent" ><span class="paragraphHead"><a
483 id="x1-210001.3.1"></a><span
484 class="cmbx-10x-x-109">Comment Header</span></span>
485 The comment header includes user text comments (“tags”) and a vendor string for the
486 application/library that produced the bitstream. The encoding and proper use of the comment
487 header is described in <a
488 href="#x1-810005">Section 5<!--tex4ht:ref: vorbis:spec:comment --></a>, “<a
489 href="#x1-810005">comment field and header specification<!--tex4ht:ref: vorbis:spec:comment --></a>”.
490 <!--l. 284--><p class="noindent" ><span class="paragraphHead"><a
491 id="x1-220001.3.1"></a><span
492 class="cmbx-10x-x-109">Setup Header</span></span>
493 The setup header includes extensive CODEC setup information as well as the complete VQ and
494 Huffman codebooks needed for decode.
495 <!--l. 289--><p class="noindent" >
496 <h5 class="subsubsectionHead"><span class="titlemark">1.3.2 </span> <a
497 id="x1-230001.3.2"></a>Decode Procedure</h5>
498 <!--l. 291--><p class="noindent" >The decoding and synthesis procedure for all audio packets is fundamentally the same.
499 <ol class="enumerate1" >
501 class="enumerate" id="x1-23002x1">decode packet type flag
504 class="enumerate" id="x1-23004x2">decode mode number
507 class="enumerate" id="x1-23006x3">decode window shape (long windows only)
510 class="enumerate" id="x1-23008x4">decode floor
513 class="enumerate" id="x1-23010x5">decode residue into residue vectors
519 class="enumerate" id="x1-23012x6">inverse channel coupling of residue vectors
522 class="enumerate" id="x1-23014x7">generate floor curve from decoded floor data
525 class="enumerate" id="x1-23016x8">compute dot product of floor and residue, producing audio spectrum vector
528 class="enumerate" id="x1-23018x9">inverse monolithic transform of audio spectrum vector, always an MDCT in Vorbis I
531 class="enumerate" id="x1-23020x10">overlap/add left-hand output of transform with right-hand output of previous frame
534 class="enumerate" id="x1-23022x11">store right hand-data from transform of current frame for future lapping
537 class="enumerate" id="x1-23024x12">if not first frame, return results of overlap/add as audio result of current frame</li></ol>
538 <!--l. 308--><p class="noindent" >Note that clever rearrangement of the synthesis arithmetic is possible; as an example, one can take
539 advantage of symmetries in the MDCT to store the right-hand transform data of a partial MDCT
540 for a 50% inter-frame buffer space savings, and then complete the transform later before
541 overlap/add with the next frame. This optimization produces entirely equivalent output and is
542 naturally perfectly legal. The decoder must be <span
543 class="cmti-10x-x-109">entirely mathematically equivalent </span>to the
544 specification, it need not be a literal semantic implementation.
545 <!--l. 317--><p class="noindent" ><span class="paragraphHead"><a
546 id="x1-240001.3.2"></a><span
547 class="cmbx-10x-x-109">Packet type decode</span></span>
548 Vorbis I uses four packet types. The first three packet types mark each of the three Vorbis headers
549 described above. The fourth packet type marks an audio packet. All other packet types are reserved;
550 packets marked with a reserved type should be ignored.
551 <!--l. 324--><p class="noindent" >Following the three header packets, all packets in a Vorbis I stream are audio. The first step of
552 audio packet decode is to read and verify the packet type; <span
553 class="cmti-10x-x-109">a non-audio packet when audio is</span>
555 class="cmti-10x-x-109">expected indicates stream corruption or a non-compliant stream. The decoder must ignore the packet</span>
557 class="cmti-10x-x-109">and not attempt decoding it to audio</span>.
558 <!--l. 334--><p class="noindent" ><span class="paragraphHead"><a
559 id="x1-250001.3.2"></a><span
560 class="cmbx-10x-x-109">Mode decode</span></span>
561 Vorbis allows an encoder to set up multiple, numbered packet ’modes’, as described earlier, all of
562 which may be used in a given Vorbis stream. The mode is encoded as an integer used as a direct
563 offset into the mode instance index.
567 <!--l. 341--><p class="noindent" ><span class="paragraphHead"><a
568 id="x1-260001.3.2"></a><span
569 class="cmbx-10x-x-109">Window shape decode (long windows only)</span></span>
570 Vorbis frames may be one of two PCM sample sizes specified during codec setup. In Vorbis
571 I, legal frame sizes are powers of two from 64 to 8192 samples. Aside from coupling,
572 Vorbis handles channels as independent vectors and these frame sizes are in samples per
574 <!--l. 348--><p class="noindent" >Vorbis uses an overlapping transform, namely the MDCT, to blend one frame into the next,
575 avoiding most inter-frame block boundary artifacts. The MDCT output of one frame is windowed
576 according to MDCT requirements, overlapped 50% with the output of the previous frame and
577 added. The window shape assures seamless reconstruction.
578 <!--l. 354--><p class="noindent" >This is easy to visualize in the case of equal sized-windows:
581 <!--l. 356--><p class="noindent" >
583 <!--l. 357--><p class="noindent" ><img
584 src="window1.png" alt="PIC"
586 <br /> <table class="caption"
587 ><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 2: </td><td
588 class="content">overlap of two equal-sized windows</td></tr></table><!--tex4ht:label?: x1-260012 -->
590 <!--l. 361--><p class="noindent" >And slightly more complex in the case of overlapping unequal sized windows:
593 <!--l. 364--><p class="noindent" >
595 <!--l. 365--><p class="noindent" ><img
596 src="window2.png" alt="PIC"
598 <br /> <table class="caption"
599 ><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 3: </td><td
600 class="content">overlap of a long and a short window</td></tr></table><!--tex4ht:label?: x1-260023 -->
602 <!--l. 369--><p class="noindent" >In the unequal-sized window case, the window shape of the long window must be modified for
603 seamless lapping as above. It is possible to correctly infer window shape to be applied to the current
604 window from knowing the sizes of the current, previous and next window. It is legal for a decoder to
605 use this method. However, in the case of a long window (short windows require no modification),
606 Vorbis also codes two flag bits to specify pre- and post- window shape. Although not strictly
607 necessary for function, this minor redundancy allows a packet to be fully decoded to the
608 point of lapping entirely independently of any other packet, allowing easier abstraction
609 of decode layers as well as allowing a greater level of easy parallelism in encode and
611 <!--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
612 href="#XSporer/Brandenburg/Edler">1</a>]</span>. Vorbis
613 windows all use the slope function
614 <center class="math-display" >
616 src="Vorbis_I_spec0x.png" alt="y = sin (.5* π sin2((x + .5)∕n *π )).
617 " class="math-display" ></center>
618 <!--l. 385--><p class="nopar" >
619 <!--l. 389--><p class="noindent" ><span class="paragraphHead"><a
620 id="x1-270001.3.2"></a><span
621 class="cmbx-10x-x-109">floor decode</span></span>
622 Each floor is encoded/decoded in channel order, however each floor belongs to a ’submap’ that
623 specifies which floor configuration to use. All floors are decoded before residue decode
625 <!--l. 395--><p class="noindent" ><span class="paragraphHead"><a
626 id="x1-280001.3.2"></a><span
627 class="cmbx-10x-x-109">residue decode</span></span>
628 Although the number of residue vectors equals the number of channels, channel coupling may mean
629 that the raw residue vectors extracted during decode do not map directly to specific channels. When
630 channel coupling is in use, some vectors will correspond to coupled magnitude or angle. The
631 coupling relationships are described in the codec setup and may differ from frame to frame, due to
632 different mode numbers.
633 <!--l. 404--><p class="noindent" >Vorbis codes residue vectors in groups by submap; the coding is done in submap order from submap
634 0 through n-1. This differs from floors which are coded using a configuration provided by submap
635 number, but are coded individually in channel order.
636 <!--l. 411--><p class="noindent" ><span class="paragraphHead"><a
637 id="x1-290001.3.2"></a><span
638 class="cmbx-10x-x-109">inverse channel coupling</span></span>
639 A detailed discussion of stereo in the Vorbis codec can be found in the document <a
640 href="stereo.html" >Stereo Channel
641 Coupling in the Vorbis CODEC</a>. Vorbis is not limited to only stereo coupling, but the stereo
642 document also gives a good overview of the generic coupling mechanism.
643 <!--l. 419--><p class="noindent" >Vorbis coupling applies to pairs of residue vectors at a time; decoupling is done in-place
644 a pair at a time in the order and using the vectors specified in the current mapping
645 configuration. The decoupling operation is the same for all pairs, converting square polar
646 representation (where one vector is magnitude and the second angle) back to Cartesian
648 <!--l. 426--><p class="noindent" >After decoupling, in order, each pair of vectors on the coupling list, the resulting residue vectors
649 represent the fine spectral detail of each output channel.
650 <!--l. 432--><p class="noindent" ><span class="paragraphHead"><a
651 id="x1-300001.3.2"></a><span
652 class="cmbx-10x-x-109">generate floor curve</span></span>
656 The decoder may choose to generate the floor curve at any appropriate time. It is reasonable
657 to generate the output curve when the floor data is decoded from the raw packet, or
658 it can be generated after inverse coupling and applied to the spectral residue directly,
659 combining generation and the dot product into one step and eliminating some working
661 <!--l. 441--><p class="noindent" >Both floor 0 and floor 1 generate a linear-range, linear-domain output vector to be multiplied (dot
662 product) by the linear-range, linear-domain spectral residue.
663 <!--l. 447--><p class="noindent" ><span class="paragraphHead"><a
664 id="x1-310001.3.2"></a><span
665 class="cmbx-10x-x-109">compute floor/residue dot product</span></span>
666 This step is straightforward; for each output channel, the decoder multiplies the floor curve
667 and residue vectors element by element, producing the finished audio spectrum of each
669 <!--l. 455--><p class="noindent" >One point is worth mentioning about this dot product; a common mistake in a fixed point
670 implementation might be to assume that a 32 bit fixed-point representation for floor
671 and residue and direct multiplication of the vectors is sufficient for acceptable spectral
672 depth in all cases because it happens to mostly work with the current Xiph.Org reference
674 <!--l. 462--><p class="noindent" >However, floor vector values can span <span
675 class="cmsy-10x-x-109">~</span>140dB (<span
676 class="cmsy-10x-x-109">~</span>24 bits unsigned), and the audio spectrum vector
677 should represent a minimum of 120dB (<span
678 class="cmsy-10x-x-109">~</span>21 bits with sign), even when output is to a 16 bit PCM
679 device. For the residue vector to represent full scale if the floor is nailed to <span
680 class="cmsy-10x-x-109">-</span>140dB, it must be able
681 to span 0 to +140dB. For the residue vector to reach full scale if the floor is nailed at 0dB, it must
682 be able to represent <span
683 class="cmsy-10x-x-109">-</span>140dB to +0dB. Thus, in order to handle full range dynamics, a residue
684 vector may span <span
685 class="cmsy-10x-x-109">-</span>140dB to +140dB entirely within spec. A 280dB range is approximately 48 bits
686 with sign; thus the residue vector must be able to represent a 48 bit range and the dot product
687 must be able to handle an effective 48 bit times 24 bit multiplication. This range may be
688 achieved using large (64 bit or larger) integers, or implementing a movable binary point
690 <!--l. 479--><p class="noindent" ><span class="paragraphHead"><a
691 id="x1-320001.3.2"></a><span
692 class="cmbx-10x-x-109">inverse monolithic transform (MDCT)</span></span>
693 The audio spectrum is converted back into time domain PCM audio via an inverse Modified
694 Discrete Cosine Transform (MDCT). A detailed description of the MDCT is available in
695 <span class="cite">[<a
696 href="#XSporer/Brandenburg/Edler">1</a>]</span>.
697 <!--l. 485--><p class="noindent" >Note that the PCM produced directly from the MDCT is not yet finished audio; it must be lapped
698 with surrounding frames using an appropriate window (such as the Vorbis window) before the
699 MDCT can be considered orthogonal.
703 <!--l. 492--><p class="noindent" ><span class="paragraphHead"><a
704 id="x1-330001.3.2"></a><span
705 class="cmbx-10x-x-109">overlap/add data</span></span>
706 Windowed MDCT output is overlapped and added with the right hand data of the previous window
707 such that the 3/4 point of the previous window is aligned with the 1/4 point of the current window
708 (as illustrated in the window overlap diagram). At this point, the audio data between the center of
709 the previous frame and the center of the current frame is now finished and ready to be
711 <!--l. 501--><p class="noindent" ><span class="paragraphHead"><a
712 id="x1-340001.3.2"></a><span
713 class="cmbx-10x-x-109">cache right hand data</span></span>
714 The decoder must cache the right hand portion of the current frame to be lapped with the left hand
715 portion of the next frame.
716 <!--l. 507--><p class="noindent" ><span class="paragraphHead"><a
717 id="x1-350001.3.2"></a><span
718 class="cmbx-10x-x-109">return finished audio data</span></span>
719 The overlapped portion produced from overlapping the previous and current frame data is finished
720 data to be returned by the decoder. This data spans from the center of the previous window to the
721 center of the current window. In the case of same-sized windows, the amount of data to return is
722 one-half block consisting of and only of the overlapped portions. When overlapping a short and long
723 window, much of the returned range is not actually overlap. This does not damage transform
724 orthogonality. Pay attention however to returning the correct data range; the amount of data to be
726 <!--l. 519--><p class="noindent" >
727 <div class="fancyvrb" id="fancyvrb1">
729 id="x1-35002r1"></a><span
730 class="cmtt-10"> </span><span
731 class="cmtt-10"> window_blocksize(previous_window)/4+window_blocksize(current_window)/4</span>
733 <!--l. 523--><p class="noindent" >from the center of the previous window to the center of the current window.
734 <!--l. 526--><p class="noindent" >Data is not returned from the first frame; it must be used to ’prime’ the decode engine. The encoder
735 accounts for this priming when calculating PCM offsets; after the first frame, the proper PCM
736 output offset is ’0’ (as no data has been returned yet).
743 <h3 class="sectionHead"><span class="titlemark">2 </span> <a
744 id="x1-360002"></a>Bitpacking Convention</h3>
745 <!--l. 6--><p class="noindent" >
746 <h4 class="subsectionHead"><span class="titlemark">2.1 </span> <a
747 id="x1-370002.1"></a>Overview</h4>
748 <!--l. 8--><p class="noindent" >The Vorbis codec uses relatively unstructured raw packets containing arbitrary-width binary integer
749 fields. Logically, these packets are a bitstream in which bits are coded one-by-one by the encoder
750 and then read one-by-one in the same monotonically increasing order by the decoder. Most current
751 binary storage arrangements group bits into a native word size of eight bits (octets), sixteen bits,
752 thirty-two bits or, less commonly other fixed word sizes. The Vorbis bitpacking convention specifies
753 the correct mapping of the logical packet bitstream into an actual representation in fixed-width
755 <!--l. 19--><p class="noindent" >
756 <h5 class="subsubsectionHead"><span class="titlemark">2.1.1 </span> <a
757 id="x1-380002.1.1"></a>octets, bytes and words</h5>
758 <!--l. 21--><p class="noindent" >In most contemporary architectures, a ’byte’ is synonymous with an ’octet’, that is, eight bits. This
759 has not always been the case; seven, ten, eleven and sixteen bit ’bytes’ have been used.
760 For purposes of the bitpacking convention, a byte implies the native, smallest integer
761 storage representation offered by a platform. On modern platforms, this is generally
762 assumed to be eight bits (not necessarily because of the processor but because of the
763 filesystem/memory architecture. Modern filesystems invariably offer bytes as the fundamental
764 atom of storage). A ’word’ is an integer size that is a grouped multiple of this smallest
766 <!--l. 32--><p class="noindent" >The most ubiquitous architectures today consider a ’byte’ to be an octet (eight bits) and a word to
767 be a group of two, four or eight bytes (16, 32 or 64 bits). Note however that the Vorbis bitpacking
768 convention is still well defined for any native byte size; Vorbis uses the native bit-width of a
769 given storage system. This document assumes that a byte is one octet for purposes of
771 <!--l. 39--><p class="noindent" >
772 <h5 class="subsubsectionHead"><span class="titlemark">2.1.2 </span> <a
773 id="x1-390002.1.2"></a>bit order</h5>
774 <!--l. 41--><p class="noindent" >A byte has a well-defined ’least significant’ bit (LSb), which is the only bit set when the byte is
775 storing the two’s complement integer value +1. A byte’s ’most significant’ bit (MSb) is at the
779 opposite end of the byte. Bits in a byte are numbered from zero at the LSb to <span
780 class="cmmi-10x-x-109">n </span>(<span
781 class="cmmi-10x-x-109">n </span>= 7 in an octet)
783 <!--l. 50--><p class="noindent" >
784 <h5 class="subsubsectionHead"><span class="titlemark">2.1.3 </span> <a
785 id="x1-400002.1.3"></a>byte order</h5>
786 <!--l. 52--><p class="noindent" >Words are native groupings of multiple bytes. Several byte orderings are possible in a word;
787 the common ones are 3-2-1-0 (’big endian’ or ’most significant byte first’ in which the
788 highest-valued byte comes first), 0-1-2-3 (’little endian’ or ’least significant byte first’ in
789 which the lowest value byte comes first) and less commonly 3-1-2-0 and 0-2-1-3 (’mixed
791 <!--l. 59--><p class="noindent" >The Vorbis bitpacking convention specifies storage and bitstream manipulation at the byte, not
792 word, level, thus host word ordering is of a concern only during optimization when writing high
793 performance code that operates on a word of storage at a time rather than by byte.
794 Logically, bytes are always coded and decoded in order from byte zero through byte
796 class="cmmi-10x-x-109">n</span>.
797 <!--l. 68--><p class="noindent" >
798 <h5 class="subsubsectionHead"><span class="titlemark">2.1.4 </span> <a
799 id="x1-410002.1.4"></a>coding bits into byte sequences</h5>
800 <!--l. 70--><p class="noindent" >The Vorbis codec has need to code arbitrary bit-width integers, from zero to 32 bits
801 wide, into packets. These integer fields are not aligned to the boundaries of the byte
802 representation; the next field is written at the bit position at which the previous field
804 <!--l. 75--><p class="noindent" >The encoder logically packs integers by writing the LSb of a binary integer to the logical bitstream
805 first, followed by next least significant bit, etc, until the requested number of bits have been coded.
806 When packing the bits into bytes, the encoder begins by placing the LSb of the integer to be written
807 into the least significant unused bit position of the destination byte, followed by the next-least
808 significant bit of the source integer and so on up to the requested number of bits. When all bits of
809 the destination byte have been filled, encoding continues by zeroing all bits of the next byte
810 and writing the next bit into the bit position 0 of that byte. Decoding follows the same
811 process as encoding, but by reading bits from the byte stream and reassembling them into
813 <!--l. 90--><p class="noindent" >
814 <h5 class="subsubsectionHead"><span class="titlemark">2.1.5 </span> <a
815 id="x1-420002.1.5"></a>signedness</h5>
819 <!--l. 92--><p class="noindent" >The signedness of a specific number resulting from decode is to be interpreted by the decoder given
820 decode context. That is, the three bit binary pattern ’b111’ can be taken to represent
821 either ’seven’ as an unsigned integer, or ’-1’ as a signed, two’s complement integer. The
822 encoder and decoder are responsible for knowing if fields are to be treated as signed or
824 <!--l. 101--><p class="noindent" >
825 <h5 class="subsubsectionHead"><span class="titlemark">2.1.6 </span> <a
826 id="x1-430002.1.6"></a>coding example</h5>
827 <!--l. 103--><p class="noindent" >Code the 4 bit integer value ’12’ [b1100] into an empty bytestream. Bytestream result:
828 <!--l. 106--><p class="noindent" >
829 <div class="fancyvrb" id="fancyvrb2">
831 id="x1-43002r1"></a><span
832 class="cmtt-10"> </span><span
833 class="cmtt-10"> </span><span
834 class="cmtt-10"> </span><span
835 class="cmtt-10"> </span><span
836 class="cmtt-10"> </span><span
837 class="cmtt-10"> </span><span
838 class="cmtt-10"> </span><span
839 class="cmtt-10"> </span><span
840 class="cmtt-10"> </span><span
841 class="cmtt-10"> </span><span
842 class="cmtt-10"> </span><span
843 class="cmtt-10"> </span><span
844 class="cmtt-10"> </span><span
845 class="cmtt-10"> </span><span
846 class="cmtt-10"> </span><span
847 class="cmtt-10"> |</span>
848 <br class="fancyvrb" /><a
849 id="x1-43004r2"></a><span
850 class="cmtt-10"> </span><span
851 class="cmtt-10"> </span><span
852 class="cmtt-10"> </span><span
853 class="cmtt-10"> </span><span
854 class="cmtt-10"> </span><span
855 class="cmtt-10"> </span><span
856 class="cmtt-10"> </span><span
857 class="cmtt-10"> </span><span
858 class="cmtt-10"> </span><span
859 class="cmtt-10"> </span><span
860 class="cmtt-10"> </span><span
861 class="cmtt-10"> </span><span
862 class="cmtt-10"> </span><span
863 class="cmtt-10"> </span><span
864 class="cmtt-10"> </span><span
865 class="cmtt-10"> V</span>
866 <br class="fancyvrb" /><a
867 id="x1-43006r3"></a><span
868 class="cmtt-10"> </span><span
869 class="cmtt-10"> </span>
870 <br class="fancyvrb" /><a
871 id="x1-43008r4"></a><span
872 class="cmtt-10"> </span><span
873 class="cmtt-10"> </span><span
874 class="cmtt-10"> </span><span
875 class="cmtt-10"> </span><span
876 class="cmtt-10"> </span><span
877 class="cmtt-10"> </span><span
878 class="cmtt-10"> </span><span
879 class="cmtt-10"> </span><span
880 class="cmtt-10"> </span><span
881 class="cmtt-10"> 7</span><span
882 class="cmtt-10"> 6</span><span
883 class="cmtt-10"> 5</span><span
884 class="cmtt-10"> 4</span><span
885 class="cmtt-10"> 3</span><span
886 class="cmtt-10"> 2</span><span
887 class="cmtt-10"> 1</span><span
888 class="cmtt-10"> 0</span>
889 <br class="fancyvrb" /><a
890 id="x1-43010r5"></a><span
891 class="cmtt-10"> </span><span
892 class="cmtt-10"> byte</span><span
893 class="cmtt-10"> 0</span><span
894 class="cmtt-10"> [0</span><span
895 class="cmtt-10"> 0</span><span
896 class="cmtt-10"> 0</span><span
897 class="cmtt-10"> 0</span><span
898 class="cmtt-10"> 1</span><span
899 class="cmtt-10"> 1</span><span
900 class="cmtt-10"> 0</span><span
901 class="cmtt-10"> 0]</span><span
902 class="cmtt-10"> </span><span
903 class="cmtt-10"> <-</span>
904 <br class="fancyvrb" /><a
905 id="x1-43012r6"></a><span
906 class="cmtt-10"> </span><span
907 class="cmtt-10"> byte</span><span
908 class="cmtt-10"> 1</span><span
909 class="cmtt-10"> [</span><span
910 class="cmtt-10"> </span><span
911 class="cmtt-10"> </span><span
912 class="cmtt-10"> </span><span
913 class="cmtt-10"> </span><span
914 class="cmtt-10"> </span><span
915 class="cmtt-10"> </span><span
916 class="cmtt-10"> </span><span
917 class="cmtt-10"> </span><span
918 class="cmtt-10"> </span><span
919 class="cmtt-10"> </span><span
920 class="cmtt-10"> </span><span
921 class="cmtt-10"> </span><span
922 class="cmtt-10"> </span><span
923 class="cmtt-10"> </span><span
924 class="cmtt-10"> ]</span>
925 <br class="fancyvrb" /><a
926 id="x1-43014r7"></a><span
927 class="cmtt-10"> </span><span
928 class="cmtt-10"> byte</span><span
929 class="cmtt-10"> 2</span><span
930 class="cmtt-10"> [</span><span
931 class="cmtt-10"> </span><span
932 class="cmtt-10"> </span><span
933 class="cmtt-10"> </span><span
934 class="cmtt-10"> </span><span
935 class="cmtt-10"> </span><span
936 class="cmtt-10"> </span><span
937 class="cmtt-10"> </span><span
938 class="cmtt-10"> </span><span
939 class="cmtt-10"> </span><span
940 class="cmtt-10"> </span><span
941 class="cmtt-10"> </span><span
942 class="cmtt-10"> </span><span
943 class="cmtt-10"> </span><span
944 class="cmtt-10"> </span><span
945 class="cmtt-10"> ]</span>
946 <br class="fancyvrb" /><a
947 id="x1-43016r8"></a><span
948 class="cmtt-10"> </span><span
949 class="cmtt-10"> byte</span><span
950 class="cmtt-10"> 3</span><span
951 class="cmtt-10"> [</span><span
952 class="cmtt-10"> </span><span
953 class="cmtt-10"> </span><span
954 class="cmtt-10"> </span><span
955 class="cmtt-10"> </span><span
956 class="cmtt-10"> </span><span
957 class="cmtt-10"> </span><span
958 class="cmtt-10"> </span><span
959 class="cmtt-10"> </span><span
960 class="cmtt-10"> </span><span
961 class="cmtt-10"> </span><span
962 class="cmtt-10"> </span><span
963 class="cmtt-10"> </span><span
964 class="cmtt-10"> </span><span
965 class="cmtt-10"> </span><span
966 class="cmtt-10"> ]</span>
967 <br class="fancyvrb" /><a
968 id="x1-43018r9"></a><span
969 class="cmtt-10"> </span><span
970 class="cmtt-10"> </span><span
971 class="cmtt-10"> </span><span
972 class="cmtt-10"> </span><span
973 class="cmtt-10"> </span><span
974 class="cmtt-10"> </span><span
975 class="cmtt-10"> </span><span
976 class="cmtt-10"> </span><span
977 class="cmtt-10"> </span><span
978 class="cmtt-10"> </span><span
979 class="cmtt-10"> </span><span
980 class="cmtt-10"> </span><span
981 class="cmtt-10"> </span><span
982 class="cmtt-10"> </span><span
983 class="cmtt-10"> ...</span>
984 <br class="fancyvrb" /><a
985 id="x1-43020r10"></a><span
986 class="cmtt-10"> </span><span
987 class="cmtt-10"> byte</span><span
988 class="cmtt-10"> n</span><span
989 class="cmtt-10"> [</span><span
990 class="cmtt-10"> </span><span
991 class="cmtt-10"> </span><span
992 class="cmtt-10"> </span><span
993 class="cmtt-10"> </span><span
994 class="cmtt-10"> </span><span
995 class="cmtt-10"> </span><span
996 class="cmtt-10"> </span><span
997 class="cmtt-10"> </span><span
998 class="cmtt-10"> </span><span
999 class="cmtt-10"> </span><span
1000 class="cmtt-10"> </span><span
1001 class="cmtt-10"> </span><span
1002 class="cmtt-10"> </span><span
1003 class="cmtt-10"> </span><span
1004 class="cmtt-10"> ]</span><span
1005 class="cmtt-10"> </span><span
1006 class="cmtt-10"> bytestream</span><span
1007 class="cmtt-10"> length</span><span
1008 class="cmtt-10"> ==</span><span
1009 class="cmtt-10"> 1</span><span
1010 class="cmtt-10"> byte</span>
1011 <br class="fancyvrb" /><a
1012 id="x1-43022r11"></a><span
1013 class="cmtt-10"> </span><span
1014 class="cmtt-10"> </span>
1016 <!--l. 121--><p class="noindent" >Continue by coding the 3 bit integer value ’-1’ [b111]:
1017 <!--l. 123--><p class="noindent" >
1018 <div class="fancyvrb" id="fancyvrb3">
1020 id="x1-43024r1"></a><span
1021 class="cmtt-10"> </span><span
1022 class="cmtt-10"> </span><span
1023 class="cmtt-10"> </span><span
1024 class="cmtt-10"> </span><span
1025 class="cmtt-10"> </span><span
1026 class="cmtt-10"> </span><span
1027 class="cmtt-10"> </span><span
1028 class="cmtt-10"> </span><span
1029 class="cmtt-10"> </span><span
1030 class="cmtt-10"> |</span>
1031 <br class="fancyvrb" /><a
1032 id="x1-43026r2"></a><span
1033 class="cmtt-10"> </span><span
1034 class="cmtt-10"> </span><span
1035 class="cmtt-10"> </span><span
1036 class="cmtt-10"> </span><span
1037 class="cmtt-10"> </span><span
1038 class="cmtt-10"> </span><span
1039 class="cmtt-10"> </span><span
1040 class="cmtt-10"> </span><span
1041 class="cmtt-10"> </span><span
1042 class="cmtt-10"> V</span>
1043 <br class="fancyvrb" /><a
1044 id="x1-43028r3"></a><span
1045 class="cmtt-10"> </span><span
1046 class="cmtt-10"> </span>
1047 <br class="fancyvrb" /><a
1048 id="x1-43030r4"></a><span
1049 class="cmtt-10"> </span><span
1050 class="cmtt-10"> </span><span
1051 class="cmtt-10"> </span><span
1052 class="cmtt-10"> </span><span
1053 class="cmtt-10"> </span><span
1054 class="cmtt-10"> </span><span
1055 class="cmtt-10"> </span><span
1056 class="cmtt-10"> </span><span
1057 class="cmtt-10"> </span><span
1058 class="cmtt-10"> 7</span><span
1059 class="cmtt-10"> 6</span><span
1060 class="cmtt-10"> 5</span><span
1061 class="cmtt-10"> 4</span><span
1062 class="cmtt-10"> 3</span><span
1063 class="cmtt-10"> 2</span><span
1064 class="cmtt-10"> 1</span><span
1065 class="cmtt-10"> 0</span>
1066 <br class="fancyvrb" /><a
1067 id="x1-43032r5"></a><span
1068 class="cmtt-10"> </span><span
1069 class="cmtt-10"> byte</span><span
1070 class="cmtt-10"> 0</span><span
1071 class="cmtt-10"> [0</span><span
1072 class="cmtt-10"> 1</span><span
1073 class="cmtt-10"> 1</span><span
1074 class="cmtt-10"> 1</span><span
1075 class="cmtt-10"> 1</span><span
1076 class="cmtt-10"> 1</span><span
1077 class="cmtt-10"> 0</span><span
1078 class="cmtt-10"> 0]</span><span
1079 class="cmtt-10"> </span><span
1080 class="cmtt-10"> <-</span>
1081 <br class="fancyvrb" /><a
1082 id="x1-43034r6"></a><span
1083 class="cmtt-10"> </span><span
1084 class="cmtt-10"> byte</span><span
1085 class="cmtt-10"> 1</span><span
1086 class="cmtt-10"> [</span><span
1087 class="cmtt-10"> </span><span
1088 class="cmtt-10"> </span><span
1089 class="cmtt-10"> </span><span
1090 class="cmtt-10"> </span><span
1091 class="cmtt-10"> </span><span
1092 class="cmtt-10"> </span><span
1093 class="cmtt-10"> </span><span
1094 class="cmtt-10"> </span><span
1095 class="cmtt-10"> </span><span
1096 class="cmtt-10"> </span><span
1097 class="cmtt-10"> </span><span
1098 class="cmtt-10"> </span><span
1099 class="cmtt-10"> </span><span
1100 class="cmtt-10"> </span><span
1101 class="cmtt-10"> ]</span>
1102 <br class="fancyvrb" /><a
1103 id="x1-43036r7"></a><span
1104 class="cmtt-10"> </span><span
1105 class="cmtt-10"> byte</span><span
1106 class="cmtt-10"> 2</span><span
1107 class="cmtt-10"> [</span><span
1108 class="cmtt-10"> </span><span
1109 class="cmtt-10"> </span><span
1110 class="cmtt-10"> </span><span
1111 class="cmtt-10"> </span><span
1112 class="cmtt-10"> </span><span
1113 class="cmtt-10"> </span><span
1114 class="cmtt-10"> </span><span
1115 class="cmtt-10"> </span><span
1116 class="cmtt-10"> </span><span
1117 class="cmtt-10"> </span><span
1118 class="cmtt-10"> </span><span
1119 class="cmtt-10"> </span><span
1120 class="cmtt-10"> </span><span
1121 class="cmtt-10"> </span><span
1122 class="cmtt-10"> ]</span>
1123 <br class="fancyvrb" /><a
1124 id="x1-43038r8"></a><span
1125 class="cmtt-10"> </span><span
1126 class="cmtt-10"> byte</span><span
1127 class="cmtt-10"> 3</span><span
1128 class="cmtt-10"> [</span><span
1129 class="cmtt-10"> </span><span
1130 class="cmtt-10"> </span><span
1131 class="cmtt-10"> </span><span
1132 class="cmtt-10"> </span><span
1133 class="cmtt-10"> </span><span
1134 class="cmtt-10"> </span><span
1135 class="cmtt-10"> </span><span
1136 class="cmtt-10"> </span><span
1137 class="cmtt-10"> </span><span
1138 class="cmtt-10"> </span><span
1139 class="cmtt-10"> </span><span
1140 class="cmtt-10"> </span><span
1141 class="cmtt-10"> </span><span
1142 class="cmtt-10"> </span><span
1143 class="cmtt-10"> ]</span>
1144 <br class="fancyvrb" /><a
1145 id="x1-43040r9"></a><span
1146 class="cmtt-10"> </span><span
1147 class="cmtt-10"> </span><span
1148 class="cmtt-10"> </span><span
1149 class="cmtt-10"> </span><span
1150 class="cmtt-10"> </span><span
1151 class="cmtt-10"> </span><span
1152 class="cmtt-10"> </span><span
1153 class="cmtt-10"> </span><span
1154 class="cmtt-10"> </span><span
1155 class="cmtt-10"> </span><span
1156 class="cmtt-10"> </span><span
1157 class="cmtt-10"> </span><span
1158 class="cmtt-10"> </span><span
1159 class="cmtt-10"> </span><span
1160 class="cmtt-10"> ...</span>
1161 <br class="fancyvrb" /><a
1162 id="x1-43042r10"></a><span
1163 class="cmtt-10"> </span><span
1164 class="cmtt-10"> byte</span><span
1165 class="cmtt-10"> n</span><span
1166 class="cmtt-10"> [</span><span
1167 class="cmtt-10"> </span><span
1168 class="cmtt-10"> </span><span
1169 class="cmtt-10"> </span><span
1170 class="cmtt-10"> </span><span
1171 class="cmtt-10"> </span><span
1172 class="cmtt-10"> </span><span
1173 class="cmtt-10"> </span><span
1174 class="cmtt-10"> </span><span
1175 class="cmtt-10"> </span><span
1176 class="cmtt-10"> </span><span
1177 class="cmtt-10"> </span><span
1178 class="cmtt-10"> </span><span
1179 class="cmtt-10"> </span><span
1180 class="cmtt-10"> </span><span
1181 class="cmtt-10"> ]</span><span
1182 class="cmtt-10"> </span><span
1183 class="cmtt-10"> bytestream</span><span
1184 class="cmtt-10"> length</span><span
1185 class="cmtt-10"> ==</span><span
1186 class="cmtt-10"> 1</span><span
1187 class="cmtt-10"> byte</span>
1189 <!--l. 137--><p class="noindent" >Continue by coding the 7 bit integer value ’17’ [b0010001]:
1190 <!--l. 139--><p class="noindent" >
1194 <div class="fancyvrb" id="fancyvrb4">
1196 id="x1-43044r1"></a><span
1197 class="cmtt-10"> </span><span
1198 class="cmtt-10"> </span><span
1199 class="cmtt-10"> </span><span
1200 class="cmtt-10"> </span><span
1201 class="cmtt-10"> </span><span
1202 class="cmtt-10"> </span><span
1203 class="cmtt-10"> </span><span
1204 class="cmtt-10"> </span><span
1205 class="cmtt-10"> </span><span
1206 class="cmtt-10"> </span><span
1207 class="cmtt-10"> </span><span
1208 class="cmtt-10"> |</span>
1209 <br class="fancyvrb" /><a
1210 id="x1-43046r2"></a><span
1211 class="cmtt-10"> </span><span
1212 class="cmtt-10"> </span><span
1213 class="cmtt-10"> </span><span
1214 class="cmtt-10"> </span><span
1215 class="cmtt-10"> </span><span
1216 class="cmtt-10"> </span><span
1217 class="cmtt-10"> </span><span
1218 class="cmtt-10"> </span><span
1219 class="cmtt-10"> </span><span
1220 class="cmtt-10"> </span><span
1221 class="cmtt-10"> </span><span
1222 class="cmtt-10"> V</span>
1223 <br class="fancyvrb" /><a
1224 id="x1-43048r3"></a><span
1225 class="cmtt-10"> </span><span
1226 class="cmtt-10"> </span>
1227 <br class="fancyvrb" /><a
1228 id="x1-43050r4"></a><span
1229 class="cmtt-10"> </span><span
1230 class="cmtt-10"> </span><span
1231 class="cmtt-10"> </span><span
1232 class="cmtt-10"> </span><span
1233 class="cmtt-10"> </span><span
1234 class="cmtt-10"> </span><span
1235 class="cmtt-10"> </span><span
1236 class="cmtt-10"> </span><span
1237 class="cmtt-10"> </span><span
1238 class="cmtt-10"> 7</span><span
1239 class="cmtt-10"> 6</span><span
1240 class="cmtt-10"> 5</span><span
1241 class="cmtt-10"> 4</span><span
1242 class="cmtt-10"> 3</span><span
1243 class="cmtt-10"> 2</span><span
1244 class="cmtt-10"> 1</span><span
1245 class="cmtt-10"> 0</span>
1246 <br class="fancyvrb" /><a
1247 id="x1-43052r5"></a><span
1248 class="cmtt-10"> </span><span
1249 class="cmtt-10"> byte</span><span
1250 class="cmtt-10"> 0</span><span
1251 class="cmtt-10"> [1</span><span
1252 class="cmtt-10"> 1</span><span
1253 class="cmtt-10"> 1</span><span
1254 class="cmtt-10"> 1</span><span
1255 class="cmtt-10"> 1</span><span
1256 class="cmtt-10"> 1</span><span
1257 class="cmtt-10"> 0</span><span
1258 class="cmtt-10"> 0]</span>
1259 <br class="fancyvrb" /><a
1260 id="x1-43054r6"></a><span
1261 class="cmtt-10"> </span><span
1262 class="cmtt-10"> byte</span><span
1263 class="cmtt-10"> 1</span><span
1264 class="cmtt-10"> [0</span><span
1265 class="cmtt-10"> 0</span><span
1266 class="cmtt-10"> 0</span><span
1267 class="cmtt-10"> 0</span><span
1268 class="cmtt-10"> 1</span><span
1269 class="cmtt-10"> 0</span><span
1270 class="cmtt-10"> 0</span><span
1271 class="cmtt-10"> 0]</span><span
1272 class="cmtt-10"> </span><span
1273 class="cmtt-10"> <-</span>
1274 <br class="fancyvrb" /><a
1275 id="x1-43056r7"></a><span
1276 class="cmtt-10"> </span><span
1277 class="cmtt-10"> byte</span><span
1278 class="cmtt-10"> 2</span><span
1279 class="cmtt-10"> [</span><span
1280 class="cmtt-10"> </span><span
1281 class="cmtt-10"> </span><span
1282 class="cmtt-10"> </span><span
1283 class="cmtt-10"> </span><span
1284 class="cmtt-10"> </span><span
1285 class="cmtt-10"> </span><span
1286 class="cmtt-10"> </span><span
1287 class="cmtt-10"> </span><span
1288 class="cmtt-10"> </span><span
1289 class="cmtt-10"> </span><span
1290 class="cmtt-10"> </span><span
1291 class="cmtt-10"> </span><span
1292 class="cmtt-10"> </span><span
1293 class="cmtt-10"> </span><span
1294 class="cmtt-10"> ]</span>
1295 <br class="fancyvrb" /><a
1296 id="x1-43058r8"></a><span
1297 class="cmtt-10"> </span><span
1298 class="cmtt-10"> byte</span><span
1299 class="cmtt-10"> 3</span><span
1300 class="cmtt-10"> [</span><span
1301 class="cmtt-10"> </span><span
1302 class="cmtt-10"> </span><span
1303 class="cmtt-10"> </span><span
1304 class="cmtt-10"> </span><span
1305 class="cmtt-10"> </span><span
1306 class="cmtt-10"> </span><span
1307 class="cmtt-10"> </span><span
1308 class="cmtt-10"> </span><span
1309 class="cmtt-10"> </span><span
1310 class="cmtt-10"> </span><span
1311 class="cmtt-10"> </span><span
1312 class="cmtt-10"> </span><span
1313 class="cmtt-10"> </span><span
1314 class="cmtt-10"> </span><span
1315 class="cmtt-10"> ]</span>
1316 <br class="fancyvrb" /><a
1317 id="x1-43060r9"></a><span
1318 class="cmtt-10"> </span><span
1319 class="cmtt-10"> </span><span
1320 class="cmtt-10"> </span><span
1321 class="cmtt-10"> </span><span
1322 class="cmtt-10"> </span><span
1323 class="cmtt-10"> </span><span
1324 class="cmtt-10"> </span><span
1325 class="cmtt-10"> </span><span
1326 class="cmtt-10"> </span><span
1327 class="cmtt-10"> </span><span
1328 class="cmtt-10"> </span><span
1329 class="cmtt-10"> </span><span
1330 class="cmtt-10"> </span><span
1331 class="cmtt-10"> </span><span
1332 class="cmtt-10"> ...</span>
1333 <br class="fancyvrb" /><a
1334 id="x1-43062r10"></a><span
1335 class="cmtt-10"> </span><span
1336 class="cmtt-10"> byte</span><span
1337 class="cmtt-10"> n</span><span
1338 class="cmtt-10"> [</span><span
1339 class="cmtt-10"> </span><span
1340 class="cmtt-10"> </span><span
1341 class="cmtt-10"> </span><span
1342 class="cmtt-10"> </span><span
1343 class="cmtt-10"> </span><span
1344 class="cmtt-10"> </span><span
1345 class="cmtt-10"> </span><span
1346 class="cmtt-10"> </span><span
1347 class="cmtt-10"> </span><span
1348 class="cmtt-10"> </span><span
1349 class="cmtt-10"> </span><span
1350 class="cmtt-10"> </span><span
1351 class="cmtt-10"> </span><span
1352 class="cmtt-10"> </span><span
1353 class="cmtt-10"> ]</span><span
1354 class="cmtt-10"> </span><span
1355 class="cmtt-10"> bytestream</span><span
1356 class="cmtt-10"> length</span><span
1357 class="cmtt-10"> ==</span><span
1358 class="cmtt-10"> 2</span><span
1359 class="cmtt-10"> bytes</span>
1360 <br class="fancyvrb" /><a
1361 id="x1-43064r11"></a><span
1362 class="cmtt-10"> </span><span
1363 class="cmtt-10"> </span><span
1364 class="cmtt-10"> </span><span
1365 class="cmtt-10"> </span><span
1366 class="cmtt-10"> </span><span
1367 class="cmtt-10"> </span><span
1368 class="cmtt-10"> </span><span
1369 class="cmtt-10"> </span><span
1370 class="cmtt-10"> </span><span
1371 class="cmtt-10"> </span><span
1372 class="cmtt-10"> </span><span
1373 class="cmtt-10"> </span><span
1374 class="cmtt-10"> </span><span
1375 class="cmtt-10"> </span><span
1376 class="cmtt-10"> </span><span
1377 class="cmtt-10"> </span><span
1378 class="cmtt-10"> </span><span
1379 class="cmtt-10"> </span><span
1380 class="cmtt-10"> </span><span
1381 class="cmtt-10"> </span><span
1382 class="cmtt-10"> </span><span
1383 class="cmtt-10"> </span><span
1384 class="cmtt-10"> </span><span
1385 class="cmtt-10"> </span><span
1386 class="cmtt-10"> </span><span
1387 class="cmtt-10"> </span><span
1388 class="cmtt-10"> </span><span
1389 class="cmtt-10"> bit</span><span
1390 class="cmtt-10"> cursor</span><span
1391 class="cmtt-10"> ==</span><span
1392 class="cmtt-10"> 6</span>
1394 <!--l. 154--><p class="noindent" >Continue by coding the 13 bit integer value ’6969’ [b110 11001110 01]:
1395 <!--l. 156--><p class="noindent" >
1396 <div class="fancyvrb" id="fancyvrb5">
1398 id="x1-43066r1"></a><span
1399 class="cmtt-10"> </span><span
1400 class="cmtt-10"> </span><span
1401 class="cmtt-10"> </span><span
1402 class="cmtt-10"> </span><span
1403 class="cmtt-10"> </span><span
1404 class="cmtt-10"> </span><span
1405 class="cmtt-10"> </span><span
1406 class="cmtt-10"> </span><span
1407 class="cmtt-10"> </span><span
1408 class="cmtt-10"> </span><span
1409 class="cmtt-10"> </span><span
1410 class="cmtt-10"> </span><span
1411 class="cmtt-10"> </span><span
1412 class="cmtt-10"> </span><span
1413 class="cmtt-10"> </span><span
1414 class="cmtt-10"> </span><span
1415 class="cmtt-10"> </span><span
1416 class="cmtt-10"> |</span>
1417 <br class="fancyvrb" /><a
1418 id="x1-43068r2"></a><span
1419 class="cmtt-10"> </span><span
1420 class="cmtt-10"> </span><span
1421 class="cmtt-10"> </span><span
1422 class="cmtt-10"> </span><span
1423 class="cmtt-10"> </span><span
1424 class="cmtt-10"> </span><span
1425 class="cmtt-10"> </span><span
1426 class="cmtt-10"> </span><span
1427 class="cmtt-10"> </span><span
1428 class="cmtt-10"> </span><span
1429 class="cmtt-10"> </span><span
1430 class="cmtt-10"> </span><span
1431 class="cmtt-10"> </span><span
1432 class="cmtt-10"> </span><span
1433 class="cmtt-10"> </span><span
1434 class="cmtt-10"> </span><span
1435 class="cmtt-10"> </span><span
1436 class="cmtt-10"> V</span>
1437 <br class="fancyvrb" /><a
1438 id="x1-43070r3"></a><span
1439 class="cmtt-10"> </span><span
1440 class="cmtt-10"> </span>
1441 <br class="fancyvrb" /><a
1442 id="x1-43072r4"></a><span
1443 class="cmtt-10"> </span><span
1444 class="cmtt-10"> </span><span
1445 class="cmtt-10"> </span><span
1446 class="cmtt-10"> </span><span
1447 class="cmtt-10"> </span><span
1448 class="cmtt-10"> </span><span
1449 class="cmtt-10"> </span><span
1450 class="cmtt-10"> </span><span
1451 class="cmtt-10"> </span><span
1452 class="cmtt-10"> 7</span><span
1453 class="cmtt-10"> 6</span><span
1454 class="cmtt-10"> 5</span><span
1455 class="cmtt-10"> 4</span><span
1456 class="cmtt-10"> 3</span><span
1457 class="cmtt-10"> 2</span><span
1458 class="cmtt-10"> 1</span><span
1459 class="cmtt-10"> 0</span>
1460 <br class="fancyvrb" /><a
1461 id="x1-43074r5"></a><span
1462 class="cmtt-10"> </span><span
1463 class="cmtt-10"> byte</span><span
1464 class="cmtt-10"> 0</span><span
1465 class="cmtt-10"> [1</span><span
1466 class="cmtt-10"> 1</span><span
1467 class="cmtt-10"> 1</span><span
1468 class="cmtt-10"> 1</span><span
1469 class="cmtt-10"> 1</span><span
1470 class="cmtt-10"> 1</span><span
1471 class="cmtt-10"> 0</span><span
1472 class="cmtt-10"> 0]</span>
1473 <br class="fancyvrb" /><a
1474 id="x1-43076r6"></a><span
1475 class="cmtt-10"> </span><span
1476 class="cmtt-10"> byte</span><span
1477 class="cmtt-10"> 1</span><span
1478 class="cmtt-10"> [0</span><span
1479 class="cmtt-10"> 1</span><span
1480 class="cmtt-10"> 0</span><span
1481 class="cmtt-10"> 0</span><span
1482 class="cmtt-10"> 1</span><span
1483 class="cmtt-10"> 0</span><span
1484 class="cmtt-10"> 0</span><span
1485 class="cmtt-10"> 0]</span>
1486 <br class="fancyvrb" /><a
1487 id="x1-43078r7"></a><span
1488 class="cmtt-10"> </span><span
1489 class="cmtt-10"> byte</span><span
1490 class="cmtt-10"> 2</span><span
1491 class="cmtt-10"> [1</span><span
1492 class="cmtt-10"> 1</span><span
1493 class="cmtt-10"> 0</span><span
1494 class="cmtt-10"> 0</span><span
1495 class="cmtt-10"> 1</span><span
1496 class="cmtt-10"> 1</span><span
1497 class="cmtt-10"> 1</span><span
1498 class="cmtt-10"> 0]</span>
1499 <br class="fancyvrb" /><a
1500 id="x1-43080r8"></a><span
1501 class="cmtt-10"> </span><span
1502 class="cmtt-10"> byte</span><span
1503 class="cmtt-10"> 3</span><span
1504 class="cmtt-10"> [0</span><span
1505 class="cmtt-10"> 0</span><span
1506 class="cmtt-10"> 0</span><span
1507 class="cmtt-10"> 0</span><span
1508 class="cmtt-10"> 0</span><span
1509 class="cmtt-10"> 1</span><span
1510 class="cmtt-10"> 1</span><span
1511 class="cmtt-10"> 0]</span><span
1512 class="cmtt-10"> </span><span
1513 class="cmtt-10"> <-</span>
1514 <br class="fancyvrb" /><a
1515 id="x1-43082r9"></a><span
1516 class="cmtt-10"> </span><span
1517 class="cmtt-10"> </span><span
1518 class="cmtt-10"> </span><span
1519 class="cmtt-10"> </span><span
1520 class="cmtt-10"> </span><span
1521 class="cmtt-10"> </span><span
1522 class="cmtt-10"> </span><span
1523 class="cmtt-10"> </span><span
1524 class="cmtt-10"> </span><span
1525 class="cmtt-10"> </span><span
1526 class="cmtt-10"> </span><span
1527 class="cmtt-10"> </span><span
1528 class="cmtt-10"> </span><span
1529 class="cmtt-10"> </span><span
1530 class="cmtt-10"> ...</span>
1531 <br class="fancyvrb" /><a
1532 id="x1-43084r10"></a><span
1533 class="cmtt-10"> </span><span
1534 class="cmtt-10"> byte</span><span
1535 class="cmtt-10"> n</span><span
1536 class="cmtt-10"> [</span><span
1537 class="cmtt-10"> </span><span
1538 class="cmtt-10"> </span><span
1539 class="cmtt-10"> </span><span
1540 class="cmtt-10"> </span><span
1541 class="cmtt-10"> </span><span
1542 class="cmtt-10"> </span><span
1543 class="cmtt-10"> </span><span
1544 class="cmtt-10"> </span><span
1545 class="cmtt-10"> </span><span
1546 class="cmtt-10"> </span><span
1547 class="cmtt-10"> </span><span
1548 class="cmtt-10"> </span><span
1549 class="cmtt-10"> </span><span
1550 class="cmtt-10"> </span><span
1551 class="cmtt-10"> ]</span><span
1552 class="cmtt-10"> </span><span
1553 class="cmtt-10"> bytestream</span><span
1554 class="cmtt-10"> length</span><span
1555 class="cmtt-10"> ==</span><span
1556 class="cmtt-10"> 4</span><span
1557 class="cmtt-10"> bytes</span>
1558 <br class="fancyvrb" /><a
1559 id="x1-43086r11"></a><span
1560 class="cmtt-10"> </span><span
1561 class="cmtt-10"> </span>
1563 <!--l. 173--><p class="noindent" >
1564 <h5 class="subsubsectionHead"><span class="titlemark">2.1.7 </span> <a
1565 id="x1-440002.1.7"></a>decoding example</h5>
1566 <!--l. 175--><p class="noindent" >Reading from the beginning of the bytestream encoded in the above example:
1567 <!--l. 177--><p class="noindent" >
1568 <div class="fancyvrb" id="fancyvrb6">
1570 id="x1-44002r1"></a><span
1571 class="cmtt-10"> </span><span
1572 class="cmtt-10"> </span><span
1573 class="cmtt-10"> </span><span
1574 class="cmtt-10"> </span><span
1575 class="cmtt-10"> </span><span
1576 class="cmtt-10"> </span><span
1577 class="cmtt-10"> </span><span
1578 class="cmtt-10"> </span><span
1579 class="cmtt-10"> </span><span
1580 class="cmtt-10"> </span><span
1581 class="cmtt-10"> </span><span
1582 class="cmtt-10"> </span><span
1583 class="cmtt-10"> </span><span
1584 class="cmtt-10"> </span><span
1585 class="cmtt-10"> </span><span
1586 class="cmtt-10"> </span><span
1587 class="cmtt-10"> </span><span
1588 class="cmtt-10"> </span><span
1589 class="cmtt-10"> </span><span
1590 class="cmtt-10"> </span><span
1591 class="cmtt-10"> </span><span
1592 class="cmtt-10"> </span><span
1593 class="cmtt-10"> </span><span
1594 class="cmtt-10"> |</span>
1595 <br class="fancyvrb" /><a
1596 id="x1-44004r2"></a><span
1597 class="cmtt-10"> </span><span
1598 class="cmtt-10"> </span><span
1599 class="cmtt-10"> </span><span
1600 class="cmtt-10"> </span><span
1601 class="cmtt-10"> </span><span
1602 class="cmtt-10"> </span><span
1603 class="cmtt-10"> </span><span
1604 class="cmtt-10"> </span><span
1605 class="cmtt-10"> </span><span
1606 class="cmtt-10"> </span><span
1607 class="cmtt-10"> </span><span
1608 class="cmtt-10"> </span><span
1609 class="cmtt-10"> </span><span
1610 class="cmtt-10"> </span><span
1611 class="cmtt-10"> </span><span
1612 class="cmtt-10"> </span><span
1613 class="cmtt-10"> </span><span
1614 class="cmtt-10"> </span><span
1615 class="cmtt-10"> </span><span
1616 class="cmtt-10"> </span><span
1617 class="cmtt-10"> </span><span
1618 class="cmtt-10"> </span><span
1619 class="cmtt-10"> </span><span
1620 class="cmtt-10"> V</span>
1621 <br class="fancyvrb" /><a
1622 id="x1-44006r3"></a><span
1623 class="cmtt-10"> </span><span
1624 class="cmtt-10"> </span>
1625 <br class="fancyvrb" /><a
1626 id="x1-44008r4"></a><span
1627 class="cmtt-10"> </span><span
1628 class="cmtt-10"> </span><span
1629 class="cmtt-10"> </span><span
1630 class="cmtt-10"> </span><span
1631 class="cmtt-10"> </span><span
1632 class="cmtt-10"> </span><span
1633 class="cmtt-10"> </span><span
1634 class="cmtt-10"> </span><span
1635 class="cmtt-10"> </span><span
1636 class="cmtt-10"> 7</span><span
1637 class="cmtt-10"> 6</span><span
1638 class="cmtt-10"> 5</span><span
1639 class="cmtt-10"> 4</span><span
1640 class="cmtt-10"> 3</span><span
1641 class="cmtt-10"> 2</span><span
1642 class="cmtt-10"> 1</span><span
1643 class="cmtt-10"> 0</span>
1644 <br class="fancyvrb" /><a
1645 id="x1-44010r5"></a><span
1646 class="cmtt-10"> </span><span
1647 class="cmtt-10"> byte</span><span
1648 class="cmtt-10"> 0</span><span
1649 class="cmtt-10"> [1</span><span
1650 class="cmtt-10"> 1</span><span
1651 class="cmtt-10"> 1</span><span
1652 class="cmtt-10"> 1</span><span
1653 class="cmtt-10"> 1</span><span
1654 class="cmtt-10"> 1</span><span
1655 class="cmtt-10"> 0</span><span
1656 class="cmtt-10"> 0]</span><span
1657 class="cmtt-10"> </span><span
1658 class="cmtt-10"> <-</span>
1659 <br class="fancyvrb" /><a
1660 id="x1-44012r6"></a><span
1661 class="cmtt-10"> </span><span
1662 class="cmtt-10"> byte</span><span
1663 class="cmtt-10"> 1</span><span
1664 class="cmtt-10"> [0</span><span
1665 class="cmtt-10"> 1</span><span
1666 class="cmtt-10"> 0</span><span
1667 class="cmtt-10"> 0</span><span
1668 class="cmtt-10"> 1</span><span
1669 class="cmtt-10"> 0</span><span
1670 class="cmtt-10"> 0</span><span
1671 class="cmtt-10"> 0]</span>
1672 <br class="fancyvrb" /><a
1673 id="x1-44014r7"></a><span
1674 class="cmtt-10"> </span><span
1675 class="cmtt-10"> byte</span><span
1676 class="cmtt-10"> 2</span><span
1677 class="cmtt-10"> [1</span><span
1678 class="cmtt-10"> 1</span><span
1679 class="cmtt-10"> 0</span><span
1680 class="cmtt-10"> 0</span><span
1681 class="cmtt-10"> 1</span><span
1682 class="cmtt-10"> 1</span><span
1683 class="cmtt-10"> 1</span><span
1684 class="cmtt-10"> 0]</span>
1685 <br class="fancyvrb" /><a
1686 id="x1-44016r8"></a><span
1687 class="cmtt-10"> </span><span
1688 class="cmtt-10"> byte</span><span
1689 class="cmtt-10"> 3</span><span
1690 class="cmtt-10"> [0</span><span
1691 class="cmtt-10"> 0</span><span
1692 class="cmtt-10"> 0</span><span
1693 class="cmtt-10"> 0</span><span
1694 class="cmtt-10"> 0</span><span
1695 class="cmtt-10"> 1</span><span
1696 class="cmtt-10"> 1</span><span
1697 class="cmtt-10"> 0]</span><span
1698 class="cmtt-10"> </span><span
1699 class="cmtt-10"> bytestream</span><span
1700 class="cmtt-10"> length</span><span
1701 class="cmtt-10"> ==</span><span
1702 class="cmtt-10"> 4</span><span
1703 class="cmtt-10"> bytes</span>
1707 <br class="fancyvrb" /><a
1708 id="x1-44018r9"></a><span
1709 class="cmtt-10"> </span><span
1710 class="cmtt-10"> </span>
1712 <!--l. 190--><p class="noindent" >We read two, two-bit integer fields, resulting in the returned numbers ’b00’ and ’b11’. Two things
1713 are worth noting here:
1714 <ul class="itemize1">
1715 <li class="itemize">Although these four bits were originally written as a single four-bit integer, reading
1716 some other combination of bit-widths from the bitstream is well defined. There are no
1717 artificial alignment boundaries maintained in the bitstream.
1719 <li class="itemize">The second value is the two-bit-wide integer ’b11’. This value may be interpreted either
1720 as the unsigned value ’3’, or the signed value ’-1’. Signedness is dependent on decode
1722 <!--l. 208--><p class="noindent" >
1723 <h5 class="subsubsectionHead"><span class="titlemark">2.1.8 </span> <a
1724 id="x1-450002.1.8"></a>end-of-packet alignment</h5>
1725 <!--l. 210--><p class="noindent" >The typical use of bitpacking is to produce many independent byte-aligned packets which are
1726 embedded into a larger byte-aligned container structure, such as an Ogg transport bitstream.
1727 Externally, each bytestream (encoded bitstream) must begin and end on a byte boundary. Often,
1728 the encoded bitstream is not an integer number of bytes, and so there is unused (uncoded) space in
1729 the last byte of a packet.
1730 <!--l. 218--><p class="noindent" >Unused space in the last byte of a bytestream is always zeroed during the coding process. Thus,
1731 should this unused space be read, it will return binary zeroes.
1732 <!--l. 222--><p class="noindent" >Attempting to read past the end of an encoded packet results in an ’end-of-packet’ condition.
1733 End-of-packet is not to be considered an error; it is merely a state indicating that there is
1734 insufficient remaining data to fulfill the desired read size. Vorbis uses truncated packets as a normal
1735 mode of operation, and as such, decoders must handle reading past the end of a packet as a typical
1736 mode of operation. Any further read operations after an ’end-of-packet’ condition shall also return
1737 ’end-of-packet’.
1738 <!--l. 233--><p class="noindent" >
1739 <h5 class="subsubsectionHead"><span class="titlemark">2.1.9 </span> <a
1740 id="x1-460002.1.9"></a>reading zero bits</h5>
1741 <!--l. 235--><p class="noindent" >Reading a zero-bit-wide integer returns the value ’0’ and does not increment the stream cursor.
1742 Reading to the end of the packet (but not past, such that an ’end-of-packet’ condition has not
1743 triggered) and then reading a zero bit integer shall succeed, returning 0, and not trigger an
1747 end-of-packet condition. Reading a zero-bit-wide integer after a previous read sets ’end-of-packet’
1748 shall also fail with ’end-of-packet’.
1755 <h3 class="sectionHead"><span class="titlemark">3 </span> <a
1756 id="x1-470003"></a>Probability Model and Codebooks</h3>
1757 <!--l. 6--><p class="noindent" >
1758 <h4 class="subsectionHead"><span class="titlemark">3.1 </span> <a
1759 id="x1-480003.1"></a>Overview</h4>
1760 <!--l. 8--><p class="noindent" >Unlike practically every other mainstream audio codec, Vorbis has no statically configured
1761 probability model, instead packing all entropy decoding configuration, VQ and Huffman, into the
1762 bitstream itself in the third header, the codec setup header. This packed configuration consists of
1763 multiple ’codebooks’, each containing a specific Huffman-equivalent representation for decoding
1764 compressed codewords as well as an optional lookup table of output vector values to which a
1765 decoded Huffman value is applied as an offset, generating the final decoded output corresponding to
1766 a given compressed codeword.
1767 <!--l. 18--><p class="noindent" >
1768 <h5 class="subsubsectionHead"><span class="titlemark">3.1.1 </span> <a
1769 id="x1-490003.1.1"></a>Bitwise operation</h5>
1770 <!--l. 19--><p class="noindent" >The codebook mechanism is built on top of the vorbis bitpacker. Both the codebooks themselves
1771 and the codewords they decode are unrolled from a packet as a series of arbitrary-width values read
1772 from the stream according to <a
1773 href="#x1-360002">Section 2<!--tex4ht:ref: vorbis:spec:bitpacking --></a>, “<a
1774 href="#x1-360002">Bitpacking Convention<!--tex4ht:ref: vorbis:spec:bitpacking --></a>”.
1775 <!--l. 27--><p class="noindent" >
1776 <h4 class="subsectionHead"><span class="titlemark">3.2 </span> <a
1777 id="x1-500003.2"></a>Packed codebook format</h4>
1778 <!--l. 29--><p class="noindent" >For purposes of the examples below, we assume that the storage system’s native byte width is eight
1779 bits. This is not universally true; see <a
1780 href="#x1-360002">Section 2<!--tex4ht:ref: vorbis:spec:bitpacking --></a>, “<a
1781 href="#x1-360002">Bitpacking Convention<!--tex4ht:ref: vorbis:spec:bitpacking --></a>” for discussion relating to
1782 non-eight-bit bytes.
1783 <!--l. 34--><p class="noindent" >
1784 <h5 class="subsubsectionHead"><span class="titlemark">3.2.1 </span> <a
1785 id="x1-510003.2.1"></a>codebook decode</h5>
1786 <!--l. 36--><p class="noindent" >A codebook begins with a 24 bit sync pattern, 0x564342:
1787 <!--l. 38--><p class="noindent" >
1791 <div class="fancyvrb" id="fancyvrb7">
1793 id="x1-51002r1"></a><span
1794 class="cmtt-10"> </span><span
1795 class="cmtt-10"> byte</span><span
1796 class="cmtt-10"> 0:</span><span
1797 class="cmtt-10"> [</span><span
1798 class="cmtt-10"> 0</span><span
1799 class="cmtt-10"> 1</span><span
1800 class="cmtt-10"> 0</span><span
1801 class="cmtt-10"> 0</span><span
1802 class="cmtt-10"> 0</span><span
1803 class="cmtt-10"> 0</span><span
1804 class="cmtt-10"> 1</span><span
1805 class="cmtt-10"> 0</span><span
1806 class="cmtt-10"> ]</span><span
1807 class="cmtt-10"> (0x42)</span>
1808 <br class="fancyvrb" /><a
1809 id="x1-51004r2"></a><span
1810 class="cmtt-10"> </span><span
1811 class="cmtt-10"> byte</span><span
1812 class="cmtt-10"> 1:</span><span
1813 class="cmtt-10"> [</span><span
1814 class="cmtt-10"> 0</span><span
1815 class="cmtt-10"> 1</span><span
1816 class="cmtt-10"> 0</span><span
1817 class="cmtt-10"> 0</span><span
1818 class="cmtt-10"> 0</span><span
1819 class="cmtt-10"> 0</span><span
1820 class="cmtt-10"> 1</span><span
1821 class="cmtt-10"> 1</span><span
1822 class="cmtt-10"> ]</span><span
1823 class="cmtt-10"> (0x43)</span>
1824 <br class="fancyvrb" /><a
1825 id="x1-51006r3"></a><span
1826 class="cmtt-10"> </span><span
1827 class="cmtt-10"> byte</span><span
1828 class="cmtt-10"> 2:</span><span
1829 class="cmtt-10"> [</span><span
1830 class="cmtt-10"> 0</span><span
1831 class="cmtt-10"> 1</span><span
1832 class="cmtt-10"> 0</span><span
1833 class="cmtt-10"> 1</span><span
1834 class="cmtt-10"> 0</span><span
1835 class="cmtt-10"> 1</span><span
1836 class="cmtt-10"> 1</span><span
1837 class="cmtt-10"> 0</span><span
1838 class="cmtt-10"> ]</span><span
1839 class="cmtt-10"> (0x56)</span>
1841 <!--l. 44--><p class="noindent" >16 bit <span
1842 class="cmtt-10x-x-109">[codebook_dimensions] </span>and 24 bit <span
1843 class="cmtt-10x-x-109">[codebook_entries] </span>fields:
1844 <!--l. 46--><p class="noindent" >
1845 <div class="fancyvrb" id="fancyvrb8">
1847 id="x1-51008r1"></a><span
1848 class="cmtt-10"> </span><span
1849 class="cmtt-10"> </span>
1850 <br class="fancyvrb" /><a
1851 id="x1-51010r2"></a><span
1852 class="cmtt-10"> </span><span
1853 class="cmtt-10"> byte</span><span
1854 class="cmtt-10"> 3:</span><span
1855 class="cmtt-10"> [</span><span
1856 class="cmtt-10"> X</span><span
1857 class="cmtt-10"> X</span><span
1858 class="cmtt-10"> X</span><span
1859 class="cmtt-10"> X</span><span
1860 class="cmtt-10"> X</span><span
1861 class="cmtt-10"> X</span><span
1862 class="cmtt-10"> X</span><span
1863 class="cmtt-10"> X</span><span
1864 class="cmtt-10"> ]</span>
1865 <br class="fancyvrb" /><a
1866 id="x1-51012r3"></a><span
1867 class="cmtt-10"> </span><span
1868 class="cmtt-10"> byte</span><span
1869 class="cmtt-10"> 4:</span><span
1870 class="cmtt-10"> [</span><span
1871 class="cmtt-10"> X</span><span
1872 class="cmtt-10"> X</span><span
1873 class="cmtt-10"> X</span><span
1874 class="cmtt-10"> X</span><span
1875 class="cmtt-10"> X</span><span
1876 class="cmtt-10"> X</span><span
1877 class="cmtt-10"> X</span><span
1878 class="cmtt-10"> X</span><span
1879 class="cmtt-10"> ]</span><span
1880 class="cmtt-10"> [codebook_dimensions]</span><span
1881 class="cmtt-10"> (16</span><span
1882 class="cmtt-10"> bit</span><span
1883 class="cmtt-10"> unsigned)</span>
1884 <br class="fancyvrb" /><a
1885 id="x1-51014r4"></a><span
1886 class="cmtt-10"> </span><span
1887 class="cmtt-10"> </span>
1888 <br class="fancyvrb" /><a
1889 id="x1-51016r5"></a><span
1890 class="cmtt-10"> </span><span
1891 class="cmtt-10"> byte</span><span
1892 class="cmtt-10"> 5:</span><span
1893 class="cmtt-10"> [</span><span
1894 class="cmtt-10"> X</span><span
1895 class="cmtt-10"> X</span><span
1896 class="cmtt-10"> X</span><span
1897 class="cmtt-10"> X</span><span
1898 class="cmtt-10"> X</span><span
1899 class="cmtt-10"> X</span><span
1900 class="cmtt-10"> X</span><span
1901 class="cmtt-10"> X</span><span
1902 class="cmtt-10"> ]</span>
1903 <br class="fancyvrb" /><a
1904 id="x1-51018r6"></a><span
1905 class="cmtt-10"> </span><span
1906 class="cmtt-10"> byte</span><span
1907 class="cmtt-10"> 6:</span><span
1908 class="cmtt-10"> [</span><span
1909 class="cmtt-10"> X</span><span
1910 class="cmtt-10"> X</span><span
1911 class="cmtt-10"> X</span><span
1912 class="cmtt-10"> X</span><span
1913 class="cmtt-10"> X</span><span
1914 class="cmtt-10"> X</span><span
1915 class="cmtt-10"> X</span><span
1916 class="cmtt-10"> X</span><span
1917 class="cmtt-10"> ]</span>
1918 <br class="fancyvrb" /><a
1919 id="x1-51020r7"></a><span
1920 class="cmtt-10"> </span><span
1921 class="cmtt-10"> byte</span><span
1922 class="cmtt-10"> 7:</span><span
1923 class="cmtt-10"> [</span><span
1924 class="cmtt-10"> X</span><span
1925 class="cmtt-10"> X</span><span
1926 class="cmtt-10"> X</span><span
1927 class="cmtt-10"> X</span><span
1928 class="cmtt-10"> X</span><span
1929 class="cmtt-10"> X</span><span
1930 class="cmtt-10"> X</span><span
1931 class="cmtt-10"> X</span><span
1932 class="cmtt-10"> ]</span><span
1933 class="cmtt-10"> [codebook_entries]</span><span
1934 class="cmtt-10"> (24</span><span
1935 class="cmtt-10"> bit</span><span
1936 class="cmtt-10"> unsigned)</span>
1937 <br class="fancyvrb" /><a
1938 id="x1-51022r8"></a><span
1939 class="cmtt-10"> </span><span
1940 class="cmtt-10"> </span>
1942 <!--l. 57--><p class="noindent" >Next is the <span
1943 class="cmtt-10x-x-109">[ordered] </span>bit flag:
1944 <!--l. 59--><p class="noindent" >
1945 <div class="fancyvrb" id="fancyvrb9">
1947 id="x1-51024r1"></a><span
1948 class="cmtt-10"> </span><span
1949 class="cmtt-10"> </span>
1950 <br class="fancyvrb" /><a
1951 id="x1-51026r2"></a><span
1952 class="cmtt-10"> </span><span
1953 class="cmtt-10"> byte</span><span
1954 class="cmtt-10"> 8:</span><span
1955 class="cmtt-10"> [</span><span
1956 class="cmtt-10"> </span><span
1957 class="cmtt-10"> </span><span
1958 class="cmtt-10"> </span><span
1959 class="cmtt-10"> </span><span
1960 class="cmtt-10"> </span><span
1961 class="cmtt-10"> </span><span
1962 class="cmtt-10"> </span><span
1963 class="cmtt-10"> </span><span
1964 class="cmtt-10"> </span><span
1965 class="cmtt-10"> </span><span
1966 class="cmtt-10"> </span><span
1967 class="cmtt-10"> </span><span
1968 class="cmtt-10"> </span><span
1969 class="cmtt-10"> </span><span
1970 class="cmtt-10"> X</span><span
1971 class="cmtt-10"> ]</span><span
1972 class="cmtt-10"> [ordered]</span><span
1973 class="cmtt-10"> (1</span><span
1974 class="cmtt-10"> bit)</span>
1975 <br class="fancyvrb" /><a
1976 id="x1-51028r3"></a><span
1977 class="cmtt-10"> </span><span
1978 class="cmtt-10"> </span>
1980 <!--l. 65--><p class="noindent" >Each entry, numbering a total of <span
1981 class="cmtt-10x-x-109">[codebook_entries]</span>, is assigned a codeword length. We now read
1982 the list of codeword lengths and store these lengths in the array <span
1983 class="cmtt-10x-x-109">[codebook_codeword_lengths]</span>.
1984 Decode of lengths is according to whether the <span
1985 class="cmtt-10x-x-109">[ordered] </span>flag is set or unset.
1986 <ul class="itemize1">
1987 <li class="itemize">If the <span
1988 class="cmtt-10x-x-109">[ordered] </span>flag is unset, the codeword list is not length ordered and the decoder
1989 needs to read each codeword length one-by-one.
1990 <!--l. 77--><p class="noindent" >The decoder first reads one additional bit flag, the <span
1991 class="cmtt-10x-x-109">[sparse] </span>flag. This flag determines
1992 whether or not the codebook contains unused entries that are not to be included in the
1993 codeword decode tree:
1994 <!--l. 82--><p class="noindent" >
1995 <div class="fancyvrb" id="fancyvrb10">
1997 id="x1-51030r1"></a><span
1998 class="cmtt-10"> </span><span
1999 class="cmtt-10"> byte</span><span
2000 class="cmtt-10"> 8:</span><span
2001 class="cmtt-10"> [</span><span
2002 class="cmtt-10"> </span><span
2003 class="cmtt-10"> </span><span
2004 class="cmtt-10"> </span><span
2005 class="cmtt-10"> </span><span
2006 class="cmtt-10"> </span><span
2007 class="cmtt-10"> </span><span
2008 class="cmtt-10"> </span><span
2009 class="cmtt-10"> </span><span
2010 class="cmtt-10"> </span><span
2011 class="cmtt-10"> </span><span
2012 class="cmtt-10"> </span><span
2013 class="cmtt-10"> </span><span
2014 class="cmtt-10"> X</span><span
2015 class="cmtt-10"> 1</span><span
2016 class="cmtt-10"> ]</span><span
2017 class="cmtt-10"> [sparse]</span><span
2018 class="cmtt-10"> flag</span><span
2019 class="cmtt-10"> (1</span><span
2020 class="cmtt-10"> bit)</span>
2025 <!--l. 86--><p class="noindent" >The decoder now performs for each of the <span
2026 class="cmtt-10x-x-109">[codebook_entries] </span>codebook entries:
2027 <!--l. 89--><p class="noindent" >
2028 <div class="fancyvrb" id="fancyvrb11">
2030 id="x1-51032r1"></a><span
2031 class="cmtt-10"> </span><span
2032 class="cmtt-10"> </span>
2033 <br class="fancyvrb" /><a
2034 id="x1-51034r2"></a><span
2035 class="cmtt-10"> </span><span
2036 class="cmtt-10"> </span><span
2037 class="cmtt-10"> </span><span
2038 class="cmtt-10"> 1)</span><span
2039 class="cmtt-10"> if([sparse]</span><span
2040 class="cmtt-10"> is</span><span
2041 class="cmtt-10"> set)</span><span
2042 class="cmtt-10"> </span><span
2043 class="cmsy-10">{</span>
2044 <br class="fancyvrb" /><a
2045 id="x1-51036r3"></a><span
2046 class="cmtt-10"> </span><span
2047 class="cmtt-10"> </span>
2048 <br class="fancyvrb" /><a
2049 id="x1-51038r4"></a><span
2050 class="cmtt-10"> </span><span
2051 class="cmtt-10"> </span><span
2052 class="cmtt-10"> </span><span
2053 class="cmtt-10"> </span><span
2054 class="cmtt-10"> </span><span
2055 class="cmtt-10"> </span><span
2056 class="cmtt-10"> </span><span
2057 class="cmtt-10"> </span><span
2058 class="cmtt-10"> </span><span
2059 class="cmtt-10"> </span><span
2060 class="cmtt-10"> 2)</span><span
2061 class="cmtt-10"> [flag]</span><span
2062 class="cmtt-10"> =</span><span
2063 class="cmtt-10"> read</span><span
2064 class="cmtt-10"> one</span><span
2065 class="cmtt-10"> bit;</span>
2066 <br class="fancyvrb" /><a
2067 id="x1-51040r5"></a><span
2068 class="cmtt-10"> </span><span
2069 class="cmtt-10"> </span><span
2070 class="cmtt-10"> </span><span
2071 class="cmtt-10"> </span><span
2072 class="cmtt-10"> </span><span
2073 class="cmtt-10"> </span><span
2074 class="cmtt-10"> </span><span
2075 class="cmtt-10"> </span><span
2076 class="cmtt-10"> </span><span
2077 class="cmtt-10"> </span><span
2078 class="cmtt-10"> 3)</span><span
2079 class="cmtt-10"> if([flag]</span><span
2080 class="cmtt-10"> is</span><span
2081 class="cmtt-10"> set)</span><span
2082 class="cmtt-10"> </span><span
2083 class="cmsy-10">{</span>
2084 <br class="fancyvrb" /><a
2085 id="x1-51042r6"></a><span
2086 class="cmtt-10"> </span><span
2087 class="cmtt-10"> </span>
2088 <br class="fancyvrb" /><a
2089 id="x1-51044r7"></a><span
2090 class="cmtt-10"> </span><span
2091 class="cmtt-10"> </span><span
2092 class="cmtt-10"> </span><span
2093 class="cmtt-10"> </span><span
2094 class="cmtt-10"> </span><span
2095 class="cmtt-10"> </span><span
2096 class="cmtt-10"> </span><span
2097 class="cmtt-10"> </span><span
2098 class="cmtt-10"> </span><span
2099 class="cmtt-10"> </span><span
2100 class="cmtt-10"> </span><span
2101 class="cmtt-10"> </span><span
2102 class="cmtt-10"> </span><span
2103 class="cmtt-10"> </span><span
2104 class="cmtt-10"> </span><span
2105 class="cmtt-10"> 4)</span><span
2106 class="cmtt-10"> [length]</span><span
2107 class="cmtt-10"> =</span><span
2108 class="cmtt-10"> read</span><span
2109 class="cmtt-10"> a</span><span
2110 class="cmtt-10"> five</span><span
2111 class="cmtt-10"> bit</span><span
2112 class="cmtt-10"> unsigned</span><span
2113 class="cmtt-10"> integer;</span>
2114 <br class="fancyvrb" /><a
2115 id="x1-51046r8"></a><span
2116 class="cmtt-10"> </span><span
2117 class="cmtt-10"> </span><span
2118 class="cmtt-10"> </span><span
2119 class="cmtt-10"> </span><span
2120 class="cmtt-10"> </span><span
2121 class="cmtt-10"> </span><span
2122 class="cmtt-10"> </span><span
2123 class="cmtt-10"> </span><span
2124 class="cmtt-10"> </span><span
2125 class="cmtt-10"> </span><span
2126 class="cmtt-10"> </span><span
2127 class="cmtt-10"> </span><span
2128 class="cmtt-10"> </span><span
2129 class="cmtt-10"> </span><span
2130 class="cmtt-10"> </span><span
2131 class="cmtt-10"> 5)</span><span
2132 class="cmtt-10"> codeword</span><span
2133 class="cmtt-10"> length</span><span
2134 class="cmtt-10"> for</span><span
2135 class="cmtt-10"> this</span><span
2136 class="cmtt-10"> entry</span><span
2137 class="cmtt-10"> is</span><span
2138 class="cmtt-10"> [length]+1;</span>
2139 <br class="fancyvrb" /><a
2140 id="x1-51048r9"></a><span
2141 class="cmtt-10"> </span><span
2142 class="cmtt-10"> </span>
2143 <br class="fancyvrb" /><a
2144 id="x1-51050r10"></a><span
2145 class="cmtt-10"> </span><span
2146 class="cmtt-10"> </span><span
2147 class="cmtt-10"> </span><span
2148 class="cmtt-10"> </span><span
2149 class="cmtt-10"> </span><span
2150 class="cmtt-10"> </span><span
2151 class="cmtt-10"> </span><span
2152 class="cmtt-10"> </span><span
2153 class="cmtt-10"> </span><span
2154 class="cmtt-10"> </span><span
2155 class="cmtt-10"> </span><span
2156 class="cmtt-10"> </span><span
2157 class="cmtt-10"> </span><span
2158 class="cmtt-10"> </span><span
2159 class="cmsy-10">}</span><span
2160 class="cmtt-10"> else</span><span
2161 class="cmtt-10"> </span><span
2162 class="cmsy-10">{</span>
2163 <br class="fancyvrb" /><a
2164 id="x1-51052r11"></a><span
2165 class="cmtt-10"> </span><span
2166 class="cmtt-10"> </span>
2167 <br class="fancyvrb" /><a
2168 id="x1-51054r12"></a><span
2169 class="cmtt-10"> </span><span
2170 class="cmtt-10"> </span><span
2171 class="cmtt-10"> </span><span
2172 class="cmtt-10"> </span><span
2173 class="cmtt-10"> </span><span
2174 class="cmtt-10"> </span><span
2175 class="cmtt-10"> </span><span
2176 class="cmtt-10"> </span><span
2177 class="cmtt-10"> </span><span
2178 class="cmtt-10"> </span><span
2179 class="cmtt-10"> </span><span
2180 class="cmtt-10"> </span><span
2181 class="cmtt-10"> </span><span
2182 class="cmtt-10"> </span><span
2183 class="cmtt-10"> </span><span
2184 class="cmtt-10"> 6)</span><span
2185 class="cmtt-10"> this</span><span
2186 class="cmtt-10"> entry</span><span
2187 class="cmtt-10"> is</span><span
2188 class="cmtt-10"> unused.</span><span
2189 class="cmtt-10"> </span><span
2190 class="cmtt-10"> mark</span><span
2191 class="cmtt-10"> it</span><span
2192 class="cmtt-10"> as</span><span
2193 class="cmtt-10"> such.</span>
2194 <br class="fancyvrb" /><a
2195 id="x1-51056r13"></a><span
2196 class="cmtt-10"> </span><span
2197 class="cmtt-10"> </span>
2198 <br class="fancyvrb" /><a
2199 id="x1-51058r14"></a><span
2200 class="cmtt-10"> </span><span
2201 class="cmtt-10"> </span><span
2202 class="cmtt-10"> </span><span
2203 class="cmtt-10"> </span><span
2204 class="cmtt-10"> </span><span
2205 class="cmtt-10"> </span><span
2206 class="cmtt-10"> </span><span
2207 class="cmtt-10"> </span><span
2208 class="cmtt-10"> </span><span
2209 class="cmtt-10"> </span><span
2210 class="cmtt-10"> </span><span
2211 class="cmtt-10"> </span><span
2212 class="cmtt-10"> </span><span
2213 class="cmtt-10"> </span><span
2214 class="cmsy-10">}</span>
2215 <br class="fancyvrb" /><a
2216 id="x1-51060r15"></a><span
2217 class="cmtt-10"> </span><span
2218 class="cmtt-10"> </span>
2219 <br class="fancyvrb" /><a
2220 id="x1-51062r16"></a><span
2221 class="cmtt-10"> </span><span
2222 class="cmtt-10"> </span><span
2223 class="cmtt-10"> </span><span
2224 class="cmtt-10"> </span><span
2225 class="cmtt-10"> </span><span
2226 class="cmtt-10"> </span><span
2227 class="cmtt-10"> </span><span
2228 class="cmsy-10">}</span><span
2229 class="cmtt-10"> else</span><span
2230 class="cmtt-10"> the</span><span
2231 class="cmtt-10"> sparse</span><span
2232 class="cmtt-10"> flag</span><span
2233 class="cmtt-10"> is</span><span
2234 class="cmtt-10"> not</span><span
2235 class="cmtt-10"> set</span><span
2236 class="cmtt-10"> </span><span
2237 class="cmsy-10">{</span>
2238 <br class="fancyvrb" /><a
2239 id="x1-51064r17"></a><span
2240 class="cmtt-10"> </span><span
2241 class="cmtt-10"> </span>
2242 <br class="fancyvrb" /><a
2243 id="x1-51066r18"></a><span
2244 class="cmtt-10"> </span><span
2245 class="cmtt-10"> </span><span
2246 class="cmtt-10"> </span><span
2247 class="cmtt-10"> </span><span
2248 class="cmtt-10"> </span><span
2249 class="cmtt-10"> </span><span
2250 class="cmtt-10"> </span><span
2251 class="cmtt-10"> </span><span
2252 class="cmtt-10"> </span><span
2253 class="cmtt-10"> 7)</span><span
2254 class="cmtt-10"> [length]</span><span
2255 class="cmtt-10"> =</span><span
2256 class="cmtt-10"> read</span><span
2257 class="cmtt-10"> a</span><span
2258 class="cmtt-10"> five</span><span
2259 class="cmtt-10"> bit</span><span
2260 class="cmtt-10"> unsigned</span><span
2261 class="cmtt-10"> integer;</span>
2262 <br class="fancyvrb" /><a
2263 id="x1-51068r19"></a><span
2264 class="cmtt-10"> </span><span
2265 class="cmtt-10"> </span><span
2266 class="cmtt-10"> </span><span
2267 class="cmtt-10"> </span><span
2268 class="cmtt-10"> </span><span
2269 class="cmtt-10"> </span><span
2270 class="cmtt-10"> </span><span
2271 class="cmtt-10"> </span><span
2272 class="cmtt-10"> </span><span
2273 class="cmtt-10"> 8)</span><span
2274 class="cmtt-10"> the</span><span
2275 class="cmtt-10"> codeword</span><span
2276 class="cmtt-10"> length</span><span
2277 class="cmtt-10"> for</span><span
2278 class="cmtt-10"> this</span><span
2279 class="cmtt-10"> entry</span><span
2280 class="cmtt-10"> is</span><span
2281 class="cmtt-10"> [length]+1;</span>
2282 <br class="fancyvrb" /><a
2283 id="x1-51070r20"></a><span
2284 class="cmtt-10"> </span><span
2285 class="cmtt-10"> </span>
2286 <br class="fancyvrb" /><a
2287 id="x1-51072r21"></a><span
2288 class="cmtt-10"> </span><span
2289 class="cmtt-10"> </span><span
2290 class="cmtt-10"> </span><span
2291 class="cmtt-10"> </span><span
2292 class="cmtt-10"> </span><span
2293 class="cmtt-10"> </span><span
2294 class="cmtt-10"> </span><span
2295 class="cmsy-10">}</span>
2296 <br class="fancyvrb" /><a
2297 id="x1-51074r22"></a><span
2298 class="cmtt-10"> </span><span
2299 class="cmtt-10"> </span>
2302 <li class="itemize">If the <span
2303 class="cmtt-10x-x-109">[ordered] </span>flag is set, the codeword list for this codebook is encoded in ascending length
2304 order. Rather than reading a length for every codeword, the encoder reads the number of
2305 codewords per length. That is, beginning at entry zero:
2306 <!--l. 120--><p class="noindent" >
2307 <div class="fancyvrb" id="fancyvrb12">
2309 id="x1-51076r1"></a><span
2310 class="cmtt-10"> </span><span
2311 class="cmtt-10"> </span><span
2312 class="cmtt-10"> </span><span
2313 class="cmtt-10"> 1)</span><span
2314 class="cmtt-10"> [current_entry]</span><span
2315 class="cmtt-10"> =</span><span
2316 class="cmtt-10"> 0;</span>
2317 <br class="fancyvrb" /><a
2318 id="x1-51078r2"></a><span
2319 class="cmtt-10"> </span><span
2320 class="cmtt-10"> </span><span
2321 class="cmtt-10"> </span><span
2322 class="cmtt-10"> 2)</span><span
2323 class="cmtt-10"> [current_length]</span><span
2324 class="cmtt-10"> =</span><span
2325 class="cmtt-10"> read</span><span
2326 class="cmtt-10"> a</span><span
2327 class="cmtt-10"> five</span><span
2328 class="cmtt-10"> bit</span><span
2329 class="cmtt-10"> unsigned</span><span
2330 class="cmtt-10"> integer</span><span
2331 class="cmtt-10"> and</span><span
2332 class="cmtt-10"> add</span><span
2333 class="cmtt-10"> 1;</span>
2334 <br class="fancyvrb" /><a
2335 id="x1-51080r3"></a><span
2336 class="cmtt-10"> </span><span
2337 class="cmtt-10"> </span><span
2338 class="cmtt-10"> </span><span
2339 class="cmtt-10"> 3)</span><span
2340 class="cmtt-10"> [number]</span><span
2341 class="cmtt-10"> =</span><span
2342 class="cmtt-10"> read</span><span
2343 class="cmtt-10"> </span><a
2344 href="#x1-1170009.2.1"><span
2345 class="cmtt-10">ilog</span></a><span
2346 class="cmtt-10">([codebook_entries]</span><span
2347 class="cmtt-10"> -</span><span
2348 class="cmtt-10"> [current_entry])</span><span
2349 class="cmtt-10"> bits</span><span
2350 class="cmtt-10"> as</span><span
2351 class="cmtt-10"> an</span><span
2352 class="cmtt-10"> unsigned</span><span
2353 class="cmtt-10"> integer</span>
2354 <br class="fancyvrb" /><a
2355 id="x1-51082r4"></a><span
2356 class="cmtt-10"> </span><span
2357 class="cmtt-10"> </span><span
2358 class="cmtt-10"> </span><span
2359 class="cmtt-10"> 4)</span><span
2360 class="cmtt-10"> set</span><span
2361 class="cmtt-10"> the</span><span
2362 class="cmtt-10"> entries</span><span
2363 class="cmtt-10"> [current_entry]</span><span
2364 class="cmtt-10"> through</span><span
2365 class="cmtt-10"> [current_entry]+[number]-1,</span><span
2366 class="cmtt-10"> inclusive,</span>
2367 <br class="fancyvrb" /><a
2368 id="x1-51084r5"></a><span
2369 class="cmtt-10"> </span><span
2370 class="cmtt-10"> </span><span
2371 class="cmtt-10"> </span><span
2372 class="cmtt-10"> </span><span
2373 class="cmtt-10"> </span><span
2374 class="cmtt-10"> of</span><span
2375 class="cmtt-10"> the</span><span
2376 class="cmtt-10"> [codebook_codeword_lengths]</span><span
2377 class="cmtt-10"> array</span><span
2378 class="cmtt-10"> to</span><span
2379 class="cmtt-10"> [current_length]</span>
2380 <br class="fancyvrb" /><a
2381 id="x1-51086r6"></a><span
2382 class="cmtt-10"> </span><span
2383 class="cmtt-10"> </span><span
2384 class="cmtt-10"> </span><span
2385 class="cmtt-10"> 5)</span><span
2386 class="cmtt-10"> set</span><span
2387 class="cmtt-10"> [current_entry]</span><span
2388 class="cmtt-10"> to</span><span
2389 class="cmtt-10"> [number]</span><span
2390 class="cmtt-10"> +</span><span
2391 class="cmtt-10"> [current_entry]</span>
2392 <br class="fancyvrb" /><a
2393 id="x1-51088r7"></a><span
2394 class="cmtt-10"> </span><span
2395 class="cmtt-10"> </span><span
2396 class="cmtt-10"> </span><span
2397 class="cmtt-10"> 6)</span><span
2398 class="cmtt-10"> increment</span><span
2399 class="cmtt-10"> [current_length]</span><span
2400 class="cmtt-10"> by</span><span
2401 class="cmtt-10"> 1</span>
2402 <br class="fancyvrb" /><a
2403 id="x1-51090r8"></a><span
2404 class="cmtt-10"> </span><span
2405 class="cmtt-10"> </span><span
2406 class="cmtt-10"> </span><span
2407 class="cmtt-10"> 7)</span><span
2408 class="cmtt-10"> if</span><span
2409 class="cmtt-10"> [current_entry]</span><span
2410 class="cmtt-10"> is</span><span
2411 class="cmtt-10"> greater</span><span
2412 class="cmtt-10"> than</span><span
2413 class="cmtt-10"> [codebook_entries]</span><span
2414 class="cmtt-10"> ERROR</span><span
2415 class="cmtt-10"> CONDITION;</span>
2416 <br class="fancyvrb" /><a
2417 id="x1-51092r9"></a><span
2418 class="cmtt-10"> </span><span
2419 class="cmtt-10"> </span><span
2420 class="cmtt-10"> </span><span
2421 class="cmtt-10"> </span><span
2422 class="cmtt-10"> </span><span
2423 class="cmtt-10"> the</span><span
2424 class="cmtt-10"> decoder</span><span
2425 class="cmtt-10"> will</span><span
2426 class="cmtt-10"> not</span><span
2427 class="cmtt-10"> be</span><span
2428 class="cmtt-10"> able</span><span
2429 class="cmtt-10"> to</span><span
2430 class="cmtt-10"> read</span><span
2431 class="cmtt-10"> this</span><span
2432 class="cmtt-10"> stream.</span>
2433 <br class="fancyvrb" /><a
2434 id="x1-51094r10"></a><span
2435 class="cmtt-10"> </span><span
2436 class="cmtt-10"> </span><span
2437 class="cmtt-10"> </span><span
2438 class="cmtt-10"> 8)</span><span
2439 class="cmtt-10"> if</span><span
2440 class="cmtt-10"> [current_entry]</span><span
2441 class="cmtt-10"> is</span><span
2442 class="cmtt-10"> less</span><span
2443 class="cmtt-10"> than</span><span
2444 class="cmtt-10"> [codebook_entries],</span><span
2445 class="cmtt-10"> repeat</span><span
2446 class="cmtt-10"> process</span><span
2447 class="cmtt-10"> starting</span><span
2448 class="cmtt-10"> at</span><span
2449 class="cmtt-10"> 3)</span>
2450 <br class="fancyvrb" /><a
2451 id="x1-51096r11"></a><span
2452 class="cmtt-10"> </span><span
2453 class="cmtt-10"> </span><span
2454 class="cmtt-10"> </span><span
2455 class="cmtt-10"> 9)</span><span
2456 class="cmtt-10"> done.</span>
2462 <!--l. 136--><p class="noindent" >After all codeword lengths have been decoded, the decoder reads the vector lookup table. Vorbis I
2463 supports three lookup types:
2464 <ol class="enumerate1" >
2466 class="enumerate" id="x1-51098x1">No lookup
2469 class="enumerate" id="x1-51100x2">Implicitly populated value mapping (lattice VQ)
2472 class="enumerate" id="x1-51102x3">Explicitly populated value mapping (tessellated or ’foam’ VQ)</li></ol>
2473 <!--l. 149--><p class="noindent" >The lookup table type is read as a four bit unsigned integer:
2474 <div class="fancyvrb" id="fancyvrb13">
2476 id="x1-51104r1"></a><span
2477 class="cmtt-10"> </span><span
2478 class="cmtt-10"> </span><span
2479 class="cmtt-10"> </span><span
2480 class="cmtt-10"> 1)</span><span
2481 class="cmtt-10"> [codebook_lookup_type]</span><span
2482 class="cmtt-10"> =</span><span
2483 class="cmtt-10"> read</span><span
2484 class="cmtt-10"> four</span><span
2485 class="cmtt-10"> bits</span><span
2486 class="cmtt-10"> as</span><span
2487 class="cmtt-10"> an</span><span
2488 class="cmtt-10"> unsigned</span><span
2489 class="cmtt-10"> integer</span>
2491 <!--l. 154--><p class="noindent" >Codebook decode precedes according to <span
2492 class="cmtt-10x-x-109">[codebook_lookup_type]</span>:
2493 <ul class="itemize1">
2494 <li class="itemize">Lookup type zero indicates no lookup to be read. Proceed past lookup decode.
2496 <li class="itemize">Lookup types one and two are similar, differing only in the number of lookup values
2497 to be read. Lookup type one reads a list of values that are permuted in a set pattern
2498 to build a list of vectors, each vector of order <span
2499 class="cmtt-10x-x-109">[codebook_dimensions] </span>scalars. Lookup
2500 type two builds the same vector list, but reads each scalar for each vector explicitly,
2501 rather than building vectors from a smaller list of possible scalar values. Lookup decode
2502 proceeds as follows:
2503 <!--l. 168--><p class="noindent" >
2504 <div class="fancyvrb" id="fancyvrb14">
2506 id="x1-51106r1"></a><span
2507 class="cmtt-10"> </span><span
2508 class="cmtt-10"> </span><span
2509 class="cmtt-10"> </span><span
2510 class="cmtt-10"> 1)</span><span
2511 class="cmtt-10"> [codebook_minimum_value]</span><span
2512 class="cmtt-10"> =</span><span
2513 class="cmtt-10"> </span><a
2514 href="#x1-1180009.2.2"><span
2515 class="cmtt-10">float32_unpack</span></a><span
2516 class="cmtt-10">(</span><span
2517 class="cmtt-10"> read</span><span
2518 class="cmtt-10"> 32</span><span
2519 class="cmtt-10"> bits</span><span
2520 class="cmtt-10"> as</span><span
2521 class="cmtt-10"> an</span><span
2522 class="cmtt-10"> unsigned</span><span
2523 class="cmtt-10"> integer)</span>
2524 <br class="fancyvrb" /><a
2525 id="x1-51108r2"></a><span
2526 class="cmtt-10"> </span><span
2527 class="cmtt-10"> </span><span
2528 class="cmtt-10"> </span><span
2529 class="cmtt-10"> 2)</span><span
2530 class="cmtt-10"> [codebook_delta_value]</span><span
2531 class="cmtt-10"> =</span><span
2532 class="cmtt-10"> </span><a
2533 href="#x1-1180009.2.2"><span
2534 class="cmtt-10">float32_unpack</span></a><span
2535 class="cmtt-10">(</span><span
2536 class="cmtt-10"> read</span><span
2537 class="cmtt-10"> 32</span><span
2538 class="cmtt-10"> bits</span><span
2539 class="cmtt-10"> as</span><span
2540 class="cmtt-10"> an</span><span
2541 class="cmtt-10"> unsigned</span><span
2542 class="cmtt-10"> integer)</span>
2543 <br class="fancyvrb" /><a
2544 id="x1-51110r3"></a><span
2545 class="cmtt-10"> </span><span
2546 class="cmtt-10"> </span><span
2547 class="cmtt-10"> </span><span
2548 class="cmtt-10"> 3)</span><span
2549 class="cmtt-10"> [codebook_value_bits]</span><span
2550 class="cmtt-10"> =</span><span
2551 class="cmtt-10"> read</span><span
2552 class="cmtt-10"> 4</span><span
2553 class="cmtt-10"> bits</span><span
2554 class="cmtt-10"> as</span><span
2555 class="cmtt-10"> an</span><span
2556 class="cmtt-10"> unsigned</span><span
2557 class="cmtt-10"> integer</span><span
2558 class="cmtt-10"> and</span><span
2559 class="cmtt-10"> add</span><span
2560 class="cmtt-10"> 1</span>
2561 <br class="fancyvrb" /><a
2562 id="x1-51112r4"></a><span
2563 class="cmtt-10"> </span><span
2564 class="cmtt-10"> </span><span
2565 class="cmtt-10"> </span><span
2566 class="cmtt-10"> 4)</span><span
2567 class="cmtt-10"> [codebook_sequence_p]</span><span
2568 class="cmtt-10"> =</span><span
2569 class="cmtt-10"> read</span><span
2570 class="cmtt-10"> 1</span><span
2571 class="cmtt-10"> bit</span><span
2572 class="cmtt-10"> as</span><span
2573 class="cmtt-10"> a</span><span
2574 class="cmtt-10"> boolean</span><span
2575 class="cmtt-10"> flag</span>
2576 <br class="fancyvrb" /><a
2577 id="x1-51114r5"></a><span
2578 class="cmtt-10"> </span><span
2579 class="cmtt-10"> </span>
2580 <br class="fancyvrb" /><a
2581 id="x1-51116r6"></a><span
2582 class="cmtt-10"> </span><span
2583 class="cmtt-10"> </span><span
2584 class="cmtt-10"> </span><span
2585 class="cmtt-10"> if</span><span
2586 class="cmtt-10"> (</span><span
2587 class="cmtt-10"> [codebook_lookup_type]</span><span
2588 class="cmtt-10"> is</span><span
2589 class="cmtt-10"> 1</span><span
2590 class="cmtt-10"> )</span><span
2591 class="cmtt-10"> </span><span
2592 class="cmsy-10">{</span>
2593 <br class="fancyvrb" /><a
2594 id="x1-51118r7"></a><span
2595 class="cmtt-10"> </span><span
2596 class="cmtt-10"> </span>
2597 <br class="fancyvrb" /><a
2598 id="x1-51120r8"></a><span
2599 class="cmtt-10"> </span><span
2600 class="cmtt-10"> </span><span
2601 class="cmtt-10"> </span><span
2602 class="cmtt-10"> </span><span
2603 class="cmtt-10"> </span><span
2604 class="cmtt-10"> </span><span
2605 class="cmtt-10"> 5)</span><span
2606 class="cmtt-10"> [codebook_lookup_values]</span><span
2607 class="cmtt-10"> =</span><span
2608 class="cmtt-10"> </span><a
2609 href="#x1-1190009.2.3"><span
2610 class="cmtt-10">lookup1_values</span></a><span
2611 class="cmtt-10">([codebook_entries],</span><span
2612 class="cmtt-10"> [codebook_dimensions]</span><span
2613 class="cmtt-10"> )</span>
2614 <br class="fancyvrb" /><a
2615 id="x1-51122r9"></a><span
2616 class="cmtt-10"> </span><span
2617 class="cmtt-10"> </span>
2618 <br class="fancyvrb" /><a
2619 id="x1-51124r10"></a><span
2620 class="cmtt-10"> </span><span
2621 class="cmtt-10"> </span><span
2622 class="cmtt-10"> </span><span
2623 class="cmtt-10"> </span><span
2624 class="cmsy-10">}</span><span
2625 class="cmtt-10"> else</span><span
2626 class="cmtt-10"> </span><span
2627 class="cmsy-10">{</span>
2628 <br class="fancyvrb" /><a
2629 id="x1-51126r11"></a><span
2630 class="cmtt-10"> </span><span
2631 class="cmtt-10"> </span>
2632 <br class="fancyvrb" /><a
2633 id="x1-51128r12"></a><span
2634 class="cmtt-10"> </span><span
2635 class="cmtt-10"> </span><span
2636 class="cmtt-10"> </span><span
2637 class="cmtt-10"> </span><span
2638 class="cmtt-10"> </span><span
2639 class="cmtt-10"> </span><span
2640 class="cmtt-10"> 6)</span><span
2641 class="cmtt-10"> [codebook_lookup_values]</span><span
2642 class="cmtt-10"> =</span><span
2643 class="cmtt-10"> [codebook_entries]</span><span
2644 class="cmtt-10"> *</span><span
2645 class="cmtt-10"> [codebook_dimensions]</span>
2646 <br class="fancyvrb" /><a
2647 id="x1-51130r13"></a><span
2648 class="cmtt-10"> </span><span
2649 class="cmtt-10"> </span>
2650 <br class="fancyvrb" /><a
2651 id="x1-51132r14"></a><span
2652 class="cmtt-10"> </span><span
2653 class="cmtt-10"> </span><span
2654 class="cmtt-10"> </span><span
2655 class="cmtt-10"> </span><span
2656 class="cmsy-10">}</span>
2657 <br class="fancyvrb" /><a
2658 id="x1-51134r15"></a><span
2659 class="cmtt-10"> </span><span
2660 class="cmtt-10"> </span>
2661 <br class="fancyvrb" /><a
2662 id="x1-51136r16"></a><span
2663 class="cmtt-10"> </span><span
2664 class="cmtt-10"> </span><span
2665 class="cmtt-10"> </span><span
2666 class="cmtt-10"> 7)</span><span
2667 class="cmtt-10"> read</span><span
2668 class="cmtt-10"> a</span><span
2669 class="cmtt-10"> total</span><span
2670 class="cmtt-10"> of</span><span
2671 class="cmtt-10"> [codebook_lookup_values]</span><span
2672 class="cmtt-10"> unsigned</span><span
2673 class="cmtt-10"> integers</span><span
2674 class="cmtt-10"> of</span><span
2675 class="cmtt-10"> [codebook_value_bits]</span><span
2676 class="cmtt-10"> each;</span>
2677 <br class="fancyvrb" /><a
2678 id="x1-51138r17"></a><span
2679 class="cmtt-10"> </span><span
2680 class="cmtt-10"> </span><span
2681 class="cmtt-10"> </span><span
2682 class="cmtt-10"> </span><span
2683 class="cmtt-10"> </span><span
2684 class="cmtt-10"> </span><span
2685 class="cmtt-10"> store</span><span
2686 class="cmtt-10"> these</span><span
2687 class="cmtt-10"> in</span><span
2688 class="cmtt-10"> order</span><span
2689 class="cmtt-10"> in</span><span
2690 class="cmtt-10"> the</span><span
2691 class="cmtt-10"> array</span><span
2692 class="cmtt-10"> [codebook_multiplicands]</span>
2698 <li class="itemize">A <span
2699 class="cmtt-10x-x-109">[codebook_lookup_type] </span>of greater than two is reserved and indicates a stream that is not
2700 decodable by the specification in this document.
2702 <!--l. 195--><p class="noindent" >An ’end of packet’ during any read operation in the above steps is considered an error condition
2703 rendering the stream undecodable.
2704 <!--l. 198--><p class="noindent" ><span class="paragraphHead"><a
2705 id="x1-520003.2.1"></a><span
2706 class="cmbx-10x-x-109">Huffman decision tree representation</span></span>
2708 class="cmtt-10x-x-109">[codebook_codeword_lengths] </span>array and <span
2709 class="cmtt-10x-x-109">[codebook_entries] </span>value uniquely define the
2710 Huffman decision tree used for entropy decoding.
2711 <!--l. 204--><p class="noindent" >Briefly, each used codebook entry (recall that length-unordered codebooks support unused codeword
2712 entries) is assigned, in order, the lowest valued unused binary Huffman codeword possible. Assume
2713 the following codeword length list:
2714 <!--l. 209--><p class="noindent" >
2715 <div class="fancyvrb" id="fancyvrb15">
2717 id="x1-52002r1"></a><span
2718 class="cmtt-10"> </span><span
2719 class="cmtt-10"> entry</span><span
2720 class="cmtt-10"> 0:</span><span
2721 class="cmtt-10"> length</span><span
2722 class="cmtt-10"> 2</span>
2723 <br class="fancyvrb" /><a
2724 id="x1-52004r2"></a><span
2725 class="cmtt-10"> </span><span
2726 class="cmtt-10"> entry</span><span
2727 class="cmtt-10"> 1:</span><span
2728 class="cmtt-10"> length</span><span
2729 class="cmtt-10"> 4</span>
2730 <br class="fancyvrb" /><a
2731 id="x1-52006r3"></a><span
2732 class="cmtt-10"> </span><span
2733 class="cmtt-10"> entry</span><span
2734 class="cmtt-10"> 2:</span><span
2735 class="cmtt-10"> length</span><span
2736 class="cmtt-10"> 4</span>
2737 <br class="fancyvrb" /><a
2738 id="x1-52008r4"></a><span
2739 class="cmtt-10"> </span><span
2740 class="cmtt-10"> entry</span><span
2741 class="cmtt-10"> 3:</span><span
2742 class="cmtt-10"> length</span><span
2743 class="cmtt-10"> 4</span>
2744 <br class="fancyvrb" /><a
2745 id="x1-52010r5"></a><span
2746 class="cmtt-10"> </span><span
2747 class="cmtt-10"> entry</span><span
2748 class="cmtt-10"> 4:</span><span
2749 class="cmtt-10"> length</span><span
2750 class="cmtt-10"> 4</span>
2751 <br class="fancyvrb" /><a
2752 id="x1-52012r6"></a><span
2753 class="cmtt-10"> </span><span
2754 class="cmtt-10"> entry</span><span
2755 class="cmtt-10"> 5:</span><span
2756 class="cmtt-10"> length</span><span
2757 class="cmtt-10"> 2</span>
2758 <br class="fancyvrb" /><a
2759 id="x1-52014r7"></a><span
2760 class="cmtt-10"> </span><span
2761 class="cmtt-10"> entry</span><span
2762 class="cmtt-10"> 6:</span><span
2763 class="cmtt-10"> length</span><span
2764 class="cmtt-10"> 3</span>
2765 <br class="fancyvrb" /><a
2766 id="x1-52016r8"></a><span
2767 class="cmtt-10"> </span><span
2768 class="cmtt-10"> entry</span><span
2769 class="cmtt-10"> 7:</span><span
2770 class="cmtt-10"> length</span><span
2771 class="cmtt-10"> 3</span>
2773 <!--l. 220--><p class="noindent" >Assigning codewords in order (lowest possible value of the appropriate length to highest) results in
2774 the following codeword list:
2775 <!--l. 223--><p class="noindent" >
2776 <div class="fancyvrb" id="fancyvrb16">
2778 id="x1-52018r1"></a><span
2779 class="cmtt-10"> </span><span
2780 class="cmtt-10"> entry</span><span
2781 class="cmtt-10"> 0:</span><span
2782 class="cmtt-10"> length</span><span
2783 class="cmtt-10"> 2</span><span
2784 class="cmtt-10"> codeword</span><span
2785 class="cmtt-10"> 00</span>
2786 <br class="fancyvrb" /><a
2787 id="x1-52020r2"></a><span
2788 class="cmtt-10"> </span><span
2789 class="cmtt-10"> entry</span><span
2790 class="cmtt-10"> 1:</span><span
2791 class="cmtt-10"> length</span><span
2792 class="cmtt-10"> 4</span><span
2793 class="cmtt-10"> codeword</span><span
2794 class="cmtt-10"> 0100</span>
2795 <br class="fancyvrb" /><a
2796 id="x1-52022r3"></a><span
2797 class="cmtt-10"> </span><span
2798 class="cmtt-10"> entry</span><span
2799 class="cmtt-10"> 2:</span><span
2800 class="cmtt-10"> length</span><span
2801 class="cmtt-10"> 4</span><span
2802 class="cmtt-10"> codeword</span><span
2803 class="cmtt-10"> 0101</span>
2804 <br class="fancyvrb" /><a
2805 id="x1-52024r4"></a><span
2806 class="cmtt-10"> </span><span
2807 class="cmtt-10"> entry</span><span
2808 class="cmtt-10"> 3:</span><span
2809 class="cmtt-10"> length</span><span
2810 class="cmtt-10"> 4</span><span
2811 class="cmtt-10"> codeword</span><span
2812 class="cmtt-10"> 0110</span>
2813 <br class="fancyvrb" /><a
2814 id="x1-52026r5"></a><span
2815 class="cmtt-10"> </span><span
2816 class="cmtt-10"> entry</span><span
2817 class="cmtt-10"> 4:</span><span
2818 class="cmtt-10"> length</span><span
2819 class="cmtt-10"> 4</span><span
2820 class="cmtt-10"> codeword</span><span
2821 class="cmtt-10"> 0111</span>
2822 <br class="fancyvrb" /><a
2823 id="x1-52028r6"></a><span
2824 class="cmtt-10"> </span><span
2825 class="cmtt-10"> entry</span><span
2826 class="cmtt-10"> 5:</span><span
2827 class="cmtt-10"> length</span><span
2828 class="cmtt-10"> 2</span><span
2829 class="cmtt-10"> codeword</span><span
2830 class="cmtt-10"> 10</span>
2831 <br class="fancyvrb" /><a
2832 id="x1-52030r7"></a><span
2833 class="cmtt-10"> </span><span
2834 class="cmtt-10"> entry</span><span
2835 class="cmtt-10"> 6:</span><span
2836 class="cmtt-10"> length</span><span
2837 class="cmtt-10"> 3</span><span
2838 class="cmtt-10"> codeword</span><span
2839 class="cmtt-10"> 110</span>
2840 <br class="fancyvrb" /><a
2841 id="x1-52032r8"></a><span
2842 class="cmtt-10"> </span><span
2843 class="cmtt-10"> entry</span><span
2844 class="cmtt-10"> 7:</span><span
2845 class="cmtt-10"> length</span><span
2846 class="cmtt-10"> 3</span><span
2847 class="cmtt-10"> codeword</span><span
2848 class="cmtt-10"> 111</span>
2853 <!--l. 235--><p class="noindent" ><span class="likesubparagraphHead"><a
2854 id="x1-530003.2.1"></a><span
2855 class="cmbx-10x-x-109">Note:</span></span> Unlike most binary numerical values in this document, we intend the above codewords to be
2856 read and used bit by bit from left to right, thus the codeword ’001’ is the bit string ’zero, zero, one’.
2857 When determining ’lowest possible value’ in the assignment definition above, the leftmost bit is the
2859 <!--l. 243--><p class="noindent" >It is clear that the codeword length list represents a Huffman decision tree with the entry numbers
2860 equivalent to the leaves numbered left-to-right:
2863 <!--l. 247--><p class="noindent" >
2865 <!--l. 248--><p class="noindent" ><img
2866 src="hufftree.png" alt="PIC"
2868 <br /> <table class="caption"
2869 ><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 4: </td><td
2870 class="content">huffman tree illustration</td></tr></table><!--tex4ht:label?: x1-530014 -->
2872 <!--l. 253--><p class="noindent" >As we assign codewords in order, we see that each choice constructs a new leaf in the leftmost
2874 <!--l. 256--><p class="noindent" >Note that it’s possible to underspecify or overspecify a Huffman tree via the length list. In the above
2875 example, if codeword seven were eliminated, it’s clear that the tree is unfinished:
2878 <!--l. 260--><p class="noindent" >
2880 <!--l. 261--><p class="noindent" ><img
2881 src="hufftree-under.png" alt="PIC"
2883 <br /> <table class="caption"
2884 ><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 5: </td><td
2885 class="content">underspecified huffman tree illustration</td></tr></table><!--tex4ht:label?: x1-530025 -->
2887 <!--l. 266--><p class="noindent" >Similarly, in the original codebook, it’s clear that the tree is fully populated and a ninth codeword is
2888 impossible. Both underspecified and overspecified trees are an error condition rendering the stream
2890 <!--l. 271--><p class="noindent" >Codebook entries marked ’unused’ are simply skipped in the assigning process. They have no
2891 codeword and do not appear in the decision tree, thus it’s impossible for any bit pattern read from
2892 the stream to decode to that entry number.
2893 <!--l. 278--><p class="noindent" ><span class="paragraphHead"><a
2894 id="x1-540003.2.1"></a><span
2895 class="cmbx-10x-x-109">VQ lookup table vector representation</span></span>
2896 Unpacking the VQ lookup table vectors relies on the following values:
2897 <div class="fancyvrb" id="fancyvrb17">
2902 id="x1-54002r1"></a><span
2903 class="cmtt-10"> </span><span
2904 class="cmtt-10"> the</span><span
2905 class="cmtt-10"> [codebook_multiplicands]</span><span
2906 class="cmtt-10"> array</span>
2907 <br class="fancyvrb" /><a
2908 id="x1-54004r2"></a><span
2909 class="cmtt-10"> </span><span
2910 class="cmtt-10"> [codebook_minimum_value]</span>
2911 <br class="fancyvrb" /><a
2912 id="x1-54006r3"></a><span
2913 class="cmtt-10"> </span><span
2914 class="cmtt-10"> [codebook_delta_value]</span>
2915 <br class="fancyvrb" /><a
2916 id="x1-54008r4"></a><span
2917 class="cmtt-10"> </span><span
2918 class="cmtt-10"> [codebook_sequence_p]</span>
2919 <br class="fancyvrb" /><a
2920 id="x1-54010r5"></a><span
2921 class="cmtt-10"> </span><span
2922 class="cmtt-10"> [codebook_lookup_type]</span>
2923 <br class="fancyvrb" /><a
2924 id="x1-54012r6"></a><span
2925 class="cmtt-10"> </span><span
2926 class="cmtt-10"> [codebook_entries]</span>
2927 <br class="fancyvrb" /><a
2928 id="x1-54014r7"></a><span
2929 class="cmtt-10"> </span><span
2930 class="cmtt-10"> [codebook_dimensions]</span>
2931 <br class="fancyvrb" /><a
2932 id="x1-54016r8"></a><span
2933 class="cmtt-10"> </span><span
2934 class="cmtt-10"> [codebook_lookup_values]</span>
2936 <!--l. 294--><p class="noindent" >Decoding (unpacking) a specific vector in the vector lookup table proceeds according to
2938 class="cmtt-10x-x-109">[codebook_lookup_type]</span>. The unpacked vector values are what a codebook would return during
2939 audio packet decode in a VQ context.
2940 <!--l. 299--><p class="noindent" ><span class="paragraphHead"><a
2941 id="x1-550003.2.1"></a><span
2942 class="cmbx-10x-x-109">Vector value decode: Lookup type 1</span></span>
2943 Lookup type one specifies a lattice VQ lookup table built algorithmically from a list of scalar
2944 values. Calculate (unpack) the final values of a codebook entry vector from the entries in
2946 class="cmtt-10x-x-109">[codebook_multiplicands] </span>as follows (<span
2947 class="cmtt-10x-x-109">[value_vector] </span>is the output vector representing the
2948 vector of values for entry number <span
2949 class="cmtt-10x-x-109">[lookup_offset] </span>in this codebook):
2950 <!--l. 308--><p class="noindent" >
2951 <div class="fancyvrb" id="fancyvrb18">
2953 id="x1-55002r1"></a><span
2954 class="cmtt-10"> </span><span
2955 class="cmtt-10"> </span><span
2956 class="cmtt-10"> </span><span
2957 class="cmtt-10"> 1)</span><span
2958 class="cmtt-10"> [last]</span><span
2959 class="cmtt-10"> =</span><span
2960 class="cmtt-10"> 0;</span>
2961 <br class="fancyvrb" /><a
2962 id="x1-55004r2"></a><span
2963 class="cmtt-10"> </span><span
2964 class="cmtt-10"> </span><span
2965 class="cmtt-10"> </span><span
2966 class="cmtt-10"> 2)</span><span
2967 class="cmtt-10"> [index_divisor]</span><span
2968 class="cmtt-10"> =</span><span
2969 class="cmtt-10"> 1;</span>
2970 <br class="fancyvrb" /><a
2971 id="x1-55006r3"></a><span
2972 class="cmtt-10"> </span><span
2973 class="cmtt-10"> </span><span
2974 class="cmtt-10"> </span><span
2975 class="cmtt-10"> 3)</span><span
2976 class="cmtt-10"> iterate</span><span
2977 class="cmtt-10"> [i]</span><span
2978 class="cmtt-10"> over</span><span
2979 class="cmtt-10"> the</span><span
2980 class="cmtt-10"> range</span><span
2981 class="cmtt-10"> 0</span><span
2982 class="cmtt-10"> ...</span><span
2983 class="cmtt-10"> [codebook_dimensions]-1</span><span
2984 class="cmtt-10"> (once</span><span
2985 class="cmtt-10"> for</span><span
2986 class="cmtt-10"> each</span><span
2987 class="cmtt-10"> scalar</span><span
2988 class="cmtt-10"> value</span><span
2989 class="cmtt-10"> in</span><span
2990 class="cmtt-10"> the</span><span
2991 class="cmtt-10"> value</span><span
2992 class="cmtt-10"> vector)</span><span
2993 class="cmtt-10"> </span><span
2994 class="cmsy-10">{</span>
2995 <br class="fancyvrb" /><a
2996 id="x1-55008r4"></a><span
2997 class="cmtt-10"> </span><span
2998 class="cmtt-10"> </span>
2999 <br class="fancyvrb" /><a
3000 id="x1-55010r5"></a><span
3001 class="cmtt-10"> </span><span
3002 class="cmtt-10"> </span><span
3003 class="cmtt-10"> </span><span
3004 class="cmtt-10"> </span><span
3005 class="cmtt-10"> </span><span
3006 class="cmtt-10"> </span><span
3007 class="cmtt-10"> </span><span
3008 class="cmtt-10"> </span><span
3009 class="cmtt-10"> 4)</span><span
3010 class="cmtt-10"> [multiplicand_offset]</span><span
3011 class="cmtt-10"> =</span><span
3012 class="cmtt-10"> (</span><span
3013 class="cmtt-10"> [lookup_offset]</span><span
3014 class="cmtt-10"> divided</span><span
3015 class="cmtt-10"> by</span><span
3016 class="cmtt-10"> [index_divisor]</span><span
3017 class="cmtt-10"> using</span><span
3018 class="cmtt-10"> integer</span>
3019 <br class="fancyvrb" /><a
3020 id="x1-55012r6"></a><span
3021 class="cmtt-10"> </span><span
3022 class="cmtt-10"> </span><span
3023 class="cmtt-10"> </span><span
3024 class="cmtt-10"> </span><span
3025 class="cmtt-10"> </span><span
3026 class="cmtt-10"> </span><span
3027 class="cmtt-10"> </span><span
3028 class="cmtt-10"> </span><span
3029 class="cmtt-10"> </span><span
3030 class="cmtt-10"> </span><span
3031 class="cmtt-10"> </span><span
3032 class="cmtt-10"> division</span><span
3033 class="cmtt-10"> )</span><span
3034 class="cmtt-10"> integer</span><span
3035 class="cmtt-10"> modulo</span><span
3036 class="cmtt-10"> [codebook_lookup_values]</span>
3037 <br class="fancyvrb" /><a
3038 id="x1-55014r7"></a><span
3039 class="cmtt-10"> </span><span
3040 class="cmtt-10"> </span>
3041 <br class="fancyvrb" /><a
3042 id="x1-55016r8"></a><span
3043 class="cmtt-10"> </span><span
3044 class="cmtt-10"> </span><span
3045 class="cmtt-10"> </span><span
3046 class="cmtt-10"> </span><span
3047 class="cmtt-10"> </span><span
3048 class="cmtt-10"> </span><span
3049 class="cmtt-10"> </span><span
3050 class="cmtt-10"> </span><span
3051 class="cmtt-10"> 5)</span><span
3052 class="cmtt-10"> vector</span><span
3053 class="cmtt-10"> [value_vector]</span><span
3054 class="cmtt-10"> element</span><span
3055 class="cmtt-10"> [i]</span><span
3056 class="cmtt-10"> =</span>
3057 <br class="fancyvrb" /><a
3058 id="x1-55018r9"></a><span
3059 class="cmtt-10"> </span><span
3060 class="cmtt-10"> </span><span
3061 class="cmtt-10"> </span><span
3062 class="cmtt-10"> </span><span
3063 class="cmtt-10"> </span><span
3064 class="cmtt-10"> </span><span
3065 class="cmtt-10"> </span><span
3066 class="cmtt-10"> </span><span
3067 class="cmtt-10"> </span><span
3068 class="cmtt-10"> </span><span
3069 class="cmtt-10"> </span><span
3070 class="cmtt-10"> </span><span
3071 class="cmtt-10"> </span><span
3072 class="cmtt-10"> (</span><span
3073 class="cmtt-10"> [codebook_multiplicands]</span><span
3074 class="cmtt-10"> array</span><span
3075 class="cmtt-10"> element</span><span
3076 class="cmtt-10"> number</span><span
3077 class="cmtt-10"> [multiplicand_offset]</span><span
3078 class="cmtt-10"> )</span><span
3079 class="cmtt-10"> *</span>
3080 <br class="fancyvrb" /><a
3081 id="x1-55020r10"></a><span
3082 class="cmtt-10"> </span><span
3083 class="cmtt-10"> </span><span
3084 class="cmtt-10"> </span><span
3085 class="cmtt-10"> </span><span
3086 class="cmtt-10"> </span><span
3087 class="cmtt-10"> </span><span
3088 class="cmtt-10"> </span><span
3089 class="cmtt-10"> </span><span
3090 class="cmtt-10"> </span><span
3091 class="cmtt-10"> </span><span
3092 class="cmtt-10"> </span><span
3093 class="cmtt-10"> </span><span
3094 class="cmtt-10"> </span><span
3095 class="cmtt-10"> [codebook_delta_value]</span><span
3096 class="cmtt-10"> +</span><span
3097 class="cmtt-10"> [codebook_minimum_value]</span><span
3098 class="cmtt-10"> +</span><span
3099 class="cmtt-10"> [last];</span>
3100 <br class="fancyvrb" /><a
3101 id="x1-55022r11"></a><span
3102 class="cmtt-10"> </span><span
3103 class="cmtt-10"> </span>
3104 <br class="fancyvrb" /><a
3105 id="x1-55024r12"></a><span
3106 class="cmtt-10"> </span><span
3107 class="cmtt-10"> </span><span
3108 class="cmtt-10"> </span><span
3109 class="cmtt-10"> </span><span
3110 class="cmtt-10"> </span><span
3111 class="cmtt-10"> </span><span
3112 class="cmtt-10"> </span><span
3113 class="cmtt-10"> </span><span
3114 class="cmtt-10"> 6)</span><span
3115 class="cmtt-10"> if</span><span
3116 class="cmtt-10"> (</span><span
3117 class="cmtt-10"> [codebook_sequence_p]</span><span
3118 class="cmtt-10"> is</span><span
3119 class="cmtt-10"> set</span><span
3120 class="cmtt-10"> )</span><span
3121 class="cmtt-10"> then</span><span
3122 class="cmtt-10"> set</span><span
3123 class="cmtt-10"> [last]</span><span
3124 class="cmtt-10"> =</span><span
3125 class="cmtt-10"> vector</span><span
3126 class="cmtt-10"> [value_vector]</span><span
3127 class="cmtt-10"> element</span><span
3128 class="cmtt-10"> [i]</span>
3129 <br class="fancyvrb" /><a
3130 id="x1-55026r13"></a><span
3131 class="cmtt-10"> </span><span
3132 class="cmtt-10"> </span>
3133 <br class="fancyvrb" /><a
3134 id="x1-55028r14"></a><span
3135 class="cmtt-10"> </span><span
3136 class="cmtt-10"> </span><span
3137 class="cmtt-10"> </span><span
3138 class="cmtt-10"> </span><span
3139 class="cmtt-10"> </span><span
3140 class="cmtt-10"> </span><span
3141 class="cmtt-10"> </span><span
3142 class="cmtt-10"> </span><span
3143 class="cmtt-10"> 7)</span><span
3144 class="cmtt-10"> [index_divisor]</span><span
3145 class="cmtt-10"> =</span><span
3146 class="cmtt-10"> [index_divisor]</span><span
3147 class="cmtt-10"> *</span><span
3148 class="cmtt-10"> [codebook_lookup_values]</span>
3149 <br class="fancyvrb" /><a
3150 id="x1-55030r15"></a><span
3151 class="cmtt-10"> </span><span
3152 class="cmtt-10"> </span>
3153 <br class="fancyvrb" /><a
3154 id="x1-55032r16"></a><span
3155 class="cmtt-10"> </span><span
3156 class="cmtt-10"> </span><span
3157 class="cmtt-10"> </span><span
3158 class="cmtt-10"> </span><span
3159 class="cmtt-10"> </span><span
3160 class="cmtt-10"> </span><span
3161 class="cmtt-10"> </span><span
3162 class="cmsy-10">}</span>
3163 <br class="fancyvrb" /><a
3164 id="x1-55034r17"></a><span
3165 class="cmtt-10"> </span><span
3166 class="cmtt-10"> </span>
3167 <br class="fancyvrb" /><a
3168 id="x1-55036r18"></a><span
3169 class="cmtt-10"> </span><span
3170 class="cmtt-10"> </span><span
3171 class="cmtt-10"> </span><span
3172 class="cmtt-10"> 8)</span><span
3173 class="cmtt-10"> vector</span><span
3174 class="cmtt-10"> calculation</span><span
3175 class="cmtt-10"> completed.</span>
3177 <!--l. 331--><p class="noindent" ><span class="paragraphHead"><a
3178 id="x1-560003.2.1"></a><span
3179 class="cmbx-10x-x-109">Vector value decode: Lookup type 2</span></span>
3183 Lookup type two specifies a VQ lookup table in which each scalar in each vector is explicitly set by
3185 class="cmtt-10x-x-109">[codebook_multiplicands] </span>array in a one-to-one mapping. Calculate [unpack] the final values
3186 of a codebook entry vector from the entries in <span
3187 class="cmtt-10x-x-109">[codebook_multiplicands] </span>as follows
3189 class="cmtt-10x-x-109">[value_vector] </span>is the output vector representing the vector of values for entry number
3191 class="cmtt-10x-x-109">[lookup_offset] </span>in this codebook):
3192 <!--l. 341--><p class="noindent" >
3193 <div class="fancyvrb" id="fancyvrb19">
3195 id="x1-56002r1"></a><span
3196 class="cmtt-10"> </span><span
3197 class="cmtt-10"> </span><span
3198 class="cmtt-10"> </span><span
3199 class="cmtt-10"> 1)</span><span
3200 class="cmtt-10"> [last]</span><span
3201 class="cmtt-10"> =</span><span
3202 class="cmtt-10"> 0;</span>
3203 <br class="fancyvrb" /><a
3204 id="x1-56004r2"></a><span
3205 class="cmtt-10"> </span><span
3206 class="cmtt-10"> </span><span
3207 class="cmtt-10"> </span><span
3208 class="cmtt-10"> 2)</span><span
3209 class="cmtt-10"> [multiplicand_offset]</span><span
3210 class="cmtt-10"> =</span><span
3211 class="cmtt-10"> [lookup_offset]</span><span
3212 class="cmtt-10"> *</span><span
3213 class="cmtt-10"> [codebook_dimensions]</span>
3214 <br class="fancyvrb" /><a
3215 id="x1-56006r3"></a><span
3216 class="cmtt-10"> </span><span
3217 class="cmtt-10"> </span><span
3218 class="cmtt-10"> </span><span
3219 class="cmtt-10"> 3)</span><span
3220 class="cmtt-10"> iterate</span><span
3221 class="cmtt-10"> [i]</span><span
3222 class="cmtt-10"> over</span><span
3223 class="cmtt-10"> the</span><span
3224 class="cmtt-10"> range</span><span
3225 class="cmtt-10"> 0</span><span
3226 class="cmtt-10"> ...</span><span
3227 class="cmtt-10"> [codebook_dimensions]-1</span><span
3228 class="cmtt-10"> (once</span><span
3229 class="cmtt-10"> for</span><span
3230 class="cmtt-10"> each</span><span
3231 class="cmtt-10"> scalar</span><span
3232 class="cmtt-10"> value</span><span
3233 class="cmtt-10"> in</span><span
3234 class="cmtt-10"> the</span><span
3235 class="cmtt-10"> value</span><span
3236 class="cmtt-10"> vector)</span><span
3237 class="cmtt-10"> </span><span
3238 class="cmsy-10">{</span>
3239 <br class="fancyvrb" /><a
3240 id="x1-56008r4"></a><span
3241 class="cmtt-10"> </span><span
3242 class="cmtt-10"> </span>
3243 <br class="fancyvrb" /><a
3244 id="x1-56010r5"></a><span
3245 class="cmtt-10"> </span><span
3246 class="cmtt-10"> </span><span
3247 class="cmtt-10"> </span><span
3248 class="cmtt-10"> </span><span
3249 class="cmtt-10"> </span><span
3250 class="cmtt-10"> </span><span
3251 class="cmtt-10"> </span><span
3252 class="cmtt-10"> </span><span
3253 class="cmtt-10"> 4)</span><span
3254 class="cmtt-10"> vector</span><span
3255 class="cmtt-10"> [value_vector]</span><span
3256 class="cmtt-10"> element</span><span
3257 class="cmtt-10"> [i]</span><span
3258 class="cmtt-10"> =</span>
3259 <br class="fancyvrb" /><a
3260 id="x1-56012r6"></a><span
3261 class="cmtt-10"> </span><span
3262 class="cmtt-10"> </span><span
3263 class="cmtt-10"> </span><span
3264 class="cmtt-10"> </span><span
3265 class="cmtt-10"> </span><span
3266 class="cmtt-10"> </span><span
3267 class="cmtt-10"> </span><span
3268 class="cmtt-10"> </span><span
3269 class="cmtt-10"> </span><span
3270 class="cmtt-10"> </span><span
3271 class="cmtt-10"> </span><span
3272 class="cmtt-10"> </span><span
3273 class="cmtt-10"> </span><span
3274 class="cmtt-10"> (</span><span
3275 class="cmtt-10"> [codebook_multiplicands]</span><span
3276 class="cmtt-10"> array</span><span
3277 class="cmtt-10"> element</span><span
3278 class="cmtt-10"> number</span><span
3279 class="cmtt-10"> [multiplicand_offset]</span><span
3280 class="cmtt-10"> )</span><span
3281 class="cmtt-10"> *</span>
3282 <br class="fancyvrb" /><a
3283 id="x1-56014r7"></a><span
3284 class="cmtt-10"> </span><span
3285 class="cmtt-10"> </span><span
3286 class="cmtt-10"> </span><span
3287 class="cmtt-10"> </span><span
3288 class="cmtt-10"> </span><span
3289 class="cmtt-10"> </span><span
3290 class="cmtt-10"> </span><span
3291 class="cmtt-10"> </span><span
3292 class="cmtt-10"> </span><span
3293 class="cmtt-10"> </span><span
3294 class="cmtt-10"> </span><span
3295 class="cmtt-10"> </span><span
3296 class="cmtt-10"> </span><span
3297 class="cmtt-10"> [codebook_delta_value]</span><span
3298 class="cmtt-10"> +</span><span
3299 class="cmtt-10"> [codebook_minimum_value]</span><span
3300 class="cmtt-10"> +</span><span
3301 class="cmtt-10"> [last];</span>
3302 <br class="fancyvrb" /><a
3303 id="x1-56016r8"></a><span
3304 class="cmtt-10"> </span><span
3305 class="cmtt-10"> </span>
3306 <br class="fancyvrb" /><a
3307 id="x1-56018r9"></a><span
3308 class="cmtt-10"> </span><span
3309 class="cmtt-10"> </span><span
3310 class="cmtt-10"> </span><span
3311 class="cmtt-10"> </span><span
3312 class="cmtt-10"> </span><span
3313 class="cmtt-10"> </span><span
3314 class="cmtt-10"> </span><span
3315 class="cmtt-10"> </span><span
3316 class="cmtt-10"> 5)</span><span
3317 class="cmtt-10"> if</span><span
3318 class="cmtt-10"> (</span><span
3319 class="cmtt-10"> [codebook_sequence_p]</span><span
3320 class="cmtt-10"> is</span><span
3321 class="cmtt-10"> set</span><span
3322 class="cmtt-10"> )</span><span
3323 class="cmtt-10"> then</span><span
3324 class="cmtt-10"> set</span><span
3325 class="cmtt-10"> [last]</span><span
3326 class="cmtt-10"> =</span><span
3327 class="cmtt-10"> vector</span><span
3328 class="cmtt-10"> [value_vector]</span><span
3329 class="cmtt-10"> element</span><span
3330 class="cmtt-10"> [i]</span>
3331 <br class="fancyvrb" /><a
3332 id="x1-56020r10"></a><span
3333 class="cmtt-10"> </span><span
3334 class="cmtt-10"> </span>
3335 <br class="fancyvrb" /><a
3336 id="x1-56022r11"></a><span
3337 class="cmtt-10"> </span><span
3338 class="cmtt-10"> </span><span
3339 class="cmtt-10"> </span><span
3340 class="cmtt-10"> </span><span
3341 class="cmtt-10"> </span><span
3342 class="cmtt-10"> </span><span
3343 class="cmtt-10"> </span><span
3344 class="cmtt-10"> </span><span
3345 class="cmtt-10"> 6)</span><span
3346 class="cmtt-10"> increment</span><span
3347 class="cmtt-10"> [multiplicand_offset]</span>
3348 <br class="fancyvrb" /><a
3349 id="x1-56024r12"></a><span
3350 class="cmtt-10"> </span><span
3351 class="cmtt-10"> </span>
3352 <br class="fancyvrb" /><a
3353 id="x1-56026r13"></a><span
3354 class="cmtt-10"> </span><span
3355 class="cmtt-10"> </span><span
3356 class="cmtt-10"> </span><span
3357 class="cmtt-10"> </span><span
3358 class="cmtt-10"> </span><span
3359 class="cmtt-10"> </span><span
3360 class="cmtt-10"> </span><span
3361 class="cmsy-10">}</span>
3362 <br class="fancyvrb" /><a
3363 id="x1-56028r14"></a><span
3364 class="cmtt-10"> </span><span
3365 class="cmtt-10"> </span>
3366 <br class="fancyvrb" /><a
3367 id="x1-56030r15"></a><span
3368 class="cmtt-10"> </span><span
3369 class="cmtt-10"> </span><span
3370 class="cmtt-10"> </span><span
3371 class="cmtt-10"> 7)</span><span
3372 class="cmtt-10"> vector</span><span
3373 class="cmtt-10"> calculation</span><span
3374 class="cmtt-10"> completed.</span>
3376 <!--l. 367--><p class="noindent" >
3377 <h4 class="subsectionHead"><span class="titlemark">3.3 </span> <a
3378 id="x1-570003.3"></a>Use of the codebook abstraction</h4>
3379 <!--l. 369--><p class="noindent" >The decoder uses the codebook abstraction much as it does the bit-unpacking convention; a specific
3380 codebook reads a codeword from the bitstream, decoding it into an entry number, and then returns
3381 that entry number to the decoder (when used in a scalar entropy coding context), or uses
3382 that entry number as an offset into the VQ lookup table, returning a vector of values
3383 (when used in a context desiring a VQ value). Scalar or VQ context is always explicit;
3384 any call to the codebook mechanism requests either a scalar entry number or a lookup
3386 <!--l. 379--><p class="noindent" >Note that VQ lookup type zero indicates that there is no lookup table; requesting decode using a
3387 codebook of lookup type 0 in any context expecting a vector return value (even in a case where a
3388 vector of dimension one) is forbidden. If decoder setup or decode requests such an action, that is an
3389 error condition rendering the packet undecodable.
3390 <!--l. 386--><p class="noindent" >Using a codebook to read from the packet bitstream consists first of reading and decoding
3391 the next codeword in the bitstream. The decoder reads bits until the accumulated bits
3392 match a codeword in the codebook. This process can be though of as logically walking
3393 the Huffman decode tree by reading one bit at a time from the bitstream, and using
3397 the bit as a decision boolean to take the 0 branch (left in the above examples) or the 1
3398 branch (right in the above examples). Walking the tree finishes when the decode process
3399 hits a leaf in the decision tree; the result is the entry number corresponding to that
3400 leaf. Reading past the end of a packet propagates the ’end-of-stream’ condition to the
3402 <!--l. 398--><p class="noindent" >When used in a scalar context, the resulting codeword entry is the desired return value.
3403 <!--l. 401--><p class="noindent" >When used in a VQ context, the codeword entry number is used as an offset into the VQ lookup
3404 table. The value returned to the decoder is the vector of scalars corresponding to this
3412 <h3 class="sectionHead"><span class="titlemark">4 </span> <a
3413 id="x1-580004"></a>Codec Setup and Packet Decode</h3>
3414 <!--l. 6--><p class="noindent" >
3415 <h4 class="subsectionHead"><span class="titlemark">4.1 </span> <a
3416 id="x1-590004.1"></a>Overview</h4>
3417 <!--l. 8--><p class="noindent" >This document serves as the top-level reference document for the bit-by-bit decode specification of
3418 Vorbis I. This document assumes a high-level understanding of the Vorbis decode process, which is
3420 href="#x1-20001">Section 1<!--tex4ht:ref: vorbis:spec:intro --></a>, “<a
3421 href="#x1-20001">Introduction and Description<!--tex4ht:ref: vorbis:spec:intro --></a>”. <a
3422 href="#x1-360002">Section 2<!--tex4ht:ref: vorbis:spec:bitpacking --></a>, “<a
3423 href="#x1-360002">Bitpacking Convention<!--tex4ht:ref: vorbis:spec:bitpacking --></a>” covers
3424 reading and writing bit fields from and to bitstream packets.
3425 <!--l. 16--><p class="noindent" >
3426 <h4 class="subsectionHead"><span class="titlemark">4.2 </span> <a
3427 id="x1-600004.2"></a>Header decode and decode setup</h4>
3428 <!--l. 18--><p class="noindent" >A Vorbis bitstream begins with three header packets. The header packets are, in order, the
3429 identification header, the comments header, and the setup header. All are required for decode
3430 compliance. An end-of-packet condition during decoding the first or third header packet renders the
3431 stream undecodable. End-of-packet decoding the comment header is a non-fatal error
3433 <!--l. 25--><p class="noindent" >
3434 <h5 class="subsubsectionHead"><span class="titlemark">4.2.1 </span> <a
3435 id="x1-610004.2.1"></a>Common header decode</h5>
3436 <!--l. 27--><p class="noindent" >Each header packet begins with the same header fields.
3437 <!--l. 30--><p class="noindent" >
3438 <div class="fancyvrb" id="fancyvrb20">
3440 id="x1-61002r1"></a><span
3441 class="cmtt-10"> </span><span
3442 class="cmtt-10"> </span><span
3443 class="cmtt-10"> </span><span
3444 class="cmtt-10"> 1)</span><span
3445 class="cmtt-10"> [packet_type]</span><span
3446 class="cmtt-10"> :</span><span
3447 class="cmtt-10"> 8</span><span
3448 class="cmtt-10"> bit</span><span
3449 class="cmtt-10"> value</span>
3450 <br class="fancyvrb" /><a
3451 id="x1-61004r2"></a><span
3452 class="cmtt-10"> </span><span
3453 class="cmtt-10"> </span><span
3454 class="cmtt-10"> </span><span
3455 class="cmtt-10"> 2)</span><span
3456 class="cmtt-10"> 0x76,</span><span
3457 class="cmtt-10"> 0x6f,</span><span
3458 class="cmtt-10"> 0x72,</span><span
3459 class="cmtt-10"> 0x62,</span><span
3460 class="cmtt-10"> 0x69,</span><span
3461 class="cmtt-10"> 0x73:</span><span
3462 class="cmtt-10"> the</span><span
3463 class="cmtt-10"> characters</span><span
3464 class="cmtt-10"> ’v’,’o’,’r’,’b’,’i’,’s’</span><span
3465 class="cmtt-10"> as</span><span
3466 class="cmtt-10"> six</span><span
3467 class="cmtt-10"> octets</span>
3469 <!--l. 35--><p class="noindent" >Decode continues according to packet type; the identification header is type 1, the comment header
3470 type 3 and the setup header type 5 (these types are all odd as a packet with a leading single bit of
3471 ’0’ is an audio packet). The packets must occur in the order of identification, comment,
3476 <!--l. 43--><p class="noindent" >
3477 <h5 class="subsubsectionHead"><span class="titlemark">4.2.2 </span> <a
3478 id="x1-620004.2.2"></a>Identification header</h5>
3479 <!--l. 45--><p class="noindent" >The identification header is a short header of only a few fields used to declare the stream definitively
3480 as Vorbis, and provide a few externally relevant pieces of information about the audio stream. The
3481 identification header is coded as follows:
3482 <!--l. 50--><p class="noindent" >
3483 <div class="fancyvrb" id="fancyvrb21">
3485 id="x1-62002r1"></a><span
3486 class="cmtt-10"> </span><span
3487 class="cmtt-10"> </span><span
3488 class="cmtt-10"> 1)</span><span
3489 class="cmtt-10"> [vorbis_version]</span><span
3490 class="cmtt-10"> =</span><span
3491 class="cmtt-10"> read</span><span
3492 class="cmtt-10"> 32</span><span
3493 class="cmtt-10"> bits</span><span
3494 class="cmtt-10"> as</span><span
3495 class="cmtt-10"> unsigned</span><span
3496 class="cmtt-10"> integer</span>
3497 <br class="fancyvrb" /><a
3498 id="x1-62004r2"></a><span
3499 class="cmtt-10"> </span><span
3500 class="cmtt-10"> </span><span
3501 class="cmtt-10"> 2)</span><span
3502 class="cmtt-10"> [audio_channels]</span><span
3503 class="cmtt-10"> =</span><span
3504 class="cmtt-10"> read</span><span
3505 class="cmtt-10"> 8</span><span
3506 class="cmtt-10"> bit</span><span
3507 class="cmtt-10"> integer</span><span
3508 class="cmtt-10"> as</span><span
3509 class="cmtt-10"> unsigned</span>
3510 <br class="fancyvrb" /><a
3511 id="x1-62006r3"></a><span
3512 class="cmtt-10"> </span><span
3513 class="cmtt-10"> </span><span
3514 class="cmtt-10"> 3)</span><span
3515 class="cmtt-10"> [audio_sample_rate]</span><span
3516 class="cmtt-10"> =</span><span
3517 class="cmtt-10"> read</span><span
3518 class="cmtt-10"> 32</span><span
3519 class="cmtt-10"> bits</span><span
3520 class="cmtt-10"> as</span><span
3521 class="cmtt-10"> unsigned</span><span
3522 class="cmtt-10"> integer</span>
3523 <br class="fancyvrb" /><a
3524 id="x1-62008r4"></a><span
3525 class="cmtt-10"> </span><span
3526 class="cmtt-10"> </span><span
3527 class="cmtt-10"> 4)</span><span
3528 class="cmtt-10"> [bitrate_maximum]</span><span
3529 class="cmtt-10"> =</span><span
3530 class="cmtt-10"> read</span><span
3531 class="cmtt-10"> 32</span><span
3532 class="cmtt-10"> bits</span><span
3533 class="cmtt-10"> as</span><span
3534 class="cmtt-10"> signed</span><span
3535 class="cmtt-10"> integer</span>
3536 <br class="fancyvrb" /><a
3537 id="x1-62010r5"></a><span
3538 class="cmtt-10"> </span><span
3539 class="cmtt-10"> </span><span
3540 class="cmtt-10"> 5)</span><span
3541 class="cmtt-10"> [bitrate_nominal]</span><span
3542 class="cmtt-10"> =</span><span
3543 class="cmtt-10"> read</span><span
3544 class="cmtt-10"> 32</span><span
3545 class="cmtt-10"> bits</span><span
3546 class="cmtt-10"> as</span><span
3547 class="cmtt-10"> signed</span><span
3548 class="cmtt-10"> integer</span>
3549 <br class="fancyvrb" /><a
3550 id="x1-62012r6"></a><span
3551 class="cmtt-10"> </span><span
3552 class="cmtt-10"> </span><span
3553 class="cmtt-10"> 6)</span><span
3554 class="cmtt-10"> [bitrate_minimum]</span><span
3555 class="cmtt-10"> =</span><span
3556 class="cmtt-10"> read</span><span
3557 class="cmtt-10"> 32</span><span
3558 class="cmtt-10"> bits</span><span
3559 class="cmtt-10"> as</span><span
3560 class="cmtt-10"> signed</span><span
3561 class="cmtt-10"> integer</span>
3562 <br class="fancyvrb" /><a
3563 id="x1-62014r7"></a><span
3564 class="cmtt-10"> </span><span
3565 class="cmtt-10"> </span><span
3566 class="cmtt-10"> 7)</span><span
3567 class="cmtt-10"> [blocksize_0]</span><span
3568 class="cmtt-10"> =</span><span
3569 class="cmtt-10"> 2</span><span
3570 class="cmtt-10"> exponent</span><span
3571 class="cmtt-10"> (read</span><span
3572 class="cmtt-10"> 4</span><span
3573 class="cmtt-10"> bits</span><span
3574 class="cmtt-10"> as</span><span
3575 class="cmtt-10"> unsigned</span><span
3576 class="cmtt-10"> integer)</span>
3577 <br class="fancyvrb" /><a
3578 id="x1-62016r8"></a><span
3579 class="cmtt-10"> </span><span
3580 class="cmtt-10"> </span><span
3581 class="cmtt-10"> 8)</span><span
3582 class="cmtt-10"> [blocksize_1]</span><span
3583 class="cmtt-10"> =</span><span
3584 class="cmtt-10"> 2</span><span
3585 class="cmtt-10"> exponent</span><span
3586 class="cmtt-10"> (read</span><span
3587 class="cmtt-10"> 4</span><span
3588 class="cmtt-10"> bits</span><span
3589 class="cmtt-10"> as</span><span
3590 class="cmtt-10"> unsigned</span><span
3591 class="cmtt-10"> integer)</span>
3592 <br class="fancyvrb" /><a
3593 id="x1-62018r9"></a><span
3594 class="cmtt-10"> </span><span
3595 class="cmtt-10"> </span><span
3596 class="cmtt-10"> 9)</span><span
3597 class="cmtt-10"> [framing_flag]</span><span
3598 class="cmtt-10"> =</span><span
3599 class="cmtt-10"> read</span><span
3600 class="cmtt-10"> one</span><span
3601 class="cmtt-10"> bit</span>
3603 <!--l. 62--><p class="noindent" ><span
3604 class="cmtt-10x-x-109">[vorbis_version] </span>is to read ’0’ in order to be compatible with this document. Both
3606 class="cmtt-10x-x-109">[audio_channels] </span>and <span
3607 class="cmtt-10x-x-109">[audio_sample_rate] </span>must read greater than zero. Allowed final blocksize
3608 values are 64, 128, 256, 512, 1024, 2048, 4096 and 8192 in Vorbis I. <span
3609 class="cmtt-10x-x-109">[blocksize_0] </span>must be less
3610 than or equal to <span
3611 class="cmtt-10x-x-109">[blocksize_1]</span>. The framing bit must be nonzero. Failure to meet any of these
3612 conditions renders a stream undecodable.
3613 <!--l. 70--><p class="noindent" >The bitrate fields above are used only as hints. The nominal bitrate field especially may be
3614 considerably off in purely VBR streams. The fields are meaningful only when greater than
3616 <ul class="itemize1">
3617 <li class="itemize">All three fields set to the same value implies a fixed rate, or tightly bounded, nearly
3618 fixed-rate bitstream
3620 <li class="itemize">Only nominal set implies a VBR or ABR stream that averages the nominal bitrate
3622 <li class="itemize">Maximum and or minimum set implies a VBR bitstream that obeys the bitrate limits
3624 <li class="itemize">None set indicates the encoder does not care to speculate.</li></ul>
3625 <!--l. 84--><p class="noindent" >
3629 <h5 class="subsubsectionHead"><span class="titlemark">4.2.3 </span> <a
3630 id="x1-630004.2.3"></a>Comment header</h5>
3631 <!--l. 85--><p class="noindent" >Comment header decode and data specification is covered in <a
3632 href="#x1-810005">Section 5<!--tex4ht:ref: vorbis:spec:comment --></a>, “<a
3633 href="#x1-810005">comment field and header
3634 specification<!--tex4ht:ref: vorbis:spec:comment --></a>”.
3635 <!--l. 89--><p class="noindent" >
3636 <h5 class="subsubsectionHead"><span class="titlemark">4.2.4 </span> <a
3637 id="x1-640004.2.4"></a>Setup header</h5>
3638 <!--l. 91--><p class="noindent" >Vorbis codec setup is configurable to an extreme degree:
3641 <!--l. 93--><p class="noindent" >
3643 <!--l. 94--><p class="noindent" ><img
3644 src="components.png" alt="PIC"
3646 <br /> <table class="caption"
3647 ><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 6: </td><td
3648 class="content">decoder pipeline configuration</td></tr></table><!--tex4ht:label?: x1-640016 -->
3650 <!--l. 99--><p class="noindent" >The setup header contains the bulk of the codec setup information needed for decode. The setup
3651 header contains, in order, the lists of codebook configurations, time-domain transform
3652 configurations (placeholders in Vorbis I), floor configurations, residue configurations, channel
3653 mapping configurations and mode configurations. It finishes with a framing bit of ’1’. Header decode
3654 proceeds in the following order:
3655 <!--l. 107--><p class="noindent" ><span class="paragraphHead"><a
3656 id="x1-650004.2.4"></a><span
3657 class="cmbx-10x-x-109">Codebooks</span></span>
3658 <ol class="enumerate1" >
3660 class="enumerate" id="x1-65002x1"><span
3661 class="cmtt-10x-x-109">[vorbis_codebook_count] </span>= read eight bits as unsigned integer and add one
3664 class="enumerate" id="x1-65004x2">Decode <span
3665 class="cmtt-10x-x-109">[vorbis_codebook_count] </span>codebooks in order as defined in <a
3666 href="#x1-470003">Section 3<!--tex4ht:ref: vorbis:spec:codebook --></a>,
3668 href="#x1-470003">Probability Model and Codebooks<!--tex4ht:ref: vorbis:spec:codebook --></a>”. Save each configuration, in order, in an array of
3669 codebook configurations <span
3670 class="cmtt-10x-x-109">[vorbis_codebook_configurations]</span>.</li></ol>
3671 <!--l. 119--><p class="noindent" ><span class="paragraphHead"><a
3672 id="x1-660004.2.4"></a><span
3673 class="cmbx-10x-x-109">Time domain transforms</span></span>
3674 These hooks are placeholders in Vorbis I. Nevertheless, the configuration placeholder values must be
3675 read to maintain bitstream sync.
3679 <!--l. 126--><p class="noindent" >
3680 <ol class="enumerate1" >
3682 class="enumerate" id="x1-66002x1"><span
3683 class="cmtt-10x-x-109">[vorbis_time_count] </span>= read 6 bits as unsigned integer and add one
3686 class="enumerate" id="x1-66004x2">read <span
3687 class="cmtt-10x-x-109">[vorbis_time_count] </span>16 bit values; each value should be zero. If any value is
3688 nonzero, this is an error condition and the stream is undecodable.</li></ol>
3689 <!--l. 132--><p class="noindent" ><span class="paragraphHead"><a
3690 id="x1-670004.2.4"></a><span
3691 class="cmbx-10x-x-109">Floors</span></span>
3692 Vorbis uses two floor types; header decode is handed to the decode abstraction of the appropriate
3694 <!--l. 138--><p class="noindent" >
3695 <ol class="enumerate1" >
3697 class="enumerate" id="x1-67002x1"><span
3698 class="cmtt-10x-x-109">[vorbis_floor_count] </span>= read 6 bits as unsigned integer and add one
3701 class="enumerate" id="x1-67004x2">For each <span
3702 class="cmtt-10x-x-109">[i] </span>of <span
3703 class="cmtt-10x-x-109">[vorbis_floor_count] </span>floor numbers:
3704 <ol class="enumerate2" >
3706 class="enumerate" id="x1-67006x1">read the floor type: vector <span
3707 class="cmtt-10x-x-109">[vorbis_floor_types] </span>element <span
3708 class="cmtt-10x-x-109">[i] </span>= read 16 bits as
3712 class="enumerate" id="x1-67008x2">If the floor type is zero, decode the floor configuration as defined in <a
3713 href="#x1-890006">Section 6<!--tex4ht:ref: vorbis:spec:floor0 --></a>,
3715 href="#x1-890006">Floor type 0 setup and decode<!--tex4ht:ref: vorbis:spec:floor0 --></a>”; save this configuration in slot <span
3716 class="cmtt-10x-x-109">[i] </span>of the floor
3717 configuration array <span
3718 class="cmtt-10x-x-109">[vorbis_floor_configurations]</span>.
3721 class="enumerate" id="x1-67010x3">If the floor type is one, decode the floor configuration as defined in <a
3722 href="#x1-950007">Section 7<!--tex4ht:ref: vorbis:spec:floor1 --></a>,
3724 href="#x1-950007">Floor type 1 setup and decode<!--tex4ht:ref: vorbis:spec:floor1 --></a>”; save this configuration in slot <span
3725 class="cmtt-10x-x-109">[i] </span>of the floor
3726 configuration array <span
3727 class="cmtt-10x-x-109">[vorbis_floor_configurations]</span>.
3730 class="enumerate" id="x1-67012x4">If the the floor type is greater than one, this stream is undecodable; ERROR
3733 <!--l. 156--><p class="noindent" ><span class="paragraphHead"><a
3734 id="x1-680004.2.4"></a><span
3735 class="cmbx-10x-x-109">Residues</span></span>
3736 Vorbis uses three residue types; header decode of each type is identical.
3737 <!--l. 162--><p class="noindent" >
3741 <ol class="enumerate1" >
3743 class="enumerate" id="x1-68002x1"><span
3744 class="cmtt-10x-x-109">[vorbis_residue_count] </span>= read 6 bits as unsigned integer and add one
3747 class="enumerate" id="x1-68004x2">For each of <span
3748 class="cmtt-10x-x-109">[vorbis_residue_count] </span>residue numbers:
3749 <ol class="enumerate2" >
3751 class="enumerate" id="x1-68006x1">read the residue type; vector <span
3752 class="cmtt-10x-x-109">[vorbis_residue_types] </span>element <span
3753 class="cmtt-10x-x-109">[i] </span>= read 16
3754 bits as unsigned integer
3757 class="enumerate" id="x1-68008x2">If the residue type is zero, one or two, decode the residue configuration as defined
3759 href="#x1-1020008">Section 8<!--tex4ht:ref: vorbis:spec:residue --></a>, “<a
3760 href="#x1-1020008">Residue setup and decode<!--tex4ht:ref: vorbis:spec:residue --></a>”; save this configuration in slot <span
3761 class="cmtt-10x-x-109">[i] </span>of
3762 the residue configuration array <span
3763 class="cmtt-10x-x-109">[vorbis_residue_configurations]</span>.
3766 class="enumerate" id="x1-68010x3">If the the residue type is greater than two, this stream is undecodable; ERROR
3769 <!--l. 176--><p class="noindent" ><span class="paragraphHead"><a
3770 id="x1-690004.2.4"></a><span
3771 class="cmbx-10x-x-109">Mappings</span></span>
3772 Mappings are used to set up specific pipelines for encoding multichannel audio with varying channel
3773 mapping applications. Vorbis I uses a single mapping type (0), with implicit PCM channel
3775 <!--l. 187--><p class="noindent" >
3776 <ol class="enumerate1" >
3778 class="enumerate" id="x1-69002x1"><span
3779 class="cmtt-10x-x-109">[vorbis_mapping_count] </span>= read 6 bits as unsigned integer and add one
3782 class="enumerate" id="x1-69004x2">For each <span
3783 class="cmtt-10x-x-109">[i] </span>of <span
3784 class="cmtt-10x-x-109">[vorbis_mapping_count] </span>mapping numbers:
3785 <ol class="enumerate2" >
3787 class="enumerate" id="x1-69006x1">read the mapping type: 16 bits as unsigned integer. There’s no reason to save the
3788 mapping type in Vorbis I.
3791 class="enumerate" id="x1-69008x2">If the mapping type is nonzero, the stream is undecodable
3794 class="enumerate" id="x1-69010x3">If the mapping type is zero:
3795 <ol class="enumerate3" >
3797 class="enumerate" id="x1-69012x1">read 1 bit as a boolean flag
3798 <ol class="enumerate4" >
3800 class="enumerate" id="x1-69014x1">if set, <span
3801 class="cmtt-10x-x-109">[vorbis_mapping_submaps] </span>= read 4 bits as unsigned integer and
3808 class="enumerate" id="x1-69016x2">if unset, <span
3809 class="cmtt-10x-x-109">[vorbis_mapping_submaps] </span>= 1</li></ol>
3812 class="enumerate" id="x1-69018x2">read 1 bit as a boolean flag
3813 <ol class="enumerate4" >
3815 class="enumerate" id="x1-69020x1">if set, square polar channel mapping is in use:
3816 <ul class="itemize1">
3817 <li class="itemize"><span
3818 class="cmtt-10x-x-109">[vorbis_mapping_coupling_steps] </span>= read 8 bits as unsigned integer
3821 <li class="itemize">for <span
3822 class="cmtt-10x-x-109">[j] </span>each of <span
3823 class="cmtt-10x-x-109">[vorbis_mapping_coupling_steps] </span>steps:
3824 <ul class="itemize2">
3825 <li class="itemize">vector <span
3826 class="cmtt-10x-x-109">[vorbis_mapping_magnitude] </span>element <span
3827 class="cmtt-10x-x-109">[j]</span>= read
3829 href="#x1-1170009.2.1">ilog</a>(<span
3830 class="cmtt-10x-x-109">[audio_channels] </span>- 1) bits as unsigned integer
3832 <li class="itemize">vector <span
3833 class="cmtt-10x-x-109">[vorbis_mapping_angle] </span>element <span
3834 class="cmtt-10x-x-109">[j]</span>= read
3836 href="#x1-1170009.2.1">ilog</a>(<span
3837 class="cmtt-10x-x-109">[audio_channels] </span>- 1) bits as unsigned integer
3839 <li class="itemize">the numbers read in the above two steps are channel numbers
3840 representing the channel to treat as magnitude and the channel to
3841 treat as angle, respectively. If for any coupling step the angle channel
3842 number equals the magnitude channel number, the magnitude channel
3843 number is greater than <span
3844 class="cmtt-10x-x-109">[audio_channels]</span>-1, or the angle channel is
3846 class="cmtt-10x-x-109">[audio_channels]</span>-1, the stream is undecodable.</li></ul>
3850 class="enumerate" id="x1-69022x2">if unset, <span
3851 class="cmtt-10x-x-109">[vorbis_mapping_coupling_steps] </span>= 0</li></ol>
3854 class="enumerate" id="x1-69024x3">read 2 bits (reserved field); if the value is nonzero, the stream is undecodable
3857 class="enumerate" id="x1-69026x4">if <span
3858 class="cmtt-10x-x-109">[vorbis_mapping_submaps] </span>is greater than one, we read channel multiplex
3859 settings. For each <span
3860 class="cmtt-10x-x-109">[j] </span>of <span
3861 class="cmtt-10x-x-109">[audio_channels] </span>channels:
3862 <ol class="enumerate4" >
3864 class="enumerate" id="x1-69028x1">vector <span
3865 class="cmtt-10x-x-109">[vorbis_mapping_mux] </span>element <span
3866 class="cmtt-10x-x-109">[j] </span>= read 4 bits as unsigned
3870 class="enumerate" id="x1-69030x2">if the value is
3871 greater than the highest numbered submap (<span
3872 class="cmtt-10x-x-109">[vorbis_mapping_submaps]</span>
3873 - 1), this in an error condition rendering the stream undecodable</li></ol>
3879 class="enumerate" id="x1-69032x5">for each submap <span
3880 class="cmtt-10x-x-109">[j] </span>of <span
3881 class="cmtt-10x-x-109">[vorbis_mapping_submaps] </span>submaps, read the floor and
3882 residue numbers for use in decoding that submap:
3883 <ol class="enumerate4" >
3885 class="enumerate" id="x1-69034x1">read and discard 8 bits (the unused time configuration placeholder)
3888 class="enumerate" id="x1-69036x2">read 8 bits as unsigned integer for the floor number; save in vector
3890 class="cmtt-10x-x-109">[vorbis_mapping_submap_floor] </span>element <span
3891 class="cmtt-10x-x-109">[j]</span>
3894 class="enumerate" id="x1-69038x3">verify the floor number is not greater than the highest number floor
3895 configured for the bitstream. If it is, the bitstream is undecodable
3898 class="enumerate" id="x1-69040x4">read 8 bits as unsigned integer for the residue number; save in vector
3900 class="cmtt-10x-x-109">[vorbis_mapping_submap_residue] </span>element <span
3901 class="cmtt-10x-x-109">[j]</span>
3904 class="enumerate" id="x1-69042x5">verify the residue number is not greater than the highest number residue
3905 configured for the bitstream. If it is, the bitstream is undecodable</li></ol>
3908 class="enumerate" id="x1-69044x6">save this mapping configuration in slot <span
3909 class="cmtt-10x-x-109">[i] </span>of the mapping configuration array
3911 class="cmtt-10x-x-109">[vorbis_mapping_configurations]</span>.</li></ol>
3914 <!--l. 246--><p class="noindent" ><span class="paragraphHead"><a
3915 id="x1-700004.2.4"></a><span
3916 class="cmbx-10x-x-109">Modes</span></span>
3917 <ol class="enumerate1" >
3919 class="enumerate" id="x1-70002x1"><span
3920 class="cmtt-10x-x-109">[vorbis_mode_count] </span>= read 6 bits as unsigned integer and add one
3923 class="enumerate" id="x1-70004x2">For each of <span
3924 class="cmtt-10x-x-109">[vorbis_mode_count] </span>mode numbers:
3925 <ol class="enumerate2" >
3927 class="enumerate" id="x1-70006x1"><span
3928 class="cmtt-10x-x-109">[vorbis_mode_blockflag] </span>= read 1 bit
3931 class="enumerate" id="x1-70008x2"><span
3932 class="cmtt-10x-x-109">[vorbis_mode_windowtype] </span>= read 16 bits as unsigned integer
3935 class="enumerate" id="x1-70010x3"><span
3936 class="cmtt-10x-x-109">[vorbis_mode_transformtype] </span>= read 16 bits as unsigned integer
3939 class="enumerate" id="x1-70012x4"><span
3940 class="cmtt-10x-x-109">[vorbis_mode_mapping] </span>= read 8 bits as unsigned integer
3946 class="enumerate" id="x1-70014x5">verify ranges; zero is the only legal value
3947 in Vorbis I for <span
3948 class="cmtt-10x-x-109">[vorbis_mode_windowtype] </span>and <span
3949 class="cmtt-10x-x-109">[vorbis_mode_transformtype]</span>.
3951 class="cmtt-10x-x-109">[vorbis_mode_mapping] </span>must not be greater than the highest number mapping
3952 in use. Any illegal values render the stream undecodable.
3955 class="enumerate" id="x1-70016x6">save this mode configuration in slot <span
3956 class="cmtt-10x-x-109">[i] </span>of the mode configuration array
3958 class="cmtt-10x-x-109">[vorbis_mode_configurations]</span>.</li></ol>
3961 class="enumerate" id="x1-70018x3">read 1 bit as a framing flag. If unset, a framing error occurred and the stream is not
3962 decodable.</li></ol>
3963 <!--l. 267--><p class="noindent" >After reading mode descriptions, setup header decode is complete.
3964 <!--l. 276--><p class="noindent" >
3965 <h4 class="subsectionHead"><span class="titlemark">4.3 </span> <a
3966 id="x1-710004.3"></a>Audio packet decode and synthesis</h4>
3967 <!--l. 278--><p class="noindent" >Following the three header packets, all packets in a Vorbis I stream are audio. The first step of
3968 audio packet decode is to read and verify the packet type. <span
3969 class="cmti-10x-x-109">A non-audio packet when audio is</span>
3971 class="cmti-10x-x-109">expected indicates stream corruption or a non-compliant stream. The decoder must ignore the packet</span>
3973 class="cmti-10x-x-109">and not attempt decoding it to audio</span>.
3974 <!--l. 285--><p class="noindent" >
3975 <h5 class="subsubsectionHead"><span class="titlemark">4.3.1 </span> <a
3976 id="x1-720004.3.1"></a>packet type, mode and window decode</h5>
3977 <!--l. 288--><p class="noindent" >
3978 <ol class="enumerate1" >
3980 class="enumerate" id="x1-72002x1">read 1 bit <span
3981 class="cmtt-10x-x-109">[packet_type]</span>; check that packet type is 0 (audio)
3984 class="enumerate" id="x1-72004x2">read <a
3985 href="#x1-1170009.2.1">ilog</a>([vorbis˙mode˙count]-1) bits <span
3986 class="cmtt-10x-x-109">[mode_number]</span>
3989 class="enumerate" id="x1-72006x3">decode blocksize <span
3990 class="cmtt-10x-x-109">[n] </span>is equal to <span
3991 class="cmtt-10x-x-109">[blocksize_0] </span>if <span
3992 class="cmtt-10x-x-109">[vorbis_mode_blockflag] </span>is 0, else
3994 class="cmtt-10x-x-109">[n] </span>is equal to <span
3995 class="cmtt-10x-x-109">[blocksize_1]</span>.
3998 class="enumerate" id="x1-72008x4">perform window selection and setup; this window is used later by the inverse MDCT:
3999 <ol class="enumerate2" >
4001 class="enumerate" id="x1-72010x1">if this is a long window (the <span
4002 class="cmtt-10x-x-109">[vorbis_mode_blockflag] </span>flag of this mode is
4007 <ol class="enumerate3" >
4009 class="enumerate" id="x1-72012x1">read 1 bit for <span
4010 class="cmtt-10x-x-109">[previous_window_flag]</span>
4013 class="enumerate" id="x1-72014x2">read 1 bit for <span
4014 class="cmtt-10x-x-109">[next_window_flag]</span>
4017 class="enumerate" id="x1-72016x3">if <span
4018 class="cmtt-10x-x-109">[previous_window_flag] </span>is not set, the left half of the window will be a
4019 hybrid window for lapping with a short block. See <a
4020 href="#x1-260001.3.2">paragraph 1.3.2<!--tex4ht:ref: vorbis:spec:window --></a>, “<a
4021 href="#x1-260001.3.2">Window
4022 shape decode (long windows only)<!--tex4ht:ref: vorbis:spec:window --></a>” for an illustration of overlapping dissimilar
4023 windows. Else, the left half window will have normal long shape.
4026 class="enumerate" id="x1-72018x4">if <span
4027 class="cmtt-10x-x-109">[next_window_flag] </span>is not set, the right half of the window will be a
4028 hybrid window for lapping with a short block. See <a
4029 href="#x1-260001.3.2">paragraph 1.3.2<!--tex4ht:ref: vorbis:spec:window --></a>, “<a
4030 href="#x1-260001.3.2">Window
4031 shape decode (long windows only)<!--tex4ht:ref: vorbis:spec:window --></a>” for an illustration of overlapping dissimilar
4032 windows. Else, the left right window will have normal long shape.</li></ol>
4035 class="enumerate" id="x1-72020x2">if this is a short window, the window is always the same short-window shape.</li></ol>
4037 <!--l. 320--><p class="noindent" >Vorbis windows all use the slope function <span
4038 class="cmmi-10x-x-109">y </span>= sin(<img
4039 src="Vorbis_I_spec1x.png" alt="π
4040 2" class="frac" align="middle"> <span
4041 class="cmsy-10x-x-109">*</span> sin<sup><span
4042 class="cmr-8">2</span></sup>((<span
4043 class="cmmi-10x-x-109">x </span>+ 0<span
4044 class="cmmi-10x-x-109">.</span>5)<span
4045 class="cmmi-10x-x-109">∕n</span><span
4046 class="cmsy-10x-x-109">*</span><span
4047 class="cmmi-10x-x-109">π</span>)), where <span
4048 class="cmmi-10x-x-109">n </span>is window size
4050 class="cmmi-10x-x-109">x </span>ranges 0<span
4051 class="cmmi-10x-x-109">…</span><span
4052 class="cmmi-10x-x-109">n </span><span
4053 class="cmsy-10x-x-109">- </span>1, but dissimilar lapping requirements can affect overall shape. Window
4054 generation proceeds as follows:
4055 <!--l. 326--><p class="noindent" >
4056 <ol class="enumerate1" >
4058 class="enumerate" id="x1-72022x1"><span
4059 class="cmtt-10x-x-109">[window_center] </span>= <span
4060 class="cmtt-10x-x-109">[n] </span>/ 2
4063 class="enumerate" id="x1-72024x2">if (<span
4064 class="cmtt-10x-x-109">[vorbis_mode_blockflag] </span>is set and <span
4065 class="cmtt-10x-x-109">[previous_window_flag] </span>is not set)
4067 <ol class="enumerate2" >
4069 class="enumerate" id="x1-72026x1"><span
4070 class="cmtt-10x-x-109">[left_window_start] </span>= <span
4071 class="cmtt-10x-x-109">[n]</span>/4 - <span
4072 class="cmtt-10x-x-109">[blocksize_0]</span>/4
4075 class="enumerate" id="x1-72028x2"><span
4076 class="cmtt-10x-x-109">[left_window_end] </span>= <span
4077 class="cmtt-10x-x-109">[n]</span>/4 + <span
4078 class="cmtt-10x-x-109">[blocksize_0]</span>/4
4081 class="enumerate" id="x1-72030x3"><span
4082 class="cmtt-10x-x-109">[left_n] </span>= <span
4083 class="cmtt-10x-x-109">[blocksize_0]</span>/2</li></ol>
4084 <!--l. 335--><p class="noindent" >else
4085 <ol class="enumerate2" >
4087 class="enumerate" id="x1-72032x1"><span
4088 class="cmtt-10x-x-109">[left_window_start] </span>= 0
4091 class="enumerate" id="x1-72034x2"><span
4092 class="cmtt-10x-x-109">[left_window_end] </span>= <span
4093 class="cmtt-10x-x-109">[window_center]</span>
4099 class="enumerate" id="x1-72036x3"><span
4100 class="cmtt-10x-x-109">[left_n] </span>= <span
4101 class="cmtt-10x-x-109">[n]</span>/2</li></ol>
4104 class="enumerate" id="x1-72038x3">if (<span
4105 class="cmtt-10x-x-109">[vorbis_mode_blockflag] </span>is set and <span
4106 class="cmtt-10x-x-109">[next_window_flag] </span>is not set) then
4107 <ol class="enumerate2" >
4109 class="enumerate" id="x1-72040x1"><span
4110 class="cmtt-10x-x-109">[right_window_start] </span>= <span
4111 class="cmtt-10x-x-109">[n]*3</span>/4 - <span
4112 class="cmtt-10x-x-109">[blocksize_0]</span>/4
4115 class="enumerate" id="x1-72042x2"><span
4116 class="cmtt-10x-x-109">[right_window_end] </span>= <span
4117 class="cmtt-10x-x-109">[n]*3</span>/4 + <span
4118 class="cmtt-10x-x-109">[blocksize_0]</span>/4
4121 class="enumerate" id="x1-72044x3"><span
4122 class="cmtt-10x-x-109">[right_n] </span>= <span
4123 class="cmtt-10x-x-109">[blocksize_0]</span>/2</li></ol>
4124 <!--l. 351--><p class="noindent" >else
4125 <ol class="enumerate2" >
4127 class="enumerate" id="x1-72046x1"><span
4128 class="cmtt-10x-x-109">[right_window_start] </span>= <span
4129 class="cmtt-10x-x-109">[window_center]</span>
4132 class="enumerate" id="x1-72048x2"><span
4133 class="cmtt-10x-x-109">[right_window_end] </span>= <span
4134 class="cmtt-10x-x-109">[n]</span>
4137 class="enumerate" id="x1-72050x3"><span
4138 class="cmtt-10x-x-109">[right_n] </span>= <span
4139 class="cmtt-10x-x-109">[n]</span>/2</li></ol>
4142 class="enumerate" id="x1-72052x4">window from range 0 ... <span
4143 class="cmtt-10x-x-109">[left_window_start]</span>-1 inclusive is zero
4146 class="enumerate" id="x1-72054x5">for <span
4147 class="cmtt-10x-x-109">[i] </span>in range <span
4148 class="cmtt-10x-x-109">[left_window_start] </span>... <span
4149 class="cmtt-10x-x-109">[left_window_end]</span>-1, window(<span
4150 class="cmtt-10x-x-109">[i]</span>) =
4152 src="Vorbis_I_spec2x.png" alt="π
4153 2" class="frac" align="middle"> <span
4154 class="cmsy-10x-x-109">*</span> sin<sup><span
4155 class="cmr-8">2</span></sup>( (<span
4156 class="cmtt-10x-x-109">[i]</span>-<span
4157 class="cmtt-10x-x-109">[left_window_start]</span>+0.5) / <span
4158 class="cmtt-10x-x-109">[left_n] </span><span
4159 class="cmsy-10x-x-109">*</span><img
4160 src="Vorbis_I_spec3x.png" alt="π
4161 2" class="frac" align="middle">) )
4164 class="enumerate" id="x1-72056x6">window from range <span
4165 class="cmtt-10x-x-109">[left_window_end] </span>... <span
4166 class="cmtt-10x-x-109">[right_window_start]</span>-1 inclusive is
4170 class="enumerate" id="x1-72058x7">for <span
4171 class="cmtt-10x-x-109">[i] </span>in range <span
4172 class="cmtt-10x-x-109">[right_window_start] </span>... <span
4173 class="cmtt-10x-x-109">[right_window_end]</span>-1, window(<span
4174 class="cmtt-10x-x-109">[i]</span>) =
4176 src="Vorbis_I_spec4x.png" alt="π
4177 2" class="frac" align="middle"> <span
4178 class="cmsy-10x-x-109">*</span> sin<sup><span
4179 class="cmr-8">2</span></sup>( (<span
4180 class="cmtt-10x-x-109">[i]</span>-<span
4181 class="cmtt-10x-x-109">[right_window_start]</span>+0.5) / <span
4182 class="cmtt-10x-x-109">[right_n] </span><span
4183 class="cmsy-10x-x-109">*</span><img
4184 src="Vorbis_I_spec5x.png" alt="π
4185 2" class="frac" align="middle"> + <img
4186 src="Vorbis_I_spec6x.png" alt="π
4187 2" class="frac" align="middle">) )
4190 class="enumerate" id="x1-72060x8">window from range <span
4191 class="cmtt-10x-x-109">[right_window_start] </span>... <span
4192 class="cmtt-10x-x-109">[n]</span>-1 is zero</li></ol>
4193 <!--l. 367--><p class="noindent" >An end-of-packet condition up to this point should be considered an error that discards this packet
4194 from the stream. An end of packet condition past this point is to be considered a possible nominal
4196 <!--l. 374--><p class="noindent" >
4197 <h5 class="subsubsectionHead"><span class="titlemark">4.3.2 </span> <a
4198 id="x1-730004.3.2"></a>floor curve decode</h5>
4202 <!--l. 376--><p class="noindent" >From this point on, we assume out decode context is using mode number <span
4203 class="cmtt-10x-x-109">[mode_number]</span>
4204 from configuration array <span
4205 class="cmtt-10x-x-109">[vorbis_mode_configurations] </span>and the map number
4207 class="cmtt-10x-x-109">[vorbis_mode_mapping] </span>(specified by the current mode) taken from the mapping configuration
4209 class="cmtt-10x-x-109">[vorbis_mapping_configurations]</span>.
4210 <!--l. 383--><p class="noindent" >Floor curves are decoded one-by-one in channel order.
4211 <!--l. 385--><p class="noindent" >For each floor <span
4212 class="cmtt-10x-x-109">[i] </span>of <span
4213 class="cmtt-10x-x-109">[audio_channels]</span>
4214 <ol class="enumerate1" >
4216 class="enumerate" id="x1-73002x1"><span
4217 class="cmtt-10x-x-109">[submap_number] </span>= element <span
4218 class="cmtt-10x-x-109">[i] </span>of vector [vorbis˙mapping˙mux]
4221 class="enumerate" id="x1-73004x2"><span
4222 class="cmtt-10x-x-109">[floor_number] </span>= element <span
4223 class="cmtt-10x-x-109">[submap_number] </span>of vector [vorbis˙submap˙floor]
4226 class="enumerate" id="x1-73006x3">if the floor type of this floor (vector <span
4227 class="cmtt-10x-x-109">[vorbis_floor_types] </span>element <span
4228 class="cmtt-10x-x-109">[floor_number]</span>)
4229 is zero then decode the floor for channel <span
4230 class="cmtt-10x-x-109">[i] </span>according to the <a
4231 href="#x1-930006.2.2">subsubsection 6.2.2<!--tex4ht:ref: vorbis:spec:floor0-decode --></a>,
4233 href="#x1-930006.2.2">packet decode<!--tex4ht:ref: vorbis:spec:floor0-decode --></a>”
4236 class="enumerate" id="x1-73008x4">if the type of this floor is one then decode the floor for channel <span
4237 class="cmtt-10x-x-109">[i] </span>according to the
4239 href="#x1-1000007.2.2">paragraph 7.2.2<!--tex4ht:ref: vorbis:spec:floor1-decode --></a>, “<a
4240 href="#x1-1000007.2.2">packet decode<!--tex4ht:ref: vorbis:spec:floor1-decode --></a>”
4243 class="enumerate" id="x1-73010x5">save the needed decoded floor information for channel for later synthesis
4246 class="enumerate" id="x1-73012x6">if the decoded floor returned ’unused’, set vector <span
4247 class="cmtt-10x-x-109">[no_residue] </span>element <span
4248 class="cmtt-10x-x-109">[i] </span>to true,
4249 else set vector <span
4250 class="cmtt-10x-x-109">[no_residue] </span>element <span
4251 class="cmtt-10x-x-109">[i] </span>to false</li></ol>
4252 <!--l. 405--><p class="noindent" >An end-of-packet condition during floor decode shall result in packet decode zeroing all channel
4253 output vectors and skipping to the add/overlap output stage.
4254 <!--l. 411--><p class="noindent" >
4255 <h5 class="subsubsectionHead"><span class="titlemark">4.3.3 </span> <a
4256 id="x1-740004.3.3"></a>nonzero vector propagate</h5>
4257 <!--l. 413--><p class="noindent" >A possible result of floor decode is that a specific vector is marked ’unused’ which indicates that
4258 that final output vector is all-zero values (and the floor is zero). The residue for that vector is not
4259 coded in the stream, save for one complication. If some vectors are used and some are not, channel
4260 coupling could result in mixing a zeroed and nonzeroed vector to produce two nonzeroed
4262 <!--l. 420--><p class="noindent" >for each <span
4263 class="cmtt-10x-x-109">[i] </span>from 0 ... <span
4264 class="cmtt-10x-x-109">[vorbis_mapping_coupling_steps]</span>-1
4265 <!--l. 423--><p class="noindent" >
4266 <ol class="enumerate1" >
4268 class="enumerate" id="x1-74002x1">if either <span
4269 class="cmtt-10x-x-109">[no_residue] </span>entry for channel (<span
4270 class="cmtt-10x-x-109">[vorbis_mapping_magnitude] </span>element <span
4271 class="cmtt-10x-x-109">[i]</span>)
4276 class="cmtt-10x-x-109">[vorbis_mapping_angle] </span>element <span
4277 class="cmtt-10x-x-109">[i]</span>) are set to false, then both must be
4278 set to false. Note that an ’unused’ floor has no decoded floor information; it is important
4279 that this is remembered at floor curve synthesis time.</li></ol>
4280 <!--l. 435--><p class="noindent" >
4281 <h5 class="subsubsectionHead"><span class="titlemark">4.3.4 </span> <a
4282 id="x1-750004.3.4"></a>residue decode</h5>
4283 <!--l. 437--><p class="noindent" >Unlike floors, which are decoded in channel order, the residue vectors are decoded in submap
4285 <!--l. 440--><p class="noindent" >for each submap <span
4286 class="cmtt-10x-x-109">[i] </span>in order from 0 ... <span
4287 class="cmtt-10x-x-109">[vorbis_mapping_submaps]</span>-1
4288 <!--l. 443--><p class="noindent" >
4289 <ol class="enumerate1" >
4291 class="enumerate" id="x1-75002x1"><span
4292 class="cmtt-10x-x-109">[ch] </span>= 0
4295 class="enumerate" id="x1-75004x2">for each channel <span
4296 class="cmtt-10x-x-109">[j] </span>in order from 0 ... <span
4297 class="cmtt-10x-x-109">[audio_channels] </span>- 1
4298 <ol class="enumerate2" >
4300 class="enumerate" id="x1-75006x1">if channel <span
4301 class="cmtt-10x-x-109">[j] </span>in submap <span
4302 class="cmtt-10x-x-109">[i] </span>(vector <span
4303 class="cmtt-10x-x-109">[vorbis_mapping_mux] </span>element <span
4304 class="cmtt-10x-x-109">[j] </span>is equal to
4306 class="cmtt-10x-x-109">[i]</span>)
4307 <ol class="enumerate3" >
4309 class="enumerate" id="x1-75008x1">if vector <span
4310 class="cmtt-10x-x-109">[no_residue] </span>element <span
4311 class="cmtt-10x-x-109">[j] </span>is true
4312 <ol class="enumerate4" >
4314 class="enumerate" id="x1-75010x1">vector <span
4315 class="cmtt-10x-x-109">[do_not_decode_flag] </span>element <span
4316 class="cmtt-10x-x-109">[ch] </span>is set</li></ol>
4317 <!--l. 452--><p class="noindent" >else
4318 <ol class="enumerate4" >
4320 class="enumerate" id="x1-75012x1">vector <span
4321 class="cmtt-10x-x-109">[do_not_decode_flag] </span>element <span
4322 class="cmtt-10x-x-109">[ch] </span>is unset</li></ol>
4325 class="enumerate" id="x1-75014x2">increment <span
4326 class="cmtt-10x-x-109">[ch]</span></li></ol>
4330 class="enumerate" id="x1-75016x3"><span
4331 class="cmtt-10x-x-109">[residue_number] </span>= vector <span
4332 class="cmtt-10x-x-109">[vorbis_mapping_submap_residue] </span>element <span
4333 class="cmtt-10x-x-109">[i]</span>
4336 class="enumerate" id="x1-75018x4"><span
4337 class="cmtt-10x-x-109">[residue_type] </span>= vector <span
4338 class="cmtt-10x-x-109">[vorbis_residue_types] </span>element <span
4339 class="cmtt-10x-x-109">[residue_number]</span>
4342 class="enumerate" id="x1-75020x5">decode <span
4343 class="cmtt-10x-x-109">[ch] </span>vectors using residue <span
4344 class="cmtt-10x-x-109">[residue_number]</span>, according to type <span
4345 class="cmtt-10x-x-109">[residue_type]</span>,
4346 also passing vector <span
4347 class="cmtt-10x-x-109">[do_not_decode_flag] </span>to indicate which vectors in the bundle should not
4348 be decoded. Correct per-vector decode length is <span
4349 class="cmtt-10x-x-109">[n]</span>/2.
4355 class="enumerate" id="x1-75022x6"><span
4356 class="cmtt-10x-x-109">[ch] </span>= 0
4359 class="enumerate" id="x1-75024x7">for each channel <span
4360 class="cmtt-10x-x-109">[j] </span>in order from 0 ... <span
4361 class="cmtt-10x-x-109">[audio_channels]</span>
4362 <ol class="enumerate2" >
4364 class="enumerate" id="x1-75026x1">if channel <span
4365 class="cmtt-10x-x-109">[j] </span>is in submap <span
4366 class="cmtt-10x-x-109">[i] </span>(vector <span
4367 class="cmtt-10x-x-109">[vorbis_mapping_mux] </span>element <span
4368 class="cmtt-10x-x-109">[j] </span>is equal to
4370 class="cmtt-10x-x-109">[i]</span>)
4371 <ol class="enumerate3" >
4373 class="enumerate" id="x1-75028x1">residue vector for channel <span
4374 class="cmtt-10x-x-109">[j] </span>is set to decoded residue vector <span
4375 class="cmtt-10x-x-109">[ch]</span>
4378 class="enumerate" id="x1-75030x2">increment <span
4379 class="cmtt-10x-x-109">[ch]</span></li></ol>
4382 <!--l. 479--><p class="noindent" >
4383 <h5 class="subsubsectionHead"><span class="titlemark">4.3.5 </span> <a
4384 id="x1-760004.3.5"></a>inverse coupling</h5>
4385 <!--l. 481--><p class="noindent" >for each <span
4386 class="cmtt-10x-x-109">[i] </span>from <span
4387 class="cmtt-10x-x-109">[vorbis_mapping_coupling_steps]</span>-1 descending to 0
4388 <!--l. 484--><p class="noindent" >
4389 <ol class="enumerate1" >
4391 class="enumerate" id="x1-76002x1"><span
4392 class="cmtt-10x-x-109">[magnitude_vector] </span>= the residue vector for channel (vector
4394 class="cmtt-10x-x-109">[vorbis_mapping_magnitude] </span>element <span
4395 class="cmtt-10x-x-109">[i]</span>)
4398 class="enumerate" id="x1-76004x2"><span
4399 class="cmtt-10x-x-109">[angle_vector] </span>= the residue vector for channel (vector <span
4400 class="cmtt-10x-x-109">[vorbis_mapping_angle]</span>
4402 class="cmtt-10x-x-109">[i]</span>)
4405 class="enumerate" id="x1-76006x3">for each scalar value <span
4406 class="cmtt-10x-x-109">[M] </span>in vector <span
4407 class="cmtt-10x-x-109">[magnitude_vector] </span>and the corresponding scalar value
4409 class="cmtt-10x-x-109">[A] </span>in vector <span
4410 class="cmtt-10x-x-109">[angle_vector]</span>:
4411 <ol class="enumerate2" >
4413 class="enumerate" id="x1-76008x1">if (<span
4414 class="cmtt-10x-x-109">[M] </span>is greater than zero)
4415 <ol class="enumerate3" >
4417 class="enumerate" id="x1-76010x1">if (<span
4418 class="cmtt-10x-x-109">[A] </span>is greater than zero)
4419 <ol class="enumerate4" >
4421 class="enumerate" id="x1-76012x1"><span
4422 class="cmtt-10x-x-109">[new_M] </span>= <span
4423 class="cmtt-10x-x-109">[M]</span>
4426 class="enumerate" id="x1-76014x2"><span
4427 class="cmtt-10x-x-109">[new_A] </span>= <span
4428 class="cmtt-10x-x-109">[M]</span>-<span
4429 class="cmtt-10x-x-109">[A]</span></li></ol>
4433 <!--l. 497--><p class="noindent" >else
4434 <ol class="enumerate4" >
4436 class="enumerate" id="x1-76016x1"><span
4437 class="cmtt-10x-x-109">[new_A] </span>= <span
4438 class="cmtt-10x-x-109">[M]</span>
4441 class="enumerate" id="x1-76018x2"><span
4442 class="cmtt-10x-x-109">[new_M] </span>= <span
4443 class="cmtt-10x-x-109">[M]</span>+<span
4444 class="cmtt-10x-x-109">[A]</span></li></ol>
4446 <!--l. 504--><p class="noindent" >else
4447 <ol class="enumerate3" >
4449 class="enumerate" id="x1-76020x1">if (<span
4450 class="cmtt-10x-x-109">[A] </span>is greater than zero)
4451 <ol class="enumerate4" >
4453 class="enumerate" id="x1-76022x1"><span
4454 class="cmtt-10x-x-109">[new_M] </span>= <span
4455 class="cmtt-10x-x-109">[M]</span>
4458 class="enumerate" id="x1-76024x2"><span
4459 class="cmtt-10x-x-109">[new_A] </span>= <span
4460 class="cmtt-10x-x-109">[M]</span>+<span
4461 class="cmtt-10x-x-109">[A]</span></li></ol>
4462 <!--l. 511--><p class="noindent" >else
4463 <ol class="enumerate4" >
4465 class="enumerate" id="x1-76026x1"><span
4466 class="cmtt-10x-x-109">[new_A] </span>= <span
4467 class="cmtt-10x-x-109">[M]</span>
4470 class="enumerate" id="x1-76028x2"><span
4471 class="cmtt-10x-x-109">[new_M] </span>= <span
4472 class="cmtt-10x-x-109">[M]</span>-<span
4473 class="cmtt-10x-x-109">[A]</span></li></ol>
4477 class="enumerate" id="x1-76030x2">set scalar value <span
4478 class="cmtt-10x-x-109">[M] </span>in vector <span
4479 class="cmtt-10x-x-109">[magnitude_vector] </span>to <span
4480 class="cmtt-10x-x-109">[new_M]</span>
4483 class="enumerate" id="x1-76032x3">set scalar value <span
4484 class="cmtt-10x-x-109">[A] </span>in vector <span
4485 class="cmtt-10x-x-109">[angle_vector] </span>to <span
4486 class="cmtt-10x-x-109">[new_A]</span></li></ol>
4488 <!--l. 528--><p class="noindent" >
4489 <h5 class="subsubsectionHead"><span class="titlemark">4.3.6 </span> <a
4490 id="x1-770004.3.6"></a>dot product</h5>
4491 <!--l. 530--><p class="noindent" >For each channel, synthesize the floor curve from the decoded floor information, according to packet
4492 type. Note that the vector synthesis length for floor computation is <span
4493 class="cmtt-10x-x-109">[n]</span>/2.
4494 <!--l. 534--><p class="noindent" >For each channel, multiply each element of the floor curve by each element of that channel’s residue
4495 vector. The result is the dot product of the floor and residue vectors for each channel; the produced
4496 vectors are the length <span
4497 class="cmtt-10x-x-109">[n]</span>/2 audio spectrum for each channel.
4498 <!--l. 542--><p class="noindent" >One point is worth mentioning about this dot product; a common mistake in a fixed point
4499 implementation might be to assume that a 32 bit fixed-point representation for floor
4503 and residue and direct multiplication of the vectors is sufficient for acceptable spectral
4504 depth in all cases because it happens to mostly work with the current Xiph.Org reference
4506 <!--l. 549--><p class="noindent" >However, floor vector values can span <span
4507 class="cmsy-10x-x-109">~</span>140dB (<span
4508 class="cmsy-10x-x-109">~</span>24 bits unsigned), and the audio spectrum vector
4509 should represent a minimum of 120dB (<span
4510 class="cmsy-10x-x-109">~</span>21 bits with sign), even when output is to a 16 bit PCM
4511 device. For the residue vector to represent full scale if the floor is nailed to <span
4512 class="cmsy-10x-x-109">-</span>140dB, it must be able
4513 to span 0 to +140dB. For the residue vector to reach full scale if the floor is nailed at 0dB, it must
4514 be able to represent <span
4515 class="cmsy-10x-x-109">-</span>140dB to +0dB. Thus, in order to handle full range dynamics, a residue
4516 vector may span <span
4517 class="cmsy-10x-x-109">-</span>140dB to +140dB entirely within spec. A 280dB range is approximately 48 bits
4518 with sign; thus the residue vector must be able to represent a 48 bit range and the dot product
4519 must be able to handle an effective 48 bit times 24 bit multiplication. This range may be
4520 achieved using large (64 bit or larger) integers, or implementing a movable binary point
4522 <!--l. 566--><p class="noindent" >
4523 <h5 class="subsubsectionHead"><span class="titlemark">4.3.7 </span> <a
4524 id="x1-780004.3.7"></a>inverse MDCT</h5>
4525 <!--l. 568--><p class="noindent" >Convert the audio spectrum vector of each channel back into time domain PCM audio via an
4526 inverse Modified Discrete Cosine Transform (MDCT). A detailed description of the MDCT
4527 is available in <span class="cite">[<a
4528 href="#XSporer/Brandenburg/Edler">1</a>]</span>. The window function used for the MDCT is the function described
4530 <!--l. 575--><p class="noindent" >
4531 <h5 class="subsubsectionHead"><span class="titlemark">4.3.8 </span> <a
4532 id="x1-790004.3.8"></a>overlap˙add</h5>
4533 <!--l. 577--><p class="noindent" >Windowed MDCT output is overlapped and added with the right hand data of the previous
4534 window such that the 3/4 point of the previous window is aligned with the 1/4 point of the
4535 current window (as illustrated in <a
4536 href="#x1-260001.3.2">paragraph 1.3.2<!--tex4ht:ref: vorbis:spec:window --></a>, “<a
4537 href="#x1-260001.3.2">Window shape decode (long windows
4538 only)<!--tex4ht:ref: vorbis:spec:window --></a>”). The overlapped portion produced from overlapping the previous and current frame
4539 data is finished data to be returned by the decoder. This data spans from the center
4540 of the previous window to the center of the current window. In the case of same-sized
4541 windows, the amount of data to return is one-half block consisting of and only of the
4542 overlapped portions. When overlapping a short and long window, much of the returned
4543 range does not actually overlap. This does not damage transform orthogonality. Pay
4544 attention however to returning the correct data range; the amount of data to be returned
4546 <!--l. 591--><p class="noindent" >
4547 <div class="fancyvrb" id="fancyvrb22">
4549 id="x1-79002r1"></a><span
4550 class="cmtt-10"> </span><span
4551 class="cmtt-10"> window_blocksize(previous_window)/4+window_blocksize(current_window)/4</span>
4556 <!--l. 595--><p class="noindent" >from the center (element windowsize/2) of the previous window to the center (element
4557 windowsize/2-1, inclusive) of the current window.
4558 <!--l. 598--><p class="noindent" >Data is not returned from the first frame; it must be used to ’prime’ the decode engine. The encoder
4559 accounts for this priming when calculating PCM offsets; after the first frame, the proper PCM
4560 output offset is ’0’ (as no data has been returned yet).
4561 <!--l. 605--><p class="noindent" >
4562 <h5 class="subsubsectionHead"><span class="titlemark">4.3.9 </span> <a
4563 id="x1-800004.3.9"></a>output channel order</h5>
4564 <!--l. 607--><p class="noindent" >Vorbis I specifies only a channel mapping type 0. In mapping type 0, channel mapping is implicitly
4565 defined as follows for standard audio applications:
4566 <!--l. 612--><p class="noindent" >
4567 <dl class="description"><dt class="description">
4569 class="cmssbx-10x-x-109">three channels</span> </dt><dd
4570 class="description">the stream is monophonic
4571 </dd><dt class="description">
4573 class="cmssbx-10x-x-109">two channels</span> </dt><dd
4574 class="description">the stream is stereo. channel order: left, right
4575 </dd><dt class="description">
4577 class="cmssbx-10x-x-109">three channels</span> </dt><dd
4578 class="description">the stream is a 1d-surround encoding. channel order: left, center, right
4579 </dd><dt class="description">
4581 class="cmssbx-10x-x-109">four channels</span> </dt><dd
4582 class="description">the stream is quadraphonic surround. channel order: front left, front right, rear
4584 </dd><dt class="description">
4586 class="cmssbx-10x-x-109">five channels</span> </dt><dd
4587 class="description">the stream is five-channel surround. channel order: front left, front center, front
4588 right, rear left, rear right
4589 </dd><dt class="description">
4591 class="cmssbx-10x-x-109">six channels</span> </dt><dd
4592 class="description">the stream is 5.1 surround. channel order: front left, front center, front right,
4593 rear left, rear right, LFE
4594 </dd><dt class="description">
4596 class="cmssbx-10x-x-109">greater than six channels</span> </dt><dd
4597 class="description">channel use and order is defined by the application
4599 <!--l. 639--><p class="noindent" >Applications using Vorbis for dedicated purposes may define channel mapping as seen fit. Future
4600 channel mappings (such as three and four channel <a
4601 href="http://www.ambisonic.net/" >Ambisonics</a>) will make use of channel mappings
4602 other than mapping 0.
4609 <h3 class="sectionHead"><span class="titlemark">5 </span> <a
4610 id="x1-810005"></a>comment field and header specification</h3>
4611 <!--l. 6--><p class="noindent" >
4612 <h4 class="subsectionHead"><span class="titlemark">5.1 </span> <a
4613 id="x1-820005.1"></a>Overview</h4>
4614 <!--l. 8--><p class="noindent" >The Vorbis text comment header is the second (of three) header packets that begin a Vorbis
4615 bitstream. It is meant for short text comments, not arbitrary metadata; arbitrary metadata belongs
4616 in a separate logical bitstream (usually an XML stream type) that provides greater structure and
4617 machine parseability.
4618 <!--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
4619 CDR. It should be a little information to remember the disc by and explain it to others; a short,
4620 to-the-point text note that need not only be a couple words, but isn’t going to be more
4621 than a short paragraph. The essentials, in other words, whatever they turn out to be,
4623 <!--l. 21--><p class="noindent" >
4625 <!--l. 22--><p class="noindent" >Honest Bob and the Factory-to-Dealer-Incentives, <span
4626 class="cmti-10x-x-109">“I’m Still Around”</span>, opening for
4627 Moxy Früvous, 1997.</div>
4628 <!--l. 29--><p class="noindent" >
4629 <h4 class="subsectionHead"><span class="titlemark">5.2 </span> <a
4630 id="x1-830005.2"></a>Comment encoding</h4>
4631 <!--l. 31--><p class="noindent" >
4632 <h5 class="subsubsectionHead"><span class="titlemark">5.2.1 </span> <a
4633 id="x1-840005.2.1"></a>Structure</h5>
4634 <!--l. 33--><p class="noindent" >The comment header is logically a list of eight-bit-clean vectors; the number of vectors is bounded
4636 class="cmr-8">32</span></sup> <span
4637 class="cmsy-10x-x-109">- </span>1 and the length of each vector is limited to 2<sup><span
4638 class="cmr-8">32</span></sup> <span
4639 class="cmsy-10x-x-109">- </span>1 bytes. The vector length is encoded;
4640 the vector contents themselves are not null terminated. In addition to the vector list,
4641 there is a single vector for vendor name (also 8 bit clean, length encoded in 32 bits).
4642 For example, the 1.0 release of libvorbis set the vendor string to “Xiph.Org libVorbis I
4647 <!--l. 41--><p class="noindent" >The vector lengths and number of vectors are stored lsb first, according to the bit packing
4648 conventions of the vorbis codec. However, since data in the comment header is octet-aligned, they
4649 can simply be read as unaligned 32 bit little endian unsigned integers.
4650 <!--l. 46--><p class="noindent" >The comment header is decoded as follows:
4651 <!--l. 48--><p class="noindent" >
4652 <div class="fancyvrb" id="fancyvrb23">
4654 id="x1-84002r1"></a><span
4655 class="cmtt-10"> </span><span
4656 class="cmtt-10"> </span><span
4657 class="cmtt-10"> </span><span
4658 class="cmtt-10"> 1)</span><span
4659 class="cmtt-10"> [vendor_length]</span><span
4660 class="cmtt-10"> =</span><span
4661 class="cmtt-10"> read</span><span
4662 class="cmtt-10"> an</span><span
4663 class="cmtt-10"> unsigned</span><span
4664 class="cmtt-10"> integer</span><span
4665 class="cmtt-10"> of</span><span
4666 class="cmtt-10"> 32</span><span
4667 class="cmtt-10"> bits</span>
4668 <br class="fancyvrb" /><a
4669 id="x1-84004r2"></a><span
4670 class="cmtt-10"> </span><span
4671 class="cmtt-10"> </span><span
4672 class="cmtt-10"> </span><span
4673 class="cmtt-10"> 2)</span><span
4674 class="cmtt-10"> [vendor_string]</span><span
4675 class="cmtt-10"> =</span><span
4676 class="cmtt-10"> read</span><span
4677 class="cmtt-10"> a</span><span
4678 class="cmtt-10"> UTF-8</span><span
4679 class="cmtt-10"> vector</span><span
4680 class="cmtt-10"> as</span><span
4681 class="cmtt-10"> [vendor_length]</span><span
4682 class="cmtt-10"> octets</span>
4683 <br class="fancyvrb" /><a
4684 id="x1-84006r3"></a><span
4685 class="cmtt-10"> </span><span
4686 class="cmtt-10"> </span><span
4687 class="cmtt-10"> </span><span
4688 class="cmtt-10"> 3)</span><span
4689 class="cmtt-10"> [user_comment_list_length]</span><span
4690 class="cmtt-10"> =</span><span
4691 class="cmtt-10"> read</span><span
4692 class="cmtt-10"> an</span><span
4693 class="cmtt-10"> unsigned</span><span
4694 class="cmtt-10"> integer</span><span
4695 class="cmtt-10"> of</span><span
4696 class="cmtt-10"> 32</span><span
4697 class="cmtt-10"> bits</span>
4698 <br class="fancyvrb" /><a
4699 id="x1-84008r4"></a><span
4700 class="cmtt-10"> </span><span
4701 class="cmtt-10"> </span><span
4702 class="cmtt-10"> </span><span
4703 class="cmtt-10"> 4)</span><span
4704 class="cmtt-10"> iterate</span><span
4705 class="cmtt-10"> [user_comment_list_length]</span><span
4706 class="cmtt-10"> times</span><span
4707 class="cmtt-10"> {</span>
4708 <br class="fancyvrb" /><a
4709 id="x1-84010r5"></a><span
4710 class="cmtt-10"> </span><span
4711 class="cmtt-10"> </span><span
4712 class="cmtt-10"> </span><span
4713 class="cmtt-10"> </span><span
4714 class="cmtt-10"> </span><span
4715 class="cmtt-10"> </span><span
4716 class="cmtt-10"> </span><span
4717 class="cmtt-10"> </span><span
4718 class="cmtt-10"> 5)</span><span
4719 class="cmtt-10"> [length]</span><span
4720 class="cmtt-10"> =</span><span
4721 class="cmtt-10"> read</span><span
4722 class="cmtt-10"> an</span><span
4723 class="cmtt-10"> unsigned</span><span
4724 class="cmtt-10"> integer</span><span
4725 class="cmtt-10"> of</span><span
4726 class="cmtt-10"> 32</span><span
4727 class="cmtt-10"> bits</span>
4728 <br class="fancyvrb" /><a
4729 id="x1-84012r6"></a><span
4730 class="cmtt-10"> </span><span
4731 class="cmtt-10"> </span><span
4732 class="cmtt-10"> </span><span
4733 class="cmtt-10"> </span><span
4734 class="cmtt-10"> </span><span
4735 class="cmtt-10"> </span><span
4736 class="cmtt-10"> </span><span
4737 class="cmtt-10"> </span><span
4738 class="cmtt-10"> 6)</span><span
4739 class="cmtt-10"> this</span><span
4740 class="cmtt-10"> iteration’s</span><span
4741 class="cmtt-10"> user</span><span
4742 class="cmtt-10"> comment</span><span
4743 class="cmtt-10"> =</span><span
4744 class="cmtt-10"> read</span><span
4745 class="cmtt-10"> a</span><span
4746 class="cmtt-10"> UTF-8</span><span
4747 class="cmtt-10"> vector</span><span
4748 class="cmtt-10"> as</span><span
4749 class="cmtt-10"> [length]</span><span
4750 class="cmtt-10"> octets</span>
4751 <br class="fancyvrb" /><a
4752 id="x1-84014r7"></a><span
4753 class="cmtt-10"> </span><span
4754 class="cmtt-10"> </span><span
4755 class="cmtt-10"> </span><span
4756 class="cmtt-10"> </span><span
4757 class="cmtt-10"> </span><span
4758 class="cmtt-10"> </span><span
4759 class="cmtt-10"> }</span>
4760 <br class="fancyvrb" /><a
4761 id="x1-84016r8"></a><span
4762 class="cmtt-10"> </span><span
4763 class="cmtt-10"> </span><span
4764 class="cmtt-10"> </span><span
4765 class="cmtt-10"> 7)</span><span
4766 class="cmtt-10"> [framing_bit]</span><span
4767 class="cmtt-10"> =</span><span
4768 class="cmtt-10"> read</span><span
4769 class="cmtt-10"> a</span><span
4770 class="cmtt-10"> single</span><span
4771 class="cmtt-10"> bit</span><span
4772 class="cmtt-10"> as</span><span
4773 class="cmtt-10"> boolean</span>
4774 <br class="fancyvrb" /><a
4775 id="x1-84018r9"></a><span
4776 class="cmtt-10"> </span><span
4777 class="cmtt-10"> </span><span
4778 class="cmtt-10"> </span><span
4779 class="cmtt-10"> 8)</span><span
4780 class="cmtt-10"> if</span><span
4781 class="cmtt-10"> (</span><span
4782 class="cmtt-10"> [framing_bit]</span><span
4783 class="cmtt-10"> unset</span><span
4784 class="cmtt-10"> or</span><span
4785 class="cmtt-10"> end-of-packet</span><span
4786 class="cmtt-10"> )</span><span
4787 class="cmtt-10"> then</span><span
4788 class="cmtt-10"> ERROR</span>
4789 <br class="fancyvrb" /><a
4790 id="x1-84020r10"></a><span
4791 class="cmtt-10"> </span><span
4792 class="cmtt-10"> </span><span
4793 class="cmtt-10"> </span><span
4794 class="cmtt-10"> 9)</span><span
4795 class="cmtt-10"> done.</span>
4797 <!--l. 64--><p class="noindent" >
4798 <h5 class="subsubsectionHead"><span class="titlemark">5.2.2 </span> <a
4799 id="x1-850005.2.2"></a>Content vector format</h5>
4800 <!--l. 66--><p class="noindent" >The comment vectors are structured similarly to a UNIX environment variable. That is, comment
4801 fields consist of a field name and a corresponding value and look like:
4802 <!--l. 70--><p class="noindent" >
4804 <!--l. 71--><p class="noindent" >
4805 <div class="fancyvrb" id="fancyvrb24">
4807 id="x1-85002r1"></a><span
4808 class="cmtt-10"> </span><span
4809 class="cmtt-10"> comment[0]="ARTIST=me";</span>
4810 <br class="fancyvrb" /><a
4811 id="x1-85004r2"></a><span
4812 class="cmtt-10"> </span><span
4813 class="cmtt-10"> comment[1]="TITLE=the</span><span
4814 class="cmtt-10"> sound</span><span
4815 class="cmtt-10"> of</span><span
4816 class="cmtt-10"> Vorbis";</span>
4819 <!--l. 77--><p class="noindent" >The field name is case-insensitive and may consist of ASCII 0x20 through 0x7D, 0x3D (’=’)
4820 excluded. ASCII 0x41 through 0x5A inclusive (characters A-Z) is to be considered equivalent to
4821 ASCII 0x61 through 0x7A inclusive (characters a-z).
4822 <!--l. 83--><p class="noindent" >The field name is immediately followed by ASCII 0x3D (’=’); this equals sign is used to terminate
4827 <!--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
4829 <!--l. 91--><p class="noindent" ><span class="paragraphHead"><a
4830 id="x1-860005.2.2"></a><span
4831 class="cmbx-10x-x-109">Field names</span></span>
4832 Below is a proposed, minimal list of standard field names with a description of intended use. No
4833 single or group of field names is mandatory; a comment header may contain one, all or none of the
4835 <!--l. 99--><p class="noindent" >
4836 <dl class="description"><dt class="description">
4838 class="cmssbx-10x-x-109">TITLE</span> </dt><dd
4839 class="description">Track/Work name
4840 </dd><dt class="description">
4842 class="cmssbx-10x-x-109">VERSION</span> </dt><dd
4843 class="description">The version field may be used to differentiate multiple versions of the same track
4844 title in a single collection. (e.g. remix info)
4845 </dd><dt class="description">
4847 class="cmssbx-10x-x-109">ALBUM</span> </dt><dd
4848 class="description">The collection name to which this track belongs
4849 </dd><dt class="description">
4851 class="cmssbx-10x-x-109">TRACKNUMBER</span> </dt><dd
4852 class="description">The track number of this piece if part of a specific larger collection or
4854 </dd><dt class="description">
4856 class="cmssbx-10x-x-109">ARTIST</span> </dt><dd
4857 class="description">The artist generally considered responsible for the work. In popular music this is
4858 usually the performing band or singer. For classical music it would be the composer.
4859 For an audio book it would be the author of the original text.
4860 </dd><dt class="description">
4862 class="cmssbx-10x-x-109">PERFORMER</span> </dt><dd
4863 class="description">The artist(s) who performed the work. In classical music this would be the
4864 conductor, orchestra, soloists. In an audio book it would be the actor who did the
4865 reading. In popular music this is typically the same as the ARTIST and is omitted.
4866 </dd><dt class="description">
4868 class="cmssbx-10x-x-109">COPYRIGHT</span> </dt><dd
4869 class="description">Copyright attribution, e.g., ’2001 Nobody’s Band’ or ’1999 Jack Moffitt’
4870 </dd><dt class="description">
4872 class="cmssbx-10x-x-109">LICENSE</span> </dt><dd
4873 class="description">License information, eg, ’All Rights Reserved’, ’Any Use Permitted’, a URL to a
4875 Creative Commons license (”www.creativecommons.org/blahblah/license.html”) or the
4876 EFF Open Audio License (’distributed under the terms of the Open Audio License. see
4877 http://www.eff.org/IP/Open˙licenses/eff˙oal.html for details’), etc.
4878 </dd><dt class="description">
4880 class="cmssbx-10x-x-109">ORGANIZATION</span> </dt><dd
4881 class="description">Name of the organization producing the track (i.e. the ’record label’)
4882 </dd><dt class="description">
4884 class="cmssbx-10x-x-109">DESCRIPTION</span> </dt><dd
4885 class="description">A short text description of the contents
4889 </dd><dt class="description">
4891 class="cmssbx-10x-x-109">GENRE</span> </dt><dd
4892 class="description">A short text indication of music genre
4893 </dd><dt class="description">
4895 class="cmssbx-10x-x-109">DATE</span> </dt><dd
4896 class="description">Date the track was recorded
4897 </dd><dt class="description">
4899 class="cmssbx-10x-x-109">LOCATION</span> </dt><dd
4900 class="description">Location where track was recorded
4901 </dd><dt class="description">
4903 class="cmssbx-10x-x-109">CONTACT</span> </dt><dd
4904 class="description">Contact information for the creators or distributors of the track. This could be
4905 a URL, an email address, the physical address of the producing label.
4906 </dd><dt class="description">
4908 class="cmssbx-10x-x-109">ISRC</span> </dt><dd
4909 class="description">International Standard Recording Code for the track; see <a
4910 href="http://www.ifpi.org/isrc/" >the ISRC intro page</a> for more
4911 information on ISRC numbers.
4913 <!--l. 158--><p class="noindent" ><span class="paragraphHead"><a
4914 id="x1-870005.2.2"></a><span
4915 class="cmbx-10x-x-109">Implications</span></span>
4916 Field names should not be ’internationalized’; this is a concession to simplicity not an attempt to
4917 exclude the majority of the world that doesn’t speak English. Field <span
4918 class="cmti-10x-x-109">contents</span>, however, use the
4919 UTF-8 character encoding to allow easy representation of any language.
4920 <!--l. 166--><p class="noindent" >We have the length of the entirety of the field and restrictions on the field name so that
4921 the field name is bounded in a known way. Thus we also have the length of the field
4923 <!--l. 170--><p class="noindent" >Individual ’vendors’ may use non-standard field names within reason. The proper use of comment
4924 fields should be clear through context at this point. Abuse will be discouraged.
4925 <!--l. 174--><p class="noindent" >There is no vendor-specific prefix to ’nonstandard’ field names. Vendors should make some effort to
4926 avoid arbitrarily polluting the common namespace. We will generally collect the more useful tags
4927 here to help with standardization.
4928 <!--l. 179--><p class="noindent" >Field names are not required to be unique (occur once) within a comment header. As an example,
4929 assume a track was recorded by three well know artists; the following is permissible, and
4931 <!--l. 183--><p class="noindent" >
4933 <!--l. 184--><p class="noindent" >
4934 <div class="fancyvrb" id="fancyvrb25">
4936 id="x1-87002r1"></a><span
4937 class="cmtt-10"> </span><span
4938 class="cmtt-10"> ARTIST=Dizzy</span><span
4939 class="cmtt-10"> Gillespie</span>
4940 <br class="fancyvrb" /><a
4941 id="x1-87004r2"></a><span
4942 class="cmtt-10"> </span><span
4943 class="cmtt-10"> ARTIST=Sonny</span><span
4944 class="cmtt-10"> Rollins</span>
4945 <br class="fancyvrb" /><a
4946 id="x1-87006r3"></a><span
4947 class="cmtt-10"> </span><span
4948 class="cmtt-10"> ARTIST=Sonny</span><span
4949 class="cmtt-10"> Stitt</span>
4955 <!--l. 197--><p class="noindent" >
4956 <h5 class="subsubsectionHead"><span class="titlemark">5.2.3 </span> <a
4957 id="x1-880005.2.3"></a>Encoding</h5>
4958 <!--l. 199--><p class="noindent" >The comment header comprises the entirety of the second bitstream header packet. Unlike the first
4959 bitstream header packet, it is not generally the only packet on the second page and may not be
4960 restricted to within the second bitstream page. The length of the comment header packet is
4961 (practically) unbounded. The comment header packet is not optional; it must be present in the
4962 bitstream even if it is effectively empty.
4963 <!--l. 207--><p class="noindent" >The comment header is encoded as follows (as per Ogg’s standard bitstream mapping which renders
4964 least-significant-bit of the word to be coded into the least significant available bit of the current
4965 bitstream octet first):
4966 <!--l. 213--><p class="noindent" >
4967 <ol class="enumerate1" >
4969 class="enumerate" id="x1-88002x1">Vendor string length (32 bit unsigned quantity specifying number of octets)
4972 class="enumerate" id="x1-88004x2">Vendor string ([vendor string length] octets coded from beginning of string to end of
4973 string, not null terminated)
4976 class="enumerate" id="x1-88006x3">Number of comment fields (32 bit unsigned quantity specifying number of fields)
4979 class="enumerate" id="x1-88008x4">Comment field 0 length (if [Number of comment fields] <span
4980 class="cmmi-10x-x-109">> </span>0; 32 bit unsigned quantity
4981 specifying number of octets)
4984 class="enumerate" id="x1-88010x5">Comment field 0 ([Comment field 0 length] octets coded from beginning of string to end
4985 of string, not null terminated)
4988 class="enumerate" id="x1-88012x6">Comment field 1 length (if [Number of comment fields] <span
4989 class="cmmi-10x-x-109">> </span>1...)...
4991 <!--l. 234--><p class="noindent" >This is actually somewhat easier to describe in code; implementation of the above can be found in
4993 class="cmtt-10x-x-109">vorbis/lib/info.c</span>, <span
4994 class="cmtt-10x-x-109">_vorbis_pack_comment() </span>and <span
4995 class="cmtt-10x-x-109">_vorbis_unpack_comment()</span>.
5002 <h3 class="sectionHead"><span class="titlemark">6 </span> <a
5003 id="x1-890006"></a>Floor type 0 setup and decode</h3>
5004 <!--l. 6--><p class="noindent" >
5005 <h4 class="subsectionHead"><span class="titlemark">6.1 </span> <a
5006 id="x1-900006.1"></a>Overview</h4>
5007 <!--l. 8--><p class="noindent" >Vorbis floor type zero uses Line Spectral Pair (LSP, also alternately known as Line Spectral
5008 Frequency or LSF) representation to encode a smooth spectral envelope curve as the frequency
5009 response of the LSP filter. This representation is equivalent to a traditional all-pole infinite impulse
5010 response filter as would be used in linear predictive coding; LSP representation may be converted to
5011 LPC representation and vice-versa.
5012 <!--l. 18--><p class="noindent" >
5013 <h4 class="subsectionHead"><span class="titlemark">6.2 </span> <a
5014 id="x1-910006.2"></a>Floor 0 format</h4>
5015 <!--l. 20--><p class="noindent" >Floor zero configuration consists of six integer fields and a list of VQ codebooks for use in
5016 coding/decoding the LSP filter coefficient values used by each frame.
5017 <!--l. 24--><p class="noindent" >
5018 <h5 class="subsubsectionHead"><span class="titlemark">6.2.1 </span> <a
5019 id="x1-920006.2.1"></a>header decode</h5>
5020 <!--l. 26--><p class="noindent" >Configuration information for instances of floor zero decodes from the codec setup header (third
5021 packet). configuration decode proceeds as follows:
5022 <!--l. 30--><p class="noindent" >
5023 <div class="fancyvrb" id="fancyvrb26">
5025 id="x1-92002r1"></a><span
5026 class="cmtt-10"> </span><span
5027 class="cmtt-10"> </span><span
5028 class="cmtt-10"> </span><span
5029 class="cmtt-10"> 1)</span><span
5030 class="cmtt-10"> [floor0_order]</span><span
5031 class="cmtt-10"> =</span><span
5032 class="cmtt-10"> read</span><span
5033 class="cmtt-10"> an</span><span
5034 class="cmtt-10"> unsigned</span><span
5035 class="cmtt-10"> integer</span><span
5036 class="cmtt-10"> of</span><span
5037 class="cmtt-10"> 8</span><span
5038 class="cmtt-10"> bits</span>
5039 <br class="fancyvrb" /><a
5040 id="x1-92004r2"></a><span
5041 class="cmtt-10"> </span><span
5042 class="cmtt-10"> </span><span
5043 class="cmtt-10"> </span><span
5044 class="cmtt-10"> 2)</span><span
5045 class="cmtt-10"> [floor0_rate]</span><span
5046 class="cmtt-10"> =</span><span
5047 class="cmtt-10"> read</span><span
5048 class="cmtt-10"> an</span><span
5049 class="cmtt-10"> unsigned</span><span
5050 class="cmtt-10"> integer</span><span
5051 class="cmtt-10"> of</span><span
5052 class="cmtt-10"> 16</span><span
5053 class="cmtt-10"> bits</span>
5054 <br class="fancyvrb" /><a
5055 id="x1-92006r3"></a><span
5056 class="cmtt-10"> </span><span
5057 class="cmtt-10"> </span><span
5058 class="cmtt-10"> </span><span
5059 class="cmtt-10"> 3)</span><span
5060 class="cmtt-10"> [floor0_bark_map_size]</span><span
5061 class="cmtt-10"> =</span><span
5062 class="cmtt-10"> read</span><span
5063 class="cmtt-10"> an</span><span
5064 class="cmtt-10"> unsigned</span><span
5065 class="cmtt-10"> integer</span><span
5066 class="cmtt-10"> of</span><span
5067 class="cmtt-10"> 16</span><span
5068 class="cmtt-10"> bits</span>
5069 <br class="fancyvrb" /><a
5070 id="x1-92008r4"></a><span
5071 class="cmtt-10"> </span><span
5072 class="cmtt-10"> </span><span
5073 class="cmtt-10"> </span><span
5074 class="cmtt-10"> 4)</span><span
5075 class="cmtt-10"> [floor0_amplitude_bits]</span><span
5076 class="cmtt-10"> =</span><span
5077 class="cmtt-10"> read</span><span
5078 class="cmtt-10"> an</span><span
5079 class="cmtt-10"> unsigned</span><span
5080 class="cmtt-10"> integer</span><span
5081 class="cmtt-10"> of</span><span
5082 class="cmtt-10"> six</span><span
5083 class="cmtt-10"> bits</span>
5084 <br class="fancyvrb" /><a
5085 id="x1-92010r5"></a><span
5086 class="cmtt-10"> </span><span
5087 class="cmtt-10"> </span><span
5088 class="cmtt-10"> </span><span
5089 class="cmtt-10"> 5)</span><span
5090 class="cmtt-10"> [floor0_amplitude_offset]</span><span
5091 class="cmtt-10"> =</span><span
5092 class="cmtt-10"> read</span><span
5093 class="cmtt-10"> an</span><span
5094 class="cmtt-10"> unsigned</span><span
5095 class="cmtt-10"> integer</span><span
5096 class="cmtt-10"> of</span><span
5097 class="cmtt-10"> eight</span><span
5098 class="cmtt-10"> bits</span>
5099 <br class="fancyvrb" /><a
5100 id="x1-92012r6"></a><span
5101 class="cmtt-10"> </span><span
5102 class="cmtt-10"> </span><span
5103 class="cmtt-10"> </span><span
5104 class="cmtt-10"> 6)</span><span
5105 class="cmtt-10"> [floor0_number_of_books]</span><span
5106 class="cmtt-10"> =</span><span
5107 class="cmtt-10"> read</span><span
5108 class="cmtt-10"> an</span><span
5109 class="cmtt-10"> unsigned</span><span
5110 class="cmtt-10"> integer</span><span
5111 class="cmtt-10"> of</span><span
5112 class="cmtt-10"> four</span><span
5113 class="cmtt-10"> bits</span><span
5114 class="cmtt-10"> and</span><span
5115 class="cmtt-10"> add</span><span
5116 class="cmtt-10"> 1</span>
5117 <br class="fancyvrb" /><a
5118 id="x1-92014r7"></a><span
5119 class="cmtt-10"> </span><span
5120 class="cmtt-10"> </span><span
5121 class="cmtt-10"> </span><span
5122 class="cmtt-10"> 7)</span><span
5123 class="cmtt-10"> array</span><span
5124 class="cmtt-10"> [floor0_book_list]</span><span
5125 class="cmtt-10"> =</span><span
5126 class="cmtt-10"> read</span><span
5127 class="cmtt-10"> a</span><span
5128 class="cmtt-10"> list</span><span
5129 class="cmtt-10"> of</span><span
5130 class="cmtt-10"> [floor0_number_of_books]</span><span
5131 class="cmtt-10"> unsigned</span><span
5132 class="cmtt-10"> integers</span><span
5133 class="cmtt-10"> of</span><span
5134 class="cmtt-10"> eight</span><span
5135 class="cmtt-10"> bits</span><span
5136 class="cmtt-10"> each;</span>
5141 <!--l. 40--><p class="noindent" >An end-of-packet condition during any of these bitstream reads renders this stream undecodable. In
5142 addition, any element of the array <span
5143 class="cmtt-10x-x-109">[floor0_book_list] </span>that is greater than the maximum
5144 codebook number for this bitstream is an error condition that also renders the stream
5146 <!--l. 48--><p class="noindent" >
5147 <h5 class="subsubsectionHead"><span class="titlemark">6.2.2 </span> <a
5148 id="x1-930006.2.2"></a>packet decode</h5>
5149 <!--l. 50--><p class="noindent" >Extracting a floor0 curve from an audio packet consists of first decoding the curve amplitude and
5151 class="cmtt-10x-x-109">[floor0_order] </span>LSP coefficient values from the bitstream, and then computing the floor curve,
5152 which is defined as the frequency response of the decoded LSP filter.
5153 <!--l. 56--><p class="noindent" >Packet decode proceeds as follows:
5154 <div class="fancyvrb" id="fancyvrb27">
5156 id="x1-93002r1"></a><span
5157 class="cmtt-10"> </span><span
5158 class="cmtt-10"> </span><span
5159 class="cmtt-10"> </span><span
5160 class="cmtt-10"> 1)</span><span
5161 class="cmtt-10"> [amplitude]</span><span
5162 class="cmtt-10"> =</span><span
5163 class="cmtt-10"> read</span><span
5164 class="cmtt-10"> an</span><span
5165 class="cmtt-10"> unsigned</span><span
5166 class="cmtt-10"> integer</span><span
5167 class="cmtt-10"> of</span><span
5168 class="cmtt-10"> [floor0_amplitude_bits]</span><span
5169 class="cmtt-10"> bits</span>
5170 <br class="fancyvrb" /><a
5171 id="x1-93004r2"></a><span
5172 class="cmtt-10"> </span><span
5173 class="cmtt-10"> </span><span
5174 class="cmtt-10"> </span><span
5175 class="cmtt-10"> 2)</span><span
5176 class="cmtt-10"> if</span><span
5177 class="cmtt-10"> (</span><span
5178 class="cmtt-10"> [amplitude]</span><span
5179 class="cmtt-10"> is</span><span
5180 class="cmtt-10"> greater</span><span
5181 class="cmtt-10"> than</span><span
5182 class="cmtt-10"> zero</span><span
5183 class="cmtt-10"> )</span><span
5184 class="cmtt-10"> </span><span
5185 class="cmsy-10">{</span>
5186 <br class="fancyvrb" /><a
5187 id="x1-93006r3"></a><span
5188 class="cmtt-10"> </span><span
5189 class="cmtt-10"> </span><span
5190 class="cmtt-10"> </span><span
5191 class="cmtt-10"> </span><span
5192 class="cmtt-10"> </span><span
5193 class="cmtt-10"> </span><span
5194 class="cmtt-10"> </span><span
5195 class="cmtt-10"> </span><span
5196 class="cmtt-10"> 3)</span><span
5197 class="cmtt-10"> [coefficients]</span><span
5198 class="cmtt-10"> is</span><span
5199 class="cmtt-10"> an</span><span
5200 class="cmtt-10"> empty,</span><span
5201 class="cmtt-10"> zero</span><span
5202 class="cmtt-10"> length</span><span
5203 class="cmtt-10"> vector</span>
5204 <br class="fancyvrb" /><a
5205 id="x1-93008r4"></a><span
5206 class="cmtt-10"> </span><span
5207 class="cmtt-10"> </span><span
5208 class="cmtt-10"> </span><span
5209 class="cmtt-10"> </span><span
5210 class="cmtt-10"> </span><span
5211 class="cmtt-10"> </span><span
5212 class="cmtt-10"> </span><span
5213 class="cmtt-10"> </span><span
5214 class="cmtt-10"> 4)</span><span
5215 class="cmtt-10"> [booknumber]</span><span
5216 class="cmtt-10"> =</span><span
5217 class="cmtt-10"> read</span><span
5218 class="cmtt-10"> an</span><span
5219 class="cmtt-10"> unsigned</span><span
5220 class="cmtt-10"> integer</span><span
5221 class="cmtt-10"> of</span><span
5222 class="cmtt-10"> </span><a
5223 href="#x1-1170009.2.1"><span
5224 class="cmtt-10">ilog</span></a><span
5225 class="cmtt-10">(</span><span
5226 class="cmtt-10"> [floor0_number_of_books]</span><span
5227 class="cmtt-10"> )</span><span
5228 class="cmtt-10"> bits</span>
5229 <br class="fancyvrb" /><a
5230 id="x1-93010r5"></a><span
5231 class="cmtt-10"> </span><span
5232 class="cmtt-10"> </span><span
5233 class="cmtt-10"> </span><span
5234 class="cmtt-10"> </span><span
5235 class="cmtt-10"> </span><span
5236 class="cmtt-10"> </span><span
5237 class="cmtt-10"> </span><span
5238 class="cmtt-10"> </span><span
5239 class="cmtt-10"> 5)</span><span
5240 class="cmtt-10"> if</span><span
5241 class="cmtt-10"> (</span><span
5242 class="cmtt-10"> [booknumber]</span><span
5243 class="cmtt-10"> is</span><span
5244 class="cmtt-10"> greater</span><span
5245 class="cmtt-10"> than</span><span
5246 class="cmtt-10"> the</span><span
5247 class="cmtt-10"> highest</span><span
5248 class="cmtt-10"> number</span><span
5249 class="cmtt-10"> decode</span><span
5250 class="cmtt-10"> codebook</span><span
5251 class="cmtt-10"> )</span><span
5252 class="cmtt-10"> then</span><span
5253 class="cmtt-10"> packet</span><span
5254 class="cmtt-10"> is</span><span
5255 class="cmtt-10"> undecodable</span>
5256 <br class="fancyvrb" /><a
5257 id="x1-93012r6"></a><span
5258 class="cmtt-10"> </span><span
5259 class="cmtt-10"> </span><span
5260 class="cmtt-10"> </span><span
5261 class="cmtt-10"> </span><span
5262 class="cmtt-10"> </span><span
5263 class="cmtt-10"> </span><span
5264 class="cmtt-10"> </span><span
5265 class="cmtt-10"> </span><span
5266 class="cmtt-10"> 6)</span><span
5267 class="cmtt-10"> [last]</span><span
5268 class="cmtt-10"> =</span><span
5269 class="cmtt-10"> zero;</span>
5270 <br class="fancyvrb" /><a
5271 id="x1-93014r7"></a><span
5272 class="cmtt-10"> </span><span
5273 class="cmtt-10"> </span><span
5274 class="cmtt-10"> </span><span
5275 class="cmtt-10"> </span><span
5276 class="cmtt-10"> </span><span
5277 class="cmtt-10"> </span><span
5278 class="cmtt-10"> </span><span
5279 class="cmtt-10"> </span><span
5280 class="cmtt-10"> 7)</span><span
5281 class="cmtt-10"> vector</span><span
5282 class="cmtt-10"> [temp_vector]</span><span
5283 class="cmtt-10"> =</span><span
5284 class="cmtt-10"> read</span><span
5285 class="cmtt-10"> vector</span><span
5286 class="cmtt-10"> from</span><span
5287 class="cmtt-10"> bitstream</span><span
5288 class="cmtt-10"> using</span><span
5289 class="cmtt-10"> codebook</span><span
5290 class="cmtt-10"> number</span><span
5291 class="cmtt-10"> [floor0_book_list]</span><span
5292 class="cmtt-10"> element</span><span
5293 class="cmtt-10"> [booknumber]</span><span
5294 class="cmtt-10"> in</span><span
5295 class="cmtt-10"> VQ</span><span
5296 class="cmtt-10"> context.</span>
5297 <br class="fancyvrb" /><a
5298 id="x1-93016r8"></a><span
5299 class="cmtt-10"> </span><span
5300 class="cmtt-10"> </span><span
5301 class="cmtt-10"> </span><span
5302 class="cmtt-10"> </span><span
5303 class="cmtt-10"> </span><span
5304 class="cmtt-10"> </span><span
5305 class="cmtt-10"> </span><span
5306 class="cmtt-10"> </span><span
5307 class="cmtt-10"> 8)</span><span
5308 class="cmtt-10"> add</span><span
5309 class="cmtt-10"> the</span><span
5310 class="cmtt-10"> scalar</span><span
5311 class="cmtt-10"> value</span><span
5312 class="cmtt-10"> [last]</span><span
5313 class="cmtt-10"> to</span><span
5314 class="cmtt-10"> each</span><span
5315 class="cmtt-10"> scalar</span><span
5316 class="cmtt-10"> in</span><span
5317 class="cmtt-10"> vector</span><span
5318 class="cmtt-10"> [temp_vector]</span>
5319 <br class="fancyvrb" /><a
5320 id="x1-93018r9"></a><span
5321 class="cmtt-10"> </span><span
5322 class="cmtt-10"> </span><span
5323 class="cmtt-10"> </span><span
5324 class="cmtt-10"> </span><span
5325 class="cmtt-10"> </span><span
5326 class="cmtt-10"> </span><span
5327 class="cmtt-10"> </span><span
5328 class="cmtt-10"> </span><span
5329 class="cmtt-10"> 9)</span><span
5330 class="cmtt-10"> [last]</span><span
5331 class="cmtt-10"> =</span><span
5332 class="cmtt-10"> the</span><span
5333 class="cmtt-10"> value</span><span
5334 class="cmtt-10"> of</span><span
5335 class="cmtt-10"> the</span><span
5336 class="cmtt-10"> last</span><span
5337 class="cmtt-10"> scalar</span><span
5338 class="cmtt-10"> in</span><span
5339 class="cmtt-10"> vector</span><span
5340 class="cmtt-10"> [temp_vector]</span>
5341 <br class="fancyvrb" /><a
5342 id="x1-93020r10"></a><span
5343 class="cmtt-10"> </span><span
5344 class="cmtt-10"> </span><span
5345 class="cmtt-10"> </span><span
5346 class="cmtt-10"> </span><span
5347 class="cmtt-10"> </span><span
5348 class="cmtt-10"> </span><span
5349 class="cmtt-10"> </span><span
5350 class="cmtt-10"> 10)</span><span
5351 class="cmtt-10"> concatenate</span><span
5352 class="cmtt-10"> [temp_vector]</span><span
5353 class="cmtt-10"> onto</span><span
5354 class="cmtt-10"> the</span><span
5355 class="cmtt-10"> end</span><span
5356 class="cmtt-10"> of</span><span
5357 class="cmtt-10"> the</span><span
5358 class="cmtt-10"> [coefficients]</span><span
5359 class="cmtt-10"> vector</span>
5360 <br class="fancyvrb" /><a
5361 id="x1-93022r11"></a><span
5362 class="cmtt-10"> </span><span
5363 class="cmtt-10"> </span><span
5364 class="cmtt-10"> </span><span
5365 class="cmtt-10"> </span><span
5366 class="cmtt-10"> </span><span
5367 class="cmtt-10"> </span><span
5368 class="cmtt-10"> </span><span
5369 class="cmtt-10"> 11)</span><span
5370 class="cmtt-10"> if</span><span
5371 class="cmtt-10"> (length</span><span
5372 class="cmtt-10"> of</span><span
5373 class="cmtt-10"> vector</span><span
5374 class="cmtt-10"> [coefficients]</span><span
5375 class="cmtt-10"> is</span><span
5376 class="cmtt-10"> less</span><span
5377 class="cmtt-10"> than</span><span
5378 class="cmtt-10"> [floor0_order],</span><span
5379 class="cmtt-10"> continue</span><span
5380 class="cmtt-10"> at</span><span
5381 class="cmtt-10"> step</span><span
5382 class="cmtt-10"> 6</span>
5383 <br class="fancyvrb" /><a
5384 id="x1-93024r12"></a><span
5385 class="cmtt-10"> </span><span
5386 class="cmtt-10"> </span>
5387 <br class="fancyvrb" /><a
5388 id="x1-93026r13"></a><span
5389 class="cmtt-10"> </span><span
5390 class="cmtt-10"> </span><span
5391 class="cmtt-10"> </span><span
5392 class="cmtt-10"> </span><span
5393 class="cmtt-10"> </span><span
5394 class="cmtt-10"> </span><span
5395 class="cmtt-10"> </span><span
5396 class="cmsy-10">}</span>
5397 <br class="fancyvrb" /><a
5398 id="x1-93028r14"></a><span
5399 class="cmtt-10"> </span><span
5400 class="cmtt-10"> </span>
5401 <br class="fancyvrb" /><a
5402 id="x1-93030r15"></a><span
5403 class="cmtt-10"> </span><span
5404 class="cmtt-10"> </span><span
5405 class="cmtt-10"> 12)</span><span
5406 class="cmtt-10"> done.</span>
5407 <br class="fancyvrb" /><a
5408 id="x1-93032r16"></a><span
5409 class="cmtt-10"> </span><span
5410 class="cmtt-10"> </span>
5412 <!--l. 76--><p class="noindent" >Take note of the following properties of decode:
5413 <ul class="itemize1">
5414 <li class="itemize">An <span
5415 class="cmtt-10x-x-109">[amplitude] </span>value of zero must result in a return code that indicates this channel is
5416 unused in this frame (the output of the channel will be all-zeroes in synthesis). Several
5417 later stages of decode don’t occur for an unused channel.
5419 <li class="itemize">An end-of-packet condition during decode should be considered a nominal occruence;
5420 if end-of-packet is reached during any read operation above, floor decode is to return
5421 ’unused’ status as if the <span
5422 class="cmtt-10x-x-109">[amplitude] </span>value had read zero at the beginning of decode.
5424 <li class="itemize">The book number used for decode can, in fact, be stored in the bitstream in <a
5425 href="#x1-1170009.2.1">ilog</a>(
5427 class="cmtt-10x-x-109">[floor0_number_of_books] </span>- 1 ) bits. Nevertheless, the above specification is correct
5431 and values greater than the maximum possible book value are reserved.
5433 <li class="itemize">The number of scalars read into the vector <span
5434 class="cmtt-10x-x-109">[coefficients] </span>may be greater
5436 class="cmtt-10x-x-109">[floor0_order]</span>, the number actually required for curve computation. For
5437 example, if the VQ codebook used for the floor currently being decoded has a
5439 class="cmtt-10x-x-109">[codebook_dimensions] </span>value of three and <span
5440 class="cmtt-10x-x-109">[floor0_order] </span>is ten, the only way to fill
5441 all the needed scalars in <span
5442 class="cmtt-10x-x-109">[coefficients] </span>is to to read a total of twelve scalars as four
5443 vectors of three scalars each. This is not an error condition, and care must be taken not
5444 to allow a buffer overflow in decode. The extra values are not used and may be ignored
5445 or discarded.</li></ul>
5446 <!--l. 104--><p class="noindent" >
5447 <h5 class="subsubsectionHead"><span class="titlemark">6.2.3 </span> <a
5448 id="x1-940006.2.3"></a>curve computation</h5>
5449 <!--l. 106--><p class="noindent" >Given an <span
5450 class="cmtt-10x-x-109">[amplitude] </span>integer and <span
5451 class="cmtt-10x-x-109">[coefficients] </span>vector from packet decode as well as the
5452 [floor0˙order], [floor0˙rate], [floor0˙bark˙map˙size], [floor0˙amplitude˙bits] and [floor0˙amplitude˙offset]
5453 values from floor setup, and an output vector size <span
5454 class="cmtt-10x-x-109">[n] </span>specified by the decode process, we compute
5455 a floor output vector.
5456 <!--l. 113--><p class="noindent" >If the value <span
5457 class="cmtt-10x-x-109">[amplitude] </span>is zero, the return value is a length <span
5458 class="cmtt-10x-x-109">[n] </span>vector with all-zero
5459 scalars. Otherwise, begin by assuming the following definitions for the given vector to be
5461 <center class="par-math-display" >
5463 src="Vorbis_I_spec7x.png" alt=" {
5464 min (floor0xbarkxmapxsize - 1,foobar) for i ∈ [0,n - 1]
5465 mapi = - 1 for i = n
5466 " class="par-math-display" ></center>
5467 <!--l. 128--><p class="nopar" >
5468 <!--l. 130--><p class="noindent" >where
5469 <center class="par-math-display" >
5471 src="Vorbis_I_spec8x.png" alt=" ⌊ ( ) ⌋
5472 f oobar = bark floor0xrate-⋅i- ⋅ floor0xbarkxmapxsize-
5473 2n bark(.5 ⋅floor0xrate )
5474 " class="par-math-display" ></center>
5475 <!--l. 137--><p class="nopar" >
5476 <!--l. 139--><p class="noindent" >and
5480 <center class="par-math-display" >
5482 src="Vorbis_I_spec9x.png" alt="bark(x) = 13.1 arctan (.00074x) + 2.24 arctan (.0000000185x2 + .0001x)
5483 " class="par-math-display" ></center>
5484 <!--l. 143--><p class="nopar" >
5485 <!--l. 145--><p class="noindent" >The above is used to synthesize the LSP curve on a Bark-scale frequency axis, then map the result
5486 to a linear-scale frequency axis. Similarly, the below calculation synthesizes the output LSP
5488 class="cmtt-10x-x-109">[output] </span>on a log (dB) amplitude scale, mapping it to linear amplitude in the last
5490 <!--l. 151--><p class="noindent" >
5491 <ol class="enumerate1" >
5493 class="enumerate" id="x1-94002x1"><span
5494 class="cmtt-10x-x-109">[i] </span>= 0
5497 class="enumerate" id="x1-94004x2"><span
5498 class="cmtt-10x-x-109">[</span><span
5499 class="cmmi-10x-x-109">ω</span><span
5500 class="cmtt-10x-x-109">] </span>= <span
5501 class="cmmi-10x-x-109">π </span>* map element <span
5502 class="cmtt-10x-x-109">[i] </span>/ <span
5503 class="cmtt-10x-x-109">[floor0_bark_map_size]</span>
5506 class="enumerate" id="x1-94006x3">if ( <span
5507 class="cmtt-10x-x-109">[floor0_order] </span>is odd )
5508 <ol class="enumerate2" >
5510 class="enumerate" id="x1-94008x1">calculate <span
5511 class="cmtt-10x-x-109">[p] </span>and <span
5512 class="cmtt-10x-x-109">[q] </span>according to: <div class="eqnarray">
5513 <center class="math-display" >
5515 src="Vorbis_I_spec10x.png" alt=" floor0x2order-3
5516 p = (1- cos2ω ) ∏ 4(cos([coefficients ] )- cosω )2
5520 q = -- 4(cos([coefficients ]2j) - cosω)2
5522 " class="math-display" ></center>
5525 <!--l. 162--><p class="noindent" >else <span
5526 class="cmtt-10x-x-109">[floor0_order] </span>is even
5527 <ol class="enumerate2" >
5529 class="enumerate" id="x1-94011x1">calculate <span
5530 class="cmtt-10x-x-109">[p] </span>and <span
5531 class="cmtt-10x-x-109">[q] </span>according to: <div class="eqnarray">
5535 <center class="math-display" >
5537 src="Vorbis_I_spec11x.png" alt=" floor0xorder-2
5538 (1--cos2ω-) ∏2 2
5539 p = 2 4(cos([coefficients ]2j+1)- cosω )
5541 (1+ cos2ω )floor0x∏o2rder-2
5542 q = ----------- 4(cos([coefficients ]2j)- cosω )2
5544 " class="math-display" ></center>
5549 class="enumerate" id="x1-94014x4">calculate <span
5550 class="cmtt-10x-x-109">[linear_floor_value] </span>according to:
5551 <center class="math-display" >
5553 src="Vorbis_I_spec12x.png" alt=" ( ( ))
5554 exp .11512925 amplitude--⋅floor0xamplitutex√offset-- - floor0xamplitudexoffset
5555 (2floor0xamplitudexbits - 1) p + q
5556 " class="math-display" ></center>
5557 <!--l. 177--><p class="nopar" >
5560 class="enumerate" id="x1-94016x5"><span
5561 class="cmtt-10x-x-109">[iteration_condition] </span>= map element <span
5562 class="cmtt-10x-x-109">[i]</span>
5565 class="enumerate" id="x1-94018x6"><span
5566 class="cmtt-10x-x-109">[output] </span>element <span
5567 class="cmtt-10x-x-109">[i] </span>= <span
5568 class="cmtt-10x-x-109">[linear_floor_value]</span>
5571 class="enumerate" id="x1-94020x7">increment <span
5572 class="cmtt-10x-x-109">[i]</span>
5575 class="enumerate" id="x1-94022x8">if ( map element <span
5576 class="cmtt-10x-x-109">[i] </span>is equal to <span
5577 class="cmtt-10x-x-109">[iteration_condition] </span>) continue at step 5
5580 class="enumerate" id="x1-94024x9">if ( <span
5581 class="cmtt-10x-x-109">[i] </span>is less than <span
5582 class="cmtt-10x-x-109">[n] </span>) continue at step 2
5585 class="enumerate" id="x1-94026x10">done</li></ol>
5592 <h3 class="sectionHead"><span class="titlemark">7 </span> <a
5593 id="x1-950007"></a>Floor type 1 setup and decode</h3>
5594 <!--l. 6--><p class="noindent" >
5595 <h4 class="subsectionHead"><span class="titlemark">7.1 </span> <a
5596 id="x1-960007.1"></a>Overview</h4>
5597 <!--l. 8--><p class="noindent" >Vorbis floor type one uses a piecewise straight-line representation to encode a spectral envelope
5598 curve. The representation plots this curve mechanically on a linear frequency axis and a
5599 logarithmic (dB) amplitude axis. The integer plotting algorithm used is similar to Bresenham’s
5601 <!--l. 16--><p class="noindent" >
5602 <h4 class="subsectionHead"><span class="titlemark">7.2 </span> <a
5603 id="x1-970007.2"></a>Floor 1 format</h4>
5604 <!--l. 18--><p class="noindent" >
5605 <h5 class="subsubsectionHead"><span class="titlemark">7.2.1 </span> <a
5606 id="x1-980007.2.1"></a>model</h5>
5607 <!--l. 20--><p class="noindent" >Floor type one represents a spectral curve as a series of line segments. Synthesis constructs a floor
5608 curve using iterative prediction in a process roughly equivalent to the following simplified
5610 <ul class="itemize1">
5611 <li class="itemize">the first line segment (base case) is a logical line spanning from x˙0,y˙0 to x˙1,y˙1 where
5612 in the base case x˙0=0 and x˙1=[n], the full range of the spectral floor to be computed.
5614 <li class="itemize">the induction step chooses a point x˙new within an existing logical line segment and
5615 produces a y˙new value at that point computed from the existing line’s y value at x˙new
5616 (as plotted by the line) and a difference value decoded from the bitstream packet.
5618 <li class="itemize">floor computation produces two new line segments, one running from x˙0,y˙0 to
5619 x˙new,y˙new and from x˙new,y˙new to x˙1,y˙1. This step is performed logically even if
5620 y˙new represents no change to the amplitude value at x˙new so that later refinement is
5621 additionally bounded at x˙new.
5626 <li class="itemize">the induction step repeats, using a list of x values specified in the codec setup header
5627 at floor 1 initialization time. Computation is completed at the end of the x value list.
5629 <!--l. 48--><p class="noindent" >Consider the following example, with values chosen for ease of understanding rather than
5630 representing typical configuration:
5631 <!--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
5632 increasing order is 0,16,32,48,64,80,96,112 and 128. In list order, the values interleave as 0, 128, 64,
5633 32, 96, 16, 48, 80 and 112. The corresponding list-order Y values as decoded from an example
5634 packet are 110, 20, -5, -45, 0, -25, -10, 30 and -10. We compute the floor in the following way,
5635 beginning with the first line:
5638 <!--l. 59--><p class="noindent" >
5640 <!--l. 60--><p class="noindent" ><img
5641 src="floor1-1.png" alt="PIC"
5643 <br /> <table class="caption"
5644 ><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 7: </td><td
5645 class="content">graph of example floor</td></tr></table><!--tex4ht:label?: x1-980017 -->
5647 <!--l. 64--><p class="noindent" >We now draw new logical lines to reflect the correction to new˙Y, and iterate for X positions 32 and
5651 <!--l. 67--><p class="noindent" >
5653 <!--l. 68--><p class="noindent" ><img
5654 src="floor1-2.png" alt="PIC"
5656 <br /> <table class="caption"
5657 ><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 8: </td><td
5658 class="content">graph of example floor</td></tr></table><!--tex4ht:label?: x1-980028 -->
5660 <!--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
5661 further refinement. From here on, the pattern should be clear; we complete the floor computation as
5665 <!--l. 76--><p class="noindent" >
5667 <!--l. 77--><p class="noindent" ><img
5668 src="floor1-3.png" alt="PIC"
5670 <br /> <table class="caption"
5671 ><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 9: </td><td
5672 class="content">graph of example floor</td></tr></table><!--tex4ht:label?: x1-980039 -->
5679 <!--l. 81--><p class="noindent" >
5681 <!--l. 82--><p class="noindent" ><img
5682 src="floor1-4.png" alt="PIC"
5684 <br /> <table class="caption"
5685 ><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 10: </td><td
5686 class="content">graph of example floor</td></tr></table><!--tex4ht:label?: x1-9800410 -->
5688 <!--l. 86--><p class="noindent" >A more efficient algorithm with carefully defined integer rounding behavior is used for actual
5689 decode, as described later. The actual algorithm splits Y value computation and line plotting into
5690 two steps with modifications to the above algorithm to eliminate noise accumulation through integer
5691 roundoff/truncation.
5692 <!--l. 94--><p class="noindent" >
5693 <h5 class="subsubsectionHead"><span class="titlemark">7.2.2 </span> <a
5694 id="x1-990007.2.2"></a>header decode</h5>
5695 <!--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
5696 packet decode and synthesis). This list is split into partitions, and each partition is assigned to a
5697 partition class. X positions 0 and [n] are implicit and do not belong to an explicit partition or
5699 <!--l. 102--><p class="noindent" >A partition class consists of a representation vector width (the number of Y values which the
5700 partition class encodes at once), a ’subclass’ value representing the number of alternate entropy
5701 books the partition class may use in representing Y values, the list of [subclass] books and a master
5702 book used to encode which alternate books were chosen for representation in a given packet. The
5703 master/subclass mechanism is meant to be used as a flexible representation cascade while still using
5704 codebooks only in a scalar context.
5705 <!--l. 112--><p class="noindent" >
5706 <div class="fancyvrb" id="fancyvrb28">
5708 id="x1-99002r1"></a><span
5709 class="cmtt-10"> </span><span
5710 class="cmtt-10"> </span>
5711 <br class="fancyvrb" /><a
5712 id="x1-99004r2"></a><span
5713 class="cmtt-10"> </span><span
5714 class="cmtt-10"> </span><span
5715 class="cmtt-10"> </span><span
5716 class="cmtt-10"> 1)</span><span
5717 class="cmtt-10"> [floor1_partitions]</span><span
5718 class="cmtt-10"> =</span><span
5719 class="cmtt-10"> read</span><span
5720 class="cmtt-10"> 5</span><span
5721 class="cmtt-10"> bits</span><span
5722 class="cmtt-10"> as</span><span
5723 class="cmtt-10"> unsigned</span><span
5724 class="cmtt-10"> integer</span>
5725 <br class="fancyvrb" /><a
5726 id="x1-99006r3"></a><span
5727 class="cmtt-10"> </span><span
5728 class="cmtt-10"> </span><span
5729 class="cmtt-10"> </span><span
5730 class="cmtt-10"> 2)</span><span
5731 class="cmtt-10"> [maximum_class]</span><span
5732 class="cmtt-10"> =</span><span
5733 class="cmtt-10"> -1</span>
5734 <br class="fancyvrb" /><a
5735 id="x1-99008r4"></a><span
5736 class="cmtt-10"> </span><span
5737 class="cmtt-10"> </span><span
5738 class="cmtt-10"> </span><span
5739 class="cmtt-10"> 3)</span><span
5740 class="cmtt-10"> iterate</span><span
5741 class="cmtt-10"> [i]</span><span
5742 class="cmtt-10"> over</span><span
5743 class="cmtt-10"> the</span><span
5744 class="cmtt-10"> range</span><span
5745 class="cmtt-10"> 0</span><span
5746 class="cmtt-10"> ...</span><span
5747 class="cmtt-10"> [floor1_partitions]-1</span><span
5748 class="cmtt-10"> </span><span
5749 class="cmsy-10">{</span>
5750 <br class="fancyvrb" /><a
5751 id="x1-99010r5"></a><span
5752 class="cmtt-10"> </span><span
5753 class="cmtt-10"> </span>
5754 <br class="fancyvrb" /><a
5755 id="x1-99012r6"></a><span
5756 class="cmtt-10"> </span><span
5757 class="cmtt-10"> </span><span
5758 class="cmtt-10"> </span><span
5759 class="cmtt-10"> </span><span
5760 class="cmtt-10"> </span><span
5761 class="cmtt-10"> </span><span
5762 class="cmtt-10"> </span><span
5763 class="cmtt-10"> </span><span
5764 class="cmtt-10"> </span><span
5765 class="cmtt-10"> 4)</span><span
5766 class="cmtt-10"> vector</span><span
5767 class="cmtt-10"> [floor1_partition_class_list]</span><span
5768 class="cmtt-10"> element</span><span
5769 class="cmtt-10"> [i]</span><span
5770 class="cmtt-10"> =</span><span
5771 class="cmtt-10"> read</span><span
5772 class="cmtt-10"> 4</span><span
5773 class="cmtt-10"> bits</span><span
5774 class="cmtt-10"> as</span><span
5775 class="cmtt-10"> unsigned</span><span
5776 class="cmtt-10"> integer</span>
5777 <br class="fancyvrb" /><a
5778 id="x1-99014r7"></a><span
5779 class="cmtt-10"> </span><span
5780 class="cmtt-10"> </span>
5781 <br class="fancyvrb" /><a
5782 id="x1-99016r8"></a><span
5783 class="cmtt-10"> </span><span
5784 class="cmtt-10"> </span><span
5785 class="cmtt-10"> </span><span
5786 class="cmtt-10"> </span><span
5787 class="cmtt-10"> </span><span
5788 class="cmtt-10"> </span><span
5789 class="cmtt-10"> </span><span
5790 class="cmsy-10">}</span>
5791 <br class="fancyvrb" /><a
5792 id="x1-99018r9"></a><span
5793 class="cmtt-10"> </span><span
5794 class="cmtt-10"> </span>
5795 <br class="fancyvrb" /><a
5796 id="x1-99020r10"></a><span
5797 class="cmtt-10"> </span><span
5798 class="cmtt-10"> </span><span
5799 class="cmtt-10"> </span><span
5800 class="cmtt-10"> 5)</span><span
5801 class="cmtt-10"> [maximum_class]</span><span
5802 class="cmtt-10"> =</span><span
5803 class="cmtt-10"> largest</span><span
5804 class="cmtt-10"> integer</span><span
5805 class="cmtt-10"> scalar</span><span
5806 class="cmtt-10"> value</span><span
5807 class="cmtt-10"> in</span><span
5808 class="cmtt-10"> vector</span><span
5809 class="cmtt-10"> [floor1_partition_class_list]</span>
5810 <br class="fancyvrb" /><a
5811 id="x1-99022r11"></a><span
5812 class="cmtt-10"> </span><span
5813 class="cmtt-10"> </span><span
5814 class="cmtt-10"> </span><span
5815 class="cmtt-10"> 6)</span><span
5816 class="cmtt-10"> iterate</span><span
5817 class="cmtt-10"> [i]</span><span
5818 class="cmtt-10"> over</span><span
5819 class="cmtt-10"> the</span><span
5820 class="cmtt-10"> range</span><span
5821 class="cmtt-10"> 0</span><span
5822 class="cmtt-10"> ...</span><span
5823 class="cmtt-10"> [maximum_class]</span><span
5824 class="cmtt-10"> </span><span
5825 class="cmsy-10">{</span>
5826 <br class="fancyvrb" /><a
5827 id="x1-99024r12"></a><span
5828 class="cmtt-10"> </span><span
5829 class="cmtt-10"> </span>
5830 <br class="fancyvrb" /><a
5831 id="x1-99026r13"></a><span
5832 class="cmtt-10"> </span><span
5833 class="cmtt-10"> </span><span
5834 class="cmtt-10"> </span><span
5835 class="cmtt-10"> </span><span
5836 class="cmtt-10"> </span><span
5837 class="cmtt-10"> </span><span
5838 class="cmtt-10"> </span><span
5839 class="cmtt-10"> </span><span
5840 class="cmtt-10"> </span><span
5841 class="cmtt-10"> 7)</span><span
5842 class="cmtt-10"> vector</span><span
5843 class="cmtt-10"> [floor1_class_dimensions]</span><span
5844 class="cmtt-10"> element</span><span
5845 class="cmtt-10"> [i]</span><span
5846 class="cmtt-10"> =</span><span
5847 class="cmtt-10"> read</span><span
5848 class="cmtt-10"> 3</span><span
5849 class="cmtt-10"> bits</span><span
5850 class="cmtt-10"> as</span><span
5851 class="cmtt-10"> unsigned</span><span
5852 class="cmtt-10"> integer</span><span
5853 class="cmtt-10"> and</span><span
5854 class="cmtt-10"> add</span><span
5855 class="cmtt-10"> 1</span>
5856 <br class="fancyvrb" /><a
5857 id="x1-99028r14"></a><span
5858 class="cmtt-10"> </span><span
5859 class="cmtt-10">  8)</span><span
5860 class="cmtt-10"> vector</span><span
5861 class="cmtt-10"> [floor1_class_subclasses]</span><span
5862 class="cmtt-10"> element</span><span
5863 class="cmtt-10"> [i]</span><span
5864 class="cmtt-10"> =</span><span
5865 class="cmtt-10"> read</span><span
5866 class="cmtt-10"> 2</span><span
5867 class="cmtt-10"> bits</span><span
5868 class="cmtt-10"> as</span><span
5869 class="cmtt-10"> unsigned</span><span
5870 class="cmtt-10"> integer</span>
5874 <br class="fancyvrb" /><a
5875 id="x1-99030r15"></a><span
5876 class="cmtt-10"> </span><span
5877 class="cmtt-10"> </span><span
5878 class="cmtt-10"> </span><span
5879 class="cmtt-10"> </span><span
5880 class="cmtt-10"> </span><span
5881 class="cmtt-10"> </span><span
5882 class="cmtt-10"> </span><span
5883 class="cmtt-10"> </span><span
5884 class="cmtt-10"> </span><span
5885 class="cmtt-10"> 9)</span><span
5886 class="cmtt-10"> if</span><span
5887 class="cmtt-10"> (</span><span
5888 class="cmtt-10"> vector</span><span
5889 class="cmtt-10"> [floor1_class_subclasses]</span><span
5890 class="cmtt-10"> element</span><span
5891 class="cmtt-10"> [i]</span><span
5892 class="cmtt-10"> is</span><span
5893 class="cmtt-10"> nonzero</span><span
5894 class="cmtt-10"> )</span><span
5895 class="cmtt-10"> </span><span
5896 class="cmsy-10">{</span>
5897 <br class="fancyvrb" /><a
5898 id="x1-99032r16"></a><span
5899 class="cmtt-10"> </span><span
5900 class="cmtt-10"> </span>
5901 <br class="fancyvrb" /><a
5902 id="x1-99034r17"></a><span
5903 class="cmtt-10"> </span><span
5904 class="cmtt-10"> </span><span
5905 class="cmtt-10"> </span><span
5906 class="cmtt-10"> </span><span
5907 class="cmtt-10"> </span><span
5908 class="cmtt-10"> </span><span
5909 class="cmtt-10"> </span><span
5910 class="cmtt-10"> </span><span
5911 class="cmtt-10"> </span><span
5912 class="cmtt-10"> </span><span
5913 class="cmtt-10"> </span><span
5914 class="cmtt-10"> </span><span
5915 class="cmtt-10"> </span><span
5916 class="cmtt-10"> </span><span
5917 class="cmtt-10"> 10)</span><span
5918 class="cmtt-10"> vector</span><span
5919 class="cmtt-10"> [floor1_class_masterbooks]</span><span
5920 class="cmtt-10"> element</span><span
5921 class="cmtt-10"> [i]</span><span
5922 class="cmtt-10"> =</span><span
5923 class="cmtt-10"> read</span><span
5924 class="cmtt-10"> 8</span><span
5925 class="cmtt-10"> bits</span><span
5926 class="cmtt-10"> as</span><span
5927 class="cmtt-10"> unsigned</span><span
5928 class="cmtt-10"> integer</span>
5929 <br class="fancyvrb" /><a
5930 id="x1-99036r18"></a><span
5931 class="cmtt-10"> </span><span
5932 class="cmtt-10"> </span>
5933 <br class="fancyvrb" /><a
5934 id="x1-99038r19"></a><span
5935 class="cmtt-10"> </span><span
5936 class="cmtt-10"> </span><span
5937 class="cmtt-10"> </span><span
5938 class="cmtt-10"> </span><span
5939 class="cmtt-10"> </span><span
5940 class="cmtt-10"> </span><span
5941 class="cmtt-10"> </span><span
5942 class="cmtt-10"> </span><span
5943 class="cmtt-10"> </span><span
5944 class="cmtt-10"> </span><span
5945 class="cmtt-10"> </span><span
5946 class="cmtt-10"> </span><span
5947 class="cmtt-10"> </span><span
5948 class="cmsy-10">}</span>
5949 <br class="fancyvrb" /><a
5950 id="x1-99040r20"></a><span
5951 class="cmtt-10"> </span><span
5952 class="cmtt-10"> </span>
5953 <br class="fancyvrb" /><a
5954 id="x1-99042r21"></a><span
5955 class="cmtt-10"> </span><span
5956 class="cmtt-10"> </span><span
5957 class="cmtt-10"> </span><span
5958 class="cmtt-10"> </span><span
5959 class="cmtt-10"> </span><span
5960 class="cmtt-10"> </span><span
5961 class="cmtt-10"> </span><span
5962 class="cmtt-10"> </span><span
5963 class="cmtt-10"> 11)</span><span
5964 class="cmtt-10"> iterate</span><span
5965 class="cmtt-10"> [j]</span><span
5966 class="cmtt-10"> over</span><span
5967 class="cmtt-10"> the</span><span
5968 class="cmtt-10"> range</span><span
5969 class="cmtt-10"> 0</span><span
5970 class="cmtt-10"> ...</span><span
5971 class="cmtt-10"> (2</span><span
5972 class="cmtt-10"> exponent</span><span
5973 class="cmtt-10"> [floor1_class_subclasses]</span><span
5974 class="cmtt-10"> element</span><span
5975 class="cmtt-10"> [i])</span><span
5976 class="cmtt-10"> -</span><span
5977 class="cmtt-10"> 1</span><span
5978 class="cmtt-10"> </span><span
5979 class="cmsy-10">{</span>
5980 <br class="fancyvrb" /><a
5981 id="x1-99044r22"></a><span
5982 class="cmtt-10"> </span><span
5983 class="cmtt-10"> </span>
5984 <br class="fancyvrb" /><a
5985 id="x1-99046r23"></a><span
5986 class="cmtt-10"> </span><span
5987 class="cmtt-10"> </span><span
5988 class="cmtt-10"> </span><span
5989 class="cmtt-10"> </span><span
5990 class="cmtt-10"> </span><span
5991 class="cmtt-10"> </span><span
5992 class="cmtt-10"> </span><span
5993 class="cmtt-10"> </span><span
5994 class="cmtt-10"> </span><span
5995 class="cmtt-10"> </span><span
5996 class="cmtt-10"> </span><span
5997 class="cmtt-10"> </span><span
5998 class="cmtt-10"> </span><span
5999 class="cmtt-10"> </span><span
6000 class="cmtt-10"> 12)</span><span
6001 class="cmtt-10"> array</span><span
6002 class="cmtt-10"> [floor1_subclass_books]</span><span
6003 class="cmtt-10"> element</span><span
6004 class="cmtt-10"> [i],[j]</span><span
6005 class="cmtt-10"> =</span>
6006 <br class="fancyvrb" /><a
6007 id="x1-99048r24"></a><span
6008 class="cmtt-10"> </span><span
6009 class="cmtt-10"> </span><span
6010 class="cmtt-10"> </span><span
6011 class="cmtt-10"> </span><span
6012 class="cmtt-10"> </span><span
6013 class="cmtt-10"> </span><span
6014 class="cmtt-10"> </span><span
6015 class="cmtt-10"> </span><span
6016 class="cmtt-10"> </span><span
6017 class="cmtt-10"> </span><span
6018 class="cmtt-10"> </span><span
6019 class="cmtt-10"> </span><span
6020 class="cmtt-10"> </span><span
6021 class="cmtt-10"> </span><span
6022 class="cmtt-10"> </span><span
6023 class="cmtt-10"> </span><span
6024 class="cmtt-10"> </span><span
6025 class="cmtt-10"> </span><span
6026 class="cmtt-10"> read</span><span
6027 class="cmtt-10"> 8</span><span
6028 class="cmtt-10"> bits</span><span
6029 class="cmtt-10"> as</span><span
6030 class="cmtt-10"> unsigned</span><span
6031 class="cmtt-10"> integer</span><span
6032 class="cmtt-10"> and</span><span
6033 class="cmtt-10"> subtract</span><span
6034 class="cmtt-10"> one</span>
6035 <br class="fancyvrb" /><a
6036 id="x1-99050r25"></a><span
6037 class="cmtt-10"> </span><span
6038 class="cmtt-10"> </span><span
6039 class="cmtt-10"> </span><span
6040 class="cmtt-10"> </span><span
6041 class="cmtt-10"> </span><span
6042 class="cmtt-10"> </span><span
6043 class="cmtt-10"> </span><span
6044 class="cmtt-10"> </span><span
6045 class="cmtt-10"> </span><span
6046 class="cmtt-10"> </span><span
6047 class="cmtt-10"> </span><span
6048 class="cmtt-10"> </span><span
6049 class="cmtt-10"> </span><span
6050 class="cmsy-10">}</span>
6051 <br class="fancyvrb" /><a
6052 id="x1-99052r26"></a><span
6053 class="cmtt-10"> </span><span
6054 class="cmtt-10"> </span><span
6055 class="cmtt-10"> </span><span
6056 class="cmtt-10"> </span><span
6057 class="cmtt-10"> </span><span
6058 class="cmtt-10"> </span><span
6059 class="cmtt-10"> </span><span
6060 class="cmtt-10"> </span><span
6061 class="cmsy-10">}</span>
6062 <br class="fancyvrb" /><a
6063 id="x1-99054r27"></a><span
6064 class="cmtt-10"> </span><span
6065 class="cmtt-10"> </span>
6066 <br class="fancyvrb" /><a
6067 id="x1-99056r28"></a><span
6068 class="cmtt-10"> </span><span
6069 class="cmtt-10"> </span><span
6070 class="cmtt-10"> 13)</span><span
6071 class="cmtt-10"> [floor1_multiplier]</span><span
6072 class="cmtt-10"> =</span><span
6073 class="cmtt-10"> read</span><span
6074 class="cmtt-10"> 2</span><span
6075 class="cmtt-10"> bits</span><span
6076 class="cmtt-10"> as</span><span
6077 class="cmtt-10"> unsigned</span><span
6078 class="cmtt-10"> integer</span><span
6079 class="cmtt-10"> and</span><span
6080 class="cmtt-10"> add</span><span
6081 class="cmtt-10"> one</span>
6082 <br class="fancyvrb" /><a
6083 id="x1-99058r29"></a><span
6084 class="cmtt-10"> </span><span
6085 class="cmtt-10"> </span><span
6086 class="cmtt-10"> 14)</span><span
6087 class="cmtt-10"> [rangebits]</span><span
6088 class="cmtt-10"> =</span><span
6089 class="cmtt-10"> read</span><span
6090 class="cmtt-10"> 4</span><span
6091 class="cmtt-10"> bits</span><span
6092 class="cmtt-10"> as</span><span
6093 class="cmtt-10"> unsigned</span><span
6094 class="cmtt-10"> integer</span>
6095 <br class="fancyvrb" /><a
6096 id="x1-99060r30"></a><span
6097 class="cmtt-10"> </span><span
6098 class="cmtt-10"> </span><span
6099 class="cmtt-10"> 15)</span><span
6100 class="cmtt-10"> vector</span><span
6101 class="cmtt-10"> [floor1_X_list]</span><span
6102 class="cmtt-10"> element</span><span
6103 class="cmtt-10"> [0]</span><span
6104 class="cmtt-10"> =</span><span
6105 class="cmtt-10"> 0</span>
6106 <br class="fancyvrb" /><a
6107 id="x1-99062r31"></a><span
6108 class="cmtt-10"> </span><span
6109 class="cmtt-10"> </span><span
6110 class="cmtt-10"> 16)</span><span
6111 class="cmtt-10"> vector</span><span
6112 class="cmtt-10"> [floor1_X_list]</span><span
6113 class="cmtt-10"> element</span><span
6114 class="cmtt-10"> [1]</span><span
6115 class="cmtt-10"> =</span><span
6116 class="cmtt-10"> 2</span><span
6117 class="cmtt-10"> exponent</span><span
6118 class="cmtt-10"> [rangebits];</span>
6119 <br class="fancyvrb" /><a
6120 id="x1-99064r32"></a><span
6121 class="cmtt-10"> </span><span
6122 class="cmtt-10"> </span><span
6123 class="cmtt-10"> 17)</span><span
6124 class="cmtt-10"> [floor1_values]</span><span
6125 class="cmtt-10"> =</span><span
6126 class="cmtt-10"> 2</span>
6127 <br class="fancyvrb" /><a
6128 id="x1-99066r33"></a><span
6129 class="cmtt-10"> </span><span
6130 class="cmtt-10"> </span><span
6131 class="cmtt-10"> 18)</span><span
6132 class="cmtt-10"> iterate</span><span
6133 class="cmtt-10"> [i]</span><span
6134 class="cmtt-10"> over</span><span
6135 class="cmtt-10"> the</span><span
6136 class="cmtt-10"> range</span><span
6137 class="cmtt-10"> 0</span><span
6138 class="cmtt-10"> ...</span><span
6139 class="cmtt-10"> [floor1_partitions]-1</span><span
6140 class="cmtt-10"> </span><span
6141 class="cmsy-10">{</span>
6142 <br class="fancyvrb" /><a
6143 id="x1-99068r34"></a><span
6144 class="cmtt-10"> </span><span
6145 class="cmtt-10"> </span>
6146 <br class="fancyvrb" /><a
6147 id="x1-99070r35"></a><span
6148 class="cmtt-10"> </span><span
6149 class="cmtt-10"> </span><span
6150 class="cmtt-10"> </span><span
6151 class="cmtt-10"> </span><span
6152 class="cmtt-10"> </span><span
6153 class="cmtt-10"> </span><span
6154 class="cmtt-10"> </span><span
6155 class="cmtt-10"> </span><span
6156 class="cmtt-10"> 19)</span><span
6157 class="cmtt-10"> [current_class_number]</span><span
6158 class="cmtt-10"> =</span><span
6159 class="cmtt-10"> vector</span><span
6160 class="cmtt-10"> [floor1_partition_class_list]</span><span
6161 class="cmtt-10"> element</span><span
6162 class="cmtt-10"> [i]</span>
6163 <br class="fancyvrb" /><a
6164 id="x1-99072r36"></a><span
6165 class="cmtt-10"> </span><span
6166 class="cmtt-10"> </span><span
6167 class="cmtt-10"> </span><span
6168 class="cmtt-10"> </span><span
6169 class="cmtt-10"> </span><span
6170 class="cmtt-10"> </span><span
6171 class="cmtt-10"> </span><span
6172 class="cmtt-10"> </span><span
6173 class="cmtt-10"> 20)</span><span
6174 class="cmtt-10"> iterate</span><span
6175 class="cmtt-10"> [j]</span><span
6176 class="cmtt-10"> over</span><span
6177 class="cmtt-10"> the</span><span
6178 class="cmtt-10"> range</span><span
6179 class="cmtt-10"> 0</span><span
6180 class="cmtt-10"> ...</span><span
6181 class="cmtt-10"> ([floor1_class_dimensions]</span><span
6182 class="cmtt-10"> element</span><span
6183 class="cmtt-10"> [current_class_number])-1</span><span
6184 class="cmtt-10"> </span><span
6185 class="cmsy-10">{</span>
6186 <br class="fancyvrb" /><a
6187 id="x1-99074r37"></a><span
6188 class="cmtt-10"> </span><span
6189 class="cmtt-10"> </span><span
6190 class="cmtt-10"> </span><span
6191 class="cmtt-10"> </span><span
6192 class="cmtt-10"> </span><span
6193 class="cmtt-10"> </span><span
6194 class="cmtt-10"> </span><span
6195 class="cmtt-10"> </span><span
6196 class="cmtt-10"> </span><span
6197 class="cmtt-10"> </span><span
6198 class="cmtt-10"> </span><span
6199 class="cmtt-10"> </span><span
6200 class="cmtt-10"> </span><span
6201 class="cmtt-10"> </span><span
6202 class="cmtt-10"> 21)</span><span
6203 class="cmtt-10"> vector</span><span
6204 class="cmtt-10"> [floor1_X_list]</span><span
6205 class="cmtt-10"> element</span><span
6206 class="cmtt-10"> ([floor1_values])</span><span
6207 class="cmtt-10"> =</span>
6208 <br class="fancyvrb" /><a
6209 id="x1-99076r38"></a><span
6210 class="cmtt-10"> </span><span
6211 class="cmtt-10"> </span><span
6212 class="cmtt-10"> </span><span
6213 class="cmtt-10"> </span><span
6214 class="cmtt-10"> </span><span
6215 class="cmtt-10"> </span><span
6216 class="cmtt-10"> </span><span
6217 class="cmtt-10"> </span><span
6218 class="cmtt-10"> </span><span
6219 class="cmtt-10"> </span><span
6220 class="cmtt-10"> </span><span
6221 class="cmtt-10"> </span><span
6222 class="cmtt-10"> </span><span
6223 class="cmtt-10"> </span><span
6224 class="cmtt-10"> </span><span
6225 class="cmtt-10"> </span><span
6226 class="cmtt-10"> </span><span
6227 class="cmtt-10"> </span><span
6228 class="cmtt-10"> read</span><span
6229 class="cmtt-10"> [rangebits]</span><span
6230 class="cmtt-10"> bits</span><span
6231 class="cmtt-10"> as</span><span
6232 class="cmtt-10"> unsigned</span><span
6233 class="cmtt-10"> integer</span>
6234 <br class="fancyvrb" /><a
6235 id="x1-99078r39"></a><span
6236 class="cmtt-10"> </span><span
6237 class="cmtt-10"> </span><span
6238 class="cmtt-10"> </span><span
6239 class="cmtt-10"> </span><span
6240 class="cmtt-10"> </span><span
6241 class="cmtt-10"> </span><span
6242 class="cmtt-10"> </span><span
6243 class="cmtt-10"> </span><span
6244 class="cmtt-10"> </span><span
6245 class="cmtt-10"> </span><span
6246 class="cmtt-10"> </span><span
6247 class="cmtt-10"> </span><span
6248 class="cmtt-10"> </span><span
6249 class="cmtt-10"> </span><span
6250 class="cmtt-10"> 22)</span><span
6251 class="cmtt-10"> increment</span><span
6252 class="cmtt-10"> [floor1_values]</span><span
6253 class="cmtt-10"> by</span><span
6254 class="cmtt-10"> one</span>
6255 <br class="fancyvrb" /><a
6256 id="x1-99080r40"></a><span
6257 class="cmtt-10"> </span><span
6258 class="cmtt-10"> </span><span
6259 class="cmtt-10"> </span><span
6260 class="cmtt-10"> </span><span
6261 class="cmtt-10"> </span><span
6262 class="cmtt-10"> </span><span
6263 class="cmtt-10"> </span><span
6264 class="cmtt-10"> </span><span
6265 class="cmtt-10"> </span><span
6266 class="cmtt-10"> </span><span
6267 class="cmtt-10"> </span><span
6268 class="cmtt-10"> </span><span
6269 class="cmtt-10"> </span><span
6270 class="cmsy-10">}</span>
6271 <br class="fancyvrb" /><a
6272 id="x1-99082r41"></a><span
6273 class="cmtt-10"> </span><span
6274 class="cmtt-10"> </span><span
6275 class="cmtt-10"> </span><span
6276 class="cmtt-10"> </span><span
6277 class="cmtt-10"> </span><span
6278 class="cmtt-10"> </span><span
6279 class="cmtt-10"> </span><span
6280 class="cmsy-10">}</span>
6281 <br class="fancyvrb" /><a
6282 id="x1-99084r42"></a><span
6283 class="cmtt-10"> </span><span
6284 class="cmtt-10"> </span>
6285 <br class="fancyvrb" /><a
6286 id="x1-99086r43"></a><span
6287 class="cmtt-10"> </span><span
6288 class="cmtt-10"> </span><span
6289 class="cmtt-10"> 23)</span><span
6290 class="cmtt-10"> done</span>
6292 <!--l. 158--><p class="noindent" >An end-of-packet condition while reading any aspect of a floor 1 configuration during setup renders
6293 a stream undecodable. In addition, a <span
6294 class="cmtt-10x-x-109">[floor1_class_masterbooks] </span>or <span
6295 class="cmtt-10x-x-109">[floor1_subclass_books]</span>
6296 scalar element greater than the highest numbered codebook configured in this stream is an error
6297 condition that renders the stream undecodable.
6298 <!--l. 165--><p class="noindent" ><span class="paragraphHead"><a
6299 id="x1-1000007.2.2"></a><span
6300 class="cmbx-10x-x-109">packet decode</span></span>
6301 Packet decode begins by checking the <span
6302 class="cmtt-10x-x-109">[nonzero] </span>flag:
6303 <!--l. 169--><p class="noindent" >
6304 <div class="fancyvrb" id="fancyvrb29">
6306 id="x1-100002r1"></a><span
6307 class="cmtt-10"> </span><span
6308 class="cmtt-10"> </span><span
6309 class="cmtt-10"> </span><span
6310 class="cmtt-10"> 1)</span><span
6311 class="cmtt-10"> [nonzero]</span><span
6312 class="cmtt-10"> =</span><span
6313 class="cmtt-10"> read</span><span
6314 class="cmtt-10"> 1</span><span
6315 class="cmtt-10"> bit</span><span
6316 class="cmtt-10"> as</span><span
6317 class="cmtt-10"> boolean</span>
6319 <!--l. 173--><p class="noindent" >If <span
6320 class="cmtt-10x-x-109">[nonzero] </span>is unset, that indicates this channel contained no audio energy in this frame. Decode
6321 immediately returns a status indicating this floor curve (and thus this channel) is unused
6322 this frame. (A return status of ’unused’ is different from decoding a floor that has all
6326 points set to minimum representation amplitude, which happens to be approximately
6328 <!--l. 181--><p class="noindent" >Assuming <span
6329 class="cmtt-10x-x-109">[nonzero] </span>is set, decode proceeds as follows:
6330 <!--l. 183--><p class="noindent" >
6331 <div class="fancyvrb" id="fancyvrb30">
6333 id="x1-100004r1"></a><span
6334 class="cmtt-10"> </span><span
6335 class="cmtt-10"> </span><span
6336 class="cmtt-10"> </span><span
6337 class="cmtt-10"> 1)</span><span
6338 class="cmtt-10"> [range]</span><span
6339 class="cmtt-10"> =</span><span
6340 class="cmtt-10"> vector</span><span
6341 class="cmtt-10"> </span><span
6342 class="cmsy-10">{</span><span
6343 class="cmtt-10"> 256,</span><span
6344 class="cmtt-10"> 128,</span><span
6345 class="cmtt-10"> 86,</span><span
6346 class="cmtt-10"> 64</span><span
6347 class="cmtt-10"> </span><span
6348 class="cmsy-10">}</span><span
6349 class="cmtt-10"> element</span><span
6350 class="cmtt-10"> ([floor1_multiplier]-1)</span>
6351 <br class="fancyvrb" /><a
6352 id="x1-100006r2"></a><span
6353 class="cmtt-10"> </span><span
6354 class="cmtt-10"> </span><span
6355 class="cmtt-10"> </span><span
6356 class="cmtt-10"> 2)</span><span
6357 class="cmtt-10"> vector</span><span
6358 class="cmtt-10"> [floor1_Y]</span><span
6359 class="cmtt-10"> element</span><span
6360 class="cmtt-10"> [0]</span><span
6361 class="cmtt-10"> =</span><span
6362 class="cmtt-10"> read</span><span
6363 class="cmtt-10"> </span><a
6364 href="#x1-1170009.2.1"><span
6365 class="cmtt-10">ilog</span></a><span
6366 class="cmtt-10">([range]-1)</span><span
6367 class="cmtt-10"> bits</span><span
6368 class="cmtt-10"> as</span><span
6369 class="cmtt-10"> unsigned</span><span
6370 class="cmtt-10"> integer</span>
6371 <br class="fancyvrb" /><a
6372 id="x1-100008r3"></a><span
6373 class="cmtt-10"> </span><span
6374 class="cmtt-10"> </span><span
6375 class="cmtt-10"> </span><span
6376 class="cmtt-10"> 3)</span><span
6377 class="cmtt-10"> vector</span><span
6378 class="cmtt-10"> [floor1_Y]</span><span
6379 class="cmtt-10"> element</span><span
6380 class="cmtt-10"> [1]</span><span
6381 class="cmtt-10"> =</span><span
6382 class="cmtt-10"> read</span><span
6383 class="cmtt-10"> </span><a
6384 href="#x1-1170009.2.1"><span
6385 class="cmtt-10">ilog</span></a><span
6386 class="cmtt-10">([range]-1)</span><span
6387 class="cmtt-10"> bits</span><span
6388 class="cmtt-10"> as</span><span
6389 class="cmtt-10"> unsigned</span><span
6390 class="cmtt-10"> integer</span>
6391 <br class="fancyvrb" /><a
6392 id="x1-100010r4"></a><span
6393 class="cmtt-10"> </span><span
6394 class="cmtt-10"> </span><span
6395 class="cmtt-10"> </span><span
6396 class="cmtt-10"> 4)</span><span
6397 class="cmtt-10"> [offset]</span><span
6398 class="cmtt-10"> =</span><span
6399 class="cmtt-10"> 2;</span>
6400 <br class="fancyvrb" /><a
6401 id="x1-100012r5"></a><span
6402 class="cmtt-10"> </span><span
6403 class="cmtt-10"> </span><span
6404 class="cmtt-10"> </span><span
6405 class="cmtt-10"> 5)</span><span
6406 class="cmtt-10"> iterate</span><span
6407 class="cmtt-10"> [i]</span><span
6408 class="cmtt-10"> over</span><span
6409 class="cmtt-10"> the</span><span
6410 class="cmtt-10"> range</span><span
6411 class="cmtt-10"> 0</span><span
6412 class="cmtt-10"> ...</span><span
6413 class="cmtt-10"> [floor1_partitions]-1</span><span
6414 class="cmtt-10"> </span><span
6415 class="cmsy-10">{</span>
6416 <br class="fancyvrb" /><a
6417 id="x1-100014r6"></a><span
6418 class="cmtt-10"> </span><span
6419 class="cmtt-10"> </span>
6420 <br class="fancyvrb" /><a
6421 id="x1-100016r7"></a><span
6422 class="cmtt-10"> </span><span
6423 class="cmtt-10"> </span><span
6424 class="cmtt-10"> </span><span
6425 class="cmtt-10"> </span><span
6426 class="cmtt-10"> </span><span
6427 class="cmtt-10"> </span><span
6428 class="cmtt-10"> </span><span
6429 class="cmtt-10"> </span><span
6430 class="cmtt-10"> 6)</span><span
6431 class="cmtt-10"> [class]</span><span
6432 class="cmtt-10"> =</span><span
6433 class="cmtt-10"> vector</span><span
6434 class="cmtt-10"> [floor1_partition_class]</span><span
6435 class="cmtt-10"> </span><span
6436 class="cmtt-10"> element</span><span
6437 class="cmtt-10"> [i]</span>
6438 <br class="fancyvrb" /><a
6439 id="x1-100018r8"></a><span
6440 class="cmtt-10"> </span><span
6441 class="cmtt-10"> </span><span
6442 class="cmtt-10"> </span><span
6443 class="cmtt-10"> </span><span
6444 class="cmtt-10"> </span><span
6445 class="cmtt-10"> </span><span
6446 class="cmtt-10"> </span><span
6447 class="cmtt-10"> </span><span
6448 class="cmtt-10"> 7)</span><span
6449 class="cmtt-10"> [cdim]</span><span
6450 class="cmtt-10"> </span><span
6451 class="cmtt-10"> =</span><span
6452 class="cmtt-10"> vector</span><span
6453 class="cmtt-10"> [floor1_class_dimensions]</span><span
6454 class="cmtt-10"> element</span><span
6455 class="cmtt-10"> [class]</span>
6456 <br class="fancyvrb" /><a
6457 id="x1-100020r9"></a><span
6458 class="cmtt-10"> </span><span
6459 class="cmtt-10"> </span><span
6460 class="cmtt-10"> </span><span
6461 class="cmtt-10"> </span><span
6462 class="cmtt-10"> </span><span
6463 class="cmtt-10"> </span><span
6464 class="cmtt-10"> </span><span
6465 class="cmtt-10"> </span><span
6466 class="cmtt-10"> 8)</span><span
6467 class="cmtt-10"> [cbits]</span><span
6468 class="cmtt-10"> =</span><span
6469 class="cmtt-10"> vector</span><span
6470 class="cmtt-10"> [floor1_class_subclasses]</span><span
6471 class="cmtt-10"> element</span><span
6472 class="cmtt-10"> [class]</span>
6473 <br class="fancyvrb" /><a
6474 id="x1-100022r10"></a><span
6475 class="cmtt-10"> </span><span
6476 class="cmtt-10"> </span><span
6477 class="cmtt-10"> </span><span
6478 class="cmtt-10"> </span><span
6479 class="cmtt-10"> </span><span
6480 class="cmtt-10"> </span><span
6481 class="cmtt-10"> </span><span
6482 class="cmtt-10"> </span><span
6483 class="cmtt-10"> 9)</span><span
6484 class="cmtt-10"> [csub]</span><span
6485 class="cmtt-10"> </span><span
6486 class="cmtt-10"> =</span><span
6487 class="cmtt-10"> (2</span><span
6488 class="cmtt-10"> exponent</span><span
6489 class="cmtt-10"> [cbits])-1</span>
6490 <br class="fancyvrb" /><a
6491 id="x1-100024r11"></a><span
6492 class="cmtt-10"> </span><span
6493 class="cmtt-10"> </span><span
6494 class="cmtt-10"> </span><span
6495 class="cmtt-10"> </span><span
6496 class="cmtt-10"> </span><span
6497 class="cmtt-10"> </span><span
6498 class="cmtt-10"> </span><span
6499 class="cmtt-10"> 10)</span><span
6500 class="cmtt-10"> [cval]</span><span
6501 class="cmtt-10"> </span><span
6502 class="cmtt-10"> =</span><span
6503 class="cmtt-10"> 0</span>
6504 <br class="fancyvrb" /><a
6505 id="x1-100026r12"></a><span
6506 class="cmtt-10"> </span><span
6507 class="cmtt-10"> </span><span
6508 class="cmtt-10"> </span><span
6509 class="cmtt-10"> </span><span
6510 class="cmtt-10"> </span><span
6511 class="cmtt-10"> </span><span
6512 class="cmtt-10"> </span><span
6513 class="cmtt-10"> 11)</span><span
6514 class="cmtt-10"> if</span><span
6515 class="cmtt-10"> (</span><span
6516 class="cmtt-10"> [cbits]</span><span
6517 class="cmtt-10"> is</span><span
6518 class="cmtt-10"> greater</span><span
6519 class="cmtt-10"> than</span><span
6520 class="cmtt-10"> zero</span><span
6521 class="cmtt-10"> )</span><span
6522 class="cmtt-10"> </span><span
6523 class="cmsy-10">{</span>
6524 <br class="fancyvrb" /><a
6525 id="x1-100028r13"></a><span
6526 class="cmtt-10"> </span><span
6527 class="cmtt-10"> </span>
6528 <br class="fancyvrb" /><a
6529 id="x1-100030r14"></a><span
6530 class="cmtt-10"> </span><span
6531 class="cmtt-10"> </span><span
6532 class="cmtt-10"> </span><span
6533 class="cmtt-10"> </span><span
6534 class="cmtt-10"> </span><span
6535 class="cmtt-10"> </span><span
6536 class="cmtt-10"> </span><span
6537 class="cmtt-10"> </span><span
6538 class="cmtt-10"> </span><span
6539 class="cmtt-10"> </span><span
6540 class="cmtt-10"> </span><span
6541 class="cmtt-10"> </span><span
6542 class="cmtt-10"> </span><span
6543 class="cmtt-10"> </span><span
6544 class="cmtt-10"> 12)</span><span
6545 class="cmtt-10"> [cval]</span><span
6546 class="cmtt-10"> =</span><span
6547 class="cmtt-10"> read</span><span
6548 class="cmtt-10"> from</span><span
6549 class="cmtt-10"> packet</span><span
6550 class="cmtt-10"> using</span><span
6551 class="cmtt-10"> codebook</span><span
6552 class="cmtt-10"> number</span>
6553 <br class="fancyvrb" /><a
6554 id="x1-100032r15"></a><span
6555 class="cmtt-10"> </span><span
6556 class="cmtt-10"> </span><span
6557 class="cmtt-10"> </span><span
6558 class="cmtt-10"> </span><span
6559 class="cmtt-10"> </span><span
6560 class="cmtt-10"> </span><span
6561 class="cmtt-10"> </span><span
6562 class="cmtt-10"> </span><span
6563 class="cmtt-10"> </span><span
6564 class="cmtt-10"> </span><span
6565 class="cmtt-10"> </span><span
6566 class="cmtt-10"> </span><span
6567 class="cmtt-10"> </span><span
6568 class="cmtt-10"> </span><span
6569 class="cmtt-10"> </span><span
6570 class="cmtt-10"> </span><span
6571 class="cmtt-10"> </span><span
6572 class="cmtt-10"> </span><span
6573 class="cmtt-10"> (vector</span><span
6574 class="cmtt-10"> [floor1_class_masterbooks]</span><span
6575 class="cmtt-10"> element</span><span
6576 class="cmtt-10"> [class])</span><span
6577 class="cmtt-10"> in</span><span
6578 class="cmtt-10"> scalar</span><span
6579 class="cmtt-10"> context</span>
6580 <br class="fancyvrb" /><a
6581 id="x1-100034r16"></a><span
6582 class="cmtt-10"> </span><span
6583 class="cmtt-10"> </span><span
6584 class="cmtt-10"> </span><span
6585 class="cmtt-10"> </span><span
6586 class="cmtt-10"> </span><span
6587 class="cmtt-10"> </span><span
6588 class="cmtt-10"> </span><span
6589 class="cmtt-10"> </span><span
6590 class="cmtt-10"> </span><span
6591 class="cmtt-10"> </span><span
6592 class="cmtt-10"> </span><span
6593 class="cmtt-10"> </span><span
6594 class="cmsy-10">}</span>
6595 <br class="fancyvrb" /><a
6596 id="x1-100036r17"></a><span
6597 class="cmtt-10"> </span><span
6598 class="cmtt-10"> </span>
6599 <br class="fancyvrb" /><a
6600 id="x1-100038r18"></a><span
6601 class="cmtt-10"> </span><span
6602 class="cmtt-10"> </span><span
6603 class="cmtt-10"> </span><span
6604 class="cmtt-10"> </span><span
6605 class="cmtt-10"> </span><span
6606 class="cmtt-10"> </span><span
6607 class="cmtt-10"> </span><span
6608 class="cmtt-10"> 13)</span><span
6609 class="cmtt-10"> iterate</span><span
6610 class="cmtt-10"> [j]</span><span
6611 class="cmtt-10"> over</span><span
6612 class="cmtt-10"> the</span><span
6613 class="cmtt-10"> range</span><span
6614 class="cmtt-10"> 0</span><span
6615 class="cmtt-10"> ...</span><span
6616 class="cmtt-10"> [cdim]-1</span><span
6617 class="cmtt-10"> </span><span
6618 class="cmsy-10">{</span>
6619 <br class="fancyvrb" /><a
6620 id="x1-100040r19"></a><span
6621 class="cmtt-10"> </span><span
6622 class="cmtt-10"> </span>
6623 <br class="fancyvrb" /><a
6624 id="x1-100042r20"></a><span
6625 class="cmtt-10"> </span><span
6626 class="cmtt-10"> </span><span
6627 class="cmtt-10"> </span><span
6628 class="cmtt-10"> </span><span
6629 class="cmtt-10"> </span><span
6630 class="cmtt-10"> </span><span
6631 class="cmtt-10"> </span><span
6632 class="cmtt-10"> </span><span
6633 class="cmtt-10"> </span><span
6634 class="cmtt-10"> </span><span
6635 class="cmtt-10"> </span><span
6636 class="cmtt-10"> </span><span
6637 class="cmtt-10"> </span><span
6638 class="cmtt-10"> </span><span
6639 class="cmtt-10"> 14)</span><span
6640 class="cmtt-10"> [book]</span><span
6641 class="cmtt-10"> =</span><span
6642 class="cmtt-10"> array</span><span
6643 class="cmtt-10"> [floor1_subclass_books]</span><span
6644 class="cmtt-10"> element</span><span
6645 class="cmtt-10"> [class],([cval]</span><span
6646 class="cmtt-10"> bitwise</span><span
6647 class="cmtt-10"> AND</span><span
6648 class="cmtt-10"> [csub])</span>
6649 <br class="fancyvrb" /><a
6650 id="x1-100044r21"></a><span
6651 class="cmtt-10"> </span><span
6652 class="cmtt-10"> </span><span
6653 class="cmtt-10"> </span><span
6654 class="cmtt-10"> </span><span
6655 class="cmtt-10"> </span><span
6656 class="cmtt-10"> </span><span
6657 class="cmtt-10"> </span><span
6658 class="cmtt-10"> </span><span
6659 class="cmtt-10"> </span><span
6660 class="cmtt-10"> </span><span
6661 class="cmtt-10"> </span><span
6662 class="cmtt-10"> </span><span
6663 class="cmtt-10"> </span><span
6664 class="cmtt-10"> </span><span
6665 class="cmtt-10"> 15)</span><span
6666 class="cmtt-10"> [cval]</span><span
6667 class="cmtt-10"> =</span><span
6668 class="cmtt-10"> [cval]</span><span
6669 class="cmtt-10"> right</span><span
6670 class="cmtt-10"> shifted</span><span
6671 class="cmtt-10"> [cbits]</span><span
6672 class="cmtt-10"> bits</span>
6673 <br class="fancyvrb" /><a
6674 id="x1-100046r22"></a><span
6675 class="cmtt-10"> </span><span
6676 class="cmtt-10">  </span><span
6677 class="cmtt-10"> </span><span
6678 class="cmtt-10"> </span><span
6679 class="cmtt-10"> </span><span
6680 class="cmtt-10"> </span><span
6681 class="cmtt-10"> 16)</span><span
6682 class="cmtt-10"> if</span><span
6683 class="cmtt-10"> (</span><span
6684 class="cmtt-10"> [book]</span><span
6685 class="cmtt-10"> is</span><span
6686 class="cmtt-10"> not</span><span
6687 class="cmtt-10"> less</span><span
6688 class="cmtt-10"> than</span><span
6689 class="cmtt-10"> zero</span><span
6690 class="cmtt-10"> )</span><span
6691 class="cmtt-10"> </span><span
6692 class="cmsy-10">{</span>
6693 <br class="fancyvrb" /><a
6694 id="x1-100048r23"></a><span
6695 class="cmtt-10"> </span><span
6696 class="cmtt-10"> </span>
6697 <br class="fancyvrb" /><a
6698 id="x1-100050r24"></a><span
6699 class="cmtt-10"> </span><span
6700 class="cmtt-10">  </span><span
6701 class="cmtt-10"> </span><span
6702 class="cmtt-10"> </span><span
6703 class="cmtt-10"> </span><span
6704 class="cmtt-10"> </span><span
6705 class="cmtt-10"> </span><span
6706 class="cmtt-10"> </span><span
6707 class="cmtt-10"> </span><span
6708 class="cmtt-10"> </span><span
6709 class="cmtt-10"> </span><span
6710 class="cmtt-10"> </span><span
6711 class="cmtt-10"> 17)</span><span
6712 class="cmtt-10"> vector</span><span
6713 class="cmtt-10"> [floor1_Y]</span><span
6714 class="cmtt-10"> element</span><span
6715 class="cmtt-10"> ([j]+[offset])</span><span
6716 class="cmtt-10"> =</span><span
6717 class="cmtt-10"> read</span><span
6718 class="cmtt-10"> from</span><span
6719 class="cmtt-10"> packet</span><span
6720 class="cmtt-10"> using</span><span
6721 class="cmtt-10"> codebook</span>
6722 <br class="fancyvrb" /><a
6723 id="x1-100052r25"></a><span
6724 class="cmtt-10"> </span><span
6725 class="cmtt-10"> </span><span
6726 class="cmtt-10"> </span><span
6727 class="cmtt-10"> </span><span
6728 class="cmtt-10"> </span><span
6729 class="cmtt-10"> </span><span
6730 class="cmtt-10"> </span><span
6731 class="cmtt-10"> </span><span
6732 class="cmtt-10"> </span><span
6733 class="cmtt-10"> </span><span
6734 class="cmtt-10"> </span><span
6735 class="cmtt-10"> </span><span
6736 class="cmtt-10"> </span><span
6737 class="cmtt-10"> </span><span
6738 class="cmtt-10"> </span><span
6739 class="cmtt-10"> </span><span
6740 class="cmtt-10"> </span><span
6741 class="cmtt-10"> </span><span
6742 class="cmtt-10"> </span><span
6743 class="cmtt-10"> </span><span
6744 class="cmtt-10"> </span><span
6745 class="cmtt-10"> </span><span
6746 class="cmtt-10"> </span><span
6747 class="cmtt-10"> </span><span
6748 class="cmtt-10"> [book]</span><span
6749 class="cmtt-10"> in</span><span
6750 class="cmtt-10"> scalar</span><span
6751 class="cmtt-10"> context</span>
6752 <br class="fancyvrb" /><a
6753 id="x1-100054r26"></a><span
6754 class="cmtt-10"> </span><span
6755 class="cmtt-10"> </span>
6756 <br class="fancyvrb" /><a
6757 id="x1-100056r27"></a><span
6758 class="cmtt-10"> </span><span
6759 class="cmtt-10"> </span><span
6760 class="cmtt-10"> </span><span
6761 class="cmtt-10"> </span><span
6762 class="cmtt-10"> </span><span
6763 class="cmtt-10"> </span><span
6764 class="cmtt-10"> </span><span
6765 class="cmtt-10"> </span><span
6766 class="cmtt-10"> </span><span
6767 class="cmtt-10"> </span><span
6768 class="cmtt-10"> </span><span
6769 class="cmtt-10"> </span><span
6770 class="cmtt-10"> </span><span
6771 class="cmtt-10"> </span><span
6772 class="cmtt-10"> </span><span
6773 class="cmtt-10"> </span><span
6774 class="cmtt-10"> </span><span
6775 class="cmtt-10"> </span><span
6776 class="cmtt-10"> </span><span
6777 class="cmsy-10">}</span><span
6778 class="cmtt-10"> else</span><span
6779 class="cmtt-10"> [book]</span><span
6780 class="cmtt-10"> is</span><span
6781 class="cmtt-10"> less</span><span
6782 class="cmtt-10"> than</span><span
6783 class="cmtt-10"> zero</span><span
6784 class="cmtt-10"> </span><span
6785 class="cmsy-10">{</span>
6786 <br class="fancyvrb" /><a
6787 id="x1-100058r28"></a><span
6788 class="cmtt-10"> </span><span
6789 class="cmtt-10"> </span>
6790 <br class="fancyvrb" /><a
6791 id="x1-100060r29"></a><span
6792 class="cmtt-10"> </span><span
6793 class="cmtt-10">  </span><span
6794 class="cmtt-10"> </span><span
6795 class="cmtt-10"> </span><span
6796 class="cmtt-10"> </span><span
6797 class="cmtt-10"> </span><span
6798 class="cmtt-10"> </span><span
6799 class="cmtt-10"> </span><span
6800 class="cmtt-10"> </span><span
6801 class="cmtt-10"> </span><span
6802 class="cmtt-10"> </span><span
6803 class="cmtt-10"> </span><span
6804 class="cmtt-10"> 18)</span><span
6805 class="cmtt-10"> vector</span><span
6806 class="cmtt-10"> [floor1_Y]</span><span
6807 class="cmtt-10"> element</span><span
6808 class="cmtt-10"> ([j]+[offset])</span><span
6809 class="cmtt-10"> =</span><span
6810 class="cmtt-10"> 0</span>
6811 <br class="fancyvrb" /><a
6812 id="x1-100062r30"></a><span
6813 class="cmtt-10"> </span><span
6814 class="cmtt-10"> </span>
6815 <br class="fancyvrb" /><a
6816 id="x1-100064r31"></a><span
6817 class="cmtt-10"> </span><span
6818 class="cmtt-10"> </span><span
6819 class="cmtt-10"> </span><span
6820 class="cmtt-10"> </span><span
6821 class="cmtt-10"> </span><span
6822 class="cmtt-10"> </span><span
6823 class="cmtt-10"> </span><span
6824 class="cmtt-10"> </span><span
6825 class="cmtt-10"> </span><span
6826 class="cmtt-10"> </span><span
6827 class="cmtt-10"> </span><span
6828 class="cmtt-10"> </span><span
6829 class="cmtt-10"> </span><span
6830 class="cmtt-10"> </span><span
6831 class="cmtt-10"> </span><span
6832 class="cmtt-10"> </span><span
6833 class="cmtt-10"> </span><span
6834 class="cmtt-10"> </span><span
6835 class="cmtt-10"> </span><span
6836 class="cmsy-10">}</span>
6837 <br class="fancyvrb" /><a
6838 id="x1-100066r32"></a><span
6839 class="cmtt-10"> </span><span
6840 class="cmtt-10"> </span><span
6841 class="cmtt-10"> </span><span
6842 class="cmtt-10"> </span><span
6843 class="cmtt-10"> </span><span
6844 class="cmtt-10"> </span><span
6845 class="cmtt-10"> </span><span
6846 class="cmtt-10"> </span><span
6847 class="cmtt-10"> </span><span
6848 class="cmtt-10"> </span><span
6849 class="cmtt-10"> </span><span
6850 class="cmtt-10"> </span><span
6851 class="cmsy-10">}</span>
6852 <br class="fancyvrb" /><a
6853 id="x1-100068r33"></a><span
6854 class="cmtt-10"> </span><span
6855 class="cmtt-10"> </span>
6856 <br class="fancyvrb" /><a
6857 id="x1-100070r34"></a><span
6858 class="cmtt-10"> </span><span
6859 class="cmtt-10"> </span><span
6860 class="cmtt-10"> </span><span
6861 class="cmtt-10"> </span><span
6862 class="cmtt-10"> </span><span
6863 class="cmtt-10"> </span><span
6864 class="cmtt-10"> </span><span
6865 class="cmtt-10"> 19)</span><span
6866 class="cmtt-10"> [offset]</span><span
6867 class="cmtt-10"> =</span><span
6868 class="cmtt-10"> [offset]</span><span
6869 class="cmtt-10"> +</span><span
6870 class="cmtt-10"> [cdim]</span>
6871 <br class="fancyvrb" /><a
6872 id="x1-100072r35"></a><span
6873 class="cmtt-10"> </span><span
6874 class="cmtt-10"> </span>
6875 <br class="fancyvrb" /><a
6876 id="x1-100074r36"></a><span
6877 class="cmtt-10"> </span><span
6878 class="cmtt-10"> </span><span
6879 class="cmtt-10"> </span><span
6880 class="cmtt-10"> </span><span
6881 class="cmtt-10"> </span><span
6882 class="cmtt-10"> </span><span
6883 class="cmtt-10"> </span><span
6884 class="cmsy-10">}</span>
6885 <br class="fancyvrb" /><a
6886 id="x1-100076r37"></a><span
6887 class="cmtt-10"> </span><span
6888 class="cmtt-10"> </span>
6889 <br class="fancyvrb" /><a
6890 id="x1-100078r38"></a><span
6891 class="cmtt-10"> </span><span
6892 class="cmtt-10"> </span><span
6893 class="cmtt-10"> 20)</span><span
6894 class="cmtt-10"> done</span>
6896 <!--l. 224--><p class="noindent" >An end-of-packet condition during curve decode should be considered a nominal occurrence; if
6897 end-of-packet is reached during any read operation above, floor decode is to return ’unused’ status
6899 class="cmtt-10x-x-109">[nonzero] </span>flag had been unset at the beginning of decode.
6900 <!--l. 230--><p class="noindent" >Vector <span
6901 class="cmtt-10x-x-109">[floor1_Y] </span>contains the values from packet decode needed for floor 1 synthesis.
6905 <!--l. 235--><p class="noindent" ><span class="paragraphHead"><a
6906 id="x1-1010007.2.2"></a><span
6907 class="cmbx-10x-x-109">curve computation</span></span>
6908 Curve computation is split into two logical steps; the first step derives final Y amplitude values from
6909 the encoded, wrapped difference values taken from the bitstream. The second step plots the curve
6910 lines. Also, although zero-difference values are used in the iterative prediction to find final Y values,
6911 these points are conditionally skipped during final line computation in step two. Skipping
6912 zero-difference values allows a smoother line fit.
6913 <!--l. 245--><p class="noindent" >Although some aspects of the below algorithm look like inconsequential optimizations, implementors
6914 are warned to follow the details closely. Deviation from implementing a strictly equivalent algorithm
6915 can result in serious decoding errors.
6916 <!--l. 251--><p class="noindent" >
6917 <dl class="description"><dt class="description">
6919 class="cmssbx-10x-x-109">step 1: amplitude value synthesis</span> </dt><dd
6920 class="description">
6921 <!--l. 253--><p class="noindent" >Unwrap the always-positive-or-zero values read from the packet into +/- difference
6922 values, then apply to line prediction.
6923 <!--l. 256--><p class="noindent" >
6924 <div class="fancyvrb" id="fancyvrb31">
6926 id="x1-101002r1"></a><span
6927 class="cmtt-10"> </span><span
6928 class="cmtt-10"> </span><span
6929 class="cmtt-10"> </span><span
6930 class="cmtt-10"> 1)</span><span
6931 class="cmtt-10"> [range]</span><span
6932 class="cmtt-10"> =</span><span
6933 class="cmtt-10"> vector</span><span
6934 class="cmtt-10"> </span><span
6935 class="cmsy-10">{</span><span
6936 class="cmtt-10"> 256,</span><span
6937 class="cmtt-10"> 128,</span><span
6938 class="cmtt-10"> 86,</span><span
6939 class="cmtt-10"> 64</span><span
6940 class="cmtt-10"> </span><span
6941 class="cmsy-10">}</span><span
6942 class="cmtt-10"> element</span><span
6943 class="cmtt-10"> ([floor1_multiplier]-1)</span>
6944 <br class="fancyvrb" /><a
6945 id="x1-101004r2"></a><span
6946 class="cmtt-10"> </span><span
6947 class="cmtt-10"> </span><span
6948 class="cmtt-10"> </span><span
6949 class="cmtt-10"> 2)</span><span
6950 class="cmtt-10"> vector</span><span
6951 class="cmtt-10"> [floor1_step2_flag]</span><span
6952 class="cmtt-10"> element</span><span
6953 class="cmtt-10"> [0]</span><span
6954 class="cmtt-10"> =</span><span
6955 class="cmtt-10"> set</span>
6956 <br class="fancyvrb" /><a
6957 id="x1-101006r3"></a><span
6958 class="cmtt-10"> </span><span
6959 class="cmtt-10"> </span><span
6960 class="cmtt-10"> </span><span
6961 class="cmtt-10"> 3)</span><span
6962 class="cmtt-10"> vector</span><span
6963 class="cmtt-10"> [floor1_step2_flag]</span><span
6964 class="cmtt-10"> element</span><span
6965 class="cmtt-10"> [1]</span><span
6966 class="cmtt-10"> =</span><span
6967 class="cmtt-10"> set</span>
6968 <br class="fancyvrb" /><a
6969 id="x1-101008r4"></a><span
6970 class="cmtt-10"> </span><span
6971 class="cmtt-10"> </span><span
6972 class="cmtt-10"> </span><span
6973 class="cmtt-10"> 4)</span><span
6974 class="cmtt-10"> vector</span><span
6975 class="cmtt-10"> [floor1_final_Y]</span><span
6976 class="cmtt-10"> element</span><span
6977 class="cmtt-10"> [0]</span><span
6978 class="cmtt-10"> =</span><span
6979 class="cmtt-10"> vector</span><span
6980 class="cmtt-10"> [floor1_Y]</span><span
6981 class="cmtt-10"> element</span><span
6982 class="cmtt-10"> [0]</span>
6983 <br class="fancyvrb" /><a
6984 id="x1-101010r5"></a><span
6985 class="cmtt-10"> </span><span
6986 class="cmtt-10"> </span><span
6987 class="cmtt-10"> </span><span
6988 class="cmtt-10"> 5)</span><span
6989 class="cmtt-10"> vector</span><span
6990 class="cmtt-10"> [floor1_final_Y]</span><span
6991 class="cmtt-10"> element</span><span
6992 class="cmtt-10"> [1]</span><span
6993 class="cmtt-10"> =</span><span
6994 class="cmtt-10"> vector</span><span
6995 class="cmtt-10"> [floor1_Y]</span><span
6996 class="cmtt-10"> element</span><span
6997 class="cmtt-10"> [1]</span>
6998 <br class="fancyvrb" /><a
6999 id="x1-101012r6"></a><span
7000 class="cmtt-10"> </span><span
7001 class="cmtt-10"> </span><span
7002 class="cmtt-10"> </span><span
7003 class="cmtt-10"> 6)</span><span
7004 class="cmtt-10"> iterate</span><span
7005 class="cmtt-10"> [i]</span><span
7006 class="cmtt-10"> over</span><span
7007 class="cmtt-10"> the</span><span
7008 class="cmtt-10"> range</span><span
7009 class="cmtt-10"> 2</span><span
7010 class="cmtt-10"> ...</span><span
7011 class="cmtt-10"> [floor1_values]-1</span><span
7012 class="cmtt-10"> </span><span
7013 class="cmsy-10">{</span>
7014 <br class="fancyvrb" /><a
7015 id="x1-101014r7"></a><span
7016 class="cmtt-10"> </span><span
7017 class="cmtt-10"> </span>
7018 <br class="fancyvrb" /><a
7019 id="x1-101016r8"></a><span
7020 class="cmtt-10"> </span><span
7021 class="cmtt-10"> </span><span
7022 class="cmtt-10"> </span><span
7023 class="cmtt-10"> </span><span
7024 class="cmtt-10"> </span><span
7025 class="cmtt-10"> </span><span
7026 class="cmtt-10"> </span><span
7027 class="cmtt-10"> </span><span
7028 class="cmtt-10"> 7)</span><span
7029 class="cmtt-10"> [low_neighbor_offset]</span><span
7030 class="cmtt-10"> =</span><span
7031 class="cmtt-10"> </span><a
7032 href="#x1-1200009.2.4"><span
7033 class="cmtt-10">low_neighbor</span></a><span
7034 class="cmtt-10">([floor1_X_list],[i])</span>
7035 <br class="fancyvrb" /><a
7036 id="x1-101018r9"></a><span
7037 class="cmtt-10"> </span><span
7038 class="cmtt-10"> </span><span
7039 class="cmtt-10"> </span><span
7040 class="cmtt-10"> </span><span
7041 class="cmtt-10"> </span><span
7042 class="cmtt-10"> </span><span
7043 class="cmtt-10"> </span><span
7044 class="cmtt-10"> </span><span
7045 class="cmtt-10"> 8)</span><span
7046 class="cmtt-10"> [high_neighbor_offset]</span><span
7047 class="cmtt-10"> =</span><span
7048 class="cmtt-10"> </span><a
7049 href="#x1-1210009.2.5"><span
7050 class="cmtt-10">high_neighbor</span></a><span
7051 class="cmtt-10">([floor1_X_list],[i])</span>
7052 <br class="fancyvrb" /><a
7053 id="x1-101020r10"></a><span
7054 class="cmtt-10"> </span><span
7055 class="cmtt-10"> </span>
7056 <br class="fancyvrb" /><a
7057 id="x1-101022r11"></a><span
7058 class="cmtt-10"> </span><span
7059 class="cmtt-10"> </span><span
7060 class="cmtt-10"> </span><span
7061 class="cmtt-10"> </span><span
7062 class="cmtt-10"> </span><span
7063 class="cmtt-10"> </span><span
7064 class="cmtt-10"> </span><span
7065 class="cmtt-10"> </span><span
7066 class="cmtt-10"> 9)</span><span
7067 class="cmtt-10"> [predicted]</span><span
7068 class="cmtt-10"> =</span><span
7069 class="cmtt-10"> </span><a
7070 href="#x1-1220009.2.6"><span
7071 class="cmtt-10">render_point</span></a><span
7072 class="cmtt-10">(</span><span
7073 class="cmtt-10"> vector</span><span
7074 class="cmtt-10"> [floor1_X_list]</span><span
7075 class="cmtt-10"> element</span><span
7076 class="cmtt-10"> [low_neighbor_offset],</span>
7077 <br class="fancyvrb" /><a
7078 id="x1-101024r12"></a><span
7079 class="cmtt-10"> </span><span
7080 class="cmtt-10">  </span><span
7081 class="cmtt-10"> </span><span
7082 class="cmtt-10"> </span><span
7083 class="cmtt-10"> </span><span
7084 class="cmtt-10"> </span><span
7085 class="cmtt-10"> </span><span
7086 class="cmtt-10"> vector</span><span
7087 class="cmtt-10"> [floor1_final_Y]</span><span
7088 class="cmtt-10"> element</span><span
7089 class="cmtt-10"> [low_neighbor_offset],</span>
7090 <br class="fancyvrb" /><a
7091 id="x1-101026r13"></a><span
7092 class="cmtt-10"> </span><span
7093 class="cmtt-10"> </span><span
7094 class="cmtt-10"> </span><span
7095 class="cmtt-10"> </span><span
7096 class="cmtt-10"> </span><span
7097 class="cmtt-10"> </span><span
7098 class="cmtt-10"> </span><span
7099 class="cmtt-10"> </span><span
7100 class="cmtt-10"> </span><span
7101 class="cmtt-10"> </span><span
7102 class="cmtt-10"> </span><span
7103 class="cmtt-10"> </span><span
7104 class="cmtt-10"> </span><span
7105 class="cmtt-10"> </span><span
7106 class="cmtt-10"> </span><span
7107 class="cmtt-10"> </span><span
7108 class="cmtt-10"> </span><span
7109 class="cmtt-10"> </span><span
7110 class="cmtt-10"> </span><span
7111 class="cmtt-10"> </span><span
7112 class="cmtt-10"> </span><span
7113 class="cmtt-10"> </span><span
7114 class="cmtt-10"> </span><span
7115 class="cmtt-10"> </span><span
7116 class="cmtt-10"> </span><span
7117 class="cmtt-10"> </span><span
7118 class="cmtt-10"> </span><span
7119 class="cmtt-10"> </span><span
7120 class="cmtt-10"> </span><span
7121 class="cmtt-10"> </span><span
7122 class="cmtt-10"> </span><span
7123 class="cmtt-10"> </span><span
7124 class="cmtt-10"> </span><span
7125 class="cmtt-10"> </span><span
7126 class="cmtt-10"> </span><span
7127 class="cmtt-10"> </span><span
7128 class="cmtt-10"> </span><span
7129 class="cmtt-10"> </span><span
7130 class="cmtt-10"> </span><span
7131 class="cmtt-10"> vector</span><span
7132 class="cmtt-10"> [floor1_X_list]</span><span
7133 class="cmtt-10"> element</span><span
7134 class="cmtt-10"> [high_neighbor_offset],</span>
7135 <br class="fancyvrb" /><a
7136 id="x1-101028r14"></a><span
7137 class="cmtt-10"> </span><span
7138 class="cmtt-10">  </span><span
7139 class="cmtt-10"> </span><span
7140 class="cmtt-10"> </span><span
7141 class="cmtt-10"> </span><span
7142 class="cmtt-10"> </span><span
7143 class="cmtt-10"> </span><span
7144 class="cmtt-10"> vector</span><span
7145 class="cmtt-10"> [floor1_final_Y]</span><span
7146 class="cmtt-10"> element</span><span
7147 class="cmtt-10"> [high_neighbor_offset],</span>
7148 <br class="fancyvrb" /><a
7149 id="x1-101030r15"></a><span
7150 class="cmtt-10"> </span><span
7151 class="cmtt-10"> </span><span
7152 class="cmtt-10"> </span><span
7153 class="cmtt-10"> </span><span
7154 class="cmtt-10"> </span><span
7155 class="cmtt-10"> </span><span
7156 class="cmtt-10"> </span><span
7157 class="cmtt-10"> </span><span
7158 class="cmtt-10"> </span><span
7159 class="cmtt-10"> </span><span
7160 class="cmtt-10"> </span><span
7161 class="cmtt-10"> </span><span
7162 class="cmtt-10"> </span><span
7163 class="cmtt-10"> </span><span
7164 class="cmtt-10"> </span><span
7165 class="cmtt-10"> </span><span
7166 class="cmtt-10"> </span><span
7167 class="cmtt-10"> </span><span
7168 class="cmtt-10"> </span><span
7169 class="cmtt-10"> </span><span
7170 class="cmtt-10"> </span><span
7171 class="cmtt-10"> </span><span
7172 class="cmtt-10"> </span><span
7173 class="cmtt-10"> </span><span
7174 class="cmtt-10"> </span><span
7175 class="cmtt-10"> </span><span
7176 class="cmtt-10"> </span><span
7177 class="cmtt-10"> </span><span
7178 class="cmtt-10"> </span><span
7179 class="cmtt-10"> </span><span
7180 class="cmtt-10"> </span><span
7181 class="cmtt-10"> </span><span
7182 class="cmtt-10"> </span><span
7183 class="cmtt-10"> </span><span
7184 class="cmtt-10"> </span><span
7185 class="cmtt-10"> </span><span
7186 class="cmtt-10"> </span><span
7187 class="cmtt-10"> </span><span
7188 class="cmtt-10"> </span><span
7189 class="cmtt-10"> vector</span><span
7190 class="cmtt-10"> [floor1_X_list]</span><span
7191 class="cmtt-10"> element</span><span
7192 class="cmtt-10"> [i]</span><span
7193 class="cmtt-10"> )</span>
7194 <br class="fancyvrb" /><a
7195 id="x1-101032r16"></a><span
7196 class="cmtt-10"> </span><span
7197 class="cmtt-10"> </span>
7198 <br class="fancyvrb" /><a
7199 id="x1-101034r17"></a><span
7200 class="cmtt-10"> </span><span
7201 class="cmtt-10"> </span><span
7202 class="cmtt-10"> </span><span
7203 class="cmtt-10"> </span><span
7204 class="cmtt-10"> </span><span
7205 class="cmtt-10"> </span><span
7206 class="cmtt-10"> </span><span
7207 class="cmtt-10"> 10)</span><span
7208 class="cmtt-10"> [val]</span><span
7209 class="cmtt-10"> =</span><span
7210 class="cmtt-10"> vector</span><span
7211 class="cmtt-10"> [floor1_Y]</span><span
7212 class="cmtt-10"> element</span><span
7213 class="cmtt-10"> [i]</span>
7214 <br class="fancyvrb" /><a
7215 id="x1-101036r18"></a><span
7216 class="cmtt-10"> </span><span
7217 class="cmtt-10"> </span><span
7218 class="cmtt-10"> </span><span
7219 class="cmtt-10"> </span><span
7220 class="cmtt-10"> </span><span
7221 class="cmtt-10"> </span><span
7222 class="cmtt-10"> </span><span
7223 class="cmtt-10"> 11)</span><span
7224 class="cmtt-10"> [highroom]</span><span
7225 class="cmtt-10"> =</span><span
7226 class="cmtt-10"> [range]</span><span
7227 class="cmtt-10"> -</span><span
7228 class="cmtt-10"> [predicted]</span>
7229 <br class="fancyvrb" /><a
7230 id="x1-101038r19"></a><span
7231 class="cmtt-10"> </span><span
7232 class="cmtt-10"> </span><span
7233 class="cmtt-10"> </span><span
7234 class="cmtt-10"> </span><span
7235 class="cmtt-10"> </span><span
7236 class="cmtt-10"> </span><span
7237 class="cmtt-10"> </span><span
7238 class="cmtt-10"> 12)</span><span
7239 class="cmtt-10"> [lowroom]</span><span
7240 class="cmtt-10"> </span><span
7241 class="cmtt-10"> =</span><span
7242 class="cmtt-10"> [predicted]</span>
7243 <br class="fancyvrb" /><a
7244 id="x1-101040r20"></a><span
7245 class="cmtt-10"> </span><span
7246 class="cmtt-10"> </span><span
7247 class="cmtt-10"> </span><span
7248 class="cmtt-10"> </span><span
7249 class="cmtt-10"> </span><span
7250 class="cmtt-10"> </span><span
7251 class="cmtt-10"> </span><span
7252 class="cmtt-10"> 13)</span><span
7253 class="cmtt-10"> if</span><span
7254 class="cmtt-10"> (</span><span
7255 class="cmtt-10"> [highroom]</span><span
7256 class="cmtt-10"> is</span><span
7257 class="cmtt-10"> less</span><span
7258 class="cmtt-10"> than</span><span
7259 class="cmtt-10"> [lowroom]</span><span
7260 class="cmtt-10"> )</span><span
7261 class="cmtt-10"> </span><span
7262 class="cmsy-10">{</span>
7263 <br class="fancyvrb" /><a
7264 id="x1-101042r21"></a><span
7265 class="cmtt-10"> </span><span
7266 class="cmtt-10"> </span>
7267 <br class="fancyvrb" /><a
7268 id="x1-101044r22"></a><span
7269 class="cmtt-10"> </span><span
7270 class="cmtt-10"> </span><span
7271 class="cmtt-10"> </span><span
7272 class="cmtt-10"> </span><span
7273 class="cmtt-10"> </span><span
7274 class="cmtt-10"> </span><span
7275 class="cmtt-10"> </span><span
7276 class="cmtt-10"> </span><span
7277 class="cmtt-10"> </span><span
7278 class="cmtt-10"> </span><span
7279 class="cmtt-10"> </span><span
7280 class="cmtt-10"> </span><span
7281 class="cmtt-10"> </span><span
7282 class="cmtt-10"> 14)</span><span
7283 class="cmtt-10"> [room]</span><span
7284 class="cmtt-10"> =</span><span
7285 class="cmtt-10"> [highroom]</span><span
7286 class="cmtt-10"> *</span><span
7287 class="cmtt-10"> 2</span>
7288 <br class="fancyvrb" /><a
7289 id="x1-101046r23"></a><span
7290 class="cmtt-10"> </span><span
7291 class="cmtt-10"> </span>
7292 <br class="fancyvrb" /><a
7293 id="x1-101048r24"></a><span
7294 class="cmtt-10"> </span><span
7295 class="cmtt-10"> </span><span
7296 class="cmtt-10"> </span><span
7297 class="cmtt-10"> </span><span
7298 class="cmtt-10"> </span><span
7299 class="cmtt-10"> </span><span
7300 class="cmtt-10"> </span><span
7301 class="cmtt-10"> </span><span
7302 class="cmtt-10"> </span><span
7303 class="cmtt-10"> </span><span
7304 class="cmtt-10"> </span><span
7305 class="cmtt-10"> </span><span
7306 class="cmsy-10">}</span><span
7307 class="cmtt-10"> else</span><span
7308 class="cmtt-10"> [highroom]</span><span
7309 class="cmtt-10"> is</span><span
7310 class="cmtt-10"> not</span><span
7311 class="cmtt-10"> less</span><span
7312 class="cmtt-10"> than</span><span
7313 class="cmtt-10"> [lowroom]</span><span
7314 class="cmtt-10"> </span><span
7315 class="cmsy-10">{</span>
7316 <br class="fancyvrb" /><a
7317 id="x1-101050r25"></a><span
7318 class="cmtt-10"> </span><span
7319 class="cmtt-10"> </span>
7320 <br class="fancyvrb" /><a
7321 id="x1-101052r26"></a><span
7322 class="cmtt-10"> </span><span
7323 class="cmtt-10"> </span><span
7324 class="cmtt-10"> </span><span
7325 class="cmtt-10"> </span><span
7326 class="cmtt-10"> </span><span
7327 class="cmtt-10"> </span><span
7328 class="cmtt-10"> </span><span
7329 class="cmtt-10"> </span><span
7330 class="cmtt-10"> </span><span
7331 class="cmtt-10"> </span><span
7332 class="cmtt-10"> </span><span
7333 class="cmtt-10"> </span><span
7334 class="cmtt-10"> </span><span
7335 class="cmtt-10"> 15)</span><span
7336 class="cmtt-10"> [room]</span><span
7337 class="cmtt-10"> =</span><span
7338 class="cmtt-10"> [lowroom]</span><span
7339 class="cmtt-10"> *</span><span
7340 class="cmtt-10"> 2</span>
7341 <br class="fancyvrb" /><a
7342 id="x1-101054r27"></a><span
7343 class="cmtt-10"> </span><span
7344 class="cmtt-10"> </span>
7348 <br class="fancyvrb" /><a
7349 id="x1-101056r28"></a><span
7350 class="cmtt-10"> </span><span
7351 class="cmtt-10"> </span><span
7352 class="cmtt-10"> </span><span
7353 class="cmtt-10"> </span><span
7354 class="cmtt-10"> </span><span
7355 class="cmtt-10"> </span><span
7356 class="cmtt-10"> </span><span
7357 class="cmtt-10"> </span><span
7358 class="cmtt-10"> </span><span
7359 class="cmtt-10"> </span><span
7360 class="cmtt-10"> </span><span
7361 class="cmtt-10"> </span><span
7362 class="cmsy-10">}</span>
7363 <br class="fancyvrb" /><a
7364 id="x1-101058r29"></a><span
7365 class="cmtt-10"> </span><span
7366 class="cmtt-10"> </span>
7367 <br class="fancyvrb" /><a
7368 id="x1-101060r30"></a><span
7369 class="cmtt-10"> </span><span
7370 class="cmtt-10"> </span><span
7371 class="cmtt-10"> </span><span
7372 class="cmtt-10"> </span><span
7373 class="cmtt-10"> </span><span
7374 class="cmtt-10"> </span><span
7375 class="cmtt-10"> </span><span
7376 class="cmtt-10"> 16)</span><span
7377 class="cmtt-10"> if</span><span
7378 class="cmtt-10"> (</span><span
7379 class="cmtt-10"> [val]</span><span
7380 class="cmtt-10"> is</span><span
7381 class="cmtt-10"> nonzero</span><span
7382 class="cmtt-10"> )</span><span
7383 class="cmtt-10"> </span><span
7384 class="cmsy-10">{</span>
7385 <br class="fancyvrb" /><a
7386 id="x1-101062r31"></a><span
7387 class="cmtt-10"> </span><span
7388 class="cmtt-10"> </span>
7389 <br class="fancyvrb" /><a
7390 id="x1-101064r32"></a><span
7391 class="cmtt-10"> </span><span
7392 class="cmtt-10"> </span><span
7393 class="cmtt-10"> </span><span
7394 class="cmtt-10"> </span><span
7395 class="cmtt-10"> </span><span
7396 class="cmtt-10"> </span><span
7397 class="cmtt-10"> </span><span
7398 class="cmtt-10"> </span><span
7399 class="cmtt-10"> </span><span
7400 class="cmtt-10"> </span><span
7401 class="cmtt-10"> </span><span
7402 class="cmtt-10"> </span><span
7403 class="cmtt-10"> </span><span
7404 class="cmtt-10"> 17)</span><span
7405 class="cmtt-10"> vector</span><span
7406 class="cmtt-10"> [floor1_step2_flag]</span><span
7407 class="cmtt-10"> element</span><span
7408 class="cmtt-10"> [low_neighbor_offset]</span><span
7409 class="cmtt-10"> =</span><span
7410 class="cmtt-10"> set</span>
7411 <br class="fancyvrb" /><a
7412 id="x1-101066r33"></a><span
7413 class="cmtt-10"> </span><span
7414 class="cmtt-10"> </span><span
7415 class="cmtt-10"> </span><span
7416 class="cmtt-10"> </span><span
7417 class="cmtt-10"> </span><span
7418 class="cmtt-10"> </span><span
7419 class="cmtt-10"> </span><span
7420 class="cmtt-10"> </span><span
7421 class="cmtt-10"> </span><span
7422 class="cmtt-10"> </span><span
7423 class="cmtt-10"> </span><span
7424 class="cmtt-10"> </span><span
7425 class="cmtt-10"> </span><span
7426 class="cmtt-10"> 18)</span><span
7427 class="cmtt-10"> vector</span><span
7428 class="cmtt-10"> [floor1_step2_flag]</span><span
7429 class="cmtt-10"> element</span><span
7430 class="cmtt-10"> [high_neighbor_offset]</span><span
7431 class="cmtt-10"> =</span><span
7432 class="cmtt-10"> set</span>
7433 <br class="fancyvrb" /><a
7434 id="x1-101068r34"></a><span
7435 class="cmtt-10"> </span><span
7436 class="cmtt-10"> </span><span
7437 class="cmtt-10"> </span><span
7438 class="cmtt-10"> </span><span
7439 class="cmtt-10"> </span><span
7440 class="cmtt-10"> </span><span
7441 class="cmtt-10"> </span><span
7442 class="cmtt-10"> </span><span
7443 class="cmtt-10"> </span><span
7444 class="cmtt-10"> </span><span
7445 class="cmtt-10"> </span><span
7446 class="cmtt-10"> </span><span
7447 class="cmtt-10"> </span><span
7448 class="cmtt-10"> 19)</span><span
7449 class="cmtt-10"> vector</span><span
7450 class="cmtt-10"> [floor1_step2_flag]</span><span
7451 class="cmtt-10"> element</span><span
7452 class="cmtt-10"> [i]</span><span
7453 class="cmtt-10"> =</span><span
7454 class="cmtt-10"> set</span>
7455 <br class="fancyvrb" /><a
7456 id="x1-101070r35"></a><span
7457 class="cmtt-10"> </span><span
7458 class="cmtt-10"> </span><span
7459 class="cmtt-10"> </span><span
7460 class="cmtt-10"> </span><span
7461 class="cmtt-10"> </span><span
7462 class="cmtt-10"> </span><span
7463 class="cmtt-10"> </span><span
7464 class="cmtt-10"> </span><span
7465 class="cmtt-10"> </span><span
7466 class="cmtt-10"> </span><span
7467 class="cmtt-10"> </span><span
7468 class="cmtt-10"> </span><span
7469 class="cmtt-10"> </span><span
7470 class="cmtt-10"> 20)</span><span
7471 class="cmtt-10"> if</span><span
7472 class="cmtt-10"> (</span><span
7473 class="cmtt-10"> [val]</span><span
7474 class="cmtt-10"> is</span><span
7475 class="cmtt-10"> greater</span><span
7476 class="cmtt-10"> than</span><span
7477 class="cmtt-10"> or</span><span
7478 class="cmtt-10"> equal</span><span
7479 class="cmtt-10"> to</span><span
7480 class="cmtt-10"> [room]</span><span
7481 class="cmtt-10"> )</span><span
7482 class="cmtt-10"> </span><span
7483 class="cmsy-10">{</span>
7484 <br class="fancyvrb" /><a
7485 id="x1-101072r36"></a><span
7486 class="cmtt-10"> </span><span
7487 class="cmtt-10"> </span>
7488 <br class="fancyvrb" /><a
7489 id="x1-101074r37"></a><span
7490 class="cmtt-10"> </span><span
7491 class="cmtt-10"> </span><span
7492 class="cmtt-10"> </span><span
7493 class="cmtt-10"> </span><span
7494 class="cmtt-10"> </span><span
7495 class="cmtt-10"> </span><span
7496 class="cmtt-10"> </span><span
7497 class="cmtt-10"> </span><span
7498 class="cmtt-10"> </span><span
7499 class="cmtt-10"> </span><span
7500 class="cmtt-10"> </span><span
7501 class="cmtt-10"> </span><span
7502 class="cmtt-10"> </span><span
7503 class="cmtt-10"> </span><span
7504 class="cmtt-10"> </span><span
7505 class="cmtt-10"> </span><span
7506 class="cmtt-10"> </span><span
7507 class="cmtt-10"> </span><span
7508 class="cmtt-10"> </span><span
7509 class="cmtt-10"> 21)</span><span
7510 class="cmtt-10"> if</span><span
7511 class="cmtt-10"> (</span><span
7512 class="cmtt-10"> [highroom]</span><span
7513 class="cmtt-10"> is</span><span
7514 class="cmtt-10"> greater</span><span
7515 class="cmtt-10"> than</span><span
7516 class="cmtt-10"> [lowroom]</span><span
7517 class="cmtt-10"> )</span><span
7518 class="cmtt-10"> </span><span
7519 class="cmsy-10">{</span>
7520 <br class="fancyvrb" /><a
7521 id="x1-101076r38"></a><span
7522 class="cmtt-10"> </span><span
7523 class="cmtt-10"> </span>
7524 <br class="fancyvrb" /><a
7525 id="x1-101078r39"></a><span
7526 class="cmtt-10"> </span><span
7527 class="cmtt-10"> </span><span
7528 class="cmtt-10"> </span><span
7529 class="cmtt-10"> </span><span
7530 class="cmtt-10"> </span><span
7531 class="cmtt-10"> </span><span
7532 class="cmtt-10"> </span><span
7533 class="cmtt-10"> </span><span
7534 class="cmtt-10"> </span><span
7535 class="cmtt-10"> </span><span
7536 class="cmtt-10"> </span><span
7537 class="cmtt-10"> </span><span
7538 class="cmtt-10"> </span><span
7539 class="cmtt-10"> </span><span
7540 class="cmtt-10"> </span><span
7541 class="cmtt-10"> </span><span
7542 class="cmtt-10"> </span><span
7543 class="cmtt-10"> </span><span
7544 class="cmtt-10"> </span><span
7545 class="cmtt-10"> </span><span
7546 class="cmtt-10"> </span><span
7547 class="cmtt-10"> </span><span
7548 class="cmtt-10"> </span><span
7549 class="cmtt-10"> </span><span
7550 class="cmtt-10"> </span><span
7551 class="cmtt-10"> 22)</span><span
7552 class="cmtt-10"> vector</span><span
7553 class="cmtt-10"> [floor1_final_Y]</span><span
7554 class="cmtt-10"> element</span><span
7555 class="cmtt-10"> [i]</span><span
7556 class="cmtt-10"> =</span><span
7557 class="cmtt-10"> [val]</span><span
7558 class="cmtt-10"> -</span><span
7559 class="cmtt-10"> [lowroom]</span><span
7560 class="cmtt-10"> +</span><span
7561 class="cmtt-10"> [predicted]</span>
7562 <br class="fancyvrb" /><a
7563 id="x1-101080r40"></a><span
7564 class="cmtt-10"> </span><span
7565 class="cmtt-10"> </span>
7566 <br class="fancyvrb" /><a
7567 id="x1-101082r41"></a><span
7568 class="cmtt-10"> </span><span
7569 class="cmtt-10">  </span><span
7570 class="cmtt-10"> </span><span
7571 class="cmtt-10"> </span><span
7572 class="cmtt-10"> </span><span
7573 class="cmtt-10"> </span><span
7574 class="cmtt-10"> </span><span
7575 class="cmtt-10"> </span><span
7576 class="cmsy-10">}</span><span
7577 class="cmtt-10"> else</span><span
7578 class="cmtt-10"> [highroom]</span><span
7579 class="cmtt-10"> is</span><span
7580 class="cmtt-10"> not</span><span
7581 class="cmtt-10"> greater</span><span
7582 class="cmtt-10"> than</span><span
7583 class="cmtt-10"> [lowroom]</span><span
7584 class="cmtt-10"> </span><span
7585 class="cmsy-10">{</span>
7586 <br class="fancyvrb" /><a
7587 id="x1-101084r42"></a><span
7588 class="cmtt-10"> </span><span
7589 class="cmtt-10"> </span>
7590 <br class="fancyvrb" /><a
7591 id="x1-101086r43"></a><span
7592 class="cmtt-10"> </span><span
7593 class="cmtt-10"> </span><span
7594 class="cmtt-10"> </span><span
7595 class="cmtt-10"> </span><span
7596 class="cmtt-10"> </span><span
7597 class="cmtt-10"> </span><span
7598 class="cmtt-10"> </span><span
7599 class="cmtt-10"> </span><span
7600 class="cmtt-10"> </span><span
7601 class="cmtt-10"> </span><span
7602 class="cmtt-10"> </span><span
7603 class="cmtt-10"> </span><span
7604 class="cmtt-10"> </span><span
7605 class="cmtt-10"> </span><span
7606 class="cmtt-10"> </span><span
7607 class="cmtt-10"> </span><span
7608 class="cmtt-10"> </span><span
7609 class="cmtt-10"> </span><span
7610 class="cmtt-10"> </span><span
7611 class="cmtt-10"> </span><span
7612 class="cmtt-10"> </span><span
7613 class="cmtt-10"> </span><span
7614 class="cmtt-10"> </span><span
7615 class="cmtt-10"> </span><span
7616 class="cmtt-10"> </span><span
7617 class="cmtt-10"> 23)</span><span
7618 class="cmtt-10"> vector</span><span
7619 class="cmtt-10"> [floor1_final_Y]</span><span
7620 class="cmtt-10"> element</span><span
7621 class="cmtt-10"> [i]</span><span
7622 class="cmtt-10"> =</span><span
7623 class="cmtt-10"> [predicted]</span><span
7624 class="cmtt-10"> -</span><span
7625 class="cmtt-10"> [val]</span><span
7626 class="cmtt-10"> +</span><span
7627 class="cmtt-10"> [highroom]</span><span
7628 class="cmtt-10"> -</span><span
7629 class="cmtt-10"> 1</span>
7630 <br class="fancyvrb" /><a
7631 id="x1-101088r44"></a><span
7632 class="cmtt-10"> </span><span
7633 class="cmtt-10"> </span>
7634 <br class="fancyvrb" /><a
7635 id="x1-101090r45"></a><span
7636 class="cmtt-10"> </span><span
7637 class="cmtt-10"> </span><span
7638 class="cmtt-10"> </span><span
7639 class="cmtt-10"> </span><span
7640 class="cmtt-10"> </span><span
7641 class="cmtt-10"> </span><span
7642 class="cmtt-10"> </span><span
7643 class="cmtt-10"> </span><span
7644 class="cmtt-10"> </span><span
7645 class="cmtt-10"> </span><span
7646 class="cmtt-10"> </span><span
7647 class="cmtt-10"> </span><span
7648 class="cmtt-10"> </span><span
7649 class="cmtt-10"> </span><span
7650 class="cmtt-10"> </span><span
7651 class="cmtt-10"> </span><span
7652 class="cmtt-10"> </span><span
7653 class="cmtt-10"> </span><span
7654 class="cmtt-10"> </span><span
7655 class="cmtt-10"> </span><span
7656 class="cmtt-10"> </span><span
7657 class="cmtt-10"> </span><span
7658 class="cmtt-10"> </span><span
7659 class="cmtt-10"> </span><span
7660 class="cmsy-10">}</span>
7661 <br class="fancyvrb" /><a
7662 id="x1-101092r46"></a><span
7663 class="cmtt-10"> </span><span
7664 class="cmtt-10"> </span>
7665 <br class="fancyvrb" /><a
7666 id="x1-101094r47"></a><span
7667 class="cmtt-10"> </span><span
7668 class="cmtt-10"> </span><span
7669 class="cmtt-10"> </span><span
7670 class="cmtt-10"> </span><span
7671 class="cmtt-10"> </span><span
7672 class="cmtt-10"> </span><span
7673 class="cmtt-10"> </span><span
7674 class="cmtt-10"> </span><span
7675 class="cmtt-10"> </span><span
7676 class="cmtt-10"> </span><span
7677 class="cmtt-10"> </span><span
7678 class="cmtt-10"> </span><span
7679 class="cmtt-10"> </span><span
7680 class="cmtt-10"> </span><span
7681 class="cmtt-10"> </span><span
7682 class="cmtt-10"> </span><span
7683 class="cmtt-10"> </span><span
7684 class="cmtt-10"> </span><span
7685 class="cmsy-10">}</span><span
7686 class="cmtt-10"> else</span><span
7687 class="cmtt-10"> [val]</span><span
7688 class="cmtt-10"> is</span><span
7689 class="cmtt-10"> less</span><span
7690 class="cmtt-10"> than</span><span
7691 class="cmtt-10"> [room]</span><span
7692 class="cmtt-10"> </span><span
7693 class="cmsy-10">{</span>
7694 <br class="fancyvrb" /><a
7695 id="x1-101096r48"></a><span
7696 class="cmtt-10"> </span><span
7697 class="cmtt-10"> </span>
7698 <br class="fancyvrb" /><a
7699 id="x1-101098r49"></a><span
7700 class="cmtt-10"> </span><span
7701 class="cmtt-10">  </span><span
7702 class="cmtt-10"> </span><span
7703 class="cmtt-10"> 24)</span><span
7704 class="cmtt-10"> if</span><span
7705 class="cmtt-10"> ([val]</span><span
7706 class="cmtt-10"> is</span><span
7707 class="cmtt-10"> odd)</span><span
7708 class="cmtt-10"> </span><span
7709 class="cmsy-10">{</span>
7710 <br class="fancyvrb" /><a
7711 id="x1-101100r50"></a><span
7712 class="cmtt-10"> </span><span
7713 class="cmtt-10"> </span>
7714 <br class="fancyvrb" /><a
7715 id="x1-101102r51"></a><span
7716 class="cmtt-10"> </span><span
7717 class="cmtt-10"> </span><span
7718 class="cmtt-10"> </span><span
7719 class="cmtt-10"> </span><span
7720 class="cmtt-10"> </span><span
7721 class="cmtt-10"> </span><span
7722 class="cmtt-10"> </span><span
7723 class="cmtt-10"> </span><span
7724 class="cmtt-10"> </span><span
7725 class="cmtt-10"> </span><span
7726 class="cmtt-10"> </span><span
7727 class="cmtt-10"> </span><span
7728 class="cmtt-10"> </span><span
7729 class="cmtt-10"> </span><span
7730 class="cmtt-10"> </span><span
7731 class="cmtt-10"> </span><span
7732 class="cmtt-10"> </span><span
7733 class="cmtt-10"> </span><span
7734 class="cmtt-10"> </span><span
7735 class="cmtt-10"> </span><span
7736 class="cmtt-10"> </span><span
7737 class="cmtt-10"> </span><span
7738 class="cmtt-10"> </span><span
7739 class="cmtt-10"> </span><span
7740 class="cmtt-10"> </span><span
7741 class="cmtt-10"> 25)</span><span
7742 class="cmtt-10"> vector</span><span
7743 class="cmtt-10"> [floor1_final_Y]</span><span
7744 class="cmtt-10"> element</span><span
7745 class="cmtt-10"> [i]</span><span
7746 class="cmtt-10"> =</span>
7747 <br class="fancyvrb" /><a
7748 id="x1-101104r52"></a><span
7749 class="cmtt-10"> </span><span
7750 class="cmtt-10"> </span><span
7751 class="cmtt-10"> </span><span
7752 class="cmtt-10"> </span><span
7753 class="cmtt-10"> </span><span
7754 class="cmtt-10"> </span><span
7755 class="cmtt-10"> </span><span
7756 class="cmtt-10"> </span><span
7757 class="cmtt-10"> </span><span
7758 class="cmtt-10"> </span><span
7759 class="cmtt-10"> </span><span
7760 class="cmtt-10"> </span><span
7761 class="cmtt-10"> </span><span
7762 class="cmtt-10"> </span><span
7763 class="cmtt-10"> </span><span
7764 class="cmtt-10"> </span><span
7765 class="cmtt-10"> </span><span
7766 class="cmtt-10"> </span><span
7767 class="cmtt-10"> </span><span
7768 class="cmtt-10"> </span><span
7769 class="cmtt-10"> </span><span
7770 class="cmtt-10"> </span><span
7771 class="cmtt-10"> </span><span
7772 class="cmtt-10"> </span><span
7773 class="cmtt-10"> </span><span
7774 class="cmtt-10"> </span><span
7775 class="cmtt-10"> </span><span
7776 class="cmtt-10"> </span><span
7777 class="cmtt-10"> </span><span
7778 class="cmtt-10"> [predicted]</span><span
7779 class="cmtt-10"> -</span><span
7780 class="cmtt-10"> (([val]</span><span
7781 class="cmtt-10"> +</span><span
7782 class="cmtt-10"> 1)</span><span
7783 class="cmtt-10"> divided</span><span
7784 class="cmtt-10"> by</span><span
7785 class="cmtt-10"> </span><span
7786 class="cmtt-10"> 2</span><span
7787 class="cmtt-10"> using</span><span
7788 class="cmtt-10"> integer</span><span
7789 class="cmtt-10"> division)</span>
7790 <br class="fancyvrb" /><a
7791 id="x1-101106r53"></a><span
7792 class="cmtt-10"> </span><span
7793 class="cmtt-10"> </span>
7794 <br class="fancyvrb" /><a
7795 id="x1-101108r54"></a><span
7796 class="cmtt-10"> </span><span
7797 class="cmtt-10"> </span><span
7798 class="cmtt-10"> </span><span
7799 class="cmtt-10"> </span><span
7800 class="cmtt-10"> </span><span
7801 class="cmtt-10"> </span><span
7802 class="cmtt-10"> </span><span
7803 class="cmtt-10"> </span><span
7804 class="cmtt-10"> </span><span
7805 class="cmtt-10"> </span><span
7806 class="cmtt-10"> </span><span
7807 class="cmtt-10"> </span><span
7808 class="cmtt-10"> </span><span
7809 class="cmtt-10"> </span><span
7810 class="cmtt-10"> </span><span
7811 class="cmtt-10"> </span><span
7812 class="cmtt-10"> </span><span
7813 class="cmtt-10"> </span><span
7814 class="cmtt-10"> </span><span
7815 class="cmtt-10"> </span><span
7816 class="cmtt-10"> </span><span
7817 class="cmtt-10"> </span><span
7818 class="cmtt-10"> </span><span
7819 class="cmtt-10"> </span><span
7820 class="cmsy-10">}</span><span
7821 class="cmtt-10"> else</span><span
7822 class="cmtt-10"> [val]</span><span
7823 class="cmtt-10"> is</span><span
7824 class="cmtt-10"> even</span><span
7825 class="cmtt-10"> </span><span
7826 class="cmsy-10">{</span>
7827 <br class="fancyvrb" /><a
7828 id="x1-101110r55"></a><span
7829 class="cmtt-10"> </span><span
7830 class="cmtt-10"> </span>
7831 <br class="fancyvrb" /><a
7832 id="x1-101112r56"></a><span
7833 class="cmtt-10"> </span><span
7834 class="cmtt-10"> </span><span
7835 class="cmtt-10"> </span><span
7836 class="cmtt-10"> </span><span
7837 class="cmtt-10"> </span><span
7838 class="cmtt-10"> </span><span
7839 class="cmtt-10"> </span><span
7840 class="cmtt-10"> </span><span
7841 class="cmtt-10"> </span><span
7842 class="cmtt-10"> </span><span
7843 class="cmtt-10"> </span><span
7844 class="cmtt-10"> </span><span
7845 class="cmtt-10"> </span><span
7846 class="cmtt-10"> </span><span
7847 class="cmtt-10"> </span><span
7848 class="cmtt-10"> </span><span
7849 class="cmtt-10"> </span><span
7850 class="cmtt-10"> </span><span
7851 class="cmtt-10"> </span><span
7852 class="cmtt-10"> </span><span
7853 class="cmtt-10"> </span><span
7854 class="cmtt-10"> </span><span
7855 class="cmtt-10"> </span><span
7856 class="cmtt-10"> </span><span
7857 class="cmtt-10"> </span><span
7858 class="cmtt-10"> 26)</span><span
7859 class="cmtt-10"> vector</span><span
7860 class="cmtt-10"> [floor1_final_Y]</span><span
7861 class="cmtt-10"> element</span><span
7862 class="cmtt-10"> [i]</span><span
7863 class="cmtt-10"> =</span>
7864 <br class="fancyvrb" /><a
7865 id="x1-101114r57"></a><span
7866 class="cmtt-10"> </span><span
7867 class="cmtt-10"> </span><span
7868 class="cmtt-10"> </span><span
7869 class="cmtt-10"> </span><span
7870 class="cmtt-10"> </span><span
7871 class="cmtt-10"> </span><span
7872 class="cmtt-10"> </span><span
7873 class="cmtt-10"> </span><span
7874 class="cmtt-10"> </span><span
7875 class="cmtt-10"> </span><span
7876 class="cmtt-10"> </span><span
7877 class="cmtt-10"> </span><span
7878 class="cmtt-10"> </span><span
7879 class="cmtt-10"> </span><span
7880 class="cmtt-10"> </span><span
7881 class="cmtt-10"> </span><span
7882 class="cmtt-10"> </span><span
7883 class="cmtt-10"> </span><span
7884 class="cmtt-10"> </span><span
7885 class="cmtt-10"> </span><span
7886 class="cmtt-10"> </span><span
7887 class="cmtt-10"> </span><span
7888 class="cmtt-10"> </span><span
7889 class="cmtt-10"> </span><span
7890 class="cmtt-10"> </span><span
7891 class="cmtt-10"> </span><span
7892 class="cmtt-10"> </span><span
7893 class="cmtt-10"> </span><span
7894 class="cmtt-10"> </span><span
7895 class="cmtt-10"> [predicted]</span><span
7896 class="cmtt-10"> +</span><span
7897 class="cmtt-10"> ([val]</span><span
7898 class="cmtt-10"> /</span><span
7899 class="cmtt-10"> 2</span><span
7900 class="cmtt-10"> using</span><span
7901 class="cmtt-10"> integer</span><span
7902 class="cmtt-10"> division)</span>
7903 <br class="fancyvrb" /><a
7904 id="x1-101116r58"></a><span
7905 class="cmtt-10"> </span><span
7906 class="cmtt-10"> </span>
7907 <br class="fancyvrb" /><a
7908 id="x1-101118r59"></a><span
7909 class="cmtt-10"> </span><span
7910 class="cmtt-10"> </span><span
7911 class="cmtt-10"> </span><span
7912 class="cmtt-10"> </span><span
7913 class="cmtt-10"> </span><span
7914 class="cmtt-10"> </span><span
7915 class="cmtt-10"> </span><span
7916 class="cmtt-10"> </span><span
7917 class="cmtt-10"> </span><span
7918 class="cmtt-10"> </span><span
7919 class="cmtt-10"> </span><span
7920 class="cmtt-10"> </span><span
7921 class="cmtt-10"> </span><span
7922 class="cmtt-10"> </span><span
7923 class="cmtt-10"> </span><span
7924 class="cmtt-10"> </span><span
7925 class="cmtt-10"> </span><span
7926 class="cmtt-10"> </span><span
7927 class="cmtt-10"> </span><span
7928 class="cmtt-10"> </span><span
7929 class="cmtt-10"> </span><span
7930 class="cmtt-10"> </span><span
7931 class="cmtt-10"> </span><span
7932 class="cmtt-10"> </span><span
7933 class="cmsy-10">}</span>
7934 <br class="fancyvrb" /><a
7935 id="x1-101120r60"></a><span
7936 class="cmtt-10"> </span><span
7937 class="cmtt-10"> </span>
7938 <br class="fancyvrb" /><a
7939 id="x1-101122r61"></a><span
7940 class="cmtt-10"> </span><span
7941 class="cmtt-10"> </span><span
7942 class="cmtt-10"> </span><span
7943 class="cmtt-10"> </span><span
7944 class="cmtt-10"> </span><span
7945 class="cmtt-10"> </span><span
7946 class="cmtt-10"> </span><span
7947 class="cmtt-10"> </span><span
7948 class="cmtt-10"> </span><span
7949 class="cmtt-10"> </span><span
7950 class="cmtt-10"> </span><span
7951 class="cmtt-10"> </span><span
7952 class="cmtt-10"> </span><span
7953 class="cmtt-10"> </span><span
7954 class="cmtt-10"> </span><span
7955 class="cmtt-10"> </span><span
7956 class="cmtt-10"> </span><span
7957 class="cmtt-10"> </span><span
7958 class="cmsy-10">}</span>
7959 <br class="fancyvrb" /><a
7960 id="x1-101124r62"></a><span
7961 class="cmtt-10"> </span><span
7962 class="cmtt-10"> </span>
7963 <br class="fancyvrb" /><a
7964 id="x1-101126r63"></a><span
7965 class="cmtt-10"> </span><span
7966 class="cmtt-10"> </span><span
7967 class="cmtt-10"> </span><span
7968 class="cmtt-10"> </span><span
7969 class="cmtt-10"> </span><span
7970 class="cmtt-10"> </span><span
7971 class="cmtt-10"> </span><span
7972 class="cmtt-10"> </span><span
7973 class="cmtt-10"> </span><span
7974 class="cmtt-10"> </span><span
7975 class="cmtt-10"> </span><span
7976 class="cmtt-10"> </span><span
7977 class="cmsy-10">}</span><span
7978 class="cmtt-10"> else</span><span
7979 class="cmtt-10"> [val]</span><span
7980 class="cmtt-10"> is</span><span
7981 class="cmtt-10"> zero</span><span
7982 class="cmtt-10"> </span><span
7983 class="cmsy-10">{</span>
7984 <br class="fancyvrb" /><a
7985 id="x1-101128r64"></a><span
7986 class="cmtt-10"> </span><span
7987 class="cmtt-10"> </span>
7988 <br class="fancyvrb" /><a
7989 id="x1-101130r65"></a><span
7990 class="cmtt-10"> </span><span
7991 class="cmtt-10"> </span><span
7992 class="cmtt-10"> </span><span
7993 class="cmtt-10"> </span><span
7994 class="cmtt-10"> </span><span
7995 class="cmtt-10"> </span><span
7996 class="cmtt-10"> </span><span
7997 class="cmtt-10"> </span><span
7998 class="cmtt-10"> </span><span
7999 class="cmtt-10"> </span><span
8000 class="cmtt-10"> </span><span
8001 class="cmtt-10"> </span><span
8002 class="cmtt-10"> </span><span
8003 class="cmtt-10"> 27)</span><span
8004 class="cmtt-10"> vector</span><span
8005 class="cmtt-10"> [floor1_step2_flag]</span><span
8006 class="cmtt-10"> element</span><span
8007 class="cmtt-10"> [i]</span><span
8008 class="cmtt-10"> =</span><span
8009 class="cmtt-10"> unset</span>
8010 <br class="fancyvrb" /><a
8011 id="x1-101132r66"></a><span
8012 class="cmtt-10"> </span><span
8013 class="cmtt-10"> </span><span
8014 class="cmtt-10"> </span><span
8015 class="cmtt-10"> </span><span
8016 class="cmtt-10"> </span><span
8017 class="cmtt-10"> </span><span
8018 class="cmtt-10"> </span><span
8019 class="cmtt-10"> </span><span
8020 class="cmtt-10"> </span><span
8021 class="cmtt-10"> </span><span
8022 class="cmtt-10"> </span><span
8023 class="cmtt-10"> </span><span
8024 class="cmtt-10"> </span><span
8025 class="cmtt-10"> 28)</span><span
8026 class="cmtt-10"> vector</span><span
8027 class="cmtt-10"> [floor1_final_Y]</span><span
8028 class="cmtt-10"> element</span><span
8029 class="cmtt-10"> [i]</span><span
8030 class="cmtt-10"> =</span><span
8031 class="cmtt-10"> [predicted]</span>
8032 <br class="fancyvrb" /><a
8033 id="x1-101134r67"></a><span
8034 class="cmtt-10"> </span><span
8035 class="cmtt-10"> </span>
8036 <br class="fancyvrb" /><a
8037 id="x1-101136r68"></a><span
8038 class="cmtt-10"> </span><span
8039 class="cmtt-10"> </span><span
8040 class="cmtt-10"> </span><span
8041 class="cmtt-10"> </span><span
8042 class="cmtt-10"> </span><span
8043 class="cmtt-10"> </span><span
8044 class="cmtt-10"> </span><span
8045 class="cmtt-10"> </span><span
8046 class="cmtt-10"> </span><span
8047 class="cmtt-10"> </span><span
8048 class="cmtt-10"> </span><span
8049 class="cmtt-10"> </span><span
8050 class="cmsy-10">}</span>
8051 <br class="fancyvrb" /><a
8052 id="x1-101138r69"></a><span
8053 class="cmtt-10"> </span><span
8054 class="cmtt-10"> </span>
8055 <br class="fancyvrb" /><a
8056 id="x1-101140r70"></a><span
8057 class="cmtt-10"> </span><span
8058 class="cmtt-10"> </span><span
8059 class="cmtt-10"> </span><span
8060 class="cmtt-10"> </span><span
8061 class="cmtt-10"> </span><span
8062 class="cmtt-10"> </span><span
8063 class="cmtt-10"> </span><span
8064 class="cmsy-10">}</span>
8065 <br class="fancyvrb" /><a
8066 id="x1-101142r71"></a><span
8067 class="cmtt-10"> </span><span
8068 class="cmtt-10"> </span>
8069 <br class="fancyvrb" /><a
8070 id="x1-101144r72"></a><span
8071 class="cmtt-10"> </span><span
8072 class="cmtt-10"> </span><span
8073 class="cmtt-10"> 29)</span><span
8074 class="cmtt-10"> done</span>
8075 <br class="fancyvrb" /><a
8076 id="x1-101146r73"></a><span
8077 class="cmtt-10"> </span><span
8078 class="cmtt-10"> </span>
8080 </dd><dt class="description">
8082 class="cmssbx-10x-x-109">step 2: curve synthesis</span> </dt><dd
8083 class="description">
8084 <!--l. 336--><p class="noindent" >Curve synthesis generates a return vector <span
8085 class="cmtt-10x-x-109">[floor] </span>of length <span
8086 class="cmtt-10x-x-109">[n] </span>(where <span
8087 class="cmtt-10x-x-109">[n] </span>is provided by the
8091 decode process calling to floor decode). Floor 1 curve synthesis makes use of the
8093 class="cmtt-10x-x-109">[floor1_X_list]</span>, <span
8094 class="cmtt-10x-x-109">[floor1_final_Y] </span>and <span
8095 class="cmtt-10x-x-109">[floor1_step2_flag] </span>vectors, as well as
8096 [floor1˙multiplier] and [floor1˙values] values.
8097 <!--l. 343--><p class="noindent" >Decode begins by sorting the scalars from vectors <span
8098 class="cmtt-10x-x-109">[floor1_X_list]</span>, <span
8099 class="cmtt-10x-x-109">[floor1_final_Y] </span>and
8101 class="cmtt-10x-x-109">[floor1_step2_flag] </span>together into new vectors <span
8102 class="cmtt-10x-x-109">[floor1_X_list]’</span>, <span
8103 class="cmtt-10x-x-109">[floor1_final_Y]’</span>
8105 class="cmtt-10x-x-109">[floor1_step2_flag]’ </span>according to ascending sort order of the values in
8107 class="cmtt-10x-x-109">[floor1_X_list]</span>. That is, sort the values of <span
8108 class="cmtt-10x-x-109">[floor1_X_list] </span>and then apply the same
8109 permutation to elements of the other two vectors so that the X, Y and step2˙flag values still
8111 <!--l. 353--><p class="noindent" >Then compute the final curve in one pass:
8112 <!--l. 355--><p class="noindent" >
8113 <div class="fancyvrb" id="fancyvrb32">
8115 id="x1-101148r1"></a><span
8116 class="cmtt-10"> </span><span
8117 class="cmtt-10"> </span><span
8118 class="cmtt-10"> </span><span
8119 class="cmtt-10"> 1)</span><span
8120 class="cmtt-10"> [hx]</span><span
8121 class="cmtt-10"> =</span><span
8122 class="cmtt-10"> 0</span>
8123 <br class="fancyvrb" /><a
8124 id="x1-101150r2"></a><span
8125 class="cmtt-10"> </span><span
8126 class="cmtt-10"> </span><span
8127 class="cmtt-10"> </span><span
8128 class="cmtt-10"> 2)</span><span
8129 class="cmtt-10"> [lx]</span><span
8130 class="cmtt-10"> =</span><span
8131 class="cmtt-10"> 0</span>
8132 <br class="fancyvrb" /><a
8133 id="x1-101152r3"></a><span
8134 class="cmtt-10"> </span><span
8135 class="cmtt-10"> </span><span
8136 class="cmtt-10"> </span><span
8137 class="cmtt-10"> 3)</span><span
8138 class="cmtt-10"> [ly]</span><span
8139 class="cmtt-10"> =</span><span
8140 class="cmtt-10"> vector</span><span
8141 class="cmtt-10"> [floor1_final_Y]’</span><span
8142 class="cmtt-10"> element</span><span
8143 class="cmtt-10"> [0]</span><span
8144 class="cmtt-10"> *</span><span
8145 class="cmtt-10"> [floor1_multiplier]</span>
8146 <br class="fancyvrb" /><a
8147 id="x1-101154r4"></a><span
8148 class="cmtt-10"> </span><span
8149 class="cmtt-10"> </span><span
8150 class="cmtt-10"> </span><span
8151 class="cmtt-10"> 4)</span><span
8152 class="cmtt-10"> iterate</span><span
8153 class="cmtt-10"> [i]</span><span
8154 class="cmtt-10"> over</span><span
8155 class="cmtt-10"> the</span><span
8156 class="cmtt-10"> range</span><span
8157 class="cmtt-10"> 1</span><span
8158 class="cmtt-10"> ...</span><span
8159 class="cmtt-10"> [floor1_values]-1</span><span
8160 class="cmtt-10"> </span><span
8161 class="cmsy-10">{</span>
8162 <br class="fancyvrb" /><a
8163 id="x1-101156r5"></a><span
8164 class="cmtt-10"> </span><span
8165 class="cmtt-10"> </span>
8166 <br class="fancyvrb" /><a
8167 id="x1-101158r6"></a><span
8168 class="cmtt-10"> </span><span
8169 class="cmtt-10"> </span><span
8170 class="cmtt-10"> </span><span
8171 class="cmtt-10"> </span><span
8172 class="cmtt-10"> </span><span
8173 class="cmtt-10"> </span><span
8174 class="cmtt-10"> </span><span
8175 class="cmtt-10"> </span><span
8176 class="cmtt-10"> 5)</span><span
8177 class="cmtt-10"> if</span><span
8178 class="cmtt-10"> (</span><span
8179 class="cmtt-10"> [floor1_step2_flag]’</span><span
8180 class="cmtt-10"> element</span><span
8181 class="cmtt-10"> [i]</span><span
8182 class="cmtt-10"> is</span><span
8183 class="cmtt-10"> set</span><span
8184 class="cmtt-10"> )</span><span
8185 class="cmtt-10"> </span><span
8186 class="cmsy-10">{</span>
8187 <br class="fancyvrb" /><a
8188 id="x1-101160r7"></a><span
8189 class="cmtt-10"> </span><span
8190 class="cmtt-10"> </span>
8191 <br class="fancyvrb" /><a
8192 id="x1-101162r8"></a><span
8193 class="cmtt-10"> </span><span
8194 class="cmtt-10"> </span><span
8195 class="cmtt-10"> </span><span
8196 class="cmtt-10"> </span><span
8197 class="cmtt-10"> </span><span
8198 class="cmtt-10"> </span><span
8199 class="cmtt-10"> </span><span
8200 class="cmtt-10"> </span><span
8201 class="cmtt-10"> </span><span
8202 class="cmtt-10"> </span><span
8203 class="cmtt-10"> </span><span
8204 class="cmtt-10"> </span><span
8205 class="cmtt-10"> </span><span
8206 class="cmtt-10"> </span><span
8207 class="cmtt-10"> 6)</span><span
8208 class="cmtt-10"> [hy]</span><span
8209 class="cmtt-10"> =</span><span
8210 class="cmtt-10"> [floor1_final_Y]’</span><span
8211 class="cmtt-10"> element</span><span
8212 class="cmtt-10"> [i]</span><span
8213 class="cmtt-10"> *</span><span
8214 class="cmtt-10"> [floor1_multiplier]</span>
8215 <br class="fancyvrb" /><a
8216 id="x1-101164r9"></a><span
8217 class="cmtt-10"> </span><span
8218 class="cmtt-10"> </span><span
8219 class="cmtt-10">  </span><span
8220 class="cmtt-10"> </span><span
8221 class="cmtt-10"> </span><span
8222 class="cmtt-10"> </span><span
8223 class="cmtt-10"> </span><span
8224 class="cmtt-10"> 7)</span><span
8225 class="cmtt-10"> [hx]</span><span
8226 class="cmtt-10"> =</span><span
8227 class="cmtt-10"> [floor1_X_list]’</span><span
8228 class="cmtt-10"> element</span><span
8229 class="cmtt-10"> [i]</span>
8230 <br class="fancyvrb" /><a
8231 id="x1-101166r10"></a><span
8232 class="cmtt-10"> </span><span
8233 class="cmtt-10"> </span><span
8234 class="cmtt-10"> </span><span
8235 class="cmtt-10"> </span><span
8236 class="cmtt-10"> </span><span
8237 class="cmtt-10"> </span><span
8238 class="cmtt-10"> </span><span
8239 class="cmtt-10"> </span><span
8240 class="cmtt-10"> </span><span
8241 class="cmtt-10"> </span><span
8242 class="cmtt-10"> </span><span
8243 class="cmtt-10"> </span><span
8244 class="cmtt-10"> </span><span
8245 class="cmtt-10"> </span><span
8246 class="cmtt-10"> 8)</span><span
8247 class="cmtt-10"> </span><a
8248 href="#x1-1230009.2.7"><span
8249 class="cmtt-10">render_line</span></a><span
8250 class="cmtt-10">(</span><span
8251 class="cmtt-10"> [lx],</span><span
8252 class="cmtt-10"> [ly],</span><span
8253 class="cmtt-10"> [hx],</span><span
8254 class="cmtt-10"> [hy],</span><span
8255 class="cmtt-10"> [floor]</span><span
8256 class="cmtt-10"> )</span>
8257 <br class="fancyvrb" /><a
8258 id="x1-101168r11"></a><span
8259 class="cmtt-10"> </span><span
8260 class="cmtt-10"> </span><span
8261 class="cmtt-10"> </span><span
8262 class="cmtt-10"> </span><span
8263 class="cmtt-10"> </span><span
8264 class="cmtt-10"> </span><span
8265 class="cmtt-10"> </span><span
8266 class="cmtt-10"> </span><span
8267 class="cmtt-10"> </span><span
8268 class="cmtt-10"> </span><span
8269 class="cmtt-10"> </span><span
8270 class="cmtt-10"> </span><span
8271 class="cmtt-10"> </span><span
8272 class="cmtt-10"> </span><span
8273 class="cmtt-10"> 9)</span><span
8274 class="cmtt-10"> [lx]</span><span
8275 class="cmtt-10"> =</span><span
8276 class="cmtt-10"> [hx]</span>
8277 <br class="fancyvrb" /><a
8278 id="x1-101170r12"></a><span
8279 class="cmtt-10"> </span><span
8280 class="cmtt-10">  </span><span
8281 class="cmtt-10"> </span><span
8282 class="cmtt-10"> </span><span
8283 class="cmtt-10"> </span><span
8284 class="cmtt-10"> 10)</span><span
8285 class="cmtt-10"> [ly]</span><span
8286 class="cmtt-10"> =</span><span
8287 class="cmtt-10"> [hy]</span>
8288 <br class="fancyvrb" /><a
8289 id="x1-101172r13"></a><span
8290 class="cmtt-10"> </span><span
8291 class="cmtt-10"> </span><span
8292 class="cmtt-10"> </span><span
8293 class="cmtt-10"> </span><span
8294 class="cmtt-10"> </span><span
8295 class="cmtt-10"> </span><span
8296 class="cmtt-10"> </span><span
8297 class="cmtt-10"> </span><span
8298 class="cmtt-10"> </span><span
8299 class="cmtt-10"> </span><span
8300 class="cmtt-10"> </span><span
8301 class="cmtt-10"> </span><span
8302 class="cmsy-10">}</span>
8303 <br class="fancyvrb" /><a
8304 id="x1-101174r14"></a><span
8305 class="cmtt-10"> </span><span
8306 class="cmtt-10"> </span><span
8307 class="cmtt-10"> </span><span
8308 class="cmtt-10"> </span><span
8309 class="cmtt-10"> </span><span
8310 class="cmtt-10"> </span><span
8311 class="cmtt-10"> </span><span
8312 class="cmsy-10">}</span>
8313 <br class="fancyvrb" /><a
8314 id="x1-101176r15"></a><span
8315 class="cmtt-10"> </span><span
8316 class="cmtt-10"> </span>
8317 <br class="fancyvrb" /><a
8318 id="x1-101178r16"></a><span
8319 class="cmtt-10"> </span><span
8320 class="cmtt-10"> </span><span
8321 class="cmtt-10"> 11)</span><span
8322 class="cmtt-10"> if</span><span
8323 class="cmtt-10"> (</span><span
8324 class="cmtt-10"> [hx]</span><span
8325 class="cmtt-10"> is</span><span
8326 class="cmtt-10"> less</span><span
8327 class="cmtt-10"> than</span><span
8328 class="cmtt-10"> [n]</span><span
8329 class="cmtt-10"> )</span><span
8330 class="cmtt-10"> </span><span
8331 class="cmsy-10">{</span>
8332 <br class="fancyvrb" /><a
8333 id="x1-101180r17"></a><span
8334 class="cmtt-10"> </span><span
8335 class="cmtt-10"> </span>
8336 <br class="fancyvrb" /><a
8337 id="x1-101182r18"></a><span
8338 class="cmtt-10"> </span><span
8339 class="cmtt-10"> </span><span
8340 class="cmtt-10"> </span><span
8341 class="cmtt-10"> </span><span
8342 class="cmtt-10"> </span><span
8343 class="cmtt-10"> </span><span
8344 class="cmtt-10"> </span><span
8345 class="cmtt-10"> </span><span
8346 class="cmtt-10"> </span><span
8347 class="cmtt-10"> 12)</span><span
8348 class="cmtt-10"> </span><a
8349 href="#x1-1230009.2.7"><span
8350 class="cmtt-10">render_line</span></a><span
8351 class="cmtt-10">(</span><span
8352 class="cmtt-10"> [hx],</span><span
8353 class="cmtt-10"> [hy],</span><span
8354 class="cmtt-10"> [n],</span><span
8355 class="cmtt-10"> [hy],</span><span
8356 class="cmtt-10"> [floor]</span><span
8357 class="cmtt-10"> )</span>
8358 <br class="fancyvrb" /><a
8359 id="x1-101184r19"></a><span
8360 class="cmtt-10"> </span><span
8361 class="cmtt-10"> </span>
8362 <br class="fancyvrb" /><a
8363 id="x1-101186r20"></a><span
8364 class="cmtt-10"> </span><span
8365 class="cmtt-10"> </span><span
8366 class="cmtt-10"> </span><span
8367 class="cmtt-10"> </span><span
8368 class="cmtt-10"> </span><span
8369 class="cmtt-10"> </span><span
8370 class="cmtt-10"> </span><span
8371 class="cmsy-10">}</span>
8372 <br class="fancyvrb" /><a
8373 id="x1-101188r21"></a><span
8374 class="cmtt-10"> </span><span
8375 class="cmtt-10"> </span>
8376 <br class="fancyvrb" /><a
8377 id="x1-101190r22"></a><span
8378 class="cmtt-10"> </span><span
8379 class="cmtt-10"> </span><span
8380 class="cmtt-10"> 13)</span><span
8381 class="cmtt-10"> if</span><span
8382 class="cmtt-10"> (</span><span
8383 class="cmtt-10"> [hx]</span><span
8384 class="cmtt-10"> is</span><span
8385 class="cmtt-10"> greater</span><span
8386 class="cmtt-10"> than</span><span
8387 class="cmtt-10"> [n]</span><span
8388 class="cmtt-10"> )</span><span
8389 class="cmtt-10"> </span><span
8390 class="cmsy-10">{</span>
8391 <br class="fancyvrb" /><a
8392 id="x1-101192r23"></a><span
8393 class="cmtt-10"> </span><span
8394 class="cmtt-10"> </span>
8395 <br class="fancyvrb" /><a
8396 id="x1-101194r24"></a><span
8397 class="cmtt-10"> </span><span
8398 class="cmtt-10"> </span><span
8399 class="cmtt-10"> </span><span
8400 class="cmtt-10"> </span><span
8401 class="cmtt-10"> </span><span
8402 class="cmtt-10"> </span><span
8403 class="cmtt-10"> </span><span
8404 class="cmtt-10"> </span><span
8405 class="cmtt-10"> </span><span
8406 class="cmtt-10"> </span><span
8407 class="cmtt-10"> </span><span
8408 class="cmtt-10"> </span><span
8409 class="cmtt-10"> </span><span
8410 class="cmtt-10"> 14)</span><span
8411 class="cmtt-10"> truncate</span><span
8412 class="cmtt-10"> vector</span><span
8413 class="cmtt-10"> [floor]</span><span
8414 class="cmtt-10"> to</span><span
8415 class="cmtt-10"> [n]</span><span
8416 class="cmtt-10"> elements</span>
8417 <br class="fancyvrb" /><a
8418 id="x1-101196r25"></a><span
8419 class="cmtt-10"> </span><span
8420 class="cmtt-10"> </span>
8421 <br class="fancyvrb" /><a
8422 id="x1-101198r26"></a><span
8423 class="cmtt-10"> </span><span
8424 class="cmtt-10"> </span><span
8425 class="cmtt-10"> </span><span
8426 class="cmtt-10"> </span><span
8427 class="cmtt-10"> </span><span
8428 class="cmtt-10"> </span><span
8429 class="cmtt-10"> </span><span
8430 class="cmsy-10">}</span>
8431 <br class="fancyvrb" /><a
8432 id="x1-101200r27"></a><span
8433 class="cmtt-10"> </span><span
8434 class="cmtt-10"> </span>
8435 <br class="fancyvrb" /><a
8436 id="x1-101202r28"></a><span
8437 class="cmtt-10"> </span><span
8438 class="cmtt-10"> </span><span
8439 class="cmtt-10"> 15)</span><span
8440 class="cmtt-10"> for</span><span
8441 class="cmtt-10"> each</span><span
8442 class="cmtt-10"> scalar</span><span
8443 class="cmtt-10"> in</span><span
8444 class="cmtt-10"> vector</span><span
8445 class="cmtt-10"> [floor],</span><span
8446 class="cmtt-10"> perform</span><span
8447 class="cmtt-10"> a</span><span
8448 class="cmtt-10"> lookup</span><span
8449 class="cmtt-10"> substitution</span><span
8450 class="cmtt-10"> using</span>
8451 <br class="fancyvrb" /><a
8452 id="x1-101204r29"></a><span
8453 class="cmtt-10"> </span><span
8454 class="cmtt-10"> </span><span
8455 class="cmtt-10"> </span><span
8456 class="cmtt-10"> </span><span
8457 class="cmtt-10"> </span><span
8458 class="cmtt-10"> </span><span
8459 class="cmtt-10"> the</span><span
8460 class="cmtt-10"> scalar</span><span
8461 class="cmtt-10"> value</span><span
8462 class="cmtt-10"> from</span><span
8463 class="cmtt-10"> [floor]</span><span
8464 class="cmtt-10"> as</span><span
8465 class="cmtt-10"> an</span><span
8466 class="cmtt-10"> offset</span><span
8467 class="cmtt-10"> into</span><span
8468 class="cmtt-10"> the</span><span
8469 class="cmtt-10"> vector</span><span
8470 class="cmtt-10"> </span><a
8471 href="#x1-12500010.1"><span
8472 class="cmtt-10">[floor1_inverse_dB_static_table]</span></a>
8473 <br class="fancyvrb" /><a
8474 id="x1-101206r30"></a><span
8475 class="cmtt-10"> </span><span
8476 class="cmtt-10"> </span>
8477 <br class="fancyvrb" /><a
8478 id="x1-101208r31"></a><span
8479 class="cmtt-10"> </span><span
8480 class="cmtt-10"> </span><span
8481 class="cmtt-10"> 16)</span><span
8482 class="cmtt-10"> done</span>
8483 <br class="fancyvrb" /><a
8484 id="x1-101210r32"></a><span
8485 class="cmtt-10"> </span><span
8486 class="cmtt-10"> </span>
8492 <h3 class="sectionHead"><span class="titlemark">8 </span> <a
8493 id="x1-1020008"></a>Residue setup and decode</h3>
8494 <!--l. 6--><p class="noindent" >
8495 <h4 class="subsectionHead"><span class="titlemark">8.1 </span> <a
8496 id="x1-1030008.1"></a>Overview</h4>
8497 <!--l. 8--><p class="noindent" >A residue vector represents the fine detail of the audio spectrum of one channel in an audio frame
8498 after the encoder subtracts the floor curve and performs any channel coupling. A residue vector
8499 may represent spectral lines, spectral magnitude, spectral phase or hybrids as mixed by
8500 channel coupling. The exact semantic content of the vector does not matter to the residue
8502 <!--l. 15--><p class="noindent" >Whatever the exact qualities, the Vorbis residue abstraction codes the residue vectors into the
8503 bitstream packet, and then reconstructs the vectors during decode. Vorbis makes use of three
8504 different encoding variants (numbered 0, 1 and 2) of the same basic vector encoding
8506 <!--l. 23--><p class="noindent" >
8507 <h4 class="subsectionHead"><span class="titlemark">8.2 </span> <a
8508 id="x1-1040008.2"></a>Residue format</h4>
8509 <!--l. 25--><p class="noindent" >Residue format partitions each vector in the vector bundle into chunks, classifies each chunk,
8510 encodes the chunk classifications and finally encodes the chunks themselves using the the specific
8511 VQ arrangement defined for each selected classification. The exact interleaving and partitioning
8512 vary by residue encoding number, however the high-level process used to classify and encode the
8513 residue vector is the same in all three variants.
8514 <!--l. 33--><p class="noindent" >A set of coded residue vectors are all of the same length. High level coding structure, ignoring
8515 for the moment exactly how a partition is encoded and simply trusting that it is, is as
8517 <ul class="itemize1">
8518 <li class="itemize">Each vector is partitioned into multiple equal sized chunks according to configuration
8519 specified. If we have a vector size of <span
8520 class="cmti-10x-x-109">n</span>, a partition size <span
8521 class="cmti-10x-x-109">residue˙partition˙size</span>, and
8523 class="cmti-10x-x-109">ch </span>residue vectors, the total number of partitioned chunks coded is
8525 class="cmti-10x-x-109">n</span>/<span
8526 class="cmti-10x-x-109">residue˙partition˙size</span>*<span
8527 class="cmti-10x-x-109">ch</span>. It is important to note that the integer division truncates.
8528 In the below example, we assume an example <span
8529 class="cmti-10x-x-109">residue˙partition˙size </span>of 8.
8531 <li class="itemize">Each partition in each vector has a classification number that specifies which of multiple
8532 configured VQ codebook setups are used to decode that partition. The classification
8536 numbers of each partition can be thought of as forming a vector in their own right, as
8537 in the illustration below. Just as the residue vectors are coded in grouped partitions
8538 to increase encoding efficiency, the classification vector is also partitioned into chunks.
8539 The integer elements of each scalar in a classification chunk are built into a single scalar
8540 that represents the classification numbers in that chunk. In the below example, the
8541 classification codeword encodes two classification numbers.
8543 <li class="itemize">The values in a residue vector may be encoded monolithically in a single pass through
8544 the residue vector, but more often efficient codebook design dictates that each vector
8545 is encoded as the additive sum of several passes through the residue vector using more
8546 than one VQ codebook. Thus, each residue value potentially accumulates values from
8547 multiple decode passes. The classification value associated with a partition is the same
8548 in each pass, thus the classification codeword is coded only in the first pass.
8552 <!--l. 70--><p class="noindent" >
8554 <!--l. 71--><p class="noindent" ><img
8555 src="residue-pack.png" alt="PIC"
8557 <br /> <table class="caption"
8558 ><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 11: </td><td
8559 class="content">illustration of residue vector format</td></tr></table><!--tex4ht:label?: x1-10400111 -->
8561 <!--l. 77--><p class="noindent" >
8562 <h4 class="subsectionHead"><span class="titlemark">8.3 </span> <a
8563 id="x1-1050008.3"></a>residue 0</h4>
8564 <!--l. 79--><p class="noindent" >Residue 0 and 1 differ only in the way the values within a residue partition are interleaved during
8565 partition encoding (visually treated as a black box–or cyan box or brown box–in the above
8567 <!--l. 83--><p class="noindent" >Residue encoding 0 interleaves VQ encoding according to the dimension of the codebook used to
8568 encode a partition in a specific pass. The dimension of the codebook need not be the same in
8569 multiple passes, however the partition size must be an even multiple of the codebook
8571 <!--l. 89--><p class="noindent" >As an example, assume a partition vector of size eight, to be encoded by residue 0 using codebook
8572 sizes of 8, 4, 2 and 1:
8573 <!--l. 92--><p class="noindent" >
8574 <div class="fancyvrb" id="fancyvrb33">
8579 id="x1-105002r1"></a><span
8580 class="cmtt-10"> </span><span
8581 class="cmtt-10"> </span>
8582 <br class="fancyvrb" /><a
8583 id="x1-105004r2"></a><span
8584 class="cmtt-10"> </span><span
8585 class="cmtt-10"> </span><span
8586 class="cmtt-10"> </span><span
8587 class="cmtt-10"> </span><span
8588 class="cmtt-10"> </span><span
8589 class="cmtt-10"> </span><span
8590 class="cmtt-10"> </span><span
8591 class="cmtt-10"> </span><span
8592 class="cmtt-10"> </span><span
8593 class="cmtt-10"> </span><span
8594 class="cmtt-10"> </span><span
8595 class="cmtt-10"> </span><span
8596 class="cmtt-10"> </span><span
8597 class="cmtt-10"> original</span><span
8598 class="cmtt-10"> residue</span><span
8599 class="cmtt-10"> vector:</span><span
8600 class="cmtt-10"> [</span><span
8601 class="cmtt-10"> 0</span><span
8602 class="cmtt-10"> 1</span><span
8603 class="cmtt-10"> 2</span><span
8604 class="cmtt-10"> 3</span><span
8605 class="cmtt-10"> 4</span><span
8606 class="cmtt-10"> 5</span><span
8607 class="cmtt-10"> 6</span><span
8608 class="cmtt-10"> 7</span><span
8609 class="cmtt-10"> ]</span>
8610 <br class="fancyvrb" /><a
8611 id="x1-105006r3"></a><span
8612 class="cmtt-10"> </span><span
8613 class="cmtt-10"> </span>
8614 <br class="fancyvrb" /><a
8615 id="x1-105008r4"></a><span
8616 class="cmtt-10"> </span><span
8617 class="cmtt-10"> codebook</span><span
8618 class="cmtt-10"> dimensions</span><span
8619 class="cmtt-10"> =</span><span
8620 class="cmtt-10"> 8</span><span
8621 class="cmtt-10"> </span><span
8622 class="cmtt-10"> encoded</span><span
8623 class="cmtt-10"> as:</span><span
8624 class="cmtt-10"> [</span><span
8625 class="cmtt-10"> 0</span><span
8626 class="cmtt-10"> 1</span><span
8627 class="cmtt-10"> 2</span><span
8628 class="cmtt-10"> 3</span><span
8629 class="cmtt-10"> 4</span><span
8630 class="cmtt-10"> 5</span><span
8631 class="cmtt-10"> 6</span><span
8632 class="cmtt-10"> 7</span><span
8633 class="cmtt-10"> ]</span>
8634 <br class="fancyvrb" /><a
8635 id="x1-105010r5"></a><span
8636 class="cmtt-10"> </span><span
8637 class="cmtt-10"> </span>
8638 <br class="fancyvrb" /><a
8639 id="x1-105012r6"></a><span
8640 class="cmtt-10"> </span><span
8641 class="cmtt-10"> codebook</span><span
8642 class="cmtt-10"> dimensions</span><span
8643 class="cmtt-10"> =</span><span
8644 class="cmtt-10"> 4</span><span
8645 class="cmtt-10"> </span><span
8646 class="cmtt-10"> encoded</span><span
8647 class="cmtt-10"> as:</span><span
8648 class="cmtt-10"> [</span><span
8649 class="cmtt-10"> 0</span><span
8650 class="cmtt-10"> 2</span><span
8651 class="cmtt-10"> 4</span><span
8652 class="cmtt-10"> 6</span><span
8653 class="cmtt-10"> ],</span><span
8654 class="cmtt-10"> [</span><span
8655 class="cmtt-10"> 1</span><span
8656 class="cmtt-10"> 3</span><span
8657 class="cmtt-10"> 5</span><span
8658 class="cmtt-10"> 7</span><span
8659 class="cmtt-10"> ]</span>
8660 <br class="fancyvrb" /><a
8661 id="x1-105014r7"></a><span
8662 class="cmtt-10"> </span><span
8663 class="cmtt-10"> </span>
8664 <br class="fancyvrb" /><a
8665 id="x1-105016r8"></a><span
8666 class="cmtt-10"> </span><span
8667 class="cmtt-10"> codebook</span><span
8668 class="cmtt-10"> dimensions</span><span
8669 class="cmtt-10"> =</span><span
8670 class="cmtt-10"> 2</span><span
8671 class="cmtt-10"> </span><span
8672 class="cmtt-10"> encoded</span><span
8673 class="cmtt-10"> as:</span><span
8674 class="cmtt-10"> [</span><span
8675 class="cmtt-10"> 0</span><span
8676 class="cmtt-10"> 4</span><span
8677 class="cmtt-10"> ],</span><span
8678 class="cmtt-10"> [</span><span
8679 class="cmtt-10"> 1</span><span
8680 class="cmtt-10"> 5</span><span
8681 class="cmtt-10"> ],</span><span
8682 class="cmtt-10"> [</span><span
8683 class="cmtt-10"> 2</span><span
8684 class="cmtt-10"> 6</span><span
8685 class="cmtt-10"> ],</span><span
8686 class="cmtt-10"> [</span><span
8687 class="cmtt-10"> 3</span><span
8688 class="cmtt-10"> 7</span><span
8689 class="cmtt-10"> ]</span>
8690 <br class="fancyvrb" /><a
8691 id="x1-105018r9"></a><span
8692 class="cmtt-10"> </span><span
8693 class="cmtt-10"> </span>
8694 <br class="fancyvrb" /><a
8695 id="x1-105020r10"></a><span
8696 class="cmtt-10"> </span><span
8697 class="cmtt-10"> codebook</span><span
8698 class="cmtt-10"> dimensions</span><span
8699 class="cmtt-10"> =</span><span
8700 class="cmtt-10"> 1</span><span
8701 class="cmtt-10"> </span><span
8702 class="cmtt-10"> encoded</span><span
8703 class="cmtt-10"> as:</span><span
8704 class="cmtt-10"> [</span><span
8705 class="cmtt-10"> 0</span><span
8706 class="cmtt-10"> ],</span><span
8707 class="cmtt-10"> [</span><span
8708 class="cmtt-10"> 1</span><span
8709 class="cmtt-10"> ],</span><span
8710 class="cmtt-10"> [</span><span
8711 class="cmtt-10"> 2</span><span
8712 class="cmtt-10"> ],</span><span
8713 class="cmtt-10"> [</span><span
8714 class="cmtt-10"> 3</span><span
8715 class="cmtt-10"> ],</span><span
8716 class="cmtt-10"> [</span><span
8717 class="cmtt-10"> 4</span><span
8718 class="cmtt-10"> ],</span><span
8719 class="cmtt-10"> [</span><span
8720 class="cmtt-10"> 5</span><span
8721 class="cmtt-10"> ],</span><span
8722 class="cmtt-10"> [</span><span
8723 class="cmtt-10"> 6</span><span
8724 class="cmtt-10"> ],</span><span
8725 class="cmtt-10"> [</span><span
8726 class="cmtt-10"> 7</span><span
8727 class="cmtt-10"> ]</span>
8728 <br class="fancyvrb" /><a
8729 id="x1-105022r11"></a><span
8730 class="cmtt-10"> </span><span
8731 class="cmtt-10"> </span>
8733 <!--l. 106--><p class="noindent" >It is worth mentioning at this point that no configurable value in the residue coding setup is
8734 restricted to a power of two.
8735 <!--l. 111--><p class="noindent" >
8736 <h4 class="subsectionHead"><span class="titlemark">8.4 </span> <a
8737 id="x1-1060008.4"></a>residue 1</h4>
8738 <!--l. 113--><p class="noindent" >Residue 1 does not interleave VQ encoding. It represents partition vector scalars in order. As with
8739 residue 0, however, partition length must be an integer multiple of the codebook dimension,
8740 although dimension may vary from pass to pass.
8741 <!--l. 118--><p class="noindent" >As an example, assume a partition vector of size eight, to be encoded by residue 0 using codebook
8742 sizes of 8, 4, 2 and 1:
8743 <!--l. 121--><p class="noindent" >
8744 <div class="fancyvrb" id="fancyvrb34">
8746 id="x1-106002r1"></a><span
8747 class="cmtt-10"> </span><span
8748 class="cmtt-10"> </span>
8749 <br class="fancyvrb" /><a
8750 id="x1-106004r2"></a><span
8751 class="cmtt-10"> </span><span
8752 class="cmtt-10"> </span><span
8753 class="cmtt-10"> </span><span
8754 class="cmtt-10"> </span><span
8755 class="cmtt-10"> </span><span
8756 class="cmtt-10"> </span><span
8757 class="cmtt-10"> </span><span
8758 class="cmtt-10"> </span><span
8759 class="cmtt-10"> </span><span
8760 class="cmtt-10"> </span><span
8761 class="cmtt-10"> </span><span
8762 class="cmtt-10"> </span><span
8763 class="cmtt-10"> </span><span
8764 class="cmtt-10"> original</span><span
8765 class="cmtt-10"> residue</span><span
8766 class="cmtt-10"> vector:</span><span
8767 class="cmtt-10"> [</span><span
8768 class="cmtt-10"> 0</span><span
8769 class="cmtt-10"> 1</span><span
8770 class="cmtt-10"> 2</span><span
8771 class="cmtt-10"> 3</span><span
8772 class="cmtt-10"> 4</span><span
8773 class="cmtt-10"> 5</span><span
8774 class="cmtt-10"> 6</span><span
8775 class="cmtt-10"> 7</span><span
8776 class="cmtt-10"> ]</span>
8777 <br class="fancyvrb" /><a
8778 id="x1-106006r3"></a><span
8779 class="cmtt-10"> </span><span
8780 class="cmtt-10"> </span>
8781 <br class="fancyvrb" /><a
8782 id="x1-106008r4"></a><span
8783 class="cmtt-10"> </span><span
8784 class="cmtt-10"> codebook</span><span
8785 class="cmtt-10"> dimensions</span><span
8786 class="cmtt-10"> =</span><span
8787 class="cmtt-10"> 8</span><span
8788 class="cmtt-10"> </span><span
8789 class="cmtt-10"> encoded</span><span
8790 class="cmtt-10"> as:</span><span
8791 class="cmtt-10"> [</span><span
8792 class="cmtt-10"> 0</span><span
8793 class="cmtt-10"> 1</span><span
8794 class="cmtt-10"> 2</span><span
8795 class="cmtt-10"> 3</span><span
8796 class="cmtt-10"> 4</span><span
8797 class="cmtt-10"> 5</span><span
8798 class="cmtt-10"> 6</span><span
8799 class="cmtt-10"> 7</span><span
8800 class="cmtt-10"> ]</span>
8801 <br class="fancyvrb" /><a
8802 id="x1-106010r5"></a><span
8803 class="cmtt-10"> </span><span
8804 class="cmtt-10"> </span>
8805 <br class="fancyvrb" /><a
8806 id="x1-106012r6"></a><span
8807 class="cmtt-10"> </span><span
8808 class="cmtt-10"> codebook</span><span
8809 class="cmtt-10"> dimensions</span><span
8810 class="cmtt-10"> =</span><span
8811 class="cmtt-10"> 4</span><span
8812 class="cmtt-10"> </span><span
8813 class="cmtt-10"> encoded</span><span
8814 class="cmtt-10"> as:</span><span
8815 class="cmtt-10"> [</span><span
8816 class="cmtt-10"> 0</span><span
8817 class="cmtt-10"> 1</span><span
8818 class="cmtt-10"> 2</span><span
8819 class="cmtt-10"> 3</span><span
8820 class="cmtt-10"> ],</span><span
8821 class="cmtt-10"> [</span><span
8822 class="cmtt-10"> 4</span><span
8823 class="cmtt-10"> 5</span><span
8824 class="cmtt-10"> 6</span><span
8825 class="cmtt-10"> 7</span><span
8826 class="cmtt-10"> ]</span>
8827 <br class="fancyvrb" /><a
8828 id="x1-106014r7"></a><span
8829 class="cmtt-10"> </span><span
8830 class="cmtt-10"> </span>
8831 <br class="fancyvrb" /><a
8832 id="x1-106016r8"></a><span
8833 class="cmtt-10"> </span><span
8834 class="cmtt-10"> codebook</span><span
8835 class="cmtt-10"> dimensions</span><span
8836 class="cmtt-10"> =</span><span
8837 class="cmtt-10"> 2</span><span
8838 class="cmtt-10"> </span><span
8839 class="cmtt-10"> encoded</span><span
8840 class="cmtt-10"> as:</span><span
8841 class="cmtt-10"> [</span><span
8842 class="cmtt-10"> 0</span><span
8843 class="cmtt-10"> 1</span><span
8844 class="cmtt-10"> ],</span><span
8845 class="cmtt-10"> [</span><span
8846 class="cmtt-10"> 2</span><span
8847 class="cmtt-10"> 3</span><span
8848 class="cmtt-10"> ],</span><span
8849 class="cmtt-10"> [</span><span
8850 class="cmtt-10"> 4</span><span
8851 class="cmtt-10"> 5</span><span
8852 class="cmtt-10"> ],</span><span
8853 class="cmtt-10"> [</span><span
8854 class="cmtt-10"> 6</span><span
8855 class="cmtt-10"> 7</span><span
8856 class="cmtt-10"> ]</span>
8857 <br class="fancyvrb" /><a
8858 id="x1-106018r9"></a><span
8859 class="cmtt-10"> </span><span
8860 class="cmtt-10"> </span>
8861 <br class="fancyvrb" /><a
8862 id="x1-106020r10"></a><span
8863 class="cmtt-10"> </span><span
8864 class="cmtt-10"> codebook</span><span
8865 class="cmtt-10"> dimensions</span><span
8866 class="cmtt-10"> =</span><span
8867 class="cmtt-10"> 1</span><span
8868 class="cmtt-10"> </span><span
8869 class="cmtt-10"> encoded</span><span
8870 class="cmtt-10"> as:</span><span
8871 class="cmtt-10"> [</span><span
8872 class="cmtt-10"> 0</span><span
8873 class="cmtt-10"> ],</span><span
8874 class="cmtt-10"> [</span><span
8875 class="cmtt-10"> 1</span><span
8876 class="cmtt-10"> ],</span><span
8877 class="cmtt-10"> [</span><span
8878 class="cmtt-10"> 2</span><span
8879 class="cmtt-10"> ],</span><span
8880 class="cmtt-10"> [</span><span
8881 class="cmtt-10"> 3</span><span
8882 class="cmtt-10"> ],</span><span
8883 class="cmtt-10"> [</span><span
8884 class="cmtt-10"> 4</span><span
8885 class="cmtt-10"> ],</span><span
8886 class="cmtt-10"> [</span><span
8887 class="cmtt-10"> 5</span><span
8888 class="cmtt-10"> ],</span><span
8889 class="cmtt-10"> [</span><span
8890 class="cmtt-10"> 6</span><span
8891 class="cmtt-10"> ],</span><span
8892 class="cmtt-10"> [</span><span
8893 class="cmtt-10"> 7</span><span
8894 class="cmtt-10"> ]</span>
8895 <br class="fancyvrb" /><a
8896 id="x1-106022r11"></a><span
8897 class="cmtt-10"> </span><span
8898 class="cmtt-10"> </span>
8900 <!--l. 137--><p class="noindent" >
8904 <h4 class="subsectionHead"><span class="titlemark">8.5 </span> <a
8905 id="x1-1070008.5"></a>residue 2</h4>
8906 <!--l. 139--><p class="noindent" >Residue type two can be thought of as a variant of residue type 1. Rather than encoding multiple
8907 passed-in vectors as in residue type 1, the <span
8908 class="cmti-10x-x-109">ch </span>passed in vectors of length <span
8909 class="cmti-10x-x-109">n </span>are first interleaved and
8910 flattened into a single vector of length <span
8911 class="cmti-10x-x-109">ch</span>*<span
8912 class="cmti-10x-x-109">n</span>. Encoding then proceeds as in type 1. Decoding is as in
8913 type 1 with decode interleave reversed. If operating on a single vector to begin with, residue type 1
8914 and type 2 are equivalent.
8917 <!--l. 147--><p class="noindent" >
8919 <!--l. 148--><p class="noindent" ><img
8920 src="residue2.png" alt="PIC"
8922 <br /> <table class="caption"
8923 ><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 12: </td><td
8924 class="content">illustration of residue type 2</td></tr></table><!--tex4ht:label?: x1-10700112 -->
8926 <!--l. 153--><p class="noindent" >
8927 <h4 class="subsectionHead"><span class="titlemark">8.6 </span> <a
8928 id="x1-1080008.6"></a>Residue decode</h4>
8929 <!--l. 155--><p class="noindent" >
8930 <h5 class="subsubsectionHead"><span class="titlemark">8.6.1 </span> <a
8931 id="x1-1090008.6.1"></a>header decode</h5>
8932 <!--l. 157--><p class="noindent" >Header decode for all three residue types is identical.
8933 <div class="fancyvrb" id="fancyvrb35">
8935 id="x1-109002r1"></a><span
8936 class="cmtt-10"> </span><span
8937 class="cmtt-10"> </span><span
8938 class="cmtt-10"> </span><span
8939 class="cmtt-10"> 1)</span><span
8940 class="cmtt-10"> [residue_begin]</span><span
8941 class="cmtt-10"> =</span><span
8942 class="cmtt-10"> read</span><span
8943 class="cmtt-10"> 24</span><span
8944 class="cmtt-10"> bits</span><span
8945 class="cmtt-10"> as</span><span
8946 class="cmtt-10"> unsigned</span><span
8947 class="cmtt-10"> integer</span>
8948 <br class="fancyvrb" /><a
8949 id="x1-109004r2"></a><span
8950 class="cmtt-10"> </span><span
8951 class="cmtt-10"> </span><span
8952 class="cmtt-10"> </span><span
8953 class="cmtt-10"> 2)</span><span
8954 class="cmtt-10"> [residue_end]</span><span
8955 class="cmtt-10"> =</span><span
8956 class="cmtt-10"> read</span><span
8957 class="cmtt-10"> 24</span><span
8958 class="cmtt-10"> bits</span><span
8959 class="cmtt-10"> as</span><span
8960 class="cmtt-10"> unsigned</span><span
8961 class="cmtt-10"> integer</span>
8962 <br class="fancyvrb" /><a
8963 id="x1-109006r3"></a><span
8964 class="cmtt-10"> </span><span
8965 class="cmtt-10"> </span><span
8966 class="cmtt-10"> </span><span
8967 class="cmtt-10"> 3)</span><span
8968 class="cmtt-10"> [residue_partition_size]</span><span
8969 class="cmtt-10"> =</span><span
8970 class="cmtt-10"> read</span><span
8971 class="cmtt-10"> 24</span><span
8972 class="cmtt-10"> bits</span><span
8973 class="cmtt-10"> as</span><span
8974 class="cmtt-10"> unsigned</span><span
8975 class="cmtt-10"> integer</span><span
8976 class="cmtt-10"> and</span><span
8977 class="cmtt-10"> add</span><span
8978 class="cmtt-10"> one</span>
8979 <br class="fancyvrb" /><a
8980 id="x1-109008r4"></a><span
8981 class="cmtt-10"> </span><span
8982 class="cmtt-10"> </span><span
8983 class="cmtt-10"> </span><span
8984 class="cmtt-10"> 4)</span><span
8985 class="cmtt-10"> [residue_classifications]</span><span
8986 class="cmtt-10"> =</span><span
8987 class="cmtt-10"> read</span><span
8988 class="cmtt-10"> 6</span><span
8989 class="cmtt-10"> bits</span><span
8990 class="cmtt-10"> as</span><span
8991 class="cmtt-10"> unsigned</span><span
8992 class="cmtt-10"> integer</span><span
8993 class="cmtt-10"> and</span><span
8994 class="cmtt-10"> add</span><span
8995 class="cmtt-10"> one</span>
8996 <br class="fancyvrb" /><a
8997 id="x1-109010r5"></a><span
8998 class="cmtt-10"> </span><span
8999 class="cmtt-10"> </span><span
9000 class="cmtt-10"> </span><span
9001 class="cmtt-10"> 5)</span><span
9002 class="cmtt-10"> [residue_classbook]</span><span
9003 class="cmtt-10"> =</span><span
9004 class="cmtt-10"> read</span><span
9005 class="cmtt-10"> 8</span><span
9006 class="cmtt-10"> bits</span><span
9007 class="cmtt-10"> as</span><span
9008 class="cmtt-10"> unsigned</span><span
9009 class="cmtt-10"> integer</span>
9011 <!--l. 166--><p class="noindent" ><span
9012 class="cmtt-10x-x-109">[residue_begin] </span>and <span
9013 class="cmtt-10x-x-109">[residue_end] </span>select the specific sub-portion of each vector that is
9014 actually coded; it implements akin to a bandpass where, for coding purposes, the vector
9015 effectively begins at element <span
9016 class="cmtt-10x-x-109">[residue_begin] </span>and ends at <span
9017 class="cmtt-10x-x-109">[residue_end]</span>. Preceding
9018 and following values in the unpacked vectors are zeroed. Note that for residue type 2,
9019 these values as well as <span
9020 class="cmtt-10x-x-109">[residue_partition_size]</span>apply to the interleaved vector, not
9021 the individual vectors before interleave. <span
9022 class="cmtt-10x-x-109">[residue_partition_size] </span>is as explained
9024 class="cmtt-10x-x-109">[residue_classifications] </span>is the number of possible classification to which a
9025 partition can belong and <span
9026 class="cmtt-10x-x-109">[residue_classbook] </span>is the codebook number used to code
9030 classification codewords. The number of dimensions in book <span
9031 class="cmtt-10x-x-109">[residue_classbook] </span>determines
9032 how many classification values are grouped into a single classification codeword. Note
9033 that the number of entries and dimensions in book <span
9034 class="cmtt-10x-x-109">[residue_classbook]</span>, along with
9036 class="cmtt-10x-x-109">[residue_classifications]</span>, overdetermines to possible number of classification
9038 class="cmtt-10x-x-109">[residue_classifications]</span>ˆ<span
9039 class="cmtt-10x-x-109">[residue_classbook]</span>.dimensions exceeds
9041 class="cmtt-10x-x-109">[residue_classbook]</span>.entries, the bitstream should be regarded to be undecodable.
9042 <!--l. 190--><p class="noindent" >Next we read a bitmap pattern that specifies which partition classes code values in which
9044 <!--l. 193--><p class="noindent" >
9045 <div class="fancyvrb" id="fancyvrb36">
9047 id="x1-109012r1"></a><span
9048 class="cmtt-10"> </span><span
9049 class="cmtt-10"> </span><span
9050 class="cmtt-10"> </span><span
9051 class="cmtt-10"> 1)</span><span
9052 class="cmtt-10"> iterate</span><span
9053 class="cmtt-10"> [i]</span><span
9054 class="cmtt-10"> over</span><span
9055 class="cmtt-10"> the</span><span
9056 class="cmtt-10"> range</span><span
9057 class="cmtt-10"> 0</span><span
9058 class="cmtt-10"> ...</span><span
9059 class="cmtt-10"> [residue_classifications]-1</span><span
9060 class="cmtt-10"> {</span>
9061 <br class="fancyvrb" /><a
9062 id="x1-109014r2"></a><span
9063 class="cmtt-10"> </span><span
9064 class="cmtt-10"> </span>
9065 <br class="fancyvrb" /><a
9066 id="x1-109016r3"></a><span
9067 class="cmtt-10"> </span><span
9068 class="cmtt-10"> </span><span
9069 class="cmtt-10"> </span><span
9070 class="cmtt-10"> </span><span
9071 class="cmtt-10"> </span><span
9072 class="cmtt-10"> </span><span
9073 class="cmtt-10"> </span><span
9074 class="cmtt-10"> </span><span
9075 class="cmtt-10"> 2)</span><span
9076 class="cmtt-10"> [high_bits]</span><span
9077 class="cmtt-10"> =</span><span
9078 class="cmtt-10"> 0</span>
9079 <br class="fancyvrb" /><a
9080 id="x1-109018r4"></a><span
9081 class="cmtt-10"> </span><span
9082 class="cmtt-10"> </span><span
9083 class="cmtt-10"> </span><span
9084 class="cmtt-10"> </span><span
9085 class="cmtt-10"> </span><span
9086 class="cmtt-10"> </span><span
9087 class="cmtt-10"> </span><span
9088 class="cmtt-10"> </span><span
9089 class="cmtt-10"> 3)</span><span
9090 class="cmtt-10"> [low_bits]</span><span
9091 class="cmtt-10"> =</span><span
9092 class="cmtt-10"> read</span><span
9093 class="cmtt-10"> 3</span><span
9094 class="cmtt-10"> bits</span><span
9095 class="cmtt-10"> as</span><span
9096 class="cmtt-10"> unsigned</span><span
9097 class="cmtt-10"> integer</span>
9098 <br class="fancyvrb" /><a
9099 id="x1-109020r5"></a><span
9100 class="cmtt-10"> </span><span
9101 class="cmtt-10"> </span><span
9102 class="cmtt-10"> </span><span
9103 class="cmtt-10"> </span><span
9104 class="cmtt-10"> </span><span
9105 class="cmtt-10"> </span><span
9106 class="cmtt-10"> </span><span
9107 class="cmtt-10"> </span><span
9108 class="cmtt-10"> 4)</span><span
9109 class="cmtt-10"> [bitflag]</span><span
9110 class="cmtt-10"> =</span><span
9111 class="cmtt-10"> read</span><span
9112 class="cmtt-10"> one</span><span
9113 class="cmtt-10"> bit</span><span
9114 class="cmtt-10"> as</span><span
9115 class="cmtt-10"> boolean</span>
9116 <br class="fancyvrb" /><a
9117 id="x1-109022r6"></a><span
9118 class="cmtt-10"> </span><span
9119 class="cmtt-10"> </span><span
9120 class="cmtt-10"> </span><span
9121 class="cmtt-10"> </span><span
9122 class="cmtt-10"> </span><span
9123 class="cmtt-10"> </span><span
9124 class="cmtt-10"> </span><span
9125 class="cmtt-10"> </span><span
9126 class="cmtt-10"> 5)</span><span
9127 class="cmtt-10"> if</span><span
9128 class="cmtt-10"> (</span><span
9129 class="cmtt-10"> [bitflag]</span><span
9130 class="cmtt-10"> is</span><span
9131 class="cmtt-10"> set</span><span
9132 class="cmtt-10"> )</span><span
9133 class="cmtt-10"> then</span><span
9134 class="cmtt-10"> [high_bits]</span><span
9135 class="cmtt-10"> =</span><span
9136 class="cmtt-10"> read</span><span
9137 class="cmtt-10"> five</span><span
9138 class="cmtt-10"> bits</span><span
9139 class="cmtt-10"> as</span><span
9140 class="cmtt-10"> unsigned</span><span
9141 class="cmtt-10"> integer</span>
9142 <br class="fancyvrb" /><a
9143 id="x1-109024r7"></a><span
9144 class="cmtt-10"> </span><span
9145 class="cmtt-10"> </span><span
9146 class="cmtt-10"> </span><span
9147 class="cmtt-10"> </span><span
9148 class="cmtt-10"> </span><span
9149 class="cmtt-10"> </span><span
9150 class="cmtt-10"> </span><span
9151 class="cmtt-10"> </span><span
9152 class="cmtt-10"> 6)</span><span
9153 class="cmtt-10"> vector</span><span
9154 class="cmtt-10"> [residue_cascade]</span><span
9155 class="cmtt-10"> element</span><span
9156 class="cmtt-10"> [i]</span><span
9157 class="cmtt-10"> =</span><span
9158 class="cmtt-10"> [high_bits]</span><span
9159 class="cmtt-10"> *</span><span
9160 class="cmtt-10"> 8</span><span
9161 class="cmtt-10"> +</span><span
9162 class="cmtt-10"> [low_bits]</span>
9163 <br class="fancyvrb" /><a
9164 id="x1-109026r8"></a><span
9165 class="cmtt-10"> </span><span
9166 class="cmtt-10"> </span><span
9167 class="cmtt-10"> </span><span
9168 class="cmtt-10"> </span><span
9169 class="cmtt-10"> </span><span
9170 class="cmtt-10"> </span><span
9171 class="cmtt-10"> }</span>
9172 <br class="fancyvrb" /><a
9173 id="x1-109028r9"></a><span
9174 class="cmtt-10"> </span><span
9175 class="cmtt-10"> </span><span
9176 class="cmtt-10"> </span><span
9177 class="cmtt-10"> 7)</span><span
9178 class="cmtt-10"> done</span>
9180 <!--l. 205--><p class="noindent" >Finally, we read in a list of book numbers, each corresponding to specific bit set in the cascade
9181 bitmap. We loop over the possible codebook classifications and the maximum possible number of
9182 encoding stages (8 in Vorbis I, as constrained by the elements of the cascade bitmap being eight
9184 <!--l. 211--><p class="noindent" >
9185 <div class="fancyvrb" id="fancyvrb37">
9187 id="x1-109030r1"></a><span
9188 class="cmtt-10"> </span><span
9189 class="cmtt-10"> </span><span
9190 class="cmtt-10"> </span><span
9191 class="cmtt-10"> 1)</span><span
9192 class="cmtt-10"> iterate</span><span
9193 class="cmtt-10"> [i]</span><span
9194 class="cmtt-10"> over</span><span
9195 class="cmtt-10"> the</span><span
9196 class="cmtt-10"> range</span><span
9197 class="cmtt-10"> 0</span><span
9198 class="cmtt-10"> ...</span><span
9199 class="cmtt-10"> [residue_classifications]-1</span><span
9200 class="cmtt-10"> {</span>
9201 <br class="fancyvrb" /><a
9202 id="x1-109032r2"></a><span
9203 class="cmtt-10"> </span><span
9204 class="cmtt-10"> </span>
9205 <br class="fancyvrb" /><a
9206 id="x1-109034r3"></a><span
9207 class="cmtt-10"> </span><span
9208 class="cmtt-10"> </span><span
9209 class="cmtt-10"> </span><span
9210 class="cmtt-10"> </span><span
9211 class="cmtt-10"> </span><span
9212 class="cmtt-10"> </span><span
9213 class="cmtt-10"> </span><span
9214 class="cmtt-10"> </span><span
9215 class="cmtt-10"> 2)</span><span
9216 class="cmtt-10"> iterate</span><span
9217 class="cmtt-10"> [j]</span><span
9218 class="cmtt-10"> over</span><span
9219 class="cmtt-10"> the</span><span
9220 class="cmtt-10"> range</span><span
9221 class="cmtt-10"> 0</span><span
9222 class="cmtt-10"> ...</span><span
9223 class="cmtt-10"> 7</span><span
9224 class="cmtt-10"> {</span>
9225 <br class="fancyvrb" /><a
9226 id="x1-109036r4"></a><span
9227 class="cmtt-10"> </span><span
9228 class="cmtt-10"> </span>
9229 <br class="fancyvrb" /><a
9230 id="x1-109038r5"></a><span
9231 class="cmtt-10"> </span><span
9232 class="cmtt-10"> </span><span
9233 class="cmtt-10"> </span><span
9234 class="cmtt-10"> </span><span
9235 class="cmtt-10"> </span><span
9236 class="cmtt-10"> </span><span
9237 class="cmtt-10"> </span><span
9238 class="cmtt-10"> </span><span
9239 class="cmtt-10"> </span><span
9240 class="cmtt-10"> </span><span
9241 class="cmtt-10"> </span><span
9242 class="cmtt-10"> </span><span
9243 class="cmtt-10"> </span><span
9244 class="cmtt-10"> 3)</span><span
9245 class="cmtt-10"> if</span><span
9246 class="cmtt-10"> (</span><span
9247 class="cmtt-10"> vector</span><span
9248 class="cmtt-10"> [residue_cascade]</span><span
9249 class="cmtt-10"> element</span><span
9250 class="cmtt-10"> [i]</span><span
9251 class="cmtt-10"> bit</span><span
9252 class="cmtt-10"> [j]</span><span
9253 class="cmtt-10"> is</span><span
9254 class="cmtt-10"> set</span><span
9255 class="cmtt-10"> )</span><span
9256 class="cmtt-10"> {</span>
9257 <br class="fancyvrb" /><a
9258 id="x1-109040r6"></a><span
9259 class="cmtt-10"> </span><span
9260 class="cmtt-10"> </span>
9261 <br class="fancyvrb" /><a
9262 id="x1-109042r7"></a><span
9263 class="cmtt-10"> </span><span
9264 class="cmtt-10"> </span><span
9265 class="cmtt-10"> </span><span
9266 class="cmtt-10"> </span><span
9267 class="cmtt-10"> </span><span
9268 class="cmtt-10"> </span><span
9269 class="cmtt-10"> </span><span
9270 class="cmtt-10"> </span><span
9271 class="cmtt-10"> </span><span
9272 class="cmtt-10"> </span><span
9273 class="cmtt-10"> </span><span
9274 class="cmtt-10"> </span><span
9275 class="cmtt-10"> </span><span
9276 class="cmtt-10"> </span><span
9277 class="cmtt-10"> </span><span
9278 class="cmtt-10"> </span><span
9279 class="cmtt-10"> </span><span
9280 class="cmtt-10"> </span><span
9281 class="cmtt-10"> 4)</span><span
9282 class="cmtt-10"> array</span><span
9283 class="cmtt-10"> [residue_books]</span><span
9284 class="cmtt-10"> element</span><span
9285 class="cmtt-10"> [i][j]</span><span
9286 class="cmtt-10"> =</span><span
9287 class="cmtt-10"> read</span><span
9288 class="cmtt-10"> 8</span><span
9289 class="cmtt-10"> bits</span><span
9290 class="cmtt-10"> as</span><span
9291 class="cmtt-10"> unsigned</span><span
9292 class="cmtt-10"> integer</span>
9293 <br class="fancyvrb" /><a
9294 id="x1-109044r8"></a><span
9295 class="cmtt-10"> </span><span
9296 class="cmtt-10"> </span>
9297 <br class="fancyvrb" /><a
9298 id="x1-109046r9"></a><span
9299 class="cmtt-10"> </span><span
9300 class="cmtt-10"> </span><span
9301 class="cmtt-10"> </span><span
9302 class="cmtt-10"> </span><span
9303 class="cmtt-10"> </span><span
9304 class="cmtt-10"> </span><span
9305 class="cmtt-10"> </span><span
9306 class="cmtt-10"> </span><span
9307 class="cmtt-10"> </span><span
9308 class="cmtt-10"> </span><span
9309 class="cmtt-10"> </span><span
9310 class="cmtt-10"> </span><span
9311 class="cmtt-10"> </span><span
9312 class="cmtt-10"> </span><span
9313 class="cmtt-10"> </span><span
9314 class="cmtt-10"> </span><span
9315 class="cmtt-10"> }</span><span
9316 class="cmtt-10"> else</span><span
9317 class="cmtt-10"> {</span>
9318 <br class="fancyvrb" /><a
9319 id="x1-109048r10"></a><span
9320 class="cmtt-10"> </span><span
9321 class="cmtt-10"> </span>
9322 <br class="fancyvrb" /><a
9323 id="x1-109050r11"></a><span
9324 class="cmtt-10"> </span><span
9325 class="cmtt-10"> </span><span
9326 class="cmtt-10"> </span><span
9327 class="cmtt-10"> </span><span
9328 class="cmtt-10"> </span><span
9329 class="cmtt-10"> </span><span
9330 class="cmtt-10"> </span><span
9331 class="cmtt-10"> </span><span
9332 class="cmtt-10"> </span><span
9333 class="cmtt-10"> </span><span
9334 class="cmtt-10"> </span><span
9335 class="cmtt-10"> </span><span
9336 class="cmtt-10"> </span><span
9337 class="cmtt-10"> </span><span
9338 class="cmtt-10"> </span><span
9339 class="cmtt-10"> </span><span
9340 class="cmtt-10"> </span><span
9341 class="cmtt-10"> </span><span
9342 class="cmtt-10"> 5)</span><span
9343 class="cmtt-10"> array</span><span
9344 class="cmtt-10"> [residue_books]</span><span
9345 class="cmtt-10"> element</span><span
9346 class="cmtt-10"> [i][j]</span><span
9347 class="cmtt-10"> =</span><span
9348 class="cmtt-10"> unused</span>
9349 <br class="fancyvrb" /><a
9350 id="x1-109052r12"></a><span
9351 class="cmtt-10"> </span><span
9352 class="cmtt-10"> </span>
9353 <br class="fancyvrb" /><a
9354 id="x1-109054r13"></a><span
9355 class="cmtt-10"> </span><span
9356 class="cmtt-10"> </span><span
9357 class="cmtt-10"> </span><span
9358 class="cmtt-10"> </span><span
9359 class="cmtt-10"> </span><span
9360 class="cmtt-10"> </span><span
9361 class="cmtt-10"> </span><span
9362 class="cmtt-10"> </span><span
9363 class="cmtt-10"> </span><span
9364 class="cmtt-10"> </span><span
9365 class="cmtt-10"> </span><span
9366 class="cmtt-10"> </span><span
9367 class="cmtt-10"> </span><span
9368 class="cmtt-10"> </span><span
9369 class="cmtt-10"> </span><span
9370 class="cmtt-10"> </span><span
9371 class="cmtt-10"> }</span>
9372 <br class="fancyvrb" /><a
9373 id="x1-109056r14"></a><span
9374 class="cmtt-10"> </span><span
9375 class="cmtt-10"> </span><span
9376 class="cmtt-10"> </span><span
9377 class="cmtt-10"> </span><span
9378 class="cmtt-10"> </span><span
9379 class="cmtt-10"> </span><span
9380 class="cmtt-10"> </span><span
9381 class="cmtt-10"> </span><span
9382 class="cmtt-10"> </span><span
9383 class="cmtt-10"> </span><span
9384 class="cmtt-10"> </span><span
9385 class="cmtt-10"> }</span>
9386 <br class="fancyvrb" /><a
9387 id="x1-109058r15"></a><span
9388 class="cmtt-10"> </span><span
9389 class="cmtt-10"> </span><span
9390 class="cmtt-10"> </span><span
9391 class="cmtt-10"> </span><span
9392 class="cmtt-10"> </span><span
9393 class="cmtt-10"> </span><span
9394 class="cmtt-10"> </span><span
9395 class="cmtt-10"> }</span>
9396 <br class="fancyvrb" /><a
9397 id="x1-109060r16"></a><span
9398 class="cmtt-10"> </span><span
9399 class="cmtt-10"> </span>
9400 <br class="fancyvrb" /><a
9401 id="x1-109062r17"></a><span
9402 class="cmtt-10"> </span><span
9403 class="cmtt-10"> </span><span
9404 class="cmtt-10"> </span><span
9405 class="cmtt-10"> 6)</span><span
9406 class="cmtt-10"> done</span>
9408 <!--l. 231--><p class="noindent" >An end-of-packet condition at any point in header decode renders the stream undecodable. In
9412 addition, any codebook number greater than the maximum numbered codebook set up in this
9413 stream also renders the stream undecodable.
9414 <!--l. 238--><p class="noindent" >
9415 <h5 class="subsubsectionHead"><span class="titlemark">8.6.2 </span> <a
9416 id="x1-1100008.6.2"></a>packet decode</h5>
9417 <!--l. 240--><p class="noindent" >Format 0 and 1 packet decode is identical except for specific partition interleave. Format 2 packet
9418 decode can be built out of the format 1 decode process. Thus we describe first the decode
9419 infrastructure identical to all three formats.
9420 <!--l. 245--><p class="noindent" >In addition to configuration information, the residue decode process is passed the number of vectors
9421 in the submap bundle and a vector of flags indicating if any of the vectors are not to be decoded. If
9422 the passed in number of vectors is 3 and vector number 1 is marked ’do not decode’, decode skips
9423 vector 1 during the decode loop. However, even ’do not decode’ vectors are allocated and
9425 <!--l. 252--><p class="noindent" >Depending on the values of <span
9426 class="cmtt-10x-x-109">[residue_begin] </span>and <span
9427 class="cmtt-10x-x-109">[residue_end]</span>, it is obvious that the encoded
9428 portion of a residue vector may be the entire possible residue vector or some other strict subset of
9429 the actual residue vector size with zero padding at either uncoded end. However, it is also
9430 possible to set <span
9431 class="cmtt-10x-x-109">[residue_begin] </span>and <span
9432 class="cmtt-10x-x-109">[residue_end] </span>to specify a range partially or wholly
9433 beyond the maximum vector size. Before beginning residue decode, limit <span
9434 class="cmtt-10x-x-109">[residue_begin]</span>
9436 class="cmtt-10x-x-109">[residue_end] </span>to the maximum possible vector size as follows. We assume that
9437 the number of vectors being encoded, <span
9438 class="cmtt-10x-x-109">[ch] </span>is provided by the higher level decoding
9440 <!--l. 266--><p class="noindent" >
9441 <div class="fancyvrb" id="fancyvrb38">
9443 id="x1-110002r1"></a><span
9444 class="cmtt-10"> </span><span
9445 class="cmtt-10"> </span><span
9446 class="cmtt-10"> </span><span
9447 class="cmtt-10"> 1)</span><span
9448 class="cmtt-10"> [actual_size]</span><span
9449 class="cmtt-10"> =</span><span
9450 class="cmtt-10"> current</span><span
9451 class="cmtt-10"> blocksize/2;</span>
9452 <br class="fancyvrb" /><a
9453 id="x1-110004r2"></a><span
9454 class="cmtt-10"> </span><span
9455 class="cmtt-10"> </span><span
9456 class="cmtt-10"> </span><span
9457 class="cmtt-10"> 2)</span><span
9458 class="cmtt-10"> if</span><span
9459 class="cmtt-10"> residue</span><span
9460 class="cmtt-10"> encoding</span><span
9461 class="cmtt-10"> is</span><span
9462 class="cmtt-10"> format</span><span
9463 class="cmtt-10"> 2</span>
9464 <br class="fancyvrb" /><a
9465 id="x1-110006r3"></a><span
9466 class="cmtt-10"> </span><span
9467 class="cmtt-10"> </span><span
9468 class="cmtt-10"> </span><span
9469 class="cmtt-10"> </span><span
9470 class="cmtt-10"> </span><span
9471 class="cmtt-10"> </span><span
9472 class="cmtt-10"> </span><span
9473 class="cmtt-10"> </span><span
9474 class="cmtt-10"> 3)</span><span
9475 class="cmtt-10"> [actual_size]</span><span
9476 class="cmtt-10"> =</span><span
9477 class="cmtt-10"> [actual_size]</span><span
9478 class="cmtt-10"> *</span><span
9479 class="cmtt-10"> [ch];</span>
9480 <br class="fancyvrb" /><a
9481 id="x1-110008r4"></a><span
9482 class="cmtt-10"> </span><span
9483 class="cmtt-10"> </span><span
9484 class="cmtt-10"> </span><span
9485 class="cmtt-10"> 4)</span><span
9486 class="cmtt-10"> [limit_residue_begin]</span><span
9487 class="cmtt-10"> =</span><span
9488 class="cmtt-10"> maximum</span><span
9489 class="cmtt-10"> of</span><span
9490 class="cmtt-10"> ([residue_begin],[actual_size]);</span>
9491 <br class="fancyvrb" /><a
9492 id="x1-110010r5"></a><span
9493 class="cmtt-10"> </span><span
9494 class="cmtt-10"> </span><span
9495 class="cmtt-10"> </span><span
9496 class="cmtt-10"> 5)</span><span
9497 class="cmtt-10"> [limit_residue_end]</span><span
9498 class="cmtt-10"> =</span><span
9499 class="cmtt-10"> maximum</span><span
9500 class="cmtt-10"> of</span><span
9501 class="cmtt-10"> ([residue_end],[actual_size]);</span>
9503 <!--l. 274--><p class="noindent" >The following convenience values are conceptually useful to clarifying the decode process:
9504 <!--l. 277--><p class="noindent" >
9505 <div class="fancyvrb" id="fancyvrb39">
9507 id="x1-110012r1"></a><span
9508 class="cmtt-10"> </span><span
9509 class="cmtt-10"> </span><span
9510 class="cmtt-10"> </span><span
9511 class="cmtt-10"> 1)</span><span
9512 class="cmtt-10"> [classwords_per_codeword]</span><span
9513 class="cmtt-10"> =</span><span
9514 class="cmtt-10"> [codebook_dimensions]</span><span
9515 class="cmtt-10"> value</span><span
9516 class="cmtt-10"> of</span><span
9517 class="cmtt-10"> codebook</span><span
9518 class="cmtt-10"> [residue_classbook]</span>
9519 <br class="fancyvrb" /><a
9520 id="x1-110014r2"></a><span
9521 class="cmtt-10"> </span><span
9522 class="cmtt-10"> </span><span
9523 class="cmtt-10"> </span><span
9524 class="cmtt-10"> 2)</span><span
9525 class="cmtt-10"> [n_to_read]</span><span
9526 class="cmtt-10"> =</span><span
9527 class="cmtt-10"> [limit_residue_end]</span><span
9528 class="cmtt-10"> -</span><span
9529 class="cmtt-10"> [limit_residue_begin]</span>
9530 <br class="fancyvrb" /><a
9531 id="x1-110016r3"></a><span
9532 class="cmtt-10"> </span><span
9533 class="cmtt-10"> </span><span
9534 class="cmtt-10"> </span><span
9535 class="cmtt-10"> 3)</span><span
9536 class="cmtt-10"> [partitions_to_read]</span><span
9537 class="cmtt-10"> =</span><span
9538 class="cmtt-10"> [n_to_read]</span><span
9539 class="cmtt-10"> /</span><span
9540 class="cmtt-10"> [residue_partition_size]</span>
9542 <!--l. 283--><p class="noindent" >Packet decode proceeds as follows, matching the description offered earlier in the document.
9546 <div class="fancyvrb" id="fancyvrb40">
9548 id="x1-110018r1"></a><span
9549 class="cmtt-10"> </span><span
9550 class="cmtt-10"> </span><span
9551 class="cmtt-10"> </span><span
9552 class="cmtt-10"> 1)</span><span
9553 class="cmtt-10"> allocate</span><span
9554 class="cmtt-10"> and</span><span
9555 class="cmtt-10"> zero</span><span
9556 class="cmtt-10"> all</span><span
9557 class="cmtt-10"> vectors</span><span
9558 class="cmtt-10"> that</span><span
9559 class="cmtt-10"> will</span><span
9560 class="cmtt-10"> be</span><span
9561 class="cmtt-10"> returned.</span>
9562 <br class="fancyvrb" /><a
9563 id="x1-110020r2"></a><span
9564 class="cmtt-10"> </span><span
9565 class="cmtt-10"> </span><span
9566 class="cmtt-10"> </span><span
9567 class="cmtt-10"> 2)</span><span
9568 class="cmtt-10"> if</span><span
9569 class="cmtt-10"> ([n_to_read]</span><span
9570 class="cmtt-10"> is</span><span
9571 class="cmtt-10"> zero),</span><span
9572 class="cmtt-10"> stop;</span><span
9573 class="cmtt-10"> there</span><span
9574 class="cmtt-10"> is</span><span
9575 class="cmtt-10"> no</span><span
9576 class="cmtt-10"> residue</span><span
9577 class="cmtt-10"> to</span><span
9578 class="cmtt-10"> decode.</span>
9579 <br class="fancyvrb" /><a
9580 id="x1-110022r3"></a><span
9581 class="cmtt-10"> </span><span
9582 class="cmtt-10"> </span><span
9583 class="cmtt-10"> </span><span
9584 class="cmtt-10"> 3)</span><span
9585 class="cmtt-10"> iterate</span><span
9586 class="cmtt-10"> [pass]</span><span
9587 class="cmtt-10"> over</span><span
9588 class="cmtt-10"> the</span><span
9589 class="cmtt-10"> range</span><span
9590 class="cmtt-10"> 0</span><span
9591 class="cmtt-10"> ...</span><span
9592 class="cmtt-10"> 7</span><span
9593 class="cmtt-10"> {</span>
9594 <br class="fancyvrb" /><a
9595 id="x1-110024r4"></a><span
9596 class="cmtt-10"> </span><span
9597 class="cmtt-10"> </span>
9598 <br class="fancyvrb" /><a
9599 id="x1-110026r5"></a><span
9600 class="cmtt-10"> </span><span
9601 class="cmtt-10"> </span><span
9602 class="cmtt-10"> </span><span
9603 class="cmtt-10"> </span><span
9604 class="cmtt-10"> </span><span
9605 class="cmtt-10"> </span><span
9606 class="cmtt-10"> </span><span
9607 class="cmtt-10"> </span><span
9608 class="cmtt-10"> 4)</span><span
9609 class="cmtt-10"> [partition_count]</span><span
9610 class="cmtt-10"> =</span><span
9611 class="cmtt-10"> 0</span>
9612 <br class="fancyvrb" /><a
9613 id="x1-110028r6"></a><span
9614 class="cmtt-10"> </span><span
9615 class="cmtt-10"> </span>
9616 <br class="fancyvrb" /><a
9617 id="x1-110030r7"></a><span
9618 class="cmtt-10"> </span><span
9619 class="cmtt-10"> </span><span
9620 class="cmtt-10"> </span><span
9621 class="cmtt-10"> </span><span
9622 class="cmtt-10"> </span><span
9623 class="cmtt-10"> </span><span
9624 class="cmtt-10"> </span><span
9625 class="cmtt-10"> </span><span
9626 class="cmtt-10"> 5)</span><span
9627 class="cmtt-10"> while</span><span
9628 class="cmtt-10"> [partition_count]</span><span
9629 class="cmtt-10"> is</span><span
9630 class="cmtt-10"> less</span><span
9631 class="cmtt-10"> than</span><span
9632 class="cmtt-10"> [partitions_to_read]</span>
9633 <br class="fancyvrb" /><a
9634 id="x1-110032r8"></a><span
9635 class="cmtt-10"> </span><span
9636 class="cmtt-10"> </span>
9637 <br class="fancyvrb" /><a
9638 id="x1-110034r9"></a><span
9639 class="cmtt-10"> </span><span
9640 class="cmtt-10"> </span><span
9641 class="cmtt-10"> </span><span
9642 class="cmtt-10"> </span><span
9643 class="cmtt-10"> </span><span
9644 class="cmtt-10"> </span><span
9645 class="cmtt-10"> </span><span
9646 class="cmtt-10"> </span><span
9647 class="cmtt-10"> </span><span
9648 class="cmtt-10"> </span><span
9649 class="cmtt-10"> </span><span
9650 class="cmtt-10"> </span><span
9651 class="cmtt-10"> </span><span
9652 class="cmtt-10"> 6)</span><span
9653 class="cmtt-10"> if</span><span
9654 class="cmtt-10"> ([pass]</span><span
9655 class="cmtt-10"> is</span><span
9656 class="cmtt-10"> zero)</span><span
9657 class="cmtt-10"> {</span>
9658 <br class="fancyvrb" /><a
9659 id="x1-110036r10"></a><span
9660 class="cmtt-10"> </span><span
9661 class="cmtt-10"> </span>
9662 <br class="fancyvrb" /><a
9663 id="x1-110038r11"></a><span
9664 class="cmtt-10"> </span><span
9665 class="cmtt-10"> </span><span
9666 class="cmtt-10"> </span><span
9667 class="cmtt-10"> </span><span
9668 class="cmtt-10"> </span><span
9669 class="cmtt-10"> </span><span
9670 class="cmtt-10"> </span><span
9671 class="cmtt-10"> </span><span
9672 class="cmtt-10"> </span><span
9673 class="cmtt-10"> </span><span
9674 class="cmtt-10"> </span><span
9675 class="cmtt-10"> </span><span
9676 class="cmtt-10"> </span><span
9677 class="cmtt-10"> </span><span
9678 class="cmtt-10"> </span><span
9679 class="cmtt-10"> </span><span
9680 class="cmtt-10"> </span><span
9681 class="cmtt-10"> </span><span
9682 class="cmtt-10"> 7)</span><span
9683 class="cmtt-10"> iterate</span><span
9684 class="cmtt-10"> [j]</span><span
9685 class="cmtt-10"> over</span><span
9686 class="cmtt-10"> the</span><span
9687 class="cmtt-10"> range</span><span
9688 class="cmtt-10"> 0</span><span
9689 class="cmtt-10"> ..</span><span
9690 class="cmtt-10"> [ch]-1</span><span
9691 class="cmtt-10"> {</span>
9692 <br class="fancyvrb" /><a
9693 id="x1-110040r12"></a><span
9694 class="cmtt-10"> </span><span
9695 class="cmtt-10"> </span>
9696 <br class="fancyvrb" /><a
9697 id="x1-110042r13"></a><span
9698 class="cmtt-10"> </span><span
9699 class="cmtt-10"> </span><span
9700 class="cmtt-10"> </span><span
9701 class="cmtt-10"> </span><span
9702 class="cmtt-10"> </span><span
9703 class="cmtt-10"> </span><span
9704 class="cmtt-10"> </span><span
9705 class="cmtt-10"> </span><span
9706 class="cmtt-10"> </span><span
9707 class="cmtt-10"> </span><span
9708 class="cmtt-10"> </span><span
9709 class="cmtt-10"> </span><span
9710 class="cmtt-10"> </span><span
9711 class="cmtt-10"> </span><span
9712 class="cmtt-10"> </span><span
9713 class="cmtt-10"> </span><span
9714 class="cmtt-10"> </span><span
9715 class="cmtt-10"> </span><span
9716 class="cmtt-10"> </span><span
9717 class="cmtt-10"> </span><span
9718 class="cmtt-10"> </span><span
9719 class="cmtt-10"> </span><span
9720 class="cmtt-10"> </span><span
9721 class="cmtt-10"> 8)</span><span
9722 class="cmtt-10"> if</span><span
9723 class="cmtt-10"> vector</span><span
9724 class="cmtt-10"> [j]</span><span
9725 class="cmtt-10"> is</span><span
9726 class="cmtt-10"> not</span><span
9727 class="cmtt-10"> marked</span><span
9728 class="cmtt-10"> ’do</span><span
9729 class="cmtt-10"> not</span><span
9730 class="cmtt-10"> decode’</span><span
9731 class="cmtt-10"> {</span>
9732 <br class="fancyvrb" /><a
9733 id="x1-110044r14"></a><span
9734 class="cmtt-10"> </span><span
9735 class="cmtt-10"> </span>
9736 <br class="fancyvrb" /><a
9737 id="x1-110046r15"></a><span
9738 class="cmtt-10"> </span><span
9739 class="cmtt-10"> </span><span
9740 class="cmtt-10"> </span><span
9741 class="cmtt-10"> </span><span
9742 class="cmtt-10"> </span><span
9743 class="cmtt-10"> </span><span
9744 class="cmtt-10"> </span><span
9745 class="cmtt-10"> </span><span
9746 class="cmtt-10"> </span><span
9747 class="cmtt-10"> </span><span
9748 class="cmtt-10"> </span><span
9749 class="cmtt-10"> </span><span
9750 class="cmtt-10"> </span><span
9751 class="cmtt-10"> </span><span
9752 class="cmtt-10"> </span><span
9753 class="cmtt-10"> </span><span
9754 class="cmtt-10"> </span><span
9755 class="cmtt-10"> </span><span
9756 class="cmtt-10"> </span><span
9757 class="cmtt-10"> </span><span
9758 class="cmtt-10"> </span><span
9759 class="cmtt-10"> </span><span
9760 class="cmtt-10"> </span><span
9761 class="cmtt-10"> </span><span
9762 class="cmtt-10"> </span><span
9763 class="cmtt-10"> </span><span
9764 class="cmtt-10"> </span><span
9765 class="cmtt-10"> </span><span
9766 class="cmtt-10"> 9)</span><span
9767 class="cmtt-10"> [temp]</span><span
9768 class="cmtt-10"> =</span><span
9769 class="cmtt-10"> read</span><span
9770 class="cmtt-10"> from</span><span
9771 class="cmtt-10"> packet</span><span
9772 class="cmtt-10"> using</span><span
9773 class="cmtt-10"> codebook</span><span
9774 class="cmtt-10"> [residue_classbook]</span><span
9775 class="cmtt-10"> in</span><span
9776 class="cmtt-10"> scalar</span><span
9777 class="cmtt-10"> context</span>
9778 <br class="fancyvrb" /><a
9779 id="x1-110048r16"></a><span
9780 class="cmtt-10"> </span><span
9781 class="cmtt-10"> </span><span
9782 class="cmtt-10"> </span><span
9783 class="cmtt-10"> </span><span
9784 class="cmtt-10"> </span><span
9785 class="cmtt-10"> </span><span
9786 class="cmtt-10"> </span><span
9787 class="cmtt-10"> </span><span
9788 class="cmtt-10"> </span><span
9789 class="cmtt-10"> </span><span
9790 class="cmtt-10"> </span><span
9791 class="cmtt-10"> </span><span
9792 class="cmtt-10"> </span><span
9793 class="cmtt-10"> </span><span
9794 class="cmtt-10"> </span><span
9795 class="cmtt-10"> </span><span
9796 class="cmtt-10"> </span><span
9797 class="cmtt-10"> </span><span
9798 class="cmtt-10"> </span><span
9799 class="cmtt-10"> </span><span
9800 class="cmtt-10"> </span><span
9801 class="cmtt-10"> </span><span
9802 class="cmtt-10"> </span><span
9803 class="cmtt-10"> </span><span
9804 class="cmtt-10"> </span><span
9805 class="cmtt-10"> </span><span
9806 class="cmtt-10"> </span><span
9807 class="cmtt-10"> 10)</span><span
9808 class="cmtt-10"> iterate</span><span
9809 class="cmtt-10"> [i]</span><span
9810 class="cmtt-10"> descending</span><span
9811 class="cmtt-10"> over</span><span
9812 class="cmtt-10"> the</span><span
9813 class="cmtt-10"> range</span><span
9814 class="cmtt-10"> [classwords_per_codeword]-1</span><span
9815 class="cmtt-10"> ...</span><span
9816 class="cmtt-10"> 0</span><span
9817 class="cmtt-10"> {</span>
9818 <br class="fancyvrb" /><a
9819 id="x1-110050r17"></a><span
9820 class="cmtt-10"> </span><span
9821 class="cmtt-10"> </span>
9822 <br class="fancyvrb" /><a
9823 id="x1-110052r18"></a><span
9824 class="cmtt-10"> </span><span
9825 class="cmtt-10"> </span><span
9826 class="cmtt-10"> </span><span
9827 class="cmtt-10"> </span><span
9828 class="cmtt-10"> </span><span
9829 class="cmtt-10"> </span><span
9830 class="cmtt-10"> </span><span
9831 class="cmtt-10"> </span><span
9832 class="cmtt-10"> </span><span
9833 class="cmtt-10"> </span><span
9834 class="cmtt-10"> </span><span
9835 class="cmtt-10"> </span><span
9836 class="cmtt-10"> </span><span
9837 class="cmtt-10"> </span><span
9838 class="cmtt-10"> </span><span
9839 class="cmtt-10"> </span><span
9840 class="cmtt-10"> </span><span
9841 class="cmtt-10"> </span><span
9842 class="cmtt-10"> </span><span
9843 class="cmtt-10"> </span><span
9844 class="cmtt-10"> </span><span
9845 class="cmtt-10"> </span><span
9846 class="cmtt-10"> </span><span
9847 class="cmtt-10"> </span><span
9848 class="cmtt-10"> </span><span
9849 class="cmtt-10"> </span><span
9850 class="cmtt-10"> </span><span
9851 class="cmtt-10"> </span><span
9852 class="cmtt-10"> </span><span
9853 class="cmtt-10"> </span><span
9854 class="cmtt-10"> </span><span
9855 class="cmtt-10"> </span><span
9856 class="cmtt-10"> 11)</span><span
9857 class="cmtt-10"> array</span><span
9858 class="cmtt-10"> [classifications]</span><span
9859 class="cmtt-10"> element</span><span
9860 class="cmtt-10"> [j],([i]+[partition_count])</span><span
9861 class="cmtt-10"> =</span>
9862 <br class="fancyvrb" /><a
9863 id="x1-110054r19"></a><span
9864 class="cmtt-10"> </span><span
9865 class="cmtt-10"> </span><span
9866 class="cmtt-10"> </span><span
9867 class="cmtt-10"> </span><span
9868 class="cmtt-10"> </span><span
9869 class="cmtt-10"> </span><span
9870 class="cmtt-10"> </span><span
9871 class="cmtt-10"> </span><span
9872 class="cmtt-10"> </span><span
9873 class="cmtt-10"> </span><span
9874 class="cmtt-10"> </span><span
9875 class="cmtt-10"> </span><span
9876 class="cmtt-10"> </span><span
9877 class="cmtt-10"> </span><span
9878 class="cmtt-10"> </span><span
9879 class="cmtt-10"> </span><span
9880 class="cmtt-10"> </span><span
9881 class="cmtt-10"> </span><span
9882 class="cmtt-10"> </span><span
9883 class="cmtt-10"> </span><span
9884 class="cmtt-10"> </span><span
9885 class="cmtt-10"> </span><span
9886 class="cmtt-10"> </span><span
9887 class="cmtt-10"> </span><span
9888 class="cmtt-10"> </span><span
9889 class="cmtt-10"> </span><span
9890 class="cmtt-10"> </span><span
9891 class="cmtt-10"> </span><span
9892 class="cmtt-10"> </span><span
9893 class="cmtt-10"> </span><span
9894 class="cmtt-10"> </span><span
9895 class="cmtt-10"> </span><span
9896 class="cmtt-10"> </span><span
9897 class="cmtt-10"> </span><span
9898 class="cmtt-10"> </span><span
9899 class="cmtt-10"> </span><span
9900 class="cmtt-10"> [temp]</span><span
9901 class="cmtt-10"> integer</span><span
9902 class="cmtt-10"> modulo</span><span
9903 class="cmtt-10"> [residue_classifications]</span>
9904 <br class="fancyvrb" /><a
9905 id="x1-110056r20"></a><span
9906 class="cmtt-10"> </span><span
9907 class="cmtt-10"> </span><span
9908 class="cmtt-10"> </span><span
9909 class="cmtt-10"> </span><span
9910 class="cmtt-10"> </span><span
9911 class="cmtt-10"> </span><span
9912 class="cmtt-10"> </span><span
9913 class="cmtt-10"> </span><span
9914 class="cmtt-10"> </span><span
9915 class="cmtt-10"> </span><span
9916 class="cmtt-10"> </span><span
9917 class="cmtt-10"> </span><span
9918 class="cmtt-10"> </span><span
9919 class="cmtt-10"> </span><span
9920 class="cmtt-10"> </span><span
9921 class="cmtt-10"> </span><span
9922 class="cmtt-10"> </span><span
9923 class="cmtt-10"> </span><span
9924 class="cmtt-10"> </span><span
9925 class="cmtt-10"> </span><span
9926 class="cmtt-10"> </span><span
9927 class="cmtt-10"> </span><span
9928 class="cmtt-10"> </span><span
9929 class="cmtt-10"> </span><span
9930 class="cmtt-10"> </span><span
9931 class="cmtt-10"> </span><span
9932 class="cmtt-10"> </span><span
9933 class="cmtt-10"> </span><span
9934 class="cmtt-10"> </span><span
9935 class="cmtt-10"> </span><span
9936 class="cmtt-10"> </span><span
9937 class="cmtt-10"> </span><span
9938 class="cmtt-10"> 12)</span><span
9939 class="cmtt-10"> [temp]</span><span
9940 class="cmtt-10"> =</span><span
9941 class="cmtt-10"> [temp]</span><span
9942 class="cmtt-10"> /</span><span
9943 class="cmtt-10"> [residue_classifications]</span><span
9944 class="cmtt-10"> using</span><span
9945 class="cmtt-10"> integer</span><span
9946 class="cmtt-10"> division</span>
9947 <br class="fancyvrb" /><a
9948 id="x1-110058r21"></a><span
9949 class="cmtt-10"> </span><span
9950 class="cmtt-10"> </span>
9951 <br class="fancyvrb" /><a
9952 id="x1-110060r22"></a><span
9953 class="cmtt-10"> </span><span
9954 class="cmtt-10"> </span><span
9955 class="cmtt-10"> </span><span
9956 class="cmtt-10"> </span><span
9957 class="cmtt-10"> </span><span
9958 class="cmtt-10"> </span><span
9959 class="cmtt-10"> </span><span
9960 class="cmtt-10"> </span><span
9961 class="cmtt-10"> </span><span
9962 class="cmtt-10"> </span><span
9963 class="cmtt-10"> </span><span
9964 class="cmtt-10"> </span><span
9965 class="cmtt-10"> </span><span
9966 class="cmtt-10"> </span><span
9967 class="cmtt-10"> </span><span
9968 class="cmtt-10"> </span><span
9969 class="cmtt-10"> </span><span
9970 class="cmtt-10"> </span><span
9971 class="cmtt-10"> </span><span
9972 class="cmtt-10"> </span><span
9973 class="cmtt-10"> </span><span
9974 class="cmtt-10"> </span><span
9975 class="cmtt-10"> </span><span
9976 class="cmtt-10"> </span><span
9977 class="cmtt-10"> </span><span
9978 class="cmtt-10"> </span><span
9979 class="cmtt-10"> </span><span
9980 class="cmtt-10"> </span><span
9981 class="cmtt-10"> </span><span
9982 class="cmtt-10"> </span><span
9983 class="cmtt-10"> </span><span
9984 class="cmtt-10"> }</span>
9985 <br class="fancyvrb" /><a
9986 id="x1-110062r23"></a><span
9987 class="cmtt-10"> </span><span
9988 class="cmtt-10"> </span>
9989 <br class="fancyvrb" /><a
9990 id="x1-110064r24"></a><span
9991 class="cmtt-10"> </span><span
9992 class="cmtt-10"> </span><span
9993 class="cmtt-10"> </span><span
9994 class="cmtt-10"> </span><span
9995 class="cmtt-10"> </span><span
9996 class="cmtt-10"> </span><span
9997 class="cmtt-10"> </span><span
9998 class="cmtt-10"> </span><span
9999 class="cmtt-10"> </span><span
10000 class="cmtt-10"> </span><span
10001 class="cmtt-10"> </span><span
10002 class="cmtt-10"> </span><span
10003 class="cmtt-10"> </span><span
10004 class="cmtt-10"> </span><span
10005 class="cmtt-10"> </span><span
10006 class="cmtt-10"> </span><span
10007 class="cmtt-10"> </span><span
10008 class="cmtt-10"> </span><span
10009 class="cmtt-10"> </span><span
10010 class="cmtt-10"> </span><span
10011 class="cmtt-10"> </span><span
10012 class="cmtt-10"> </span><span
10013 class="cmtt-10"> </span><span
10014 class="cmtt-10"> </span><span
10015 class="cmtt-10"> </span><span
10016 class="cmtt-10"> </span><span
10017 class="cmtt-10"> }</span>
10018 <br class="fancyvrb" /><a
10019 id="x1-110066r25"></a><span
10020 class="cmtt-10"> </span><span
10021 class="cmtt-10"> </span>
10022 <br class="fancyvrb" /><a
10023 id="x1-110068r26"></a><span
10024 class="cmtt-10"> </span><span
10025 class="cmtt-10"> </span><span
10026 class="cmtt-10"> </span><span
10027 class="cmtt-10"> </span><span
10028 class="cmtt-10"> </span><span
10029 class="cmtt-10"> </span><span
10030 class="cmtt-10"> </span><span
10031 class="cmtt-10"> </span><span
10032 class="cmtt-10"> </span><span
10033 class="cmtt-10"> </span><span
10034 class="cmtt-10"> </span><span
10035 class="cmtt-10"> </span><span
10036 class="cmtt-10"> </span><span
10037 class="cmtt-10"> </span><span
10038 class="cmtt-10"> </span><span
10039 class="cmtt-10"> </span><span
10040 class="cmtt-10"> </span><span
10041 class="cmtt-10"> </span><span
10042 class="cmtt-10"> </span><span
10043 class="cmtt-10"> </span><span
10044 class="cmtt-10"> </span><span
10045 class="cmtt-10"> }</span>
10046 <br class="fancyvrb" /><a
10047 id="x1-110070r27"></a><span
10048 class="cmtt-10"> </span><span
10049 class="cmtt-10"> </span>
10050 <br class="fancyvrb" /><a
10051 id="x1-110072r28"></a><span
10052 class="cmtt-10"> </span><span
10053 class="cmtt-10"> </span><span
10054 class="cmtt-10"> </span><span
10055 class="cmtt-10"> </span><span
10056 class="cmtt-10"> </span><span
10057 class="cmtt-10"> </span><span
10058 class="cmtt-10"> </span><span
10059 class="cmtt-10"> </span><span
10060 class="cmtt-10"> </span><span
10061 class="cmtt-10"> </span><span
10062 class="cmtt-10"> </span><span
10063 class="cmtt-10"> </span><span
10064 class="cmtt-10"> </span><span
10065 class="cmtt-10"> </span><span
10066 class="cmtt-10"> </span><span
10067 class="cmtt-10"> </span><span
10068 class="cmtt-10"> }</span>
10069 <br class="fancyvrb" /><a
10070 id="x1-110074r29"></a><span
10071 class="cmtt-10"> </span><span
10072 class="cmtt-10"> </span>
10073 <br class="fancyvrb" /><a
10074 id="x1-110076r30"></a><span
10075 class="cmtt-10"> </span><span
10076 class="cmtt-10"> </span><span
10077 class="cmtt-10"> </span><span
10078 class="cmtt-10"> </span><span
10079 class="cmtt-10"> </span><span
10080 class="cmtt-10"> </span><span
10081 class="cmtt-10"> </span><span
10082 class="cmtt-10"> </span><span
10083 class="cmtt-10"> </span><span
10084 class="cmtt-10"> </span><span
10085 class="cmtt-10"> </span><span
10086 class="cmtt-10"> </span><span
10087 class="cmtt-10"> 13)</span><span
10088 class="cmtt-10"> iterate</span><span
10089 class="cmtt-10"> [i]</span><span
10090 class="cmtt-10"> over</span><span
10091 class="cmtt-10"> the</span><span
10092 class="cmtt-10"> range</span><span
10093 class="cmtt-10"> 0</span><span
10094 class="cmtt-10"> ..</span><span
10095 class="cmtt-10"> ([classwords_per_codeword]</span><span
10096 class="cmtt-10"> -</span><span
10097 class="cmtt-10"> 1)</span><span
10098 class="cmtt-10"> while</span><span
10099 class="cmtt-10"> [partition_count]</span>
10100 <br class="fancyvrb" /><a
10101 id="x1-110078r31"></a><span
10102 class="cmtt-10"> </span><span
10103 class="cmtt-10"> </span><span
10104 class="cmtt-10"> </span><span
10105 class="cmtt-10"> </span><span
10106 class="cmtt-10"> </span><span
10107 class="cmtt-10"> </span><span
10108 class="cmtt-10"> </span><span
10109 class="cmtt-10"> </span><span
10110 class="cmtt-10"> </span><span
10111 class="cmtt-10"> </span><span
10112 class="cmtt-10"> </span><span
10113 class="cmtt-10"> </span><span
10114 class="cmtt-10"> </span><span
10115 class="cmtt-10"> </span><span
10116 class="cmtt-10"> </span><span
10117 class="cmtt-10"> </span><span
10118 class="cmtt-10"> is</span><span
10119 class="cmtt-10"> also</span><span
10120 class="cmtt-10"> less</span><span
10121 class="cmtt-10"> than</span><span
10122 class="cmtt-10"> [partitions_to_read]</span><span
10123 class="cmtt-10"> {</span>
10124 <br class="fancyvrb" /><a
10125 id="x1-110080r32"></a><span
10126 class="cmtt-10"> </span><span
10127 class="cmtt-10"> </span>
10128 <br class="fancyvrb" /><a
10129 id="x1-110082r33"></a><span
10130 class="cmtt-10"> </span><span
10131 class="cmtt-10"> </span><span
10132 class="cmtt-10"> </span><span
10133 class="cmtt-10"> </span><span
10134 class="cmtt-10"> </span><span
10135 class="cmtt-10"> </span><span
10136 class="cmtt-10"> </span><span
10137 class="cmtt-10"> </span><span
10138 class="cmtt-10"> </span><span
10139 class="cmtt-10"> </span><span
10140 class="cmtt-10"> </span><span
10141 class="cmtt-10"> </span><span
10142 class="cmtt-10"> </span><span
10143 class="cmtt-10"> </span><span
10144 class="cmtt-10"> </span><span
10145 class="cmtt-10"> </span><span
10146 class="cmtt-10"> </span><span
10147 class="cmtt-10"> </span><span
10148 class="cmtt-10"> 14)</span><span
10149 class="cmtt-10"> iterate</span><span
10150 class="cmtt-10"> [j]</span><span
10151 class="cmtt-10"> over</span><span
10152 class="cmtt-10"> the</span><span
10153 class="cmtt-10"> range</span><span
10154 class="cmtt-10"> 0</span><span
10155 class="cmtt-10"> ..</span><span
10156 class="cmtt-10"> [ch]-1</span><span
10157 class="cmtt-10"> {</span>
10158 <br class="fancyvrb" /><a
10159 id="x1-110084r34"></a><span
10160 class="cmtt-10"> </span><span
10161 class="cmtt-10"> </span>
10162 <br class="fancyvrb" /><a
10163 id="x1-110086r35"></a><span
10164 class="cmtt-10"> </span><span
10165 class="cmtt-10"> </span><span
10166 class="cmtt-10"> </span><span
10167 class="cmtt-10"> </span><span
10168 class="cmtt-10"> </span><span
10169 class="cmtt-10"> </span><span
10170 class="cmtt-10"> </span><span
10171 class="cmtt-10"> </span><span
10172 class="cmtt-10"> </span><span
10173 class="cmtt-10"> </span><span
10174 class="cmtt-10"> </span><span
10175 class="cmtt-10"> </span><span
10176 class="cmtt-10"> </span><span
10177 class="cmtt-10"> </span><span
10178 class="cmtt-10"> </span><span
10179 class="cmtt-10"> </span><span
10180 class="cmtt-10"> </span><span
10181 class="cmtt-10"> </span><span
10182 class="cmtt-10"> </span><span
10183 class="cmtt-10"> </span><span
10184 class="cmtt-10"> </span><span
10185 class="cmtt-10"> </span><span
10186 class="cmtt-10"> </span><span
10187 class="cmtt-10"> 15)</span><span
10188 class="cmtt-10"> if</span><span
10189 class="cmtt-10"> vector</span><span
10190 class="cmtt-10"> [j]</span><span
10191 class="cmtt-10"> is</span><span
10192 class="cmtt-10"> not</span><span
10193 class="cmtt-10"> marked</span><span
10194 class="cmtt-10"> ’do</span><span
10195 class="cmtt-10"> not</span><span
10196 class="cmtt-10"> decode’</span><span
10197 class="cmtt-10"> {</span>
10198 <br class="fancyvrb" /><a
10199 id="x1-110088r36"></a><span
10200 class="cmtt-10"> </span><span
10201 class="cmtt-10"> </span>
10202 <br class="fancyvrb" /><a
10203 id="x1-110090r37"></a><span
10204 class="cmtt-10"> </span><span
10205 class="cmtt-10"> </span><span
10206 class="cmtt-10"> </span><span
10207 class="cmtt-10"> </span><span
10208 class="cmtt-10"> </span><span
10209 class="cmtt-10"> </span><span
10210 class="cmtt-10"> </span><span
10211 class="cmtt-10"> </span><span
10212 class="cmtt-10"> </span><span
10213 class="cmtt-10"> </span><span
10214 class="cmtt-10"> </span><span
10215 class="cmtt-10"> </span><span
10216 class="cmtt-10"> </span><span
10217 class="cmtt-10"> </span><span
10218 class="cmtt-10"> </span><span
10219 class="cmtt-10"> </span><span
10220 class="cmtt-10"> </span><span
10221 class="cmtt-10"> </span><span
10222 class="cmtt-10"> </span><span
10223 class="cmtt-10"> </span><span
10224 class="cmtt-10"> </span><span
10225 class="cmtt-10"> </span><span
10226 class="cmtt-10"> </span><span
10227 class="cmtt-10"> </span><span
10228 class="cmtt-10"> </span><span
10229 class="cmtt-10"> </span><span
10230 class="cmtt-10"> </span><span
10231 class="cmtt-10"> </span><span
10232 class="cmtt-10"> 16)</span><span
10233 class="cmtt-10"> [vqclass]</span><span
10234 class="cmtt-10"> =</span><span
10235 class="cmtt-10"> array</span><span
10236 class="cmtt-10"> [classifications]</span><span
10237 class="cmtt-10"> element</span><span
10238 class="cmtt-10"> [j],[partition_count]</span>
10239 <br class="fancyvrb" /><a
10240 id="x1-110092r38"></a><span
10241 class="cmtt-10"> </span><span
10242 class="cmtt-10"> </span><span
10243 class="cmtt-10"> </span><span
10244 class="cmtt-10"> </span><span
10245 class="cmtt-10"> </span><span
10246 class="cmtt-10"> </span><span
10247 class="cmtt-10"> </span><span
10248 class="cmtt-10"> </span><span
10249 class="cmtt-10"> </span><span
10250 class="cmtt-10"> </span><span
10251 class="cmtt-10"> </span><span
10252 class="cmtt-10"> </span><span
10253 class="cmtt-10"> </span><span
10254 class="cmtt-10"> </span><span
10255 class="cmtt-10"> </span><span
10256 class="cmtt-10"> </span><span
10257 class="cmtt-10"> </span><span
10258 class="cmtt-10"> </span><span
10259 class="cmtt-10"> </span><span
10260 class="cmtt-10"> </span><span
10261 class="cmtt-10"> </span><span
10262 class="cmtt-10"> </span><span
10263 class="cmtt-10"> </span><span
10264 class="cmtt-10"> </span><span
10265 class="cmtt-10"> </span><span
10266 class="cmtt-10"> </span><span
10267 class="cmtt-10"> </span><span
10268 class="cmtt-10"> </span><span
10269 class="cmtt-10"> 17)</span><span
10270 class="cmtt-10"> [vqbook]</span><span
10271 class="cmtt-10"> =</span><span
10272 class="cmtt-10"> array</span><span
10273 class="cmtt-10"> [residue_books]</span><span
10274 class="cmtt-10"> element</span><span
10275 class="cmtt-10"> [vqclass],[pass]</span>
10276 <br class="fancyvrb" /><a
10277 id="x1-110094r39"></a><span
10278 class="cmtt-10"> </span><span
10279 class="cmtt-10"> </span><span
10280 class="cmtt-10"> </span><span
10281 class="cmtt-10"> </span><span
10282 class="cmtt-10"> </span><span
10283 class="cmtt-10"> </span><span
10284 class="cmtt-10"> </span><span
10285 class="cmtt-10"> </span><span
10286 class="cmtt-10"> </span><span
10287 class="cmtt-10"> </span><span
10288 class="cmtt-10"> </span><span
10289 class="cmtt-10"> </span><span
10290 class="cmtt-10"> </span><span
10291 class="cmtt-10"> </span><span
10292 class="cmtt-10"> </span><span
10293 class="cmtt-10"> </span><span
10294 class="cmtt-10"> </span><span
10295 class="cmtt-10"> </span><span
10296 class="cmtt-10"> </span><span
10297 class="cmtt-10"> </span><span
10298 class="cmtt-10"> </span><span
10299 class="cmtt-10"> </span><span
10300 class="cmtt-10"> </span><span
10301 class="cmtt-10"> </span><span
10302 class="cmtt-10"> </span><span
10303 class="cmtt-10"> </span><span
10304 class="cmtt-10"> </span><span
10305 class="cmtt-10"> </span><span
10306 class="cmtt-10"> 18)</span><span
10307 class="cmtt-10"> if</span><span
10308 class="cmtt-10"> ([vqbook]</span><span
10309 class="cmtt-10"> is</span><span
10310 class="cmtt-10"> not</span><span
10311 class="cmtt-10"> ’unused’)</span><span
10312 class="cmtt-10"> {</span>
10313 <br class="fancyvrb" /><a
10314 id="x1-110096r40"></a><span
10315 class="cmtt-10"> </span><span
10316 class="cmtt-10"> </span>
10317 <br class="fancyvrb" /><a
10318 id="x1-110098r41"></a><span
10319 class="cmtt-10"> </span><span
10320 class="cmtt-10"> </span><span
10321 class="cmtt-10"> </span><span
10322 class="cmtt-10"> </span><span
10323 class="cmtt-10"> </span><span
10324 class="cmtt-10"> </span><span
10325 class="cmtt-10"> </span><span
10326 class="cmtt-10"> </span><span
10327 class="cmtt-10"> </span><span
10328 class="cmtt-10"> </span><span
10329 class="cmtt-10"> </span><span
10330 class="cmtt-10"> </span><span
10331 class="cmtt-10"> </span><span
10332 class="cmtt-10"> </span><span
10333 class="cmtt-10"> </span><span
10334 class="cmtt-10"> </span><span
10335 class="cmtt-10"> </span><span
10336 class="cmtt-10"> </span><span
10337 class="cmtt-10"> </span><span
10338 class="cmtt-10"> </span><span
10339 class="cmtt-10"> </span><span
10340 class="cmtt-10"> </span><span
10341 class="cmtt-10"> </span><span
10342 class="cmtt-10"> </span><span
10343 class="cmtt-10"> </span><span
10344 class="cmtt-10"> </span><span
10345 class="cmtt-10"> </span><span
10346 class="cmtt-10"> </span><span
10347 class="cmtt-10"> </span><span
10348 class="cmtt-10"> </span><span
10349 class="cmtt-10"> </span><span
10350 class="cmtt-10"> </span><span
10351 class="cmtt-10"> </span><span
10352 class="cmtt-10"> 19)</span><span
10353 class="cmtt-10"> decode</span><span
10354 class="cmtt-10"> partition</span><span
10355 class="cmtt-10"> into</span><span
10356 class="cmtt-10"> output</span><span
10357 class="cmtt-10"> vector</span><span
10358 class="cmtt-10"> number</span><span
10359 class="cmtt-10"> [j],</span><span
10360 class="cmtt-10"> starting</span><span
10361 class="cmtt-10"> at</span><span
10362 class="cmtt-10"> scalar</span>
10363 <br class="fancyvrb" /><a
10364 id="x1-110100r42"></a><span
10365 class="cmtt-10"> </span><span
10366 class="cmtt-10"> </span><span
10367 class="cmtt-10"> </span><span
10368 class="cmtt-10"> </span><span
10369 class="cmtt-10"> </span><span
10370 class="cmtt-10"> </span><span
10371 class="cmtt-10"> </span><span
10372 class="cmtt-10"> </span><span
10373 class="cmtt-10"> </span><span
10374 class="cmtt-10"> </span><span
10375 class="cmtt-10"> </span><span
10376 class="cmtt-10"> </span><span
10377 class="cmtt-10"> </span><span
10378 class="cmtt-10"> </span><span
10379 class="cmtt-10"> </span><span
10380 class="cmtt-10"> </span><span
10381 class="cmtt-10"> </span><span
10382 class="cmtt-10"> </span><span
10383 class="cmtt-10"> </span><span
10384 class="cmtt-10"> </span><span
10385 class="cmtt-10"> </span><span
10386 class="cmtt-10"> </span><span
10387 class="cmtt-10"> </span><span
10388 class="cmtt-10"> </span><span
10389 class="cmtt-10"> </span><span
10390 class="cmtt-10"> </span><span
10391 class="cmtt-10"> </span><span
10392 class="cmtt-10"> </span><span
10393 class="cmtt-10"> </span><span
10394 class="cmtt-10"> </span><span
10395 class="cmtt-10"> </span><span
10396 class="cmtt-10"> </span><span
10397 class="cmtt-10"> </span><span
10398 class="cmtt-10"> </span><span
10399 class="cmtt-10"> </span><span
10400 class="cmtt-10"> </span><span
10401 class="cmtt-10"> </span><span
10402 class="cmtt-10"> offset</span><span
10403 class="cmtt-10"> [limit_residue_begin]+[partition_count]*[residue_partition_size]</span><span
10404 class="cmtt-10"> using</span>
10405 <br class="fancyvrb" /><a
10406 id="x1-110102r43"></a><span
10407 class="cmtt-10"> </span><span
10408 class="cmtt-10"> </span><span
10409 class="cmtt-10"> </span><span
10410 class="cmtt-10"> </span><span
10411 class="cmtt-10"> </span><span
10412 class="cmtt-10"> </span><span
10413 class="cmtt-10"> </span><span
10414 class="cmtt-10"> </span><span
10415 class="cmtt-10"> </span><span
10416 class="cmtt-10"> </span><span
10417 class="cmtt-10"> </span><span
10418 class="cmtt-10"> </span><span
10419 class="cmtt-10"> </span><span
10420 class="cmtt-10"> </span><span
10421 class="cmtt-10"> </span><span
10422 class="cmtt-10"> </span><span
10423 class="cmtt-10"> </span><span
10424 class="cmtt-10"> </span><span
10425 class="cmtt-10"> </span><span
10426 class="cmtt-10"> </span><span
10427 class="cmtt-10"> </span><span
10428 class="cmtt-10"> </span><span
10429 class="cmtt-10"> </span><span
10430 class="cmtt-10"> </span><span
10431 class="cmtt-10"> </span><span
10432 class="cmtt-10"> </span><span
10433 class="cmtt-10"> </span><span
10434 class="cmtt-10"> </span><span
10435 class="cmtt-10"> </span><span
10436 class="cmtt-10"> </span><span
10437 class="cmtt-10"> </span><span
10438 class="cmtt-10"> </span><span
10439 class="cmtt-10"> </span><span
10440 class="cmtt-10"> </span><span
10441 class="cmtt-10"> </span><span
10442 class="cmtt-10"> </span><span
10443 class="cmtt-10"> </span><span
10444 class="cmtt-10"> codebook</span><span
10445 class="cmtt-10"> number</span><span
10446 class="cmtt-10"> [vqbook]</span><span
10447 class="cmtt-10"> in</span><span
10448 class="cmtt-10"> VQ</span><span
10449 class="cmtt-10"> context</span>
10450 <br class="fancyvrb" /><a
10451 id="x1-110104r44"></a><span
10452 class="cmtt-10"> </span><span
10453 class="cmtt-10"> </span><span
10454 class="cmtt-10"> </span><span
10455 class="cmtt-10"> </span><span
10456 class="cmtt-10"> </span><span
10457 class="cmtt-10"> </span><span
10458 class="cmtt-10"> </span><span
10459 class="cmtt-10"> </span><span
10460 class="cmtt-10"> </span><span
10461 class="cmtt-10"> </span><span
10462 class="cmtt-10"> </span><span
10463 class="cmtt-10"> </span><span
10464 class="cmtt-10"> </span><span
10465 class="cmtt-10"> </span><span
10466 class="cmtt-10"> </span><span
10467 class="cmtt-10"> </span><span
10468 class="cmtt-10"> </span><span
10469 class="cmtt-10"> </span><span
10470 class="cmtt-10"> </span><span
10471 class="cmtt-10"> </span><span
10472 class="cmtt-10"> </span><span
10473 class="cmtt-10"> </span><span
10474 class="cmtt-10"> </span><span
10475 class="cmtt-10"> </span><span
10476 class="cmtt-10"> </span><span
10477 class="cmtt-10"> </span><span
10478 class="cmtt-10"> </span><span
10479 class="cmtt-10"> }</span>
10480 <br class="fancyvrb" /><a
10481 id="x1-110106r45"></a><span
10482 class="cmtt-10"> </span><span
10483 class="cmtt-10"> </span><span
10484 class="cmtt-10"> </span><span
10485 class="cmtt-10"> </span><span
10486 class="cmtt-10"> </span><span
10487 class="cmtt-10"> </span><span
10488 class="cmtt-10"> </span><span
10489 class="cmtt-10"> </span><span
10490 class="cmtt-10"> </span><span
10491 class="cmtt-10"> </span><span
10492 class="cmtt-10"> </span><span
10493 class="cmtt-10"> </span><span
10494 class="cmtt-10"> </span><span
10495 class="cmtt-10"> </span><span
10496 class="cmtt-10"> </span><span
10497 class="cmtt-10"> </span><span
10498 class="cmtt-10"> </span><span
10499 class="cmtt-10"> </span><span
10500 class="cmtt-10"> </span><span
10501 class="cmtt-10"> </span><span
10502 class="cmtt-10"> </span><span
10503 class="cmtt-10"> </span><span
10504 class="cmtt-10"> }</span>
10505 <br class="fancyvrb" /><a
10506 id="x1-110108r46"></a><span
10507 class="cmtt-10"> </span><span
10508 class="cmtt-10"> </span>
10509 <br class="fancyvrb" /><a
10510 id="x1-110110r47"></a><span
10511 class="cmtt-10"> </span><span
10512 class="cmtt-10"> </span><span
10513 class="cmtt-10"> </span><span
10514 class="cmtt-10"> </span><span
10515 class="cmtt-10"> </span><span
10516 class="cmtt-10"> </span><span
10517 class="cmtt-10"> </span><span
10518 class="cmtt-10"> </span><span
10519 class="cmtt-10"> </span><span
10520 class="cmtt-10"> </span><span
10521 class="cmtt-10"> </span><span
10522 class="cmtt-10"> </span><span
10523 class="cmtt-10"> </span><span
10524 class="cmtt-10"> </span><span
10525 class="cmtt-10"> </span><span
10526 class="cmtt-10"> </span><span
10527 class="cmtt-10"> </span><span
10528 class="cmtt-10"> </span><span
10529 class="cmtt-10"> 20)</span><span
10530 class="cmtt-10"> increment</span><span
10531 class="cmtt-10"> [partition_count]</span><span
10532 class="cmtt-10"> by</span><span
10533 class="cmtt-10"> one</span>
10534 <br class="fancyvrb" /><a
10535 id="x1-110112r48"></a><span
10536 class="cmtt-10"> </span><span
10537 class="cmtt-10"> </span>
10538 <br class="fancyvrb" /><a
10539 id="x1-110114r49"></a><span
10540 class="cmtt-10"> </span><span
10541 class="cmtt-10"> </span><span
10542 class="cmtt-10"> </span><span
10543 class="cmtt-10"> </span><span
10544 class="cmtt-10"> </span><span
10545 class="cmtt-10"> </span><span
10546 class="cmtt-10"> </span><span
10547 class="cmtt-10"> </span><span
10548 class="cmtt-10"> </span><span
10549 class="cmtt-10"> </span><span
10550 class="cmtt-10"> </span><span
10551 class="cmtt-10"> </span><span
10552 class="cmtt-10"> </span><span
10553 class="cmtt-10"> </span><span
10554 class="cmtt-10"> </span><span
10555 class="cmtt-10"> </span><span
10556 class="cmtt-10"> }</span>
10557 <br class="fancyvrb" /><a
10558 id="x1-110116r50"></a><span
10559 class="cmtt-10"> </span><span
10560 class="cmtt-10"> </span><span
10561 class="cmtt-10"> </span><span
10562 class="cmtt-10"> </span><span
10563 class="cmtt-10"> </span><span
10564 class="cmtt-10"> </span><span
10565 class="cmtt-10"> </span><span
10566 class="cmtt-10"> </span><span
10567 class="cmtt-10"> </span><span
10568 class="cmtt-10"> </span><span
10569 class="cmtt-10"> </span><span
10570 class="cmtt-10"> }</span>
10571 <br class="fancyvrb" /><a
10572 id="x1-110118r51"></a><span
10573 class="cmtt-10"> </span><span
10574 class="cmtt-10"> </span><span
10575 class="cmtt-10"> </span><span
10576 class="cmtt-10"> </span><span
10577 class="cmtt-10"> </span><span
10578 class="cmtt-10"> </span><span
10579 class="cmtt-10"> }</span>
10580 <br class="fancyvrb" /><a
10581 id="x1-110120r52"></a><span
10582 class="cmtt-10"> </span><span
10583 class="cmtt-10"> </span>
10587 <br class="fancyvrb" /><a
10588 id="x1-110122r53"></a><span
10589 class="cmtt-10"> </span><span
10590 class="cmtt-10"> </span><span
10591 class="cmtt-10"> 21)</span><span
10592 class="cmtt-10"> done</span>
10593 <br class="fancyvrb" /><a
10594 id="x1-110124r54"></a><span
10595 class="cmtt-10"> </span><span
10596 class="cmtt-10"> </span>
10598 <!--l. 341--><p class="noindent" >An end-of-packet condition during packet decode is to be considered a nominal occurrence. Decode
10599 returns the result of vector decode up to that point.
10600 <!--l. 347--><p class="noindent" >
10601 <h5 class="subsubsectionHead"><span class="titlemark">8.6.3 </span> <a
10602 id="x1-1110008.6.3"></a>format 0 specifics</h5>
10603 <!--l. 349--><p class="noindent" >Format zero decodes partitions exactly as described earlier in the ’Residue Format: residue 0’
10604 section. The following pseudocode presents the same algorithm. Assume:
10605 <ul class="itemize1">
10606 <li class="itemize"><span
10607 class="cmtt-10x-x-109">[n] </span>is the value in <span
10608 class="cmtt-10x-x-109">[residue_partition_size]</span>
10610 <li class="itemize"><span
10611 class="cmtt-10x-x-109">[v] </span>is the residue vector
10613 <li class="itemize"><span
10614 class="cmtt-10x-x-109">[offset] </span>is the beginning read offset in [v]</li></ul>
10615 <!--l. 360--><p class="noindent" >
10616 <div class="fancyvrb" id="fancyvrb41">
10618 id="x1-111002r1"></a><span
10619 class="cmtt-10"> </span><span
10620 class="cmtt-10"> </span><span
10621 class="cmtt-10"> 1)</span><span
10622 class="cmtt-10"> [step]</span><span
10623 class="cmtt-10"> =</span><span
10624 class="cmtt-10"> [n]</span><span
10625 class="cmtt-10"> /</span><span
10626 class="cmtt-10"> [codebook_dimensions]</span>
10627 <br class="fancyvrb" /><a
10628 id="x1-111004r2"></a><span
10629 class="cmtt-10"> </span><span
10630 class="cmtt-10"> </span><span
10631 class="cmtt-10"> 2)</span><span
10632 class="cmtt-10"> iterate</span><span
10633 class="cmtt-10"> [i]</span><span
10634 class="cmtt-10"> over</span><span
10635 class="cmtt-10"> the</span><span
10636 class="cmtt-10"> range</span><span
10637 class="cmtt-10"> 0</span><span
10638 class="cmtt-10"> ...</span><span
10639 class="cmtt-10"> [step]-1</span><span
10640 class="cmtt-10"> {</span>
10641 <br class="fancyvrb" /><a
10642 id="x1-111006r3"></a><span
10643 class="cmtt-10"> </span><span
10644 class="cmtt-10"> </span>
10645 <br class="fancyvrb" /><a
10646 id="x1-111008r4"></a><span
10647 class="cmtt-10"> </span><span
10648 class="cmtt-10"> </span><span
10649 class="cmtt-10"> </span><span
10650 class="cmtt-10"> </span><span
10651 class="cmtt-10"> </span><span
10652 class="cmtt-10"> </span><span
10653 class="cmtt-10"> </span><span
10654 class="cmtt-10"> 3)</span><span
10655 class="cmtt-10"> vector</span><span
10656 class="cmtt-10"> [entry_temp]</span><span
10657 class="cmtt-10"> =</span><span
10658 class="cmtt-10"> read</span><span
10659 class="cmtt-10"> vector</span><span
10660 class="cmtt-10"> from</span><span
10661 class="cmtt-10"> packet</span><span
10662 class="cmtt-10"> using</span><span
10663 class="cmtt-10"> current</span><span
10664 class="cmtt-10"> codebook</span><span
10665 class="cmtt-10"> in</span><span
10666 class="cmtt-10"> VQ</span><span
10667 class="cmtt-10"> context</span>
10668 <br class="fancyvrb" /><a
10669 id="x1-111010r5"></a><span
10670 class="cmtt-10"> </span><span
10671 class="cmtt-10"> </span><span
10672 class="cmtt-10"> </span><span
10673 class="cmtt-10"> </span><span
10674 class="cmtt-10"> </span><span
10675 class="cmtt-10"> </span><span
10676 class="cmtt-10"> </span><span
10677 class="cmtt-10"> 4)</span><span
10678 class="cmtt-10"> iterate</span><span
10679 class="cmtt-10"> [j]</span><span
10680 class="cmtt-10"> over</span><span
10681 class="cmtt-10"> the</span><span
10682 class="cmtt-10"> range</span><span
10683 class="cmtt-10"> 0</span><span
10684 class="cmtt-10"> ...</span><span
10685 class="cmtt-10"> [codebook_dimensions]-1</span><span
10686 class="cmtt-10"> {</span>
10687 <br class="fancyvrb" /><a
10688 id="x1-111012r6"></a><span
10689 class="cmtt-10"> </span><span
10690 class="cmtt-10"> </span>
10691 <br class="fancyvrb" /><a
10692 id="x1-111014r7"></a><span
10693 class="cmtt-10"> </span><span
10694 class="cmtt-10"> </span><span
10695 class="cmtt-10"> </span><span
10696 class="cmtt-10"> </span><span
10697 class="cmtt-10"> </span><span
10698 class="cmtt-10"> </span><span
10699 class="cmtt-10"> </span><span
10700 class="cmtt-10"> </span><span
10701 class="cmtt-10"> </span><span
10702 class="cmtt-10"> </span><span
10703 class="cmtt-10"> </span><span
10704 class="cmtt-10"> </span><span
10705 class="cmtt-10"> 5)</span><span
10706 class="cmtt-10"> vector</span><span
10707 class="cmtt-10"> [v]</span><span
10708 class="cmtt-10"> element</span><span
10709 class="cmtt-10"> ([offset]+[i]+[j]*[step])</span><span
10710 class="cmtt-10"> =</span>
10711 <br class="fancyvrb" /><a
10712 id="x1-111016r8"></a><span
10713 class="cmtt-10"> </span><span
10714 class="cmtt-10">  </span><span
10715 class="cmtt-10"> </span><span
10716 class="cmtt-10"> </span><span
10717 class="cmtt-10"> </span><span
10718 class="cmtt-10"> </span><span
10719 class="cmtt-10"> </span><span
10720 class="cmtt-10"> </span><span
10721 class="cmtt-10"> </span><span
10722 class="cmtt-10"> vector</span><span
10723 class="cmtt-10"> [v]</span><span
10724 class="cmtt-10"> element</span><span
10725 class="cmtt-10"> ([offset]+[i]+[j]*[step])</span><span
10726 class="cmtt-10"> +</span>
10727 <br class="fancyvrb" /><a
10728 id="x1-111018r9"></a><span
10729 class="cmtt-10"> </span><span
10730 class="cmtt-10"> </span><span
10731 class="cmtt-10"> </span><span
10732 class="cmtt-10"> </span><span
10733 class="cmtt-10"> </span><span
10734 class="cmtt-10"> </span><span
10735 class="cmtt-10"> </span><span
10736 class="cmtt-10"> </span><span
10737 class="cmtt-10"> </span><span
10738 class="cmtt-10"> </span><span
10739 class="cmtt-10"> </span><span
10740 class="cmtt-10"> </span><span
10741 class="cmtt-10"> </span><span
10742 class="cmtt-10"> </span><span
10743 class="cmtt-10"> </span><span
10744 class="cmtt-10"> </span><span
10745 class="cmtt-10"> </span><span
10746 class="cmtt-10"> vector</span><span
10747 class="cmtt-10"> [entry_temp]</span><span
10748 class="cmtt-10"> element</span><span
10749 class="cmtt-10"> [j]</span>
10750 <br class="fancyvrb" /><a
10751 id="x1-111020r10"></a><span
10752 class="cmtt-10"> </span><span
10753 class="cmtt-10"> </span>
10754 <br class="fancyvrb" /><a
10755 id="x1-111022r11"></a><span
10756 class="cmtt-10"> </span><span
10757 class="cmtt-10"> </span><span
10758 class="cmtt-10"> </span><span
10759 class="cmtt-10"> </span><span
10760 class="cmtt-10"> </span><span
10761 class="cmtt-10"> </span><span
10762 class="cmtt-10"> </span><span
10763 class="cmtt-10"> </span><span
10764 class="cmtt-10"> </span><span
10765 class="cmtt-10"> </span><span
10766 class="cmtt-10"> }</span>
10767 <br class="fancyvrb" /><a
10768 id="x1-111024r12"></a><span
10769 class="cmtt-10"> </span><span
10770 class="cmtt-10"> </span>
10771 <br class="fancyvrb" /><a
10772 id="x1-111026r13"></a><span
10773 class="cmtt-10"> </span><span
10774 class="cmtt-10"> </span><span
10775 class="cmtt-10"> </span><span
10776 class="cmtt-10"> </span><span
10777 class="cmtt-10"> </span><span
10778 class="cmtt-10"> }</span>
10779 <br class="fancyvrb" /><a
10780 id="x1-111028r14"></a><span
10781 class="cmtt-10"> </span><span
10782 class="cmtt-10"> </span>
10783 <br class="fancyvrb" /><a
10784 id="x1-111030r15"></a><span
10785 class="cmtt-10"> </span><span
10786 class="cmtt-10"> </span><span
10787 class="cmtt-10"> </span><span
10788 class="cmtt-10"> 6)</span><span
10789 class="cmtt-10"> done</span>
10790 <br class="fancyvrb" /><a
10791 id="x1-111032r16"></a><span
10792 class="cmtt-10"> </span><span
10793 class="cmtt-10"> </span>
10798 <!--l. 381--><p class="noindent" >
10799 <h5 class="subsubsectionHead"><span class="titlemark">8.6.4 </span> <a
10800 id="x1-1120008.6.4"></a>format 1 specifics</h5>
10801 <!--l. 383--><p class="noindent" >Format 1 decodes partitions exactly as described earlier in the ’Residue Format: residue 1’ section.
10802 The following pseudocode presents the same algorithm. Assume:
10803 <ul class="itemize1">
10804 <li class="itemize"><span
10805 class="cmtt-10x-x-109">[n] </span>is the value in <span
10806 class="cmtt-10x-x-109">[residue_partition_size]</span>
10808 <li class="itemize"><span
10809 class="cmtt-10x-x-109">[v] </span>is the residue vector
10811 <li class="itemize"><span
10812 class="cmtt-10x-x-109">[offset] </span>is the beginning read offset in [v]</li></ul>
10813 <!--l. 395--><p class="noindent" >
10814 <div class="fancyvrb" id="fancyvrb42">
10816 id="x1-112002r1"></a><span
10817 class="cmtt-10"> </span><span
10818 class="cmtt-10"> </span><span
10819 class="cmtt-10"> 1)</span><span
10820 class="cmtt-10"> [i]</span><span
10821 class="cmtt-10"> =</span><span
10822 class="cmtt-10"> 0</span>
10823 <br class="fancyvrb" /><a
10824 id="x1-112004r2"></a><span
10825 class="cmtt-10"> </span><span
10826 class="cmtt-10"> </span><span
10827 class="cmtt-10"> 2)</span><span
10828 class="cmtt-10"> vector</span><span
10829 class="cmtt-10"> [entry_temp]</span><span
10830 class="cmtt-10"> =</span><span
10831 class="cmtt-10"> read</span><span
10832 class="cmtt-10"> vector</span><span
10833 class="cmtt-10"> from</span><span
10834 class="cmtt-10"> packet</span><span
10835 class="cmtt-10"> using</span><span
10836 class="cmtt-10"> current</span><span
10837 class="cmtt-10"> codebook</span><span
10838 class="cmtt-10"> in</span><span
10839 class="cmtt-10"> VQ</span><span
10840 class="cmtt-10"> context</span>
10841 <br class="fancyvrb" /><a
10842 id="x1-112006r3"></a><span
10843 class="cmtt-10"> </span><span
10844 class="cmtt-10"> </span><span
10845 class="cmtt-10"> 3)</span><span
10846 class="cmtt-10"> iterate</span><span
10847 class="cmtt-10"> [j]</span><span
10848 class="cmtt-10"> over</span><span
10849 class="cmtt-10"> the</span><span
10850 class="cmtt-10"> range</span><span
10851 class="cmtt-10"> 0</span><span
10852 class="cmtt-10"> ...</span><span
10853 class="cmtt-10"> [codebook_dimensions]-1</span><span
10854 class="cmtt-10"> {</span>
10855 <br class="fancyvrb" /><a
10856 id="x1-112008r4"></a><span
10857 class="cmtt-10"> </span><span
10858 class="cmtt-10"> </span>
10859 <br class="fancyvrb" /><a
10860 id="x1-112010r5"></a><span
10861 class="cmtt-10"> </span><span
10862 class="cmtt-10"> </span><span
10863 class="cmtt-10"> </span><span
10864 class="cmtt-10"> </span><span
10865 class="cmtt-10"> </span><span
10866 class="cmtt-10"> </span><span
10867 class="cmtt-10"> </span><span
10868 class="cmtt-10"> 4)</span><span
10869 class="cmtt-10"> vector</span><span
10870 class="cmtt-10"> [v]</span><span
10871 class="cmtt-10"> element</span><span
10872 class="cmtt-10"> ([offset]+[i])</span><span
10873 class="cmtt-10"> =</span>
10874 <br class="fancyvrb" /><a
10875 id="x1-112012r6"></a><span
10876 class="cmtt-10"> </span><span
10877 class="cmtt-10">  </span><span
10878 class="cmtt-10"> </span><span
10879 class="cmtt-10"> vector</span><span
10880 class="cmtt-10"> [v]</span><span
10881 class="cmtt-10"> element</span><span
10882 class="cmtt-10"> ([offset]+[i])</span><span
10883 class="cmtt-10"> +</span>
10884 <br class="fancyvrb" /><a
10885 id="x1-112014r7"></a><span
10886 class="cmtt-10"> </span><span
10887 class="cmtt-10"> </span><span
10888 class="cmtt-10"> </span><span
10889 class="cmtt-10"> </span><span
10890 class="cmtt-10"> </span><span
10891 class="cmtt-10"> </span><span
10892 class="cmtt-10"> </span><span
10893 class="cmtt-10"> </span><span
10894 class="cmtt-10"> </span><span
10895 class="cmtt-10"> </span><span
10896 class="cmtt-10"> </span><span
10897 class="cmtt-10"> vector</span><span
10898 class="cmtt-10"> [entry_temp]</span><span
10899 class="cmtt-10"> element</span><span
10900 class="cmtt-10"> [j]</span>
10901 <br class="fancyvrb" /><a
10902 id="x1-112016r8"></a><span
10903 class="cmtt-10"> </span><span
10904 class="cmtt-10"> </span><span
10905 class="cmtt-10"> </span><span
10906 class="cmtt-10"> </span><span
10907 class="cmtt-10"> </span><span
10908 class="cmtt-10"> </span><span
10909 class="cmtt-10"> </span><span
10910 class="cmtt-10"> 5)</span><span
10911 class="cmtt-10"> increment</span><span
10912 class="cmtt-10"> [i]</span>
10913 <br class="fancyvrb" /><a
10914 id="x1-112018r9"></a><span
10915 class="cmtt-10"> </span><span
10916 class="cmtt-10"> </span>
10917 <br class="fancyvrb" /><a
10918 id="x1-112020r10"></a><span
10919 class="cmtt-10"> </span><span
10920 class="cmtt-10"> </span><span
10921 class="cmtt-10"> </span><span
10922 class="cmtt-10"> </span><span
10923 class="cmtt-10"> </span><span
10924 class="cmtt-10"> }</span>
10925 <br class="fancyvrb" /><a
10926 id="x1-112022r11"></a><span
10927 class="cmtt-10"> </span><span
10928 class="cmtt-10"> </span>
10929 <br class="fancyvrb" /><a
10930 id="x1-112024r12"></a><span
10931 class="cmtt-10"> </span><span
10932 class="cmtt-10"> </span><span
10933 class="cmtt-10"> </span><span
10934 class="cmtt-10"> 6)</span><span
10935 class="cmtt-10"> if</span><span
10936 class="cmtt-10"> (</span><span
10937 class="cmtt-10"> [i]</span><span
10938 class="cmtt-10"> is</span><span
10939 class="cmtt-10"> less</span><span
10940 class="cmtt-10"> than</span><span
10941 class="cmtt-10"> [n]</span><span
10942 class="cmtt-10"> )</span><span
10943 class="cmtt-10"> continue</span><span
10944 class="cmtt-10"> at</span><span
10945 class="cmtt-10"> step</span><span
10946 class="cmtt-10"> 2</span>
10947 <br class="fancyvrb" /><a
10948 id="x1-112026r13"></a><span
10949 class="cmtt-10"> </span><span
10950 class="cmtt-10"> </span><span
10951 class="cmtt-10"> </span><span
10952 class="cmtt-10"> 7)</span><span
10953 class="cmtt-10"> done</span>
10955 <!--l. 413--><p class="noindent" >
10956 <h5 class="subsubsectionHead"><span class="titlemark">8.6.5 </span> <a
10957 id="x1-1130008.6.5"></a>format 2 specifics</h5>
10958 <!--l. 415--><p class="noindent" >Format 2 is reducible to format 1. It may be implemented as an additional step prior to and an
10959 additional post-decode step after a normal format 1 decode.
10960 <!--l. 418--><p class="noindent" >Format 2 handles ’do not decode’ vectors differently than residue 0 or 1; if all vectors
10961 are marked ’do not decode’, no decode occurrs. However, if at least one vector is to be
10962 decoded, all the vectors are decoded. We then request normal format 1 to decode a single
10963 vector representing all output channels, rather than a vector for each channel. After
10964 decode, deinterleave the vector into independent vectors, one for each output channel. That
10969 <!--l. 426--><p class="noindent" >
10970 <ol class="enumerate1" >
10972 class="enumerate" id="x1-113002x1">If all vectors 0 through <span
10973 class="cmti-10x-x-109">ch</span>-1 are marked ’do not decode’, allocate and clear a single
10975 class="cmtt-10x-x-109">[v]</span>of length <span
10976 class="cmti-10x-x-109">ch*n </span>and skip step 2 below; proceed directly to the post-decode
10980 class="enumerate" id="x1-113004x2">Rather than performing format 1 decode to produce <span
10981 class="cmti-10x-x-109">ch </span>vectors of length <span
10982 class="cmti-10x-x-109">n </span>each, call
10983 format 1 decode to produce a single vector <span
10984 class="cmtt-10x-x-109">[v] </span>of length <span
10985 class="cmti-10x-x-109">ch*n</span>.
10988 class="enumerate" id="x1-113006x3">Post decode: Deinterleave the single vector <span
10989 class="cmtt-10x-x-109">[v] </span>returned by format 1 decode as
10990 described above into <span
10991 class="cmti-10x-x-109">ch </span>independent vectors, one for each outputchannel, according
10993 <div class="fancyvrb" id="fancyvrb43">
10995 id="x1-113008r1"></a><span
10996 class="cmtt-10"> </span><span
10997 class="cmtt-10"> </span><span
10998 class="cmtt-10"> </span><span
10999 class="cmtt-10"> 1)</span><span
11000 class="cmtt-10"> iterate</span><span
11001 class="cmtt-10"> [i]</span><span
11002 class="cmtt-10"> over</span><span
11003 class="cmtt-10"> the</span><span
11004 class="cmtt-10"> range</span><span
11005 class="cmtt-10"> 0</span><span
11006 class="cmtt-10"> ...</span><span
11007 class="cmtt-10"> [n]-1</span><span
11008 class="cmtt-10"> {</span>
11009 <br class="fancyvrb" /><a
11010 id="x1-113010r2"></a><span
11011 class="cmtt-10"> </span><span
11012 class="cmtt-10"> </span>
11013 <br class="fancyvrb" /><a
11014 id="x1-113012r3"></a><span
11015 class="cmtt-10"> </span><span
11016 class="cmtt-10"> </span><span
11017 class="cmtt-10"> </span><span
11018 class="cmtt-10"> </span><span
11019 class="cmtt-10"> </span><span
11020 class="cmtt-10"> </span><span
11021 class="cmtt-10"> </span><span
11022 class="cmtt-10"> </span><span
11023 class="cmtt-10"> 2)</span><span
11024 class="cmtt-10"> iterate</span><span
11025 class="cmtt-10"> [j]</span><span
11026 class="cmtt-10"> over</span><span
11027 class="cmtt-10"> the</span><span
11028 class="cmtt-10"> range</span><span
11029 class="cmtt-10"> 0</span><span
11030 class="cmtt-10"> ...</span><span
11031 class="cmtt-10"> [ch]-1</span><span
11032 class="cmtt-10"> {</span>
11033 <br class="fancyvrb" /><a
11034 id="x1-113014r4"></a><span
11035 class="cmtt-10"> </span><span
11036 class="cmtt-10"> </span>
11037 <br class="fancyvrb" /><a
11038 id="x1-113016r5"></a><span
11039 class="cmtt-10"> </span><span
11040 class="cmtt-10"> </span><span
11041 class="cmtt-10"> </span><span
11042 class="cmtt-10"> </span><span
11043 class="cmtt-10"> </span><span
11044 class="cmtt-10"> </span><span
11045 class="cmtt-10"> </span><span
11046 class="cmtt-10"> </span><span
11047 class="cmtt-10"> </span><span
11048 class="cmtt-10"> </span><span
11049 class="cmtt-10"> </span><span
11050 class="cmtt-10"> </span><span
11051 class="cmtt-10"> </span><span
11052 class="cmtt-10"> 3)</span><span
11053 class="cmtt-10"> output</span><span
11054 class="cmtt-10"> vector</span><span
11055 class="cmtt-10"> number</span><span
11056 class="cmtt-10"> [j]</span><span
11057 class="cmtt-10"> element</span><span
11058 class="cmtt-10"> [i]</span><span
11059 class="cmtt-10"> =</span><span
11060 class="cmtt-10"> vector</span><span
11061 class="cmtt-10"> [v]</span><span
11062 class="cmtt-10"> element</span><span
11063 class="cmtt-10"> ([i]</span><span
11064 class="cmtt-10"> *</span><span
11065 class="cmtt-10"> [ch]</span><span
11066 class="cmtt-10"> +</span><span
11067 class="cmtt-10"> [j])</span>
11068 <br class="fancyvrb" /><a
11069 id="x1-113018r6"></a><span
11070 class="cmtt-10"> </span><span
11071 class="cmtt-10"> </span>
11072 <br class="fancyvrb" /><a
11073 id="x1-113020r7"></a><span
11074 class="cmtt-10"> </span><span
11075 class="cmtt-10"> </span><span
11076 class="cmtt-10"> </span><span
11077 class="cmtt-10"> </span><span
11078 class="cmtt-10"> </span><span
11079 class="cmtt-10"> </span><span
11080 class="cmtt-10"> </span><span
11081 class="cmtt-10"> </span><span
11082 class="cmtt-10"> </span><span
11083 class="cmtt-10"> </span><span
11084 class="cmtt-10"> </span><span
11085 class="cmtt-10"> }</span>
11086 <br class="fancyvrb" /><a
11087 id="x1-113022r8"></a><span
11088 class="cmtt-10"> </span><span
11089 class="cmtt-10"> </span><span
11090 class="cmtt-10"> </span><span
11091 class="cmtt-10"> </span><span
11092 class="cmtt-10"> </span><span
11093 class="cmtt-10"> </span><span
11094 class="cmtt-10"> }</span>
11095 <br class="fancyvrb" /><a
11096 id="x1-113024r9"></a><span
11097 class="cmtt-10"> </span><span
11098 class="cmtt-10"> </span>
11099 <br class="fancyvrb" /><a
11100 id="x1-113026r10"></a><span
11101 class="cmtt-10"> </span><span
11102 class="cmtt-10"> </span><span
11103 class="cmtt-10"> </span><span
11104 class="cmtt-10"> 4)</span><span
11105 class="cmtt-10"> done</span>
11114 <h3 class="sectionHead"><span class="titlemark">9 </span> <a
11115 id="x1-1140009"></a>Helper equations</h3>
11116 <!--l. 6--><p class="noindent" >
11117 <h4 class="subsectionHead"><span class="titlemark">9.1 </span> <a
11118 id="x1-1150009.1"></a>Overview</h4>
11119 <!--l. 8--><p class="noindent" >The equations below are used in multiple places by the Vorbis codec specification. Rather than
11120 cluttering up the main specification documents, they are defined here and referenced where
11122 <!--l. 13--><p class="noindent" >
11123 <h4 class="subsectionHead"><span class="titlemark">9.2 </span> <a
11124 id="x1-1160009.2"></a>Functions</h4>
11125 <!--l. 15--><p class="noindent" >
11126 <h5 class="subsubsectionHead"><span class="titlemark">9.2.1 </span> <a
11127 id="x1-1170009.2.1"></a>ilog</h5>
11128 <!--l. 17--><p class="noindent" >The ”ilog(x)” function returns the position number (1 through n) of the highest set bit in the
11129 two’s complement integer value <span
11130 class="cmtt-10x-x-109">[x]</span>. Values of <span
11131 class="cmtt-10x-x-109">[x] </span>less than zero are defined to return
11133 <!--l. 20--><p class="noindent" >
11134 <div class="fancyvrb" id="fancyvrb44">
11136 id="x1-117002r1"></a><span
11137 class="cmtt-10"> </span><span
11138 class="cmtt-10"> </span><span
11139 class="cmtt-10"> </span><span
11140 class="cmtt-10"> 1)</span><span
11141 class="cmtt-10"> [return_value]</span><span
11142 class="cmtt-10"> =</span><span
11143 class="cmtt-10"> 0;</span>
11144 <br class="fancyvrb" /><a
11145 id="x1-117004r2"></a><span
11146 class="cmtt-10"> </span><span
11147 class="cmtt-10"> </span><span
11148 class="cmtt-10"> </span><span
11149 class="cmtt-10"> 2)</span><span
11150 class="cmtt-10"> if</span><span
11151 class="cmtt-10"> (</span><span
11152 class="cmtt-10"> [x]</span><span
11153 class="cmtt-10"> is</span><span
11154 class="cmtt-10"> greater</span><span
11155 class="cmtt-10"> than</span><span
11156 class="cmtt-10"> zero</span><span
11157 class="cmtt-10"> )</span><span
11158 class="cmtt-10"> {</span>
11159 <br class="fancyvrb" /><a
11160 id="x1-117006r3"></a><span
11161 class="cmtt-10"> </span><span
11162 class="cmtt-10"> </span>
11163 <br class="fancyvrb" /><a
11164 id="x1-117008r4"></a><span
11165 class="cmtt-10"> </span><span
11166 class="cmtt-10"> </span><span
11167 class="cmtt-10"> </span><span
11168 class="cmtt-10"> </span><span
11169 class="cmtt-10"> </span><span
11170 class="cmtt-10"> </span><span
11171 class="cmtt-10"> </span><span
11172 class="cmtt-10"> </span><span
11173 class="cmtt-10"> 3)</span><span
11174 class="cmtt-10"> increment</span><span
11175 class="cmtt-10"> [return_value];</span>
11176 <br class="fancyvrb" /><a
11177 id="x1-117010r5"></a><span
11178 class="cmtt-10"> </span><span
11179 class="cmtt-10"> </span><span
11180 class="cmtt-10"> </span><span
11181 class="cmtt-10"> </span><span
11182 class="cmtt-10"> </span><span
11183 class="cmtt-10"> </span><span
11184 class="cmtt-10"> </span><span
11185 class="cmtt-10"> </span><span
11186 class="cmtt-10"> 4)</span><span
11187 class="cmtt-10"> logical</span><span
11188 class="cmtt-10"> shift</span><span
11189 class="cmtt-10"> [x]</span><span
11190 class="cmtt-10"> one</span><span
11191 class="cmtt-10"> bit</span><span
11192 class="cmtt-10"> to</span><span
11193 class="cmtt-10"> the</span><span
11194 class="cmtt-10"> right,</span><span
11195 class="cmtt-10"> padding</span><span
11196 class="cmtt-10"> the</span><span
11197 class="cmtt-10"> MSb</span><span
11198 class="cmtt-10"> with</span><span
11199 class="cmtt-10"> zero</span>
11200 <br class="fancyvrb" /><a
11201 id="x1-117012r6"></a><span
11202 class="cmtt-10"> </span><span
11203 class="cmtt-10"> </span><span
11204 class="cmtt-10"> </span><span
11205 class="cmtt-10"> </span><span
11206 class="cmtt-10"> </span><span
11207 class="cmtt-10"> </span><span
11208 class="cmtt-10"> </span><span
11209 class="cmtt-10"> </span><span
11210 class="cmtt-10"> 5)</span><span
11211 class="cmtt-10"> repeat</span><span
11212 class="cmtt-10"> at</span><span
11213 class="cmtt-10"> step</span><span
11214 class="cmtt-10"> 2)</span>
11215 <br class="fancyvrb" /><a
11216 id="x1-117014r7"></a><span
11217 class="cmtt-10"> </span><span
11218 class="cmtt-10"> </span>
11219 <br class="fancyvrb" /><a
11220 id="x1-117016r8"></a><span
11221 class="cmtt-10"> </span><span
11222 class="cmtt-10"> </span><span
11223 class="cmtt-10"> </span><span
11224 class="cmtt-10"> </span><span
11225 class="cmtt-10"> </span><span
11226 class="cmtt-10"> </span><span
11227 class="cmtt-10"> }</span>
11228 <br class="fancyvrb" /><a
11229 id="x1-117018r9"></a><span
11230 class="cmtt-10"> </span><span
11231 class="cmtt-10"> </span>
11232 <br class="fancyvrb" /><a
11233 id="x1-117020r10"></a><span
11234 class="cmtt-10"> </span><span
11235 class="cmtt-10"> </span><span
11236 class="cmtt-10"> </span><span
11237 class="cmtt-10"> </span><span
11238 class="cmtt-10"> 6)</span><span
11239 class="cmtt-10"> done</span>
11241 <!--l. 33--><p class="noindent" >Examples:
11245 <ul class="itemize1">
11246 <li class="itemize">ilog(0) = 0;
11248 <li class="itemize">ilog(1) = 1;
11250 <li class="itemize">ilog(2) = 2;
11252 <li class="itemize">ilog(3) = 2;
11254 <li class="itemize">ilog(4) = 3;
11256 <li class="itemize">ilog(7) = 3;
11258 <li class="itemize">ilog(negative number) = 0;</li></ul>
11259 <!--l. 48--><p class="noindent" >
11260 <h5 class="subsubsectionHead"><span class="titlemark">9.2.2 </span> <a
11261 id="x1-1180009.2.2"></a>float32˙unpack</h5>
11262 <!--l. 50--><p class="noindent" >”float32˙unpack(x)” is intended to translate the packed binary representation of a Vorbis codebook
11263 float value into the representation used by the decoder for floating point numbers. For
11264 purposes of this example, we will unpack a Vorbis float32 into a host-native floating point
11266 <!--l. 56--><p class="noindent" >
11267 <div class="fancyvrb" id="fancyvrb45">
11269 id="x1-118002r1"></a><span
11270 class="cmtt-10"> </span><span
11271 class="cmtt-10"> </span><span
11272 class="cmtt-10"> </span><span
11273 class="cmtt-10"> 1)</span><span
11274 class="cmtt-10"> [mantissa]</span><span
11275 class="cmtt-10"> =</span><span
11276 class="cmtt-10"> [x]</span><span
11277 class="cmtt-10"> bitwise</span><span
11278 class="cmtt-10"> AND</span><span
11279 class="cmtt-10"> 0x1fffff</span><span
11280 class="cmtt-10"> (unsigned</span><span
11281 class="cmtt-10"> result)</span>
11282 <br class="fancyvrb" /><a
11283 id="x1-118004r2"></a><span
11284 class="cmtt-10"> </span><span
11285 class="cmtt-10"> </span><span
11286 class="cmtt-10"> </span><span
11287 class="cmtt-10"> 2)</span><span
11288 class="cmtt-10"> [sign]</span><span
11289 class="cmtt-10"> =</span><span
11290 class="cmtt-10"> [x]</span><span
11291 class="cmtt-10"> bitwise</span><span
11292 class="cmtt-10"> AND</span><span
11293 class="cmtt-10"> 0x80000000</span><span
11294 class="cmtt-10"> (unsigned</span><span
11295 class="cmtt-10"> result)</span>
11296 <br class="fancyvrb" /><a
11297 id="x1-118006r3"></a><span
11298 class="cmtt-10"> </span><span
11299 class="cmtt-10"> </span><span
11300 class="cmtt-10"> </span><span
11301 class="cmtt-10"> 3)</span><span
11302 class="cmtt-10"> [exponent]</span><span
11303 class="cmtt-10"> =</span><span
11304 class="cmtt-10"> (</span><span
11305 class="cmtt-10"> [x]</span><span
11306 class="cmtt-10"> bitwise</span><span
11307 class="cmtt-10"> AND</span><span
11308 class="cmtt-10"> 0x7fe00000)</span><span
11309 class="cmtt-10"> shifted</span><span
11310 class="cmtt-10"> right</span><span
11311 class="cmtt-10"> 21</span><span
11312 class="cmtt-10"> bits</span><span
11313 class="cmtt-10"> (unsigned</span><span
11314 class="cmtt-10"> result)</span>
11315 <br class="fancyvrb" /><a
11316 id="x1-118008r4"></a><span
11317 class="cmtt-10"> </span><span
11318 class="cmtt-10"> </span><span
11319 class="cmtt-10"> </span><span
11320 class="cmtt-10"> 4)</span><span
11321 class="cmtt-10"> if</span><span
11322 class="cmtt-10"> (</span><span
11323 class="cmtt-10"> [sign]</span><span
11324 class="cmtt-10"> is</span><span
11325 class="cmtt-10"> nonzero</span><span
11326 class="cmtt-10"> )</span><span
11327 class="cmtt-10"> then</span><span
11328 class="cmtt-10"> negate</span><span
11329 class="cmtt-10"> [mantissa]</span>
11330 <br class="fancyvrb" /><a
11331 id="x1-118010r5"></a><span
11332 class="cmtt-10"> </span><span
11333 class="cmtt-10"> </span><span
11334 class="cmtt-10"> </span><span
11335 class="cmtt-10"> 5)</span><span
11336 class="cmtt-10"> return</span><span
11337 class="cmtt-10"> [mantissa]</span><span
11338 class="cmtt-10"> *</span><span
11339 class="cmtt-10"> (</span><span
11340 class="cmtt-10"> 2</span><span
11341 class="cmtt-10"> ^</span><span
11342 class="cmtt-10"> (</span><span
11343 class="cmtt-10"> [exponent]</span><span
11344 class="cmtt-10"> -</span><span
11345 class="cmtt-10"> 788</span><span
11346 class="cmtt-10"> )</span><span
11347 class="cmtt-10"> )</span>
11349 <!--l. 66--><p class="noindent" >
11350 <h5 class="subsubsectionHead"><span class="titlemark">9.2.3 </span> <a
11351 id="x1-1190009.2.3"></a>lookup1˙values</h5>
11352 <!--l. 68--><p class="noindent" >”lookup1˙values(codebook˙entries,codebook˙dimensions)” is used to compute the correct length of
11353 the value index for a codebook VQ lookup table of lookup type 1. The values on this list are
11357 permuted to construct the VQ vector lookup table of size <span
11358 class="cmtt-10x-x-109">[codebook_entries]</span>.
11359 <!--l. 74--><p class="noindent" >The return value for this function is defined to be ’the greatest integer value for which
11361 class="cmtt-10x-x-109">[return_value] </span>to the power of <span
11362 class="cmtt-10x-x-109">[codebook_dimensions] </span>is less than or equal to
11364 class="cmtt-10x-x-109">[codebook_entries]</span>’.
11365 <!--l. 81--><p class="noindent" >
11366 <h5 class="subsubsectionHead"><span class="titlemark">9.2.4 </span> <a
11367 id="x1-1200009.2.4"></a>low˙neighbor</h5>
11368 <!--l. 83--><p class="noindent" >”low˙neighbor(v,x)” finds the position <span
11369 class="cmtt-10x-x-109">n </span>in vector <span
11370 class="cmtt-10x-x-109">[v] </span>of the greatest value scalar element
11372 class="cmtt-10x-x-109">n </span>is less than <span
11373 class="cmtt-10x-x-109">[x] </span>and vector <span
11374 class="cmtt-10x-x-109">[v] </span>element <span
11375 class="cmtt-10x-x-109">n </span>is less than vector <span
11376 class="cmtt-10x-x-109">[v] </span>element
11378 class="cmtt-10x-x-109">[x]</span>.
11379 <!--l. 88--><p class="noindent" >
11380 <h5 class="subsubsectionHead"><span class="titlemark">9.2.5 </span> <a
11381 id="x1-1210009.2.5"></a>high˙neighbor</h5>
11382 <!--l. 90--><p class="noindent" >”high˙neighbor(v,x)” finds the position <span
11383 class="cmtt-10x-x-109">n </span>in vector [v] of the lowest value scalar element for
11385 class="cmtt-10x-x-109">n </span>is less than <span
11386 class="cmtt-10x-x-109">[x] </span>and vector <span
11387 class="cmtt-10x-x-109">[v] </span>element <span
11388 class="cmtt-10x-x-109">n </span>is greater than vector <span
11389 class="cmtt-10x-x-109">[v] </span>element
11391 class="cmtt-10x-x-109">[x]</span>.
11392 <!--l. 97--><p class="noindent" >
11393 <h5 class="subsubsectionHead"><span class="titlemark">9.2.6 </span> <a
11394 id="x1-1220009.2.6"></a>render˙point</h5>
11395 <!--l. 99--><p class="noindent" >”render˙point(x0,y0,x1,y1,X)” is used to find the Y value at point X along the line specified by x0,
11396 x1, y0 and y1. This function uses an integer algorithm to solve for the point directly without
11397 calculating intervening values along the line.
11398 <!--l. 104--><p class="noindent" >
11399 <div class="fancyvrb" id="fancyvrb46">
11401 id="x1-122002r1"></a><span
11402 class="cmtt-10"> </span><span
11403 class="cmtt-10"> </span><span
11404 class="cmtt-10"> </span><span
11405 class="cmtt-10"> 1)</span><span
11406 class="cmtt-10"> </span><span
11407 class="cmtt-10"> [dy]</span><span
11408 class="cmtt-10"> =</span><span
11409 class="cmtt-10"> [y1]</span><span
11410 class="cmtt-10"> -</span><span
11411 class="cmtt-10"> [y0]</span>
11412 <br class="fancyvrb" /><a
11413 id="x1-122004r2"></a><span
11414 class="cmtt-10"> </span><span
11415 class="cmtt-10"> </span><span
11416 class="cmtt-10"> </span><span
11417 class="cmtt-10"> 2)</span><span
11418 class="cmtt-10"> [adx]</span><span
11419 class="cmtt-10"> =</span><span
11420 class="cmtt-10"> [x1]</span><span
11421 class="cmtt-10"> -</span><span
11422 class="cmtt-10"> [x0]</span>
11423 <br class="fancyvrb" /><a
11424 id="x1-122006r3"></a><span
11425 class="cmtt-10"> </span><span
11426 class="cmtt-10"> </span><span
11427 class="cmtt-10"> </span><span
11428 class="cmtt-10"> 3)</span><span
11429 class="cmtt-10"> [ady]</span><span
11430 class="cmtt-10"> =</span><span
11431 class="cmtt-10"> absolute</span><span
11432 class="cmtt-10"> value</span><span
11433 class="cmtt-10"> of</span><span
11434 class="cmtt-10"> [dy]</span>
11435 <br class="fancyvrb" /><a
11436 id="x1-122008r4"></a><span
11437 class="cmtt-10"> </span><span
11438 class="cmtt-10"> </span><span
11439 class="cmtt-10"> </span><span
11440 class="cmtt-10"> 4)</span><span
11441 class="cmtt-10"> [err]</span><span
11442 class="cmtt-10"> =</span><span
11443 class="cmtt-10"> [ady]</span><span
11444 class="cmtt-10"> *</span><span
11445 class="cmtt-10"> ([X]</span><span
11446 class="cmtt-10"> -</span><span
11447 class="cmtt-10"> [x0])</span>
11448 <br class="fancyvrb" /><a
11449 id="x1-122010r5"></a><span
11450 class="cmtt-10"> </span><span
11451 class="cmtt-10"> </span><span
11452 class="cmtt-10"> </span><span
11453 class="cmtt-10"> 5)</span><span
11454 class="cmtt-10"> [off]</span><span
11455 class="cmtt-10"> =</span><span
11456 class="cmtt-10"> [err]</span><span
11457 class="cmtt-10"> /</span><span
11458 class="cmtt-10"> [adx]</span><span
11459 class="cmtt-10"> using</span><span
11460 class="cmtt-10"> integer</span><span
11461 class="cmtt-10"> division</span>
11462 <br class="fancyvrb" /><a
11463 id="x1-122012r6"></a><span
11464 class="cmtt-10"> </span><span
11465 class="cmtt-10"> </span><span
11466 class="cmtt-10"> </span><span
11467 class="cmtt-10"> 6)</span><span
11468 class="cmtt-10"> if</span><span
11469 class="cmtt-10"> (</span><span
11470 class="cmtt-10"> [dy]</span><span
11471 class="cmtt-10"> is</span><span
11472 class="cmtt-10"> less</span><span
11473 class="cmtt-10"> than</span><span
11474 class="cmtt-10"> zero</span><span
11475 class="cmtt-10"> )</span><span
11476 class="cmtt-10"> {</span>
11477 <br class="fancyvrb" /><a
11478 id="x1-122014r7"></a><span
11479 class="cmtt-10"> </span><span
11480 class="cmtt-10"> </span>
11481 <br class="fancyvrb" /><a
11482 id="x1-122016r8"></a><span
11483 class="cmtt-10"> </span><span
11484 class="cmtt-10"> </span><span
11485 class="cmtt-10"> </span><span
11486 class="cmtt-10"> </span><span
11487 class="cmtt-10"> </span><span
11488 class="cmtt-10"> </span><span
11489 class="cmtt-10"> </span><span
11490 class="cmtt-10"> </span><span
11491 class="cmtt-10"> 7)</span><span
11492 class="cmtt-10"> [Y]</span><span
11493 class="cmtt-10"> =</span><span
11494 class="cmtt-10"> [y0]</span><span
11495 class="cmtt-10"> -</span><span
11496 class="cmtt-10"> [off]</span>
11497 <br class="fancyvrb" /><a
11498 id="x1-122018r9"></a><span
11499 class="cmtt-10"> </span><span
11500 class="cmtt-10"> </span>
11504 <br class="fancyvrb" /><a
11505 id="x1-122020r10"></a><span
11506 class="cmtt-10"> </span><span
11507 class="cmtt-10"> </span><span
11508 class="cmtt-10"> </span><span
11509 class="cmtt-10"> </span><span
11510 class="cmtt-10"> </span><span
11511 class="cmtt-10"> </span><span
11512 class="cmtt-10"> }</span><span
11513 class="cmtt-10"> else</span><span
11514 class="cmtt-10"> {</span>
11515 <br class="fancyvrb" /><a
11516 id="x1-122022r11"></a><span
11517 class="cmtt-10"> </span><span
11518 class="cmtt-10"> </span>
11519 <br class="fancyvrb" /><a
11520 id="x1-122024r12"></a><span
11521 class="cmtt-10"> </span><span
11522 class="cmtt-10"> </span><span
11523 class="cmtt-10"> </span><span
11524 class="cmtt-10"> </span><span
11525 class="cmtt-10"> </span><span
11526 class="cmtt-10"> </span><span
11527 class="cmtt-10"> </span><span
11528 class="cmtt-10"> </span><span
11529 class="cmtt-10"> 8)</span><span
11530 class="cmtt-10"> [Y]</span><span
11531 class="cmtt-10"> =</span><span
11532 class="cmtt-10"> [y0]</span><span
11533 class="cmtt-10"> +</span><span
11534 class="cmtt-10"> [off]</span>
11535 <br class="fancyvrb" /><a
11536 id="x1-122026r13"></a><span
11537 class="cmtt-10"> </span><span
11538 class="cmtt-10"> </span>
11539 <br class="fancyvrb" /><a
11540 id="x1-122028r14"></a><span
11541 class="cmtt-10"> </span><span
11542 class="cmtt-10"> </span><span
11543 class="cmtt-10"> </span><span
11544 class="cmtt-10"> </span><span
11545 class="cmtt-10"> </span><span
11546 class="cmtt-10"> </span><span
11547 class="cmtt-10"> }</span>
11548 <br class="fancyvrb" /><a
11549 id="x1-122030r15"></a><span
11550 class="cmtt-10"> </span><span
11551 class="cmtt-10"> </span>
11552 <br class="fancyvrb" /><a
11553 id="x1-122032r16"></a><span
11554 class="cmtt-10"> </span><span
11555 class="cmtt-10"> </span><span
11556 class="cmtt-10"> </span><span
11557 class="cmtt-10"> 9)</span><span
11558 class="cmtt-10"> done</span>
11560 <!--l. 125--><p class="noindent" >
11561 <h5 class="subsubsectionHead"><span class="titlemark">9.2.7 </span> <a
11562 id="x1-1230009.2.7"></a>render˙line</h5>
11563 <!--l. 127--><p class="noindent" >Floor decode type one uses the integer line drawing algorithm of ”render˙line(x0, y0, x1, y1, v)” to
11564 construct an integer floor curve for contiguous piecewise line segments. Note that it has not been
11565 relevant elsewhere, but here we must define integer division as rounding division of both positive
11566 and negative numbers toward zero.
11567 <!--l. 134--><p class="noindent" >
11568 <div class="fancyvrb" id="fancyvrb47">
11570 id="x1-123002r1"></a><span
11571 class="cmtt-10"> </span><span
11572 class="cmtt-10"> </span><span
11573 class="cmtt-10"> </span><span
11574 class="cmtt-10"> 1)</span><span
11575 class="cmtt-10"> </span><span
11576 class="cmtt-10"> </span><span
11577 class="cmtt-10"> [dy]</span><span
11578 class="cmtt-10"> =</span><span
11579 class="cmtt-10"> [y1]</span><span
11580 class="cmtt-10"> -</span><span
11581 class="cmtt-10"> [y0]</span>
11582 <br class="fancyvrb" /><a
11583 id="x1-123004r2"></a><span
11584 class="cmtt-10"> </span><span
11585 class="cmtt-10"> </span><span
11586 class="cmtt-10"> </span><span
11587 class="cmtt-10"> 2)</span><span
11588 class="cmtt-10"> </span><span
11589 class="cmtt-10"> [adx]</span><span
11590 class="cmtt-10"> =</span><span
11591 class="cmtt-10"> [x1]</span><span
11592 class="cmtt-10"> -</span><span
11593 class="cmtt-10"> [x0]</span>
11594 <br class="fancyvrb" /><a
11595 id="x1-123006r3"></a><span
11596 class="cmtt-10"> </span><span
11597 class="cmtt-10"> </span><span
11598 class="cmtt-10"> </span><span
11599 class="cmtt-10"> 3)</span><span
11600 class="cmtt-10"> </span><span
11601 class="cmtt-10"> [ady]</span><span
11602 class="cmtt-10"> =</span><span
11603 class="cmtt-10"> absolute</span><span
11604 class="cmtt-10"> value</span><span
11605 class="cmtt-10"> of</span><span
11606 class="cmtt-10"> [dy]</span>
11607 <br class="fancyvrb" /><a
11608 id="x1-123008r4"></a><span
11609 class="cmtt-10"> </span><span
11610 class="cmtt-10"> </span><span
11611 class="cmtt-10"> </span><span
11612 class="cmtt-10"> 4)</span><span
11613 class="cmtt-10"> [base]</span><span
11614 class="cmtt-10"> =</span><span
11615 class="cmtt-10"> [dy]</span><span
11616 class="cmtt-10"> /</span><span
11617 class="cmtt-10"> [adx]</span><span
11618 class="cmtt-10"> using</span><span
11619 class="cmtt-10"> integer</span><span
11620 class="cmtt-10"> division</span>
11621 <br class="fancyvrb" /><a
11622 id="x1-123010r5"></a><span
11623 class="cmtt-10"> </span><span
11624 class="cmtt-10"> </span><span
11625 class="cmtt-10"> </span><span
11626 class="cmtt-10"> 5)</span><span
11627 class="cmtt-10"> </span><span
11628 class="cmtt-10"> </span><span
11629 class="cmtt-10"> </span><span
11630 class="cmtt-10"> [x]</span><span
11631 class="cmtt-10"> =</span><span
11632 class="cmtt-10"> [x0]</span>
11633 <br class="fancyvrb" /><a
11634 id="x1-123012r6"></a><span
11635 class="cmtt-10"> </span><span
11636 class="cmtt-10"> </span><span
11637 class="cmtt-10"> </span><span
11638 class="cmtt-10"> 6)</span><span
11639 class="cmtt-10"> </span><span
11640 class="cmtt-10"> </span><span
11641 class="cmtt-10"> </span><span
11642 class="cmtt-10"> [y]</span><span
11643 class="cmtt-10"> =</span><span
11644 class="cmtt-10"> [y0]</span>
11645 <br class="fancyvrb" /><a
11646 id="x1-123014r7"></a><span
11647 class="cmtt-10"> </span><span
11648 class="cmtt-10"> </span><span
11649 class="cmtt-10"> </span><span
11650 class="cmtt-10"> 7)</span><span
11651 class="cmtt-10"> </span><span
11652 class="cmtt-10"> [err]</span><span
11653 class="cmtt-10"> =</span><span
11654 class="cmtt-10"> 0</span>
11655 <br class="fancyvrb" /><a
11656 id="x1-123016r8"></a><span
11657 class="cmtt-10"> </span><span
11658 class="cmtt-10"> </span>
11659 <br class="fancyvrb" /><a
11660 id="x1-123018r9"></a><span
11661 class="cmtt-10"> </span><span
11662 class="cmtt-10"> </span><span
11663 class="cmtt-10"> </span><span
11664 class="cmtt-10"> 8)</span><span
11665 class="cmtt-10"> if</span><span
11666 class="cmtt-10"> (</span><span
11667 class="cmtt-10"> [dy]</span><span
11668 class="cmtt-10"> is</span><span
11669 class="cmtt-10"> less</span><span
11670 class="cmtt-10"> than</span><span
11671 class="cmtt-10"> 0</span><span
11672 class="cmtt-10"> )</span><span
11673 class="cmtt-10"> {</span>
11674 <br class="fancyvrb" /><a
11675 id="x1-123020r10"></a><span
11676 class="cmtt-10"> </span><span
11677 class="cmtt-10"> </span>
11678 <br class="fancyvrb" /><a
11679 id="x1-123022r11"></a><span
11680 class="cmtt-10"> </span><span
11681 class="cmtt-10"> </span><span
11682 class="cmtt-10"> </span><span
11683 class="cmtt-10"> </span><span
11684 class="cmtt-10"> </span><span
11685 class="cmtt-10"> </span><span
11686 class="cmtt-10"> </span><span
11687 class="cmtt-10"> </span><span
11688 class="cmtt-10"> </span><span
11689 class="cmtt-10"> 9)</span><span
11690 class="cmtt-10"> [sy]</span><span
11691 class="cmtt-10"> =</span><span
11692 class="cmtt-10"> [base]</span><span
11693 class="cmtt-10"> -</span><span
11694 class="cmtt-10"> 1</span>
11695 <br class="fancyvrb" /><a
11696 id="x1-123024r12"></a><span
11697 class="cmtt-10"> </span><span
11698 class="cmtt-10"> </span>
11699 <br class="fancyvrb" /><a
11700 id="x1-123026r13"></a><span
11701 class="cmtt-10"> </span><span
11702 class="cmtt-10"> </span><span
11703 class="cmtt-10"> </span><span
11704 class="cmtt-10"> </span><span
11705 class="cmtt-10"> </span><span
11706 class="cmtt-10"> </span><span
11707 class="cmtt-10"> }</span><span
11708 class="cmtt-10"> else</span><span
11709 class="cmtt-10"> {</span>
11710 <br class="fancyvrb" /><a
11711 id="x1-123028r14"></a><span
11712 class="cmtt-10"> </span><span
11713 class="cmtt-10"> </span>
11714 <br class="fancyvrb" /><a
11715 id="x1-123030r15"></a><span
11716 class="cmtt-10"> </span><span
11717 class="cmtt-10"> </span><span
11718 class="cmtt-10"> </span><span
11719 class="cmtt-10"> </span><span
11720 class="cmtt-10"> </span><span
11721 class="cmtt-10"> </span><span
11722 class="cmtt-10"> </span><span
11723 class="cmtt-10"> </span><span
11724 class="cmtt-10"> 10)</span><span
11725 class="cmtt-10"> [sy]</span><span
11726 class="cmtt-10"> =</span><span
11727 class="cmtt-10"> [base]</span><span
11728 class="cmtt-10"> +</span><span
11729 class="cmtt-10"> 1</span>
11730 <br class="fancyvrb" /><a
11731 id="x1-123032r16"></a><span
11732 class="cmtt-10"> </span><span
11733 class="cmtt-10"> </span>
11734 <br class="fancyvrb" /><a
11735 id="x1-123034r17"></a><span
11736 class="cmtt-10"> </span><span
11737 class="cmtt-10"> </span><span
11738 class="cmtt-10"> </span><span
11739 class="cmtt-10"> </span><span
11740 class="cmtt-10"> </span><span
11741 class="cmtt-10"> </span><span
11742 class="cmtt-10"> }</span>
11743 <br class="fancyvrb" /><a
11744 id="x1-123036r18"></a><span
11745 class="cmtt-10"> </span><span
11746 class="cmtt-10"> </span>
11747 <br class="fancyvrb" /><a
11748 id="x1-123038r19"></a><span
11749 class="cmtt-10"> </span><span
11750 class="cmtt-10"> </span><span
11751 class="cmtt-10"> 11)</span><span
11752 class="cmtt-10"> [ady]</span><span
11753 class="cmtt-10"> =</span><span
11754 class="cmtt-10"> [ady]</span><span
11755 class="cmtt-10"> -</span><span
11756 class="cmtt-10"> (absolute</span><span
11757 class="cmtt-10"> value</span><span
11758 class="cmtt-10"> of</span><span
11759 class="cmtt-10"> [base])</span><span
11760 class="cmtt-10"> *</span><span
11761 class="cmtt-10"> [adx]</span>
11762 <br class="fancyvrb" /><a
11763 id="x1-123040r20"></a><span
11764 class="cmtt-10"> </span><span
11765 class="cmtt-10"> </span><span
11766 class="cmtt-10"> 12)</span><span
11767 class="cmtt-10"> vector</span><span
11768 class="cmtt-10"> [v]</span><span
11769 class="cmtt-10"> element</span><span
11770 class="cmtt-10"> [x]</span><span
11771 class="cmtt-10"> =</span><span
11772 class="cmtt-10"> [y]</span>
11773 <br class="fancyvrb" /><a
11774 id="x1-123042r21"></a><span
11775 class="cmtt-10"> </span><span
11776 class="cmtt-10"> </span>
11777 <br class="fancyvrb" /><a
11778 id="x1-123044r22"></a><span
11779 class="cmtt-10"> </span><span
11780 class="cmtt-10"> </span><span
11781 class="cmtt-10"> 13)</span><span
11782 class="cmtt-10"> iterate</span><span
11783 class="cmtt-10"> [x]</span><span
11784 class="cmtt-10"> over</span><span
11785 class="cmtt-10"> the</span><span
11786 class="cmtt-10"> range</span><span
11787 class="cmtt-10"> [x0]+1</span><span
11788 class="cmtt-10"> ...</span><span
11789 class="cmtt-10"> [x1]-1</span><span
11790 class="cmtt-10"> {</span>
11791 <br class="fancyvrb" /><a
11792 id="x1-123046r23"></a><span
11793 class="cmtt-10"> </span><span
11794 class="cmtt-10"> </span>
11795 <br class="fancyvrb" /><a
11796 id="x1-123048r24"></a><span
11797 class="cmtt-10"> </span><span
11798 class="cmtt-10"> </span><span
11799 class="cmtt-10"> </span><span
11800 class="cmtt-10"> </span><span
11801 class="cmtt-10"> </span><span
11802 class="cmtt-10"> </span><span
11803 class="cmtt-10"> </span><span
11804 class="cmtt-10"> </span><span
11805 class="cmtt-10"> 14)</span><span
11806 class="cmtt-10"> [err]</span><span
11807 class="cmtt-10"> =</span><span
11808 class="cmtt-10"> [err]</span><span
11809 class="cmtt-10"> +</span><span
11810 class="cmtt-10"> [ady];</span>
11811 <br class="fancyvrb" /><a
11812 id="x1-123050r25"></a><span
11813 class="cmtt-10"> </span><span
11814 class="cmtt-10"> </span><span
11815 class="cmtt-10"> </span><span
11816 class="cmtt-10"> </span><span
11817 class="cmtt-10"> </span><span
11818 class="cmtt-10"> </span><span
11819 class="cmtt-10"> </span><span
11820 class="cmtt-10"> </span><span
11821 class="cmtt-10"> 15)</span><span
11822 class="cmtt-10"> if</span><span
11823 class="cmtt-10"> (</span><span
11824 class="cmtt-10"> [err]</span><span
11825 class="cmtt-10"> >=</span><span
11826 class="cmtt-10"> [adx]</span><span
11827 class="cmtt-10"> )</span><span
11828 class="cmtt-10"> {</span>
11829 <br class="fancyvrb" /><a
11830 id="x1-123052r26"></a><span
11831 class="cmtt-10"> </span><span
11832 class="cmtt-10"> </span>
11833 <br class="fancyvrb" /><a
11834 id="x1-123054r27"></a><span
11835 class="cmtt-10"> </span><span
11836 class="cmtt-10"> </span><span
11837 class="cmtt-10"> </span><span
11838 class="cmtt-10"> </span><span
11839 class="cmtt-10"> </span><span
11840 class="cmtt-10"> </span><span
11841 class="cmtt-10"> </span><span
11842 class="cmtt-10"> </span><span
11843 class="cmtt-10"> </span><span
11844 class="cmtt-10"> </span><span
11845 class="cmtt-10"> </span><span
11846 class="cmtt-10"> </span><span
11847 class="cmtt-10"> </span><span
11848 class="cmtt-10"> </span><span
11849 class="cmtt-10"> 16)</span><span
11850 class="cmtt-10"> [err]</span><span
11851 class="cmtt-10"> =</span><span
11852 class="cmtt-10"> [err]</span><span
11853 class="cmtt-10"> -</span><span
11854 class="cmtt-10"> [adx]</span>
11855 <br class="fancyvrb" /><a
11856 id="x1-123056r28"></a><span
11857 class="cmtt-10"> </span><span
11858 class="cmtt-10"> </span><span
11859 class="cmtt-10"> </span><span
11860 class="cmtt-10"> </span><span
11861 class="cmtt-10"> </span><span
11862 class="cmtt-10"> </span><span
11863 class="cmtt-10"> </span><span
11864 class="cmtt-10"> </span><span
11865 class="cmtt-10"> </span><span
11866 class="cmtt-10"> </span><span
11867 class="cmtt-10"> </span><span
11868 class="cmtt-10"> </span><span
11869 class="cmtt-10"> </span><span
11870 class="cmtt-10"> </span><span
11871 class="cmtt-10"> 17)</span><span
11872 class="cmtt-10"> </span><span
11873 class="cmtt-10"> </span><span
11874 class="cmtt-10"> [y]</span><span
11875 class="cmtt-10"> =</span><span
11876 class="cmtt-10"> [y]</span><span
11877 class="cmtt-10"> +</span><span
11878 class="cmtt-10"> [sy]</span>
11882 <br class="fancyvrb" /><a
11883 id="x1-123058r29"></a><span
11884 class="cmtt-10"> </span><span
11885 class="cmtt-10"> </span>
11886 <br class="fancyvrb" /><a
11887 id="x1-123060r30"></a><span
11888 class="cmtt-10"> </span><span
11889 class="cmtt-10"> </span><span
11890 class="cmtt-10"> </span><span
11891 class="cmtt-10"> </span><span
11892 class="cmtt-10"> </span><span
11893 class="cmtt-10"> </span><span
11894 class="cmtt-10"> </span><span
11895 class="cmtt-10"> </span><span
11896 class="cmtt-10"> </span><span
11897 class="cmtt-10"> </span><span
11898 class="cmtt-10"> </span><span
11899 class="cmtt-10"> </span><span
11900 class="cmtt-10"> }</span><span
11901 class="cmtt-10"> else</span><span
11902 class="cmtt-10"> {</span>
11903 <br class="fancyvrb" /><a
11904 id="x1-123062r31"></a><span
11905 class="cmtt-10"> </span><span
11906 class="cmtt-10"> </span>
11907 <br class="fancyvrb" /><a
11908 id="x1-123064r32"></a><span
11909 class="cmtt-10"> </span><span
11910 class="cmtt-10"> </span><span
11911 class="cmtt-10"> </span><span
11912 class="cmtt-10"> </span><span
11913 class="cmtt-10"> </span><span
11914 class="cmtt-10"> </span><span
11915 class="cmtt-10"> </span><span
11916 class="cmtt-10"> </span><span
11917 class="cmtt-10"> </span><span
11918 class="cmtt-10"> </span><span
11919 class="cmtt-10"> </span><span
11920 class="cmtt-10"> </span><span
11921 class="cmtt-10"> </span><span
11922 class="cmtt-10"> </span><span
11923 class="cmtt-10"> 18)</span><span
11924 class="cmtt-10"> [y]</span><span
11925 class="cmtt-10"> =</span><span
11926 class="cmtt-10"> [y]</span><span
11927 class="cmtt-10"> +</span><span
11928 class="cmtt-10"> [base]</span>
11929 <br class="fancyvrb" /><a
11930 id="x1-123066r33"></a><span
11931 class="cmtt-10"> </span><span
11932 class="cmtt-10"> </span>
11933 <br class="fancyvrb" /><a
11934 id="x1-123068r34"></a><span
11935 class="cmtt-10"> </span><span
11936 class="cmtt-10"> </span><span
11937 class="cmtt-10"> </span><span
11938 class="cmtt-10"> </span><span
11939 class="cmtt-10"> </span><span
11940 class="cmtt-10"> </span><span
11941 class="cmtt-10"> </span><span
11942 class="cmtt-10"> </span><span
11943 class="cmtt-10"> </span><span
11944 class="cmtt-10"> </span><span
11945 class="cmtt-10"> </span><span
11946 class="cmtt-10"> </span><span
11947 class="cmtt-10"> }</span>
11948 <br class="fancyvrb" /><a
11949 id="x1-123070r35"></a><span
11950 class="cmtt-10"> </span><span
11951 class="cmtt-10"> </span>
11952 <br class="fancyvrb" /><a
11953 id="x1-123072r36"></a><span
11954 class="cmtt-10"> </span><span
11955 class="cmtt-10"> </span><span
11956 class="cmtt-10"> </span><span
11957 class="cmtt-10"> </span><span
11958 class="cmtt-10"> </span><span
11959 class="cmtt-10"> </span><span
11960 class="cmtt-10"> </span><span
11961 class="cmtt-10"> </span><span
11962 class="cmtt-10"> 19)</span><span
11963 class="cmtt-10"> vector</span><span
11964 class="cmtt-10"> [v]</span><span
11965 class="cmtt-10"> element</span><span
11966 class="cmtt-10"> [x]</span><span
11967 class="cmtt-10"> =</span><span
11968 class="cmtt-10"> [y]</span>
11969 <br class="fancyvrb" /><a
11970 id="x1-123074r37"></a><span
11971 class="cmtt-10"> </span><span
11972 class="cmtt-10"> </span>
11973 <br class="fancyvrb" /><a
11974 id="x1-123076r38"></a><span
11975 class="cmtt-10"> </span><span
11976 class="cmtt-10"> </span><span
11977 class="cmtt-10"> </span><span
11978 class="cmtt-10"> </span><span
11979 class="cmtt-10"> </span><span
11980 class="cmtt-10"> </span><span
11981 class="cmtt-10"> }</span>
11989 <h3 class="sectionHead"><span class="titlemark">10 </span> <a
11990 id="x1-12400010"></a>Tables</h3>
11991 <!--l. 6--><p class="noindent" >
11992 <h4 class="subsectionHead"><span class="titlemark">10.1 </span> <a
11993 id="x1-12500010.1"></a>floor1_inverse_dB_table</h4>
11994 <!--l. 8--><p class="noindent" >The vector <span
11995 class="cmtt-10x-x-109">[floor1_inverse_dB_table] </span>is a 256 element static lookup table consiting of the
11996 following values (read left to right then top to bottom):
11997 <!--l. 12--><p class="noindent" >
11998 <div class="fancyvrb" id="fancyvrb48">
12000 id="x1-125002r1"></a><span
12001 class="cmtt-10"> </span><span
12002 class="cmtt-10"> </span><span
12003 class="cmtt-10"> </span><span
12004 class="cmtt-10"> 1.0649863e-07,</span><span
12005 class="cmtt-10"> 1.1341951e-07,</span><span
12006 class="cmtt-10"> 1.2079015e-07,</span><span
12007 class="cmtt-10"> 1.2863978e-07,</span>
12008 <br class="fancyvrb" /><a
12009 id="x1-125004r2"></a><span
12010 class="cmtt-10"> </span><span
12011 class="cmtt-10"> </span><span
12012 class="cmtt-10"> </span><span
12013 class="cmtt-10"> 1.3699951e-07,</span><span
12014 class="cmtt-10"> 1.4590251e-07,</span><span
12015 class="cmtt-10"> 1.5538408e-07,</span><span
12016 class="cmtt-10"> 1.6548181e-07,</span>
12017 <br class="fancyvrb" /><a
12018 id="x1-125006r3"></a><span
12019 class="cmtt-10"> </span><span
12020 class="cmtt-10"> </span><span
12021 class="cmtt-10"> </span><span
12022 class="cmtt-10"> 1.7623575e-07,</span><span
12023 class="cmtt-10"> 1.8768855e-07,</span><span
12024 class="cmtt-10"> 1.9988561e-07,</span><span
12025 class="cmtt-10"> 2.1287530e-07,</span>
12026 <br class="fancyvrb" /><a
12027 id="x1-125008r4"></a><span
12028 class="cmtt-10"> </span><span
12029 class="cmtt-10"> </span><span
12030 class="cmtt-10"> </span><span
12031 class="cmtt-10"> 2.2670913e-07,</span><span
12032 class="cmtt-10"> 2.4144197e-07,</span><span
12033 class="cmtt-10"> 2.5713223e-07,</span><span
12034 class="cmtt-10"> 2.7384213e-07,</span>
12035 <br class="fancyvrb" /><a
12036 id="x1-125010r5"></a><span
12037 class="cmtt-10"> </span><span
12038 class="cmtt-10"> </span><span
12039 class="cmtt-10"> </span><span
12040 class="cmtt-10"> 2.9163793e-07,</span><span
12041 class="cmtt-10"> 3.1059021e-07,</span><span
12042 class="cmtt-10"> 3.3077411e-07,</span><span
12043 class="cmtt-10"> 3.5226968e-07,</span>
12044 <br class="fancyvrb" /><a
12045 id="x1-125012r6"></a><span
12046 class="cmtt-10"> </span><span
12047 class="cmtt-10"> </span><span
12048 class="cmtt-10"> </span><span
12049 class="cmtt-10"> 3.7516214e-07,</span><span
12050 class="cmtt-10"> 3.9954229e-07,</span><span
12051 class="cmtt-10"> 4.2550680e-07,</span><span
12052 class="cmtt-10"> 4.5315863e-07,</span>
12053 <br class="fancyvrb" /><a
12054 id="x1-125014r7"></a><span
12055 class="cmtt-10"> </span><span
12056 class="cmtt-10"> </span><span
12057 class="cmtt-10"> </span><span
12058 class="cmtt-10"> 4.8260743e-07,</span><span
12059 class="cmtt-10"> 5.1396998e-07,</span><span
12060 class="cmtt-10"> 5.4737065e-07,</span><span
12061 class="cmtt-10"> 5.8294187e-07,</span>
12062 <br class="fancyvrb" /><a
12063 id="x1-125016r8"></a><span
12064 class="cmtt-10"> </span><span
12065 class="cmtt-10"> </span><span
12066 class="cmtt-10"> </span><span
12067 class="cmtt-10"> 6.2082472e-07,</span><span
12068 class="cmtt-10"> 6.6116941e-07,</span><span
12069 class="cmtt-10"> 7.0413592e-07,</span><span
12070 class="cmtt-10"> 7.4989464e-07,</span>
12071 <br class="fancyvrb" /><a
12072 id="x1-125018r9"></a><span
12073 class="cmtt-10"> </span><span
12074 class="cmtt-10"> </span><span
12075 class="cmtt-10"> </span><span
12076 class="cmtt-10"> 7.9862701e-07,</span><span
12077 class="cmtt-10"> 8.5052630e-07,</span><span
12078 class="cmtt-10"> 9.0579828e-07,</span><span
12079 class="cmtt-10"> 9.6466216e-07,</span>
12080 <br class="fancyvrb" /><a
12081 id="x1-125020r10"></a><span
12082 class="cmtt-10"> </span><span
12083 class="cmtt-10"> </span><span
12084 class="cmtt-10"> </span><span
12085 class="cmtt-10"> 1.0273513e-06,</span><span
12086 class="cmtt-10"> 1.0941144e-06,</span><span
12087 class="cmtt-10"> 1.1652161e-06,</span><span
12088 class="cmtt-10"> 1.2409384e-06,</span>
12089 <br class="fancyvrb" /><a
12090 id="x1-125022r11"></a><span
12091 class="cmtt-10"> </span><span
12092 class="cmtt-10"> </span><span
12093 class="cmtt-10"> </span><span
12094 class="cmtt-10"> 1.3215816e-06,</span><span
12095 class="cmtt-10"> 1.4074654e-06,</span><span
12096 class="cmtt-10"> 1.4989305e-06,</span><span
12097 class="cmtt-10"> 1.5963394e-06,</span>
12098 <br class="fancyvrb" /><a
12099 id="x1-125024r12"></a><span
12100 class="cmtt-10"> </span><span
12101 class="cmtt-10"> </span><span
12102 class="cmtt-10"> </span><span
12103 class="cmtt-10"> 1.7000785e-06,</span><span
12104 class="cmtt-10"> 1.8105592e-06,</span><span
12105 class="cmtt-10"> 1.9282195e-06,</span><span
12106 class="cmtt-10"> 2.0535261e-06,</span>
12107 <br class="fancyvrb" /><a
12108 id="x1-125026r13"></a><span
12109 class="cmtt-10"> </span><span
12110 class="cmtt-10"> </span><span
12111 class="cmtt-10"> </span><span
12112 class="cmtt-10"> 2.1869758e-06,</span><span
12113 class="cmtt-10"> 2.3290978e-06,</span><span
12114 class="cmtt-10"> 2.4804557e-06,</span><span
12115 class="cmtt-10"> 2.6416497e-06,</span>
12116 <br class="fancyvrb" /><a
12117 id="x1-125028r14"></a><span
12118 class="cmtt-10"> </span><span
12119 class="cmtt-10"> </span><span
12120 class="cmtt-10"> </span><span
12121 class="cmtt-10"> 2.8133190e-06,</span><span
12122 class="cmtt-10"> 2.9961443e-06,</span><span
12123 class="cmtt-10"> 3.1908506e-06,</span><span
12124 class="cmtt-10"> 3.3982101e-06,</span>
12125 <br class="fancyvrb" /><a
12126 id="x1-125030r15"></a><span
12127 class="cmtt-10"> </span><span
12128 class="cmtt-10"> </span><span
12129 class="cmtt-10"> </span><span
12130 class="cmtt-10"> 3.6190449e-06,</span><span
12131 class="cmtt-10"> 3.8542308e-06,</span><span
12132 class="cmtt-10"> 4.1047004e-06,</span><span
12133 class="cmtt-10"> 4.3714470e-06,</span>
12134 <br class="fancyvrb" /><a
12135 id="x1-125032r16"></a><span
12136 class="cmtt-10"> </span><span
12137 class="cmtt-10"> </span><span
12138 class="cmtt-10"> </span><span
12139 class="cmtt-10"> 4.6555282e-06,</span><span
12140 class="cmtt-10"> 4.9580707e-06,</span><span
12141 class="cmtt-10"> 5.2802740e-06,</span><span
12142 class="cmtt-10"> 5.6234160e-06,</span>
12143 <br class="fancyvrb" /><a
12144 id="x1-125034r17"></a><span
12145 class="cmtt-10"> </span><span
12146 class="cmtt-10"> </span><span
12147 class="cmtt-10"> </span><span
12148 class="cmtt-10"> 5.9888572e-06,</span><span
12149 class="cmtt-10"> 6.3780469e-06,</span><span
12150 class="cmtt-10"> 6.7925283e-06,</span><span
12151 class="cmtt-10"> 7.2339451e-06,</span>
12152 <br class="fancyvrb" /><a
12153 id="x1-125036r18"></a><span
12154 class="cmtt-10"> </span><span
12155 class="cmtt-10"> </span><span
12156 class="cmtt-10"> </span><span
12157 class="cmtt-10"> 7.7040476e-06,</span><span
12158 class="cmtt-10"> 8.2047000e-06,</span><span
12159 class="cmtt-10"> 8.7378876e-06,</span><span
12160 class="cmtt-10"> 9.3057248e-06,</span>
12161 <br class="fancyvrb" /><a
12162 id="x1-125038r19"></a><span
12163 class="cmtt-10"> </span><span
12164 class="cmtt-10"> </span><span
12165 class="cmtt-10"> </span><span
12166 class="cmtt-10"> 9.9104632e-06,</span><span
12167 class="cmtt-10"> 1.0554501e-05,</span><span
12168 class="cmtt-10"> 1.1240392e-05,</span><span
12169 class="cmtt-10"> 1.1970856e-05,</span>
12170 <br class="fancyvrb" /><a
12171 id="x1-125040r20"></a><span
12172 class="cmtt-10"> </span><span
12173 class="cmtt-10"> </span><span
12174 class="cmtt-10"> </span><span
12175 class="cmtt-10"> 1.2748789e-05,</span><span
12176 class="cmtt-10"> 1.3577278e-05,</span><span
12177 class="cmtt-10"> 1.4459606e-05,</span><span
12178 class="cmtt-10"> 1.5399272e-05,</span>
12179 <br class="fancyvrb" /><a
12180 id="x1-125042r21"></a><span
12181 class="cmtt-10"> </span><span
12182 class="cmtt-10"> </span><span
12183 class="cmtt-10"> </span><span
12184 class="cmtt-10"> 1.6400004e-05,</span><span
12185 class="cmtt-10"> 1.7465768e-05,</span><span
12186 class="cmtt-10"> 1.8600792e-05,</span><span
12187 class="cmtt-10"> 1.9809576e-05,</span>
12188 <br class="fancyvrb" /><a
12189 id="x1-125044r22"></a><span
12190 class="cmtt-10"> </span><span
12191 class="cmtt-10"> </span><span
12192 class="cmtt-10"> </span><span
12193 class="cmtt-10"> 2.1096914e-05,</span><span
12194 class="cmtt-10"> 2.2467911e-05,</span><span
12195 class="cmtt-10"> 2.3928002e-05,</span><span
12196 class="cmtt-10"> 2.5482978e-05,</span>
12197 <br class="fancyvrb" /><a
12198 id="x1-125046r23"></a><span
12199 class="cmtt-10"> </span><span
12200 class="cmtt-10"> </span><span
12201 class="cmtt-10"> </span><span
12202 class="cmtt-10"> 2.7139006e-05,</span><span
12203 class="cmtt-10"> 2.8902651e-05,</span><span
12204 class="cmtt-10"> 3.0780908e-05,</span><span
12205 class="cmtt-10"> 3.2781225e-05,</span>
12206 <br class="fancyvrb" /><a
12207 id="x1-125048r24"></a><span
12208 class="cmtt-10"> </span><span
12209 class="cmtt-10"> </span><span
12210 class="cmtt-10"> </span><span
12211 class="cmtt-10"> 3.4911534e-05,</span><span
12212 class="cmtt-10"> 3.7180282e-05,</span><span
12213 class="cmtt-10"> 3.9596466e-05,</span><span
12214 class="cmtt-10"> 4.2169667e-05,</span>
12215 <br class="fancyvrb" /><a
12216 id="x1-125050r25"></a><span
12217 class="cmtt-10"> </span><span
12218 class="cmtt-10"> </span><span
12219 class="cmtt-10"> </span><span
12220 class="cmtt-10"> 4.4910090e-05,</span><span
12221 class="cmtt-10"> 4.7828601e-05,</span><span
12222 class="cmtt-10"> 5.0936773e-05,</span><span
12223 class="cmtt-10"> 5.4246931e-05,</span>
12224 <br class="fancyvrb" /><a
12225 id="x1-125052r26"></a><span
12226 class="cmtt-10"> </span><span
12227 class="cmtt-10"> </span><span
12228 class="cmtt-10"> </span><span
12229 class="cmtt-10"> 5.7772202e-05,</span><span
12230 class="cmtt-10"> 6.1526565e-05,</span><span
12231 class="cmtt-10"> 6.5524908e-05,</span><span
12232 class="cmtt-10"> 6.9783085e-05,</span>
12233 <br class="fancyvrb" /><a
12234 id="x1-125054r27"></a><span
12235 class="cmtt-10"> </span><span
12236 class="cmtt-10"> </span><span
12237 class="cmtt-10"> </span><span
12238 class="cmtt-10"> 7.4317983e-05,</span><span
12239 class="cmtt-10"> 7.9147585e-05,</span><span
12240 class="cmtt-10"> 8.4291040e-05,</span><span
12241 class="cmtt-10"> 8.9768747e-05,</span>
12242 <br class="fancyvrb" /><a
12243 id="x1-125056r28"></a><span
12244 class="cmtt-10"> </span><span
12245 class="cmtt-10"> </span><span
12246 class="cmtt-10"> </span><span
12247 class="cmtt-10"> 9.5602426e-05,</span><span
12248 class="cmtt-10"> 0.00010181521,</span><span
12249 class="cmtt-10"> 0.00010843174,</span><span
12250 class="cmtt-10"> 0.00011547824,</span>
12251 <br class="fancyvrb" /><a
12252 id="x1-125058r29"></a><span
12253 class="cmtt-10"> </span><span
12254 class="cmtt-10"> </span><span
12255 class="cmtt-10"> </span><span
12256 class="cmtt-10"> 0.00012298267,</span><span
12257 class="cmtt-10"> 0.00013097477,</span><span
12258 class="cmtt-10"> 0.00013948625,</span><span
12259 class="cmtt-10"> 0.00014855085,</span>
12260 <br class="fancyvrb" /><a
12261 id="x1-125060r30"></a><span
12262 class="cmtt-10"> </span><span
12263 class="cmtt-10"> </span><span
12264 class="cmtt-10"> </span><span
12265 class="cmtt-10"> 0.00015820453,</span><span
12266 class="cmtt-10"> 0.00016848555,</span><span
12267 class="cmtt-10"> 0.00017943469,</span><span
12268 class="cmtt-10"> 0.00019109536,</span>
12269 <br class="fancyvrb" /><a
12270 id="x1-125062r31"></a><span
12271 class="cmtt-10"> </span><span
12272 class="cmtt-10"> </span><span
12273 class="cmtt-10"> </span><span
12274 class="cmtt-10"> 0.00020351382,</span><span
12275 class="cmtt-10"> 0.00021673929,</span><span
12276 class="cmtt-10"> 0.00023082423,</span><span
12277 class="cmtt-10"> 0.00024582449,</span>
12278 <br class="fancyvrb" /><a
12279 id="x1-125064r32"></a><span
12280 class="cmtt-10"> </span><span
12281 class="cmtt-10"> </span><span
12282 class="cmtt-10"> </span><span
12283 class="cmtt-10"> 0.00026179955,</span><span
12284 class="cmtt-10"> 0.00027881276,</span><span
12285 class="cmtt-10"> 0.00029693158,</span><span
12286 class="cmtt-10"> 0.00031622787,</span>
12287 <br class="fancyvrb" /><a
12288 id="x1-125066r33"></a><span
12289 class="cmtt-10"> </span><span
12290 class="cmtt-10"> </span><span
12291 class="cmtt-10"> </span><span
12292 class="cmtt-10"> 0.00033677814,</span><span
12293 class="cmtt-10"> 0.00035866388,</span><span
12294 class="cmtt-10"> 0.00038197188,</span><span
12295 class="cmtt-10"> 0.00040679456,</span>
12296 <br class="fancyvrb" /><a
12297 id="x1-125068r34"></a><span
12298 class="cmtt-10"> </span><span
12299 class="cmtt-10"> </span><span
12300 class="cmtt-10"> </span><span
12301 class="cmtt-10"> 0.00043323036,</span><span
12302 class="cmtt-10"> 0.00046138411,</span><span
12303 class="cmtt-10"> 0.00049136745,</span><span
12304 class="cmtt-10"> 0.00052329927,</span>
12305 <br class="fancyvrb" /><a
12306 id="x1-125070r35"></a><span
12307 class="cmtt-10"> </span><span
12308 class="cmtt-10"> </span><span
12309 class="cmtt-10"> </span><span
12310 class="cmtt-10"> 0.00055730621,</span><span
12311 class="cmtt-10"> 0.00059352311,</span><span
12312 class="cmtt-10"> 0.00063209358,</span><span
12313 class="cmtt-10"> 0.00067317058,</span>
12314 <br class="fancyvrb" /><a
12315 id="x1-125072r36"></a><span
12316 class="cmtt-10"> </span><span
12317 class="cmtt-10"> </span><span
12318 class="cmtt-10"> </span><span
12319 class="cmtt-10"> 0.00071691700,</span><span
12320 class="cmtt-10"> 0.00076350630,</span><span
12321 class="cmtt-10"> 0.00081312324,</span><span
12322 class="cmtt-10"> 0.00086596457,</span>
12326 <br class="fancyvrb" /><a
12327 id="x1-125074r37"></a><span
12328 class="cmtt-10"> </span><span
12329 class="cmtt-10"> </span><span
12330 class="cmtt-10"> </span><span
12331 class="cmtt-10"> 0.00092223983,</span><span
12332 class="cmtt-10"> 0.00098217216,</span><span
12333 class="cmtt-10"> 0.0010459992,</span><span
12334 class="cmtt-10"> </span><span
12335 class="cmtt-10"> 0.0011139742,</span>
12336 <br class="fancyvrb" /><a
12337 id="x1-125076r38"></a><span
12338 class="cmtt-10"> </span><span
12339 class="cmtt-10"> </span><span
12340 class="cmtt-10"> </span><span
12341 class="cmtt-10"> 0.0011863665,</span><span
12342 class="cmtt-10"> </span><span
12343 class="cmtt-10"> 0.0012634633,</span><span
12344 class="cmtt-10"> </span><span
12345 class="cmtt-10"> 0.0013455702,</span><span
12346 class="cmtt-10"> </span><span
12347 class="cmtt-10"> 0.0014330129,</span>
12348 <br class="fancyvrb" /><a
12349 id="x1-125078r39"></a><span
12350 class="cmtt-10"> </span><span
12351 class="cmtt-10"> </span><span
12352 class="cmtt-10"> </span><span
12353 class="cmtt-10"> 0.0015261382,</span><span
12354 class="cmtt-10"> </span><span
12355 class="cmtt-10"> 0.0016253153,</span><span
12356 class="cmtt-10"> </span><span
12357 class="cmtt-10"> 0.0017309374,</span><span
12358 class="cmtt-10"> </span><span
12359 class="cmtt-10"> 0.0018434235,</span>
12360 <br class="fancyvrb" /><a
12361 id="x1-125080r40"></a><span
12362 class="cmtt-10"> </span><span
12363 class="cmtt-10"> </span><span
12364 class="cmtt-10"> </span><span
12365 class="cmtt-10"> 0.0019632195,</span><span
12366 class="cmtt-10"> </span><span
12367 class="cmtt-10"> 0.0020908006,</span><span
12368 class="cmtt-10"> </span><span
12369 class="cmtt-10"> 0.0022266726,</span><span
12370 class="cmtt-10"> </span><span
12371 class="cmtt-10"> 0.0023713743,</span>
12372 <br class="fancyvrb" /><a
12373 id="x1-125082r41"></a><span
12374 class="cmtt-10"> </span><span
12375 class="cmtt-10"> </span><span
12376 class="cmtt-10"> </span><span
12377 class="cmtt-10"> 0.0025254795,</span><span
12378 class="cmtt-10"> </span><span
12379 class="cmtt-10"> 0.0026895994,</span><span
12380 class="cmtt-10"> </span><span
12381 class="cmtt-10"> 0.0028643847,</span><span
12382 class="cmtt-10"> </span><span
12383 class="cmtt-10"> 0.0030505286,</span>
12384 <br class="fancyvrb" /><a
12385 id="x1-125084r42"></a><span
12386 class="cmtt-10"> </span><span
12387 class="cmtt-10"> </span><span
12388 class="cmtt-10"> </span><span
12389 class="cmtt-10"> 0.0032487691,</span><span
12390 class="cmtt-10"> </span><span
12391 class="cmtt-10"> 0.0034598925,</span><span
12392 class="cmtt-10"> </span><span
12393 class="cmtt-10"> 0.0036847358,</span><span
12394 class="cmtt-10"> </span><span
12395 class="cmtt-10"> 0.0039241906,</span>
12396 <br class="fancyvrb" /><a
12397 id="x1-125086r43"></a><span
12398 class="cmtt-10"> </span><span
12399 class="cmtt-10"> </span><span
12400 class="cmtt-10"> </span><span
12401 class="cmtt-10"> 0.0041792066,</span><span
12402 class="cmtt-10"> </span><span
12403 class="cmtt-10"> 0.0044507950,</span><span
12404 class="cmtt-10"> </span><span
12405 class="cmtt-10"> 0.0047400328,</span><span
12406 class="cmtt-10"> </span><span
12407 class="cmtt-10"> 0.0050480668,</span>
12408 <br class="fancyvrb" /><a
12409 id="x1-125088r44"></a><span
12410 class="cmtt-10"> </span><span
12411 class="cmtt-10"> </span><span
12412 class="cmtt-10"> </span><span
12413 class="cmtt-10"> 0.0053761186,</span><span
12414 class="cmtt-10"> </span><span
12415 class="cmtt-10"> 0.0057254891,</span><span
12416 class="cmtt-10"> </span><span
12417 class="cmtt-10"> 0.0060975636,</span><span
12418 class="cmtt-10"> </span><span
12419 class="cmtt-10"> 0.0064938176,</span>
12420 <br class="fancyvrb" /><a
12421 id="x1-125090r45"></a><span
12422 class="cmtt-10"> </span><span
12423 class="cmtt-10"> </span><span
12424 class="cmtt-10"> </span><span
12425 class="cmtt-10"> 0.0069158225,</span><span
12426 class="cmtt-10"> </span><span
12427 class="cmtt-10"> 0.0073652516,</span><span
12428 class="cmtt-10"> </span><span
12429 class="cmtt-10"> 0.0078438871,</span><span
12430 class="cmtt-10"> </span><span
12431 class="cmtt-10"> 0.0083536271,</span>
12432 <br class="fancyvrb" /><a
12433 id="x1-125092r46"></a><span
12434 class="cmtt-10"> </span><span
12435 class="cmtt-10"> </span><span
12436 class="cmtt-10"> </span><span
12437 class="cmtt-10"> 0.0088964928,</span><span
12438 class="cmtt-10"> </span><span
12439 class="cmtt-10"> 0.009474637,</span><span
12440 class="cmtt-10"> </span><span
12441 class="cmtt-10"> </span><span
12442 class="cmtt-10"> 0.010090352,</span><span
12443 class="cmtt-10"> </span><span
12444 class="cmtt-10"> </span><span
12445 class="cmtt-10"> 0.010746080,</span>
12446 <br class="fancyvrb" /><a
12447 id="x1-125094r47"></a><span
12448 class="cmtt-10"> </span><span
12449 class="cmtt-10"> </span><span
12450 class="cmtt-10"> </span><span
12451 class="cmtt-10"> 0.011444421,</span><span
12452 class="cmtt-10"> </span><span
12453 class="cmtt-10"> </span><span
12454 class="cmtt-10"> 0.012188144,</span><span
12455 class="cmtt-10"> </span><span
12456 class="cmtt-10"> </span><span
12457 class="cmtt-10"> 0.012980198,</span><span
12458 class="cmtt-10"> </span><span
12459 class="cmtt-10"> </span><span
12460 class="cmtt-10"> 0.013823725,</span>
12461 <br class="fancyvrb" /><a
12462 id="x1-125096r48"></a><span
12463 class="cmtt-10"> </span><span
12464 class="cmtt-10"> </span><span
12465 class="cmtt-10"> </span><span
12466 class="cmtt-10"> 0.014722068,</span><span
12467 class="cmtt-10"> </span><span
12468 class="cmtt-10"> </span><span
12469 class="cmtt-10"> 0.015678791,</span><span
12470 class="cmtt-10"> </span><span
12471 class="cmtt-10"> </span><span
12472 class="cmtt-10"> 0.016697687,</span><span
12473 class="cmtt-10"> </span><span
12474 class="cmtt-10"> </span><span
12475 class="cmtt-10"> 0.017782797,</span>
12476 <br class="fancyvrb" /><a
12477 id="x1-125098r49"></a><span
12478 class="cmtt-10"> </span><span
12479 class="cmtt-10"> </span><span
12480 class="cmtt-10"> </span><span
12481 class="cmtt-10"> 0.018938423,</span><span
12482 class="cmtt-10"> </span><span
12483 class="cmtt-10"> </span><span
12484 class="cmtt-10"> 0.020169149,</span><span
12485 class="cmtt-10"> </span><span
12486 class="cmtt-10"> </span><span
12487 class="cmtt-10"> 0.021479854,</span><span
12488 class="cmtt-10"> </span><span
12489 class="cmtt-10"> </span><span
12490 class="cmtt-10"> 0.022875735,</span>
12491 <br class="fancyvrb" /><a
12492 id="x1-125100r50"></a><span
12493 class="cmtt-10"> </span><span
12494 class="cmtt-10"> </span><span
12495 class="cmtt-10"> </span><span
12496 class="cmtt-10"> 0.024362330,</span><span
12497 class="cmtt-10"> </span><span
12498 class="cmtt-10"> </span><span
12499 class="cmtt-10"> 0.025945531,</span><span
12500 class="cmtt-10"> </span><span
12501 class="cmtt-10"> </span><span
12502 class="cmtt-10"> 0.027631618,</span><span
12503 class="cmtt-10"> </span><span
12504 class="cmtt-10"> </span><span
12505 class="cmtt-10"> 0.029427276,</span>
12506 <br class="fancyvrb" /><a
12507 id="x1-125102r51"></a><span
12508 class="cmtt-10"> </span><span
12509 class="cmtt-10"> </span><span
12510 class="cmtt-10"> </span><span
12511 class="cmtt-10"> 0.031339626,</span><span
12512 class="cmtt-10"> </span><span
12513 class="cmtt-10"> </span><span
12514 class="cmtt-10"> 0.033376252,</span><span
12515 class="cmtt-10"> </span><span
12516 class="cmtt-10"> </span><span
12517 class="cmtt-10"> 0.035545228,</span><span
12518 class="cmtt-10"> </span><span
12519 class="cmtt-10"> </span><span
12520 class="cmtt-10"> 0.037855157,</span>
12521 <br class="fancyvrb" /><a
12522 id="x1-125104r52"></a><span
12523 class="cmtt-10"> </span><span
12524 class="cmtt-10"> </span><span
12525 class="cmtt-10"> </span><span
12526 class="cmtt-10"> 0.040315199,</span><span
12527 class="cmtt-10"> </span><span
12528 class="cmtt-10"> </span><span
12529 class="cmtt-10"> 0.042935108,</span><span
12530 class="cmtt-10"> </span><span
12531 class="cmtt-10"> </span><span
12532 class="cmtt-10"> 0.045725273,</span><span
12533 class="cmtt-10"> </span><span
12534 class="cmtt-10"> </span><span
12535 class="cmtt-10"> 0.048696758,</span>
12536 <br class="fancyvrb" /><a
12537 id="x1-125106r53"></a><span
12538 class="cmtt-10"> </span><span
12539 class="cmtt-10"> </span><span
12540 class="cmtt-10"> </span><span
12541 class="cmtt-10"> 0.051861348,</span><span
12542 class="cmtt-10"> </span><span
12543 class="cmtt-10"> </span><span
12544 class="cmtt-10"> 0.055231591,</span><span
12545 class="cmtt-10"> </span><span
12546 class="cmtt-10"> </span><span
12547 class="cmtt-10"> 0.058820850,</span><span
12548 class="cmtt-10"> </span><span
12549 class="cmtt-10"> </span><span
12550 class="cmtt-10"> 0.062643361,</span>
12551 <br class="fancyvrb" /><a
12552 id="x1-125108r54"></a><span
12553 class="cmtt-10"> </span><span
12554 class="cmtt-10"> </span><span
12555 class="cmtt-10"> </span><span
12556 class="cmtt-10"> 0.066714279,</span><span
12557 class="cmtt-10"> </span><span
12558 class="cmtt-10"> </span><span
12559 class="cmtt-10"> 0.071049749,</span><span
12560 class="cmtt-10"> </span><span
12561 class="cmtt-10"> </span><span
12562 class="cmtt-10"> 0.075666962,</span><span
12563 class="cmtt-10"> </span><span
12564 class="cmtt-10"> </span><span
12565 class="cmtt-10"> 0.080584227,</span>
12566 <br class="fancyvrb" /><a
12567 id="x1-125110r55"></a><span
12568 class="cmtt-10"> </span><span
12569 class="cmtt-10"> </span><span
12570 class="cmtt-10"> </span><span
12571 class="cmtt-10"> 0.085821044,</span><span
12572 class="cmtt-10"> </span><span
12573 class="cmtt-10"> </span><span
12574 class="cmtt-10"> 0.091398179,</span><span
12575 class="cmtt-10"> </span><span
12576 class="cmtt-10"> </span><span
12577 class="cmtt-10"> 0.097337747,</span><span
12578 class="cmtt-10"> </span><span
12579 class="cmtt-10"> </span><span
12580 class="cmtt-10"> 0.10366330,</span>
12581 <br class="fancyvrb" /><a
12582 id="x1-125112r56"></a><span
12583 class="cmtt-10"> </span><span
12584 class="cmtt-10"> </span><span
12585 class="cmtt-10"> </span><span
12586 class="cmtt-10"> 0.11039993,</span><span
12587 class="cmtt-10"> </span><span
12588 class="cmtt-10"> </span><span
12589 class="cmtt-10"> </span><span
12590 class="cmtt-10"> 0.11757434,</span><span
12591 class="cmtt-10"> </span><span
12592 class="cmtt-10"> </span><span
12593 class="cmtt-10"> </span><span
12594 class="cmtt-10"> 0.12521498,</span><span
12595 class="cmtt-10"> </span><span
12596 class="cmtt-10"> </span><span
12597 class="cmtt-10"> </span><span
12598 class="cmtt-10"> 0.13335215,</span>
12599 <br class="fancyvrb" /><a
12600 id="x1-125114r57"></a><span
12601 class="cmtt-10"> </span><span
12602 class="cmtt-10"> </span><span
12603 class="cmtt-10"> </span><span
12604 class="cmtt-10"> 0.14201813,</span><span
12605 class="cmtt-10"> </span><span
12606 class="cmtt-10"> </span><span
12607 class="cmtt-10"> </span><span
12608 class="cmtt-10"> 0.15124727,</span><span
12609 class="cmtt-10"> </span><span
12610 class="cmtt-10"> </span><span
12611 class="cmtt-10"> </span><span
12612 class="cmtt-10"> 0.16107617,</span><span
12613 class="cmtt-10"> </span><span
12614 class="cmtt-10"> </span><span
12615 class="cmtt-10"> </span><span
12616 class="cmtt-10"> 0.17154380,</span>
12617 <br class="fancyvrb" /><a
12618 id="x1-125116r58"></a><span
12619 class="cmtt-10"> </span><span
12620 class="cmtt-10"> </span><span
12621 class="cmtt-10"> </span><span
12622 class="cmtt-10"> 0.18269168,</span><span
12623 class="cmtt-10"> </span><span
12624 class="cmtt-10"> </span><span
12625 class="cmtt-10"> </span><span
12626 class="cmtt-10"> 0.19456402,</span><span
12627 class="cmtt-10"> </span><span
12628 class="cmtt-10"> </span><span
12629 class="cmtt-10"> </span><span
12630 class="cmtt-10"> 0.20720788,</span><span
12631 class="cmtt-10"> </span><span
12632 class="cmtt-10"> </span><span
12633 class="cmtt-10"> </span><span
12634 class="cmtt-10"> 0.22067342,</span>
12635 <br class="fancyvrb" /><a
12636 id="x1-125118r59"></a><span
12637 class="cmtt-10"> </span><span
12638 class="cmtt-10"> </span><span
12639 class="cmtt-10"> </span><span
12640 class="cmtt-10"> 0.23501402,</span><span
12641 class="cmtt-10"> </span><span
12642 class="cmtt-10"> </span><span
12643 class="cmtt-10"> </span><span
12644 class="cmtt-10"> 0.25028656,</span><span
12645 class="cmtt-10"> </span><span
12646 class="cmtt-10"> </span><span
12647 class="cmtt-10"> </span><span
12648 class="cmtt-10"> 0.26655159,</span><span
12649 class="cmtt-10"> </span><span
12650 class="cmtt-10"> </span><span
12651 class="cmtt-10"> </span><span
12652 class="cmtt-10"> 0.28387361,</span>
12653 <br class="fancyvrb" /><a
12654 id="x1-125120r60"></a><span
12655 class="cmtt-10"> </span><span
12656 class="cmtt-10"> </span><span
12657 class="cmtt-10"> </span><span
12658 class="cmtt-10"> 0.30232132,</span><span
12659 class="cmtt-10"> </span><span
12660 class="cmtt-10"> </span><span
12661 class="cmtt-10"> </span><span
12662 class="cmtt-10"> 0.32196786,</span><span
12663 class="cmtt-10"> </span><span
12664 class="cmtt-10"> </span><span
12665 class="cmtt-10"> </span><span
12666 class="cmtt-10"> 0.34289114,</span><span
12667 class="cmtt-10"> </span><span
12668 class="cmtt-10"> </span><span
12669 class="cmtt-10"> </span><span
12670 class="cmtt-10"> 0.36517414,</span>
12671 <br class="fancyvrb" /><a
12672 id="x1-125122r61"></a><span
12673 class="cmtt-10"> </span><span
12674 class="cmtt-10"> </span><span
12675 class="cmtt-10"> </span><span
12676 class="cmtt-10"> 0.38890521,</span><span
12677 class="cmtt-10"> </span><span
12678 class="cmtt-10"> </span><span
12679 class="cmtt-10"> </span><span
12680 class="cmtt-10"> 0.41417847,</span><span
12681 class="cmtt-10"> </span><span
12682 class="cmtt-10"> </span><span
12683 class="cmtt-10"> </span><span
12684 class="cmtt-10"> 0.44109412,</span><span
12685 class="cmtt-10"> </span><span
12686 class="cmtt-10"> </span><span
12687 class="cmtt-10"> </span><span
12688 class="cmtt-10"> 0.46975890,</span>
12689 <br class="fancyvrb" /><a
12690 id="x1-125124r62"></a><span
12691 class="cmtt-10"> </span><span
12692 class="cmtt-10"> </span><span
12693 class="cmtt-10"> </span><span
12694 class="cmtt-10"> 0.50028648,</span><span
12695 class="cmtt-10"> </span><span
12696 class="cmtt-10"> </span><span
12697 class="cmtt-10"> </span><span
12698 class="cmtt-10"> 0.53279791,</span><span
12699 class="cmtt-10"> </span><span
12700 class="cmtt-10"> </span><span
12701 class="cmtt-10"> </span><span
12702 class="cmtt-10"> 0.56742212,</span><span
12703 class="cmtt-10"> </span><span
12704 class="cmtt-10"> </span><span
12705 class="cmtt-10"> </span><span
12706 class="cmtt-10"> 0.60429640,</span>
12707 <br class="fancyvrb" /><a
12708 id="x1-125126r63"></a><span
12709 class="cmtt-10"> </span><span
12710 class="cmtt-10"> </span><span
12711 class="cmtt-10"> </span><span
12712 class="cmtt-10"> 0.64356699,</span><span
12713 class="cmtt-10"> </span><span
12714 class="cmtt-10"> </span><span
12715 class="cmtt-10"> </span><span
12716 class="cmtt-10"> 0.68538959,</span><span
12717 class="cmtt-10"> </span><span
12718 class="cmtt-10"> </span><span
12719 class="cmtt-10"> </span><span
12720 class="cmtt-10"> 0.72993007,</span><span
12721 class="cmtt-10"> </span><span
12722 class="cmtt-10"> </span><span
12723 class="cmtt-10"> </span><span
12724 class="cmtt-10"> 0.77736504,</span>
12725 <br class="fancyvrb" /><a
12726 id="x1-125128r64"></a><span
12727 class="cmtt-10"> </span><span
12728 class="cmtt-10"> </span><span
12729 class="cmtt-10"> </span><span
12730 class="cmtt-10"> 0.82788260,</span><span
12731 class="cmtt-10"> </span><span
12732 class="cmtt-10"> </span><span
12733 class="cmtt-10"> </span><span
12734 class="cmtt-10"> 0.88168307,</span><span
12735 class="cmtt-10"> </span><span
12736 class="cmtt-10"> </span><span
12737 class="cmtt-10"> </span><span
12738 class="cmtt-10"> 0.9389798,</span><span
12739 class="cmtt-10"> </span><span
12740 class="cmtt-10"> </span><span
12741 class="cmtt-10"> </span><span
12742 class="cmtt-10"> </span><span
12743 class="cmtt-10"> 1.</span>
12751 <h3 class="sectionHead"><span class="titlemark">A </span> <a
12752 id="x1-126000A"></a>Embedding Vorbis into an Ogg stream</h3>
12753 <!--l. 6--><p class="noindent" >
12754 <h4 class="subsectionHead"><span class="titlemark">A.1 </span> <a
12755 id="x1-127000A.1"></a>Overview</h4>
12756 <!--l. 8--><p class="noindent" >This document describes using Ogg logical and physical transport streams to encapsulate Vorbis
12757 compressed audio packet data into file form.
12758 <!--l. 12--><p class="noindent" >The <a
12759 href="#x1-20001">Section 1<!--tex4ht:ref: vorbis:spec:intro --></a>, “<a
12760 href="#x1-20001">Introduction and Description<!--tex4ht:ref: vorbis:spec:intro --></a>” provides an overview of the construction of Vorbis
12762 <!--l. 15--><p class="noindent" >The <a
12763 href="oggstream.html" >Ogg bitstream overview</a> and <a
12764 href="framing.html" >Ogg logical bitstream and framing spec</a> provide detailed
12765 descriptions of Ogg transport streams. This specification document assumes a working
12766 knowledge of the concepts covered in these named backround documents. Please read them
12768 <!--l. 22--><p class="noindent" >
12769 <h5 class="subsubsectionHead"><span class="titlemark">A.1.1 </span> <a
12770 id="x1-128000A.1.1"></a>Restrictions</h5>
12771 <!--l. 24--><p class="noindent" >The Ogg/Vorbis I specification currently dictates that Ogg/Vorbis streams use Ogg transport
12772 streams in degenerate, unmultiplexed form only. That is:
12773 <ul class="itemize1">
12774 <li class="itemize">A meta-headerless Ogg file encapsulates the Vorbis I packets
12776 <li class="itemize">The Ogg stream may be chained, i.e., contain multiple, contigous logical streams (links).
12778 <li class="itemize">The Ogg stream must be unmultiplexed (only one stream, a Vorbis audio stream, per
12781 <!--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
12782 multi-stream Ogg file. At the time this document was written, Ogg was becoming a popular
12783 container for low-bitrate movies consisting of DivX video and Vorbis audio. However, a ’Vorbis I
12784 audio file’ is taken to imply Vorbis audio existing alone within a degenerate Ogg stream. A
12785 compliant ’Vorbis audio player’ is not required to implement Ogg support beyond the specific
12786 support of Vorbis within a degenrate Ogg stream (naturally, application authors are encouraged to
12787 support full multiplexed Ogg handling).
12791 <!--l. 55--><p class="noindent" >
12792 <h5 class="subsubsectionHead"><span class="titlemark">A.1.2 </span> <a
12793 id="x1-129000A.1.2"></a>MIME type</h5>
12794 <!--l. 57--><p class="noindent" >The MIME type of Ogg files depend on the context. Specifically, complex multimedia and
12795 applications should use <span
12796 class="cmtt-10x-x-109">application/ogg</span>, while visual media should use <span
12797 class="cmtt-10x-x-109">video/ogg</span>, and audio
12799 class="cmtt-10x-x-109">audio/ogg</span>. Vorbis data encapsulated in Ogg may appear in any of those types. RTP encapsulated
12800 Vorbis should use <span
12801 class="cmtt-10x-x-109">audio/vorbis </span>+ <span
12802 class="cmtt-10x-x-109">audio/vorbis-config</span>.
12803 <!--l. 65--><p class="noindent" >
12804 <h4 class="subsectionHead"><span class="titlemark">A.2 </span> <a
12805 id="x1-130000A.2"></a>Encapsulation</h4>
12806 <!--l. 67--><p class="noindent" >Ogg encapsulation of a Vorbis packet stream is straightforward.
12807 <ul class="itemize1">
12808 <li class="itemize">The first Vorbis packet (the identification header), which uniquely identifies a stream
12809 as Vorbis audio, is placed alone in the first page of the logical Ogg stream. This results
12810 in a first Ogg page of exactly 58 bytes at the very beginning of the logical stream.
12812 <li class="itemize">This first page is marked ’beginning of stream’ in the page flags.
12814 <li class="itemize">The second and third vorbis packets (comment and setup headers) may span one or
12815 more pages beginning on the second page of the logical stream. However many pages
12816 they span, the third header packet finishes the page on which it ends. The next (first
12817 audio) packet must begin on a fresh page.
12819 <li class="itemize">The granule position of these first pages containing only headers is zero.
12821 <li class="itemize">The first audio packet of the logical stream begins a fresh Ogg page.
12823 <li class="itemize">Packets are placed into ogg pages in order until the end of stream.
12825 <li class="itemize">The last page is marked ’end of stream’ in the page flags.
12827 <li class="itemize">Vorbis packets may span page boundaries.
12832 <li class="itemize">The granule position of pages containing Vorbis audio is in units of PCM audio samples
12833 (per channel; a stereo stream’s granule position does not increment at twice the speed
12836 <li class="itemize">The granule position of a page represents the end PCM sample position of the last
12838 class="cmti-10x-x-109">completed </span>on that page. The ’last PCM sample’ is the last complete sample
12839 returned by decode, not an internal sample awaiting lapping with a subsequent block. A
12840 page that is entirely spanned by a single packet (that completes on a subsequent page)
12841 has no granule position, and the granule position is set to ’-1’.
12842 <!--l. 126--><p class="noindent" >Note that the last decoded (fully lapped) PCM sample from a packet is not
12843 necessarily the middle sample from that block. If, eg, the current Vorbis packet
12844 encodes a ”long block” and the next Vorbis packet encodes a ”short block”, the last
12845 decodable sample from the current packet be at position (3*long_block_length/4) -
12846 (short_block_length/4).
12848 <li class="itemize">The granule (PCM) position of the first page need not indicate that the stream started
12849 at position zero. Although the granule position belongs to the last completed packet
12850 on the page and a valid granule position must be positive, by inference it may indicate
12851 that the PCM position of the beginning of audio is positive or negative.
12852 <ul class="itemize2">
12853 <li class="itemize">A positive starting value simply indicates that this stream begins at some positive
12854 time offset, potentially within a larger program. This is a common case when
12855 connecting to the middle of broadcast stream.
12857 <li class="itemize">A negative value indicates that output samples preceeding time zero should be
12858 discarded during decoding; this technique is used to allow sample-granularity
12859 editing of the stream start time of already-encoded Vorbis streams. The number
12860 of samples to be discarded must not exceed the overlap-add span of the first two
12863 <!--l. 161--><p class="noindent" >In both of these cases in which the initial audio PCM starting offset is nonzero, the second
12864 finished audio packet must flush the page on which it appears and the third packet begin a
12865 fresh page. This allows the decoder to always be able to perform PCM position adjustments
12866 before needing to return any PCM data from synthesis, resulting in correct positioning
12867 information without any aditional seeking logic.
12868 <!--l. 170--><p class="noindent" ><span class="likesubparagraphHead"><a
12869 id="x1-131000A.2"></a><span
12870 class="cmbx-10x-x-109">Note:</span></span> Failure to do so should, at worst, cause a decoder implementation to return incorrect
12871 positioning information for seeking operations at the very beginning of the stream.
12876 <li class="itemize">A granule position on the final page in a stream that indicates less audio data than the final
12877 packet would normally return is used to end the stream on other than even frame
12878 boundaries. The difference between the actual available data returned and the
12879 declared amount indicates how many trailing samples to discard from the decoding
12885 <h3 class="sectionHead"><span class="titlemark">B </span> <a
12886 id="x1-132000B"></a>Vorbis encapsulation in RTP</h3>
12887 <!--l. 8--><p class="noindent" >Please consult RFC 5215 <span
12888 class="cmti-10x-x-109">“RTP Payload Format for Vorbis Encoded Audio” </span>for description of how
12889 to embed Vorbis audio in an RTP stream.
12896 <h3 class="likesectionHead"><a
12897 id="x1-133000B"></a>Colophon</h3>
12898 <!--l. 6--><p class="noindent" ><img
12899 src="Vorbis_I_spec13x.png" alt="PIC" class="graphics"><!--tex4ht:graphics
12900 name="Vorbis_I_spec13x.png" src="xifish.pdf"
12902 <!--l. 10--><p class="noindent" >Ogg is a <a
12903 href="http://www.xiph.org/" >Xiph.org Foundation</a> effort to protect essential tenets of Internet multimedia from
12904 corporate hostage-taking; Open Source is the net’s greatest tool to keep everyone honest. See <a
12905 href="http://www.xiph.org/about.html" >About
12906 the Xiph.org Foundation</a> for details.
12907 <!--l. 17--><p class="noindent" >Ogg Vorbis is the first Ogg audio CODEC. Anyone may freely use and distribute the Ogg and
12908 Vorbis specification, whether in a private, public or corporate capacity. However, the Xiph.org
12909 Foundation and the Ogg project (xiph.org) reserve the right to set the Ogg Vorbis specification and
12910 certify specification compliance.
12911 <!--l. 23--><p class="noindent" >Xiph.org’s Vorbis software CODEC implementation is distributed under a BSD-like license. This
12912 does not restrict third parties from distributing independent implementations of Vorbis software
12913 under other licenses.
12914 <!--l. 28--><p class="noindent" >Ogg, Vorbis, Xiph.org Foundation and their logos are trademarks (tm) of the <a
12915 href="http://www.xiph.org/" >Xiph.org
12916 Foundation</a>. These pages are copyright (C) 1994-2007 Xiph.org Foundation. All rights
12918 <!--l. 33--><p class="noindent" >This document is set using <span class="LATEX">L<span class="A">A</span><span class="TEX">T<span
12919 class="E">E</span>X</span></span>.
12923 <h3 class="likesectionHead"><a
12924 id="x1-134000B"></a>References</h3>
12925 <!--l. 130--><p class="noindent" >
12926 <div class="thebibliography">
12927 <p class="bibitem" ><span class="biblabel">
12928 [1]<span class="bibsp">   </span></span><a
12929 id="XSporer/Brandenburg/Edler"></a>T. Sporer, K. Brandenburg
12930 and B. Edler, The use of multirate filter banks for coding of high quality digital audio,
12932 href="http://www.iocon.com/resource/docs/ps/eusipco_corrected.ps" class="url" ><span
12933 class="cmtt-10x-x-109">http://www.iocon.com/resource/docs/ps/eusipco_corrected.ps</span></a>.