speex_encode/speex_decode are back to using floats, new speex_encode_int
[speexdsp.git] / doc / manual.lyx
1 #LyX 1.3 created this file. For more info see http://www.lyx.org/
2 \lyxformat 221
3 \textclass article
4 \language english
5 \inputencoding auto
6 \fontscheme pslatex
7 \graphics default
8 \paperfontsize default
9 \spacing single 
10 \papersize letterpaper
11 \paperpackage a4
12 \use_geometry 0
13 \use_amsmath 0
14 \use_natbib 0
15 \use_numerical_citations 0
16 \paperorientation portrait
17 \secnumdepth 3
18 \tocdepth 3
19 \paragraph_separation indent
20 \defskip medskip
21 \quotes_language english
22 \quotes_times 2
23 \papercolumns 1
24 \papersides 1
25 \paperpagestyle headings
26
27 \layout Title
28
29 The Speex Codec Manual
30 \newline 
31 (version 1.0.3)
32 \layout Author
33
34 Jean-Marc Valin
35 \layout Standard
36 \pagebreak_top 
37 Copyright (c) 2002-2003 Jean-Marc Valin.
38 \layout Standard
39
40 Permission is granted to copy, distribute and/or modify this document under
41  the terms of the GNU Free Documentation License, Version 1.1 or any later
42  version published by the Free Software Foundation; with no Invariant Section,
43  with no Front-Cover Texts, and with no Back-Cover.
44  A copy of the license is included in the section entitled "GNU Free Documentati
45 on License".
46  
47 \layout Standard
48 \pagebreak_top \pagebreak_bottom 
49
50 \begin_inset LatexCommand \tableofcontents{}
51
52 \end_inset 
53
54
55 \layout Standard
56 \pagebreak_bottom 
57
58 \begin_inset FloatList table
59
60 \end_inset 
61
62
63 \layout Section
64
65 Introduction to Speex
66 \layout Standard
67
68 The Speex project (
69 \family typewriter 
70 http://www.speex.org/
71 \family default 
72 ) has been started because there was a need for a speech codec that was
73  open-source and free from software patents.
74  These are essential conditions for being used by any open-source software.
75  There is already Vorbis that does general audio, but it is not really suitable
76  for speech.
77  Also, unlike many other speech codecs, Speex is not targeted at cell phones
78  (not many open-source cell phones anyway :-) ) but rather at voice over
79  IP (VoIP) and file-based compression.
80  
81 \layout Standard
82
83 As design goals, we wanted to have a codec that would allow both very good
84  quality speech and low bit-rate (unfortunately not at the same time!),
85  which led us to developing a codec with multiple bit-rates.
86  Of course very good quality also meant we had to do wideband (16 kHz sampling
87  rate) in addition to narrowband (telephone quality, 8 kHz sampling rate).
88 \layout Standard
89
90 Designing for VoIP instead of cell phone use means that Speex must be robust
91  to lost packets, but not to corrupted ones since packets either arrive
92  unaltered or don't arrive at all.
93  Also, the idea was to have a reasonable complexity and memory requirement
94  without compromising too much on the efficiency of the codec.
95 \layout Standard
96
97 All this led us to the choice of CELP
98 \begin_inset LatexCommand \index{CELP}
99
100 \end_inset 
101
102  as the encoding technique to use for Speex.
103  One of the main reasons is that CELP has long proved that it could do the
104  job and scale well to both low bit-rates (think DoD CELP @ 4.8 kbps) and
105  high bit-rates (think G.728 @ 16 kbps).
106  
107 \layout Standard
108
109 The main characteristics can be summarized as follows:
110 \layout Itemize
111
112 Free software/open-source
113 \begin_inset LatexCommand \index{open-source}
114
115 \end_inset 
116
117 , patent
118 \begin_inset LatexCommand \index{patent}
119
120 \end_inset 
121
122  and royalty-free
123 \layout Itemize
124
125 Integration of narrowband
126 \begin_inset LatexCommand \index{narrowband}
127
128 \end_inset 
129
130  and wideband
131 \begin_inset LatexCommand \index{wideband}
132
133 \end_inset 
134
135  in the same bit-stream
136 \layout Itemize
137
138 Wide range of bit-rates available (from 2 kbps to 44 kbps)
139 \layout Itemize
140
141 Dynamic bit-rate switching and Variable Bit-Rate
142 \begin_inset LatexCommand \index{variable bit-rate}
143
144 \end_inset 
145
146  (VBR)
147 \layout Itemize
148
149 Voice Activity Detection
150 \begin_inset LatexCommand \index{voice activity detection}
151
152 \end_inset 
153
154  (VAD, integrated with VBR)
155 \layout Itemize
156
157 Variable complexity
158 \begin_inset LatexCommand \index{complexity}
159
160 \end_inset 
161
162
163 \layout Itemize
164
165 Ultra-wideband mode at 32 kHz (up to 48 kHz)
166 \layout Itemize
167
168 Intensity stereo encoding option
169 \layout Standard
170
171 This document is divided in the following way.
172  Section 
173 \begin_inset LatexCommand \ref{sec:Feature-description}
174
175 \end_inset 
176
177  describes the different Speex features and defines some terms that will
178  be used in later sections.
179  Section 
180 \begin_inset LatexCommand \ref{sec:Command-line-encoder/decoder}
181
182 \end_inset 
183
184  provides information about the standard command-line tools, while 
185 \begin_inset LatexCommand \ref{sec:Programming-with-Speex}
186
187 \end_inset 
188
189  contains information about programming using the Speex API.
190  Section 
191 \begin_inset LatexCommand \ref{sec:Formats-and-standards}
192
193 \end_inset 
194
195  has some information related to Speex and standards.
196  The three last sections describe the internals of the codec and require
197  some signal processing knowledge.
198  Section 
199 \begin_inset LatexCommand \ref{sec:Introduction-to-CELP}
200
201 \end_inset 
202
203  explains the general idea behind CELP, while sections 
204 \begin_inset LatexCommand \ref{sec:Speex-narrowband-mode}
205
206 \end_inset 
207
208  and 
209 \begin_inset LatexCommand \ref{sec:Speex-wideband-mode}
210
211 \end_inset 
212
213  are specific to Speex.
214  Note that if you are only interested in using Speex, those three last sections
215  are not required.
216 \layout Section
217 \pagebreak_top 
218 Feature description
219 \begin_inset LatexCommand \label{sec:Feature-description}
220
221 \end_inset 
222
223
224 \layout Standard
225
226 This section explains the main Speex features, as well as some concepts
227  in speech coding that help better understand the next sections.
228  
229 \layout Subsection*
230
231 Sampling rate
232 \begin_inset LatexCommand \index{sampling rate}
233
234 \end_inset 
235
236
237 \layout Standard
238
239 Speex is mainly designed for 3 different sampling rates: 8 kHz, 16 kHz,
240  and 32 kHz.
241  These are respectively refered to as narrowband
242 \begin_inset LatexCommand \index{narrowband}
243
244 \end_inset 
245
246 , wideband
247 \begin_inset LatexCommand \index{wideband}
248
249 \end_inset 
250
251  and ultra-wideband
252 \begin_inset LatexCommand \index{ultra-wideband}
253
254 \end_inset 
255
256 .
257  
258 \layout Subsection*
259
260 Quality
261 \begin_inset LatexCommand \index{quality}
262
263 \end_inset 
264
265
266 \layout Standard
267
268 Speex encoding is controlled most of the time by a quality parameter that
269  ranges from 0 to 10.
270  In constant bit-rate
271 \begin_inset LatexCommand \index{constant bit-rate}
272
273 \end_inset 
274
275  (CBR) operation, the quality parameter is an integer, while for variable
276  bit-rate (VBR), the parameter is a float.
277  
278 \layout Subsection*
279
280 Complexity
281 \begin_inset LatexCommand \index{complexity}
282
283 \end_inset 
284
285  (variable)
286 \layout Standard
287
288 With Speex, it is possible to vary the complexity allowed for the encoder.
289  This is done by controlling how the search is performed with an integer
290  ranging from 1 to 10 in a way that's similar to the -1 to -9 options to
291  
292 \emph on 
293 gzip
294 \emph default 
295  and 
296 \emph on 
297 bzip2
298 \emph default 
299  compression utilities.
300  For normal use, the noise level at complexity 1 is between 1 and 2 dB higher
301  than at complexity 10, but the CPU requirements for complexity 10 is about
302  5 times higher than for complexity 1.
303  In practice, the best trade-off is between complexity 2 and 4, though higher
304  settings are often useful when encoding non-speech sounds like DTMF
305 \begin_inset LatexCommand \index{DTMF}
306
307 \end_inset 
308
309  tones.
310 \layout Subsection*
311
312 Variable Bit-Rate
313 \begin_inset LatexCommand \index{variable bit-rate}
314
315 \end_inset 
316
317  (VBR)
318 \layout Standard
319
320 Variable bit-rate (VBR) allows a codec to change its bit-rate dynamically
321  to adapt to the 
322 \begin_inset Quotes eld
323 \end_inset 
324
325 difficulty
326 \begin_inset Quotes erd
327 \end_inset 
328
329  of the audio being encoded.
330  In the example of Speex, sounds like vowels and high-energy transients
331  require a higher bit-rate to achieve good quality, while fricatives (e.g.
332  s,f sounds) can be coded adequately with less bits.
333  For this reason, VBR can achive lower bit-rate for the same quality, or
334  a better quality for a certain bit-rate.
335  Despite its advantages, VBR has two main drawbacks: first, by only specifying
336  quality, there's no guaranty about the final average bit-rate.
337  Second, for some real-time applications like voice over IP (VoIP), what
338  counts is the maximum bit-rate, which must be low enough for the communication
339  channel.
340 \layout Subsection*
341
342 Average Bit-Rate
343 \begin_inset LatexCommand \index{average bit-rate}
344
345 \end_inset 
346
347  (ABR)
348 \layout Standard
349
350 Average bit-rate solves one of the problems of VBR, as it dynamically adjusts
351  VBR quality in order to meet a specific target bit-rate.
352  Because the quality/bit-rate is adjusted in real-time (open-loop), the
353  global quality will be slightly lower than that obtained by encoding in
354  VBR with exactly the right quality setting to meet the target average bit-rate.
355 \layout Subsection*
356
357 Voice Activity Detection
358 \begin_inset LatexCommand \index{voice activity detection}
359
360 \end_inset 
361
362  (VAD)
363 \layout Standard
364
365 When enabled, voice activity detection detects whether the audio being encoded
366  is speech or silence/background noise.
367  VAD is always implicitly activated when encoding in VBR, so the option
368  is only useful in non-VBR operation.
369  In this case, Speex detects non-speech periods and encode them with just
370  enough bits to reproduce the background noise.
371  This is called 
372 \begin_inset Quotes eld
373 \end_inset 
374
375 comfort noise generation
376 \begin_inset Quotes erd
377 \end_inset 
378
379  (CNG).
380 \layout Subsection*
381
382 Discontinuous Transmission
383 \begin_inset LatexCommand \index{discontinuous transmission}
384
385 \end_inset 
386
387  (DTX)
388 \layout Standard
389
390 Discontinuous transmission is an addition to VAD/VBR operation, that allows
391  to stop transmitting completely when the background noise is stationary.
392  In file-based operation, since we cannot just stop writing to the file,
393  only 5 bits are used for such frames (corresponding to 250 bps).
394 \layout Subsection*
395
396 Perceptual enhancement
397 \begin_inset LatexCommand \index{perceptual enhancement}
398
399 \end_inset 
400
401
402 \layout Standard
403
404 Perceptual enhancement is a part of the decoder which, when turned on, tries
405  to reduce (the perception of) the noise produced by the coding/decoding
406  process.
407  In most cases, perceptual enhancement make the sound further from the original
408  
409 \emph on 
410 objectively
411 \emph default 
412  (if you use SNR), but in the end it still 
413 \emph on 
414 sounds
415 \emph default 
416  better (subjective improvement).
417 \layout Subsection*
418
419 Algorithmic delay
420 \begin_inset LatexCommand \index{algorithmic delay}
421
422 \end_inset 
423
424
425 \layout Standard
426
427 Every speech codec introduces a delay in the transmission.
428  For Speex, this delay is equal to the frame size, plus some amount of 
429 \begin_inset Quotes eld
430 \end_inset 
431
432 look-ahead
433 \begin_inset Quotes erd
434 \end_inset 
435
436  required to process each frame.
437  In narrowband operation (8 kHz), the delay is 30 ms, while for wideband
438  (16 kHz), the delay is 34 ms.
439  These values don't account for the CPU time it takes to encode or decode
440  the frames.
441 \layout Section
442 \pagebreak_top 
443 Command-line encoder/decoder
444 \begin_inset LatexCommand \label{sec:Command-line-encoder/decoder}
445
446 \end_inset 
447
448
449 \layout Standard
450
451 The base Speex distribution includes a command-line encoder (
452 \emph on 
453 speexenc
454 \emph default 
455 ) and decoder (
456 \emph on 
457 speexdec
458 \emph default 
459 ).
460  This section describes how to use these tools.
461 \layout Subsection
462
463
464 \emph on 
465 speexenc
466 \begin_inset LatexCommand \index{speexenc}
467
468 \end_inset 
469
470
471 \layout Standard
472
473 The 
474 \emph on 
475 speexenc
476 \emph default 
477  utility is used to create Speex files from raw PCM or wave files.
478  It can be used by calling: 
479 \layout LyX-Code
480
481 speexenc [options] input_file output_file
482 \layout Standard
483
484 The value '-' for input_file or output_file corresponds respectively to
485  stdin and stdout.
486  The valid options are:
487 \layout Description
488
489 --narrowband\SpecialChar ~
490 (-n) Tell Speex to treat the input as narrowband (8 kHz).
491  This is the default
492 \layout Description
493
494 --wideband\SpecialChar ~
495 (-w) Tell Speex to treat the input as wideband (16 kHz)
496 \layout Description
497
498 --ultra-wideband\SpecialChar ~
499 (-u) Tell Speex to treat the input as 
500 \begin_inset Quotes eld
501 \end_inset 
502
503 ultra-wideband
504 \begin_inset Quotes erd
505 \end_inset 
506
507  (32 kHz)
508 \layout Description
509
510 --quality\SpecialChar ~
511 n Set the encoding quality (0-10), default is 8
512 \layout Description
513
514 --bitrate\SpecialChar ~
515 n Encoding bit-rate (use bit-rate n or lower) 
516 \layout Description
517
518 --vbr Enable VBR (Variable Bit-Rate), disabled by default
519 \layout Description
520
521 --abr\SpecialChar ~
522 n Enable ABR (Average Bit-Rate) at n kbps, disabled by default
523 \layout Description
524
525 --vad Enable VAD (Voice Activity Detection), disabled by default
526 \layout Description
527
528 --dtx Enable DTX (Discontinuous Transmission), disabled by default
529 \layout Description
530
531 --nframes\SpecialChar ~
532 n Pack n frames in each Ogg packet (this saves space at low bit-rates)
533 \layout Description
534
535 --comp\SpecialChar ~
536 n Set encoding speed/quality tradeoff.
537  The higher the value of n, the slower the encoding (default is 3)
538 \layout Description
539
540 -V Verbose operation, print bit-rate currently in use
541 \layout Description
542
543 --help\SpecialChar ~
544 (-h) Print the help
545 \layout Description
546
547 --version\SpecialChar ~
548 (-v) Print version information
549 \layout Subsubsection*
550
551 Speex comments
552 \layout Description
553
554 --comment Add the given string as an extra comment.
555  This may be used multiple times.
556  
557 \layout Description
558
559 --author Author of this track.
560  
561 \layout Description
562
563 --title Title for this track.
564  
565 \layout Subsubsection*
566
567 Raw input options
568 \layout Description
569
570 --rate\SpecialChar ~
571 n Sampling rate for raw input
572 \layout Description
573
574 --stereo Consider raw input as stereo 
575 \layout Description
576
577 --le Raw input is little-endian 
578 \layout Description
579
580 --be Raw input is big-endian 
581 \layout Description
582
583 --8bit Raw input is 8-bit unsigned 
584 \layout Description
585
586 --16bit Raw input is 16-bit signed 
587 \layout Subsection
588
589
590 \emph on 
591 speexdec
592 \begin_inset LatexCommand \index{speexdec}
593
594 \end_inset 
595
596
597 \layout Standard
598
599 The 
600 \emph on 
601 speexdec
602 \emph default 
603  utility is used to decode Speex files and can be used by calling: 
604 \layout LyX-Code
605
606 speexdec [options] speex_file [output_file]
607 \layout Standard
608
609 The value '-' for input_file or output_file corresponds respectively to
610  stdin and stdout.
611  Also, when no output_file is specified, the file is played to the soundcard.
612  The valid options are:
613 \layout Description
614
615 --enh enable post-filter (default)
616 \layout Description
617
618 --no-enh disable post-filter
619 \layout Description
620
621 --force-nb Force decoding in narrowband 
622 \layout Description
623
624 --force-wb Force decoding in wideband 
625 \layout Description
626
627 --force-uwb Force decoding in ultra-wideband 
628 \layout Description
629
630 --mono Force decoding in mono 
631 \layout Description
632
633 --stereo Force decoding in stereo 
634 \layout Description
635
636 --rate\SpecialChar ~
637 n Force decoding at n Hz sampling rate
638 \layout Description
639
640 --packet-loss\SpecialChar ~
641 n Simulate n % random packet loss
642 \layout Description
643
644 -V Verbose operation, print bit-rate currently in use
645 \layout Description
646
647 --help\SpecialChar ~
648 (-h) Print the help
649 \layout Description
650
651 --version\SpecialChar ~
652 (-v) Print version information
653 \layout Section
654 \pagebreak_top 
655 Programming with Speex (the libspeex
656 \begin_inset LatexCommand \index{libspeex}
657
658 \end_inset 
659
660  API
661 \begin_inset LatexCommand \index{API}
662
663 \end_inset 
664
665 )
666 \begin_inset LatexCommand \label{sec:Programming-with-Speex}
667
668 \end_inset 
669
670
671 \layout Standard
672
673 This section explains how to use the Speex API.
674  Examples of code can also be found in appendix 
675 \begin_inset LatexCommand \ref{sec:Sample-code}
676
677 \end_inset 
678
679 .
680 \layout Subsection
681
682 Encoding
683 \layout Standard
684
685 In order to encode speech using Speex, you first need to:
686 \layout LyX-Code
687
688 #include <speex.h>
689 \layout Standard
690
691 You then need to declare a Speex bit-packing struct
692 \layout LyX-Code
693
694 SpeexBits bits;
695 \layout Standard
696
697 and a Speex encoder state
698 \layout LyX-Code
699
700 void *enc_state;
701 \layout Standard
702
703 The two are initialized by:
704 \layout LyX-Code
705
706 speex_bits_init(&bits);
707 \layout LyX-Code
708
709 enc_state = speex_encoder_init(&speex_nb_mode);
710 \layout Standard
711
712 For wideband coding, 
713 \emph on 
714 speex_nb_mode
715 \emph default 
716  will be replaced by 
717 \emph on 
718 speex_wb_mode
719 \emph default 
720 .
721  In most cases, you will need to know the frame size used by the mode you
722  are using.
723  You can get that value in the 
724 \emph on 
725 frame_size
726 \emph default 
727  variable with:
728 \layout LyX-Code
729
730 speex_encoder_ctl(enc_state,SPEEX_GET_FRAME_SIZE,&frame_size);
731 \layout Standard
732
733 Once the initialization is done, for every input frame:
734 \layout LyX-Code
735
736 speex_bits_reset(&bits);
737 \layout LyX-Code
738
739 speex_encode(enc_state, input_frame, &bits);
740 \layout LyX-Code
741
742 nbBytes = speex_bits_write(&bits, byte_ptr, MAX_NB_BYTES);
743 \layout Standard
744
745 where 
746 \emph on 
747 input_frame
748 \emph default 
749  is a 
750 \emph on 
751 (float *)
752 \emph default 
753  pointing to the beginning of a speech frame, 
754 \emph on 
755 byte_ptr
756 \emph default 
757  is a 
758 \emph on 
759 (char *)
760 \emph default 
761  where the encoded frame will be written, 
762 \emph on 
763 MAX_NB_BYTES
764 \emph default 
765  is the maximum number of bytes that can be written to 
766 \emph on 
767 byte_ptr
768 \emph default 
769  without causing an overflow and 
770 \emph on 
771 nbBytes
772 \emph default 
773  is the number of bytes actually written to 
774 \emph on 
775 byte_ptr
776 \emph default 
777  (the encoded size in bytes).
778  Before calling speex_bits_write, it is possible to find the number of bytes
779  that need to be written by calling 
780 \family typewriter 
781 speex_bits_nbytes(&bits)
782 \family default 
783 , which returns a number of bytes.
784  
785 \layout Standard
786
787 After you're done with the encoding, free all resources with:
788 \layout LyX-Code
789
790 speex_bits_destroy(&bits);
791 \layout LyX-Code
792
793 speex_encoder_destroy(enc_state);
794 \layout Standard
795
796 That's about it for the encoder.
797  
798 \layout Subsection
799
800 Decoding
801 \layout Standard
802
803 In order to encode speech using Speex, you first need to:
804 \layout LyX-Code
805
806 #include <speex.h>
807 \layout Standard
808
809 You also need to declare a Speex bit-packing struct
810 \layout LyX-Code
811
812 SpeexBits bits;
813 \layout Standard
814
815 and a Speex encoder state
816 \layout LyX-Code
817
818 void *dec_state;
819 \layout Standard
820
821 The two are initialized by:
822 \layout LyX-Code
823
824 speex_bits_init(&bits);
825 \layout LyX-Code
826
827 dec_state = speex_decoder_init(&speex_nb_mode);
828 \layout Standard
829
830 For wideband decoding, 
831 \emph on 
832 speex_nb_mode
833 \emph default 
834  will be replaced by 
835 \emph on 
836 speex_wb_mode
837 \emph default 
838 .
839  If you need to obtain the size of the frames that will be used by the decoder,
840  you can get that value in the 
841 \emph on 
842 frame_size
843 \emph default 
844  variable with:
845 \layout LyX-Code
846
847 speex_decoder_ctl(dec_state, SPEEX_GET_FRAME_SIZE, &frame_size); 
848 \layout Standard
849
850 There is also a parameter that can be set for the decoder: whether or not
851  to use a perceptual post-filter.
852  This can be set by: 
853 \layout LyX-Code
854
855 speex_decoder_ctl(dec_state, SPEEX_SET_ENH, &enh); 
856 \layout Standard
857
858 where 
859 \emph on 
860 enh
861 \emph default 
862  is an int that with value 0 to have the post-filter disabled and 1 to have
863  it enabled.
864 \layout Standard
865
866 Again, once the decoder initialization is done, for every input frame:
867 \layout LyX-Code
868
869 speex_bits_read_from(&bits, input_bytes, nbBytes);
870 \layout LyX-Code
871
872 speex_decode(dec_state, &bits, output_frame);
873 \layout Standard
874
875 where input_bytes is a 
876 \emph on 
877 (char *)
878 \emph default 
879  containing the bit-stream data received for a frame, 
880 \emph on 
881 nbBytes
882 \emph default 
883  is the size (in bytes) of that bit-stream, and 
884 \emph on 
885 output_frame
886 \emph default 
887  is a 
888 \emph on 
889 (float *)
890 \emph default 
891  and points to the area where the decoded speech frame will be written.
892  A NULL value as the first argument indicates that we don't have the bits
893  for the current frame.
894  When a frame is lost, the Speex decoder will do its best to "guess" the
895  correct signal.
896 \layout Standard
897
898 After you're done with the decoding, free all resources with:
899 \layout LyX-Code
900
901 speex_bits_destroy(&bits);
902 \layout LyX-Code
903
904 speex_decoder_destroy(dec_state);
905 \layout Subsection
906
907 Codec Options (speex_*_ctl)
908 \layout Standard
909
910 The Speex encoder and decoder support many options and requests that can
911  be accessed through the 
912 \emph on 
913 speex_encoder_ctl
914 \emph default 
915  and 
916 \emph on 
917 speex_decoder_ctl
918 \emph default 
919  functions.
920  These functions are similar to the 
921 \emph on 
922 ioctl
923 \emph default 
924  system call and their prototypes are:
925 \layout LyX-Code
926
927 void speex_encoder_ctl(void *encoder, int request, void *ptr);
928 \layout LyX-Code
929
930 void speex_decoder_ctl(void *encoder, int request, void *ptr);
931 \layout Standard
932
933 The different values of request allowed are (note that some only apply to
934  the encoder or the decoder):
935 \layout Description
936
937 SPEEX_SET_ENH** Set perceptual enhancer
938 \begin_inset LatexCommand \index{perceptual enhancement}
939
940 \end_inset 
941
942  to on (1) or off (0) (integer)
943 \layout Description
944
945 SPEEX_GET_ENH** Get perceptual enhancer status (integer)
946 \layout Description
947
948 SPEEX_GET_FRAME_SIZE Get the frame size used for the current mode (integer)
949 \layout Description
950
951 SPEEX_SET_QUALITY* Set the encoder speech quality (integer 0 to 10)
952 \layout Description
953
954 SPEEX_GET_QUALITY* Get the current encoder speech quality (integer 0 to
955  10)
956 \layout Description
957
958 SPEEX_SET_MODE*
959 \begin_inset Formula $\dagger$
960 \end_inset 
961
962
963 \layout Description
964
965 SPEEX_GET_MODE*
966 \begin_inset Formula $\dagger$
967 \end_inset 
968
969
970 \layout Description
971
972 SPEEX_SET_LOW_MODE*
973 \begin_inset Formula $\dagger$
974 \end_inset 
975
976
977 \layout Description
978
979 SPEEX_GET_LOW_MODE*
980 \begin_inset Formula $\dagger$
981 \end_inset 
982
983
984 \layout Description
985
986 SPEEX_SET_HIGH_MODE*
987 \begin_inset Formula $\dagger$
988 \end_inset 
989
990
991 \layout Description
992
993 SPEEX_GET_HIGH_MODE*
994 \begin_inset Formula $\dagger$
995 \end_inset 
996
997
998 \layout Description
999
1000 SPEEX_SET_VBR* Set variable bit-rate (VBR) to on (1) or off (0) (integer)
1001 \layout Description
1002
1003 SPEEX_GET_VBR* Get variable bit-rate
1004 \begin_inset LatexCommand \index{variable bit-rate}
1005
1006 \end_inset 
1007
1008  (VBR) status (integer)
1009 \layout Description
1010
1011 SPEEX_SET_VBR_QUALITY* Set the encoder VBR speech quality (float 0 to 10)
1012 \layout Description
1013
1014 SPEEX_GET_VBR_QUALITY* Get the current encoder VBR speech quality (float
1015  0 to 10)
1016 \layout Description
1017
1018 SPEEX_SET_COMPLEXITY* Set the CPU resources allowed for the encoder (integer
1019  1 to 10)
1020 \layout Description
1021
1022 SPEEX_GET_COMPLEXITY* Get the CPU resources allowed for the encoder (integer
1023  1 to 10)
1024 \layout Description
1025
1026 SPEEX_SET_BITRATE* Set the bit-rate to use to the closest value not exceeding
1027  the parameter (integer in bps)
1028 \layout Description
1029
1030 SPEEX_GET_BITRATE Get the current bit-rate in use (integer in bps)
1031 \layout Description
1032
1033 SPEEX_SET_SAMPLING_RATE Set real sampling rate (integer in Hz)
1034 \layout Description
1035
1036 SPEEX_GET_SAMPLING_RATE Get real sampling rate (integer in Hz)
1037 \layout Description
1038
1039 SPEEX_RESET_STATE Reset the encoder/decoder state to its original state
1040  (zeros all memories)
1041 \layout Description
1042
1043 SPEEX_SET_VAD* Set voice activity detection
1044 \begin_inset LatexCommand \index{voice activity detection}
1045
1046 \end_inset 
1047
1048  (VAD) to on (1) or off (0) (integer)
1049 \layout Description
1050
1051 SPEEX_GET_VAD* Get voice activity detection (VAD) status (integer)
1052 \layout Description
1053
1054 SPEEX_SET_DTX* Set discontinuous transmission
1055 \begin_inset LatexCommand \index{discontinuous transmission}
1056
1057 \end_inset 
1058
1059  (DTX) to on (1) or off (0) (integer)
1060 \layout Description
1061
1062 SPEEX_GET_DTX* Get discontinuous transmission (DTX) status (integer)
1063 \layout Description
1064
1065 SPEEX_SET_ABR* Set average bit-rate
1066 \begin_inset LatexCommand \index{average bit-rate}
1067
1068 \end_inset 
1069
1070  (ABR) to a value n in bits per second (integer in bps)
1071 \layout Description
1072
1073 SPEEX_GET_ABR* Get average bit-rate (ABR) setting (integer in bps)
1074 \layout Description
1075
1076 * applies only to the encoder
1077 \layout Description
1078
1079 ** applies only to the decoder
1080 \layout Description
1081
1082
1083 \begin_inset Formula $\dagger$
1084 \end_inset 
1085
1086  normally only used internally
1087 \layout Subsection
1088
1089 Mode queries
1090 \layout Standard
1091
1092 Speex modes have a query system similar to the speex_encoder_ctl and speex_decod
1093 er_ctl calls.
1094  Since modes are read-only, it is only possible to get information about
1095  a particular mode.
1096  The function used to do that is:
1097 \layout LyX-Code
1098
1099 void speex_mode_query(SpeexMode *mode, int request, void *ptr);
1100 \layout Standard
1101
1102 The admissible values for request are (unless otherwise note, the values
1103  are returned through 
1104 \emph on 
1105 ptr
1106 \emph default 
1107 ):
1108 \layout Description
1109
1110 SPEEX_MODE_FRAME_SIZE Get the frame size (in samples) for the mode
1111 \layout Description
1112
1113 SPEEX_SUBMODE_BITRATE Get the bit-rate for a submode number specified through
1114  
1115 \emph on 
1116 ptr
1117 \emph default 
1118  (integer in bps).
1119  
1120 \layout Subsection
1121
1122 Packing and in-band signalling
1123 \begin_inset LatexCommand \index{in-band signalling}
1124
1125 \end_inset 
1126
1127
1128 \layout Standard
1129
1130 Sometimes it is desirable to pack more than one frame per packet (or other
1131  basic unit of storage).
1132  The proper way to do it is to call speex_encode 
1133 \begin_inset Formula $N$
1134 \end_inset 
1135
1136  times before writing the stream with speex_bits_write.
1137  In cases where the number of frames is not determined by an out-of-band
1138  mechanism, it is possible to include a terminator code.
1139  That terminator consists of the code 15 (decimal) encoded with 5 bits,
1140  as shown in figure 
1141 \begin_inset LatexCommand \ref{cap:quality_vs_bps}
1142
1143 \end_inset 
1144
1145 .
1146  Note that as of version 1.0.2, calling speex_bits_write automatically inserts
1147  the terminator so as to fill the last byte.
1148  This doesn't involves any overhead and makes sure Speex can always detect
1149  when there is no more frame in a packet.
1150 \layout Standard
1151
1152 It is also possible to send in-band 
1153 \begin_inset Quotes eld
1154 \end_inset 
1155
1156 messages
1157 \begin_inset Quotes erd
1158 \end_inset 
1159
1160  to the other side.
1161  All these messages are encoded as 
1162 \begin_inset Quotes eld
1163 \end_inset 
1164
1165 pseudo-frames
1166 \begin_inset Quotes erd
1167 \end_inset 
1168
1169  of mode 14 which contain a 4-bit message type code, followed by the message.
1170  Table 
1171 \begin_inset LatexCommand \ref{cap:In-band-signalling-codes}
1172
1173 \end_inset 
1174
1175  lists the available codes, their meaning and the size of the message that
1176  follows.
1177  Most of these messages are requests that are sent to the encoder or decoder
1178  on the other end, which is free to comply or ignore them.
1179  By default, all in-band messages are ignored.
1180 \layout Standard
1181
1182
1183 \begin_inset Float table
1184 placement htbp
1185 wide false
1186 collapsed false
1187
1188 \layout Standard
1189
1190
1191 \begin_inset  Tabular
1192 <lyxtabular version="3" rows="17" columns="3">
1193 <features>
1194 <column alignment="center" valignment="top" leftline="true" width="0pt">
1195 <column alignment="center" valignment="top" leftline="true" width="0pt">
1196 <column alignment="center" valignment="top" leftline="true" rightline="true" width="0pt">
1197 <row topline="true" bottomline="true">
1198 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1199 \begin_inset Text
1200
1201 \layout Standard
1202
1203 Code
1204 \end_inset 
1205 </cell>
1206 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1207 \begin_inset Text
1208
1209 \layout Standard
1210
1211 Size (bits)
1212 \end_inset 
1213 </cell>
1214 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1215 \begin_inset Text
1216
1217 \layout Standard
1218
1219 Content
1220 \end_inset 
1221 </cell>
1222 </row>
1223 <row topline="true">
1224 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1225 \begin_inset Text
1226
1227 \layout Standard
1228
1229 0
1230 \end_inset 
1231 </cell>
1232 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1233 \begin_inset Text
1234
1235 \layout Standard
1236
1237 1
1238 \end_inset 
1239 </cell>
1240 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1241 \begin_inset Text
1242
1243 \layout Standard
1244
1245 Asks decoder to set perceptual enhancement off (0) or on(1)
1246 \end_inset 
1247 </cell>
1248 </row>
1249 <row topline="true">
1250 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1251 \begin_inset Text
1252
1253 \layout Standard
1254
1255 1
1256 \end_inset 
1257 </cell>
1258 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1259 \begin_inset Text
1260
1261 \layout Standard
1262
1263 1
1264 \end_inset 
1265 </cell>
1266 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1267 \begin_inset Text
1268
1269 \layout Standard
1270
1271 Asks (if 1) the encoder to be less 
1272 \begin_inset Quotes eld
1273 \end_inset 
1274
1275 agressive
1276 \begin_inset Quotes erd
1277 \end_inset 
1278
1279  due to high packet loss
1280 \end_inset 
1281 </cell>
1282 </row>
1283 <row topline="true">
1284 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1285 \begin_inset Text
1286
1287 \layout Standard
1288
1289 2
1290 \end_inset 
1291 </cell>
1292 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1293 \begin_inset Text
1294
1295 \layout Standard
1296
1297 4
1298 \end_inset 
1299 </cell>
1300 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1301 \begin_inset Text
1302
1303 \layout Standard
1304
1305 Asks encoder to switch to mode N
1306 \end_inset 
1307 </cell>
1308 </row>
1309 <row topline="true">
1310 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1311 \begin_inset Text
1312
1313 \layout Standard
1314
1315 3
1316 \end_inset 
1317 </cell>
1318 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1319 \begin_inset Text
1320
1321 \layout Standard
1322
1323 4
1324 \end_inset 
1325 </cell>
1326 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1327 \begin_inset Text
1328
1329 \layout Standard
1330
1331 Asks encoder to switch to mode N for low-band
1332 \end_inset 
1333 </cell>
1334 </row>
1335 <row topline="true">
1336 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1337 \begin_inset Text
1338
1339 \layout Standard
1340
1341 4
1342 \end_inset 
1343 </cell>
1344 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1345 \begin_inset Text
1346
1347 \layout Standard
1348
1349 4
1350 \end_inset 
1351 </cell>
1352 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1353 \begin_inset Text
1354
1355 \layout Standard
1356
1357 Asks encoder to switch to mode N for high-band
1358 \end_inset 
1359 </cell>
1360 </row>
1361 <row topline="true">
1362 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1363 \begin_inset Text
1364
1365 \layout Standard
1366
1367 5
1368 \end_inset 
1369 </cell>
1370 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1371 \begin_inset Text
1372
1373 \layout Standard
1374
1375 4
1376 \end_inset 
1377 </cell>
1378 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1379 \begin_inset Text
1380
1381 \layout Standard
1382
1383 Asks encoder to switch to quality N for VBR
1384 \end_inset 
1385 </cell>
1386 </row>
1387 <row topline="true">
1388 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1389 \begin_inset Text
1390
1391 \layout Standard
1392
1393 6
1394 \end_inset 
1395 </cell>
1396 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1397 \begin_inset Text
1398
1399 \layout Standard
1400
1401 4
1402 \end_inset 
1403 </cell>
1404 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1405 \begin_inset Text
1406
1407 \layout Standard
1408
1409 Request acknowloedge (0=no, 1=all, 2=only for in-band data)
1410 \end_inset 
1411 </cell>
1412 </row>
1413 <row topline="true">
1414 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1415 \begin_inset Text
1416
1417 \layout Standard
1418
1419 7
1420 \end_inset 
1421 </cell>
1422 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1423 \begin_inset Text
1424
1425 \layout Standard
1426
1427 4
1428 \end_inset 
1429 </cell>
1430 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1431 \begin_inset Text
1432
1433 \layout Standard
1434
1435 Asks encoder to set CBR (0), VAD(1), DTX(3), VBR(5), VBR+DTX(7)
1436 \end_inset 
1437 </cell>
1438 </row>
1439 <row topline="true">
1440 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1441 \begin_inset Text
1442
1443 \layout Standard
1444
1445 8
1446 \end_inset 
1447 </cell>
1448 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1449 \begin_inset Text
1450
1451 \layout Standard
1452
1453 8
1454 \end_inset 
1455 </cell>
1456 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1457 \begin_inset Text
1458
1459 \layout Standard
1460
1461 Transmit (8-bit) character to the other end
1462 \end_inset 
1463 </cell>
1464 </row>
1465 <row topline="true">
1466 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1467 \begin_inset Text
1468
1469 \layout Standard
1470
1471 9
1472 \end_inset 
1473 </cell>
1474 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1475 \begin_inset Text
1476
1477 \layout Standard
1478
1479 8
1480 \end_inset 
1481 </cell>
1482 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1483 \begin_inset Text
1484
1485 \layout Standard
1486
1487 Intensity stereo information
1488 \end_inset 
1489 </cell>
1490 </row>
1491 <row topline="true">
1492 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1493 \begin_inset Text
1494
1495 \layout Standard
1496
1497 10
1498 \end_inset 
1499 </cell>
1500 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1501 \begin_inset Text
1502
1503 \layout Standard
1504
1505 16
1506 \end_inset 
1507 </cell>
1508 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1509 \begin_inset Text
1510
1511 \layout Standard
1512
1513 Announce maximum bit-rate acceptable (N in bytes/second)
1514 \end_inset 
1515 </cell>
1516 </row>
1517 <row topline="true">
1518 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1519 \begin_inset Text
1520
1521 \layout Standard
1522
1523 11
1524 \end_inset 
1525 </cell>
1526 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1527 \begin_inset Text
1528
1529 \layout Standard
1530
1531 16
1532 \end_inset 
1533 </cell>
1534 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1535 \begin_inset Text
1536
1537 \layout Standard
1538
1539 reserved
1540 \end_inset 
1541 </cell>
1542 </row>
1543 <row topline="true">
1544 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1545 \begin_inset Text
1546
1547 \layout Standard
1548
1549 12
1550 \end_inset 
1551 </cell>
1552 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1553 \begin_inset Text
1554
1555 \layout Standard
1556
1557 32
1558 \end_inset 
1559 </cell>
1560 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1561 \begin_inset Text
1562
1563 \layout Standard
1564
1565 Acknowledge receiving packet N
1566 \end_inset 
1567 </cell>
1568 </row>
1569 <row topline="true">
1570 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1571 \begin_inset Text
1572
1573 \layout Standard
1574
1575 13
1576 \end_inset 
1577 </cell>
1578 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1579 \begin_inset Text
1580
1581 \layout Standard
1582
1583 32
1584 \end_inset 
1585 </cell>
1586 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1587 \begin_inset Text
1588
1589 \layout Standard
1590
1591 reserved
1592 \end_inset 
1593 </cell>
1594 </row>
1595 <row topline="true">
1596 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1597 \begin_inset Text
1598
1599 \layout Standard
1600
1601 14
1602 \end_inset 
1603 </cell>
1604 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1605 \begin_inset Text
1606
1607 \layout Standard
1608
1609 64
1610 \end_inset 
1611 </cell>
1612 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1613 \begin_inset Text
1614
1615 \layout Standard
1616
1617 reserved
1618 \end_inset 
1619 </cell>
1620 </row>
1621 <row topline="true" bottomline="true">
1622 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1623 \begin_inset Text
1624
1625 \layout Standard
1626
1627 15
1628 \end_inset 
1629 </cell>
1630 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1631 \begin_inset Text
1632
1633 \layout Standard
1634
1635 64
1636 \end_inset 
1637 </cell>
1638 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1639 \begin_inset Text
1640
1641 \layout Standard
1642
1643 reserved
1644 \end_inset 
1645 </cell>
1646 </row>
1647 </lyxtabular>
1648
1649 \end_inset 
1650
1651
1652 \layout Caption
1653
1654 In-band signalling codes
1655 \begin_inset LatexCommand \label{cap:In-band-signalling-codes}
1656
1657 \end_inset 
1658
1659
1660 \end_inset 
1661
1662
1663 \layout Standard
1664
1665 Finally, applications may define custom in-band messages using mode 13.
1666  The size of the message in bytes is encoded with 5 bits, so that the decoder
1667  can skip it if it doesn't know how to interpret it.
1668 \layout Section
1669 \pagebreak_top 
1670 Formats and standards
1671 \begin_inset LatexCommand \index{standards}
1672
1673 \end_inset 
1674
1675
1676 \begin_inset LatexCommand \label{sec:Formats-and-standards}
1677
1678 \end_inset 
1679
1680
1681 \layout Standard
1682
1683 Speex can encode speech in both narrowband and wideband and provides different
1684  bit-rates.
1685  However, not all features need to be supported by a certain implementation
1686  or device.
1687  In order to be called 
1688 \begin_inset Quotes eld
1689 \end_inset 
1690
1691 Speex compatible
1692 \begin_inset Quotes erd
1693 \end_inset 
1694
1695  (whatever that means), an implementation must implement at least a basic
1696  set of features.
1697 \layout Standard
1698
1699 At the minimum, all narrowband modes of operation MUST be supported at the
1700  decoder.
1701  This includes the decoding of a wideband bit-stream by the narrowband decoder
1702 \begin_inset Foot
1703 collapsed true
1704
1705 \layout Standard
1706
1707 The wideband bit-stream contains an embedded narrowband bit-stream which
1708  can be decoded alone
1709 \end_inset 
1710
1711 .
1712  If present, a wideband decoder MUST be able to decode a narrowband stream,
1713  and MAY either be able to decode all wideband modes or be able to decode
1714  the embedded narrowband part of all modes (which includes ignoring the
1715  high-band bits).
1716 \layout Standard
1717
1718 For encoders, at least one narrowband or wideband mode MUST be supported.
1719  The main reason why all encoding modes do not have to be supported is that
1720  some platforms may not be able to handle the complexity of encoding in
1721  some modes.
1722 \layout Subsection
1723
1724 RTP
1725 \begin_inset LatexCommand \index{RTP}
1726
1727 \end_inset 
1728
1729  Payload Format 
1730 \layout Standard
1731
1732 The RTP payload draft is included in appendix 
1733 \begin_inset LatexCommand \ref{sec:IETF-draft}
1734
1735 \end_inset 
1736
1737  and the latest version is available at 
1738 \begin_inset LatexCommand \url{http://www.speex.org/drafts/latest}
1739
1740 \end_inset 
1741
1742 .
1743  This draft has been sent (2003/02/26) to the Internet Engineering Task
1744  Force (IETF) and will be discussed at the March 18th meeting in San Francisco.
1745  
1746 \layout Subsection
1747
1748 MIME Type
1749 \layout Standard
1750
1751 For now, you should use the MIME type audio/x-speex for Speex-in-Ogg.
1752  We will apply for type 
1753 \family typewriter 
1754 audio/speex
1755 \family default 
1756  in the near future.
1757 \layout Subsection
1758
1759 Ogg
1760 \begin_inset LatexCommand \index{Ogg}
1761
1762 \end_inset 
1763
1764  file format
1765 \layout Standard
1766
1767 Speex bit-streams can be stored in Ogg files.
1768  In this case, the first packet of the Ogg file contains the Speex header
1769  described in table 
1770 \begin_inset LatexCommand \ref{cap:ogg_speex_header}
1771
1772 \end_inset 
1773
1774 .
1775  All integer fields in the headers are stored as little-endian.
1776  The 
1777 \family typewriter 
1778 speex_string
1779 \family default 
1780  field must contain the 
1781 \begin_inset Quotes eld
1782 \end_inset 
1783
1784
1785 \family typewriter 
1786 Speex
1787 \family default 
1788 \SpecialChar ~
1789 \SpecialChar ~
1790 \SpecialChar ~
1791
1792 \begin_inset Quotes erd
1793 \end_inset 
1794
1795  (with 3 trailing spaces), which identifies the bit-stream.
1796  The next field, 
1797 \family typewriter 
1798 speex_version
1799 \family default 
1800  contains the version of Speex that encoded the file.
1801  For now, refer to speex_header.[ch] for more info.
1802  The 
1803 \emph on 
1804 beginning of stream
1805 \emph default 
1806  (
1807 \family typewriter 
1808 b_o_s
1809 \family default 
1810 ) flag is set to 1 for the header.
1811  The header packet has 
1812 \family typewriter 
1813 packetno=0
1814 \family default 
1815  and 
1816 \family typewriter 
1817 granulepos=0
1818 \family default 
1819 .
1820 \layout Standard
1821
1822 The second packet contains the Speex comment header.
1823  The format used is the Vorbis comment format described here: http://www.xiph.org/
1824 ogg/vorbis/doc/v-comment.html .
1825  This packet has 
1826 \family typewriter 
1827 packetno=1
1828 \family default 
1829  and 
1830 \family typewriter 
1831 granulepos=0
1832 \family default 
1833 .
1834 \layout Standard
1835
1836 The third and subsequent packets each contain one or more (number found
1837  in header) Speex frames.
1838  These are identified with 
1839 \family typewriter 
1840 packetno
1841 \family default 
1842  starting from 2 and the 
1843 \family typewriter 
1844 granulepos
1845 \family default 
1846  is the number of the last sample encoded in that packet.
1847  The last of these packets has the 
1848 \emph on 
1849 end of stream
1850 \emph default 
1851  (
1852 \family typewriter 
1853 e_o_s
1854 \family default 
1855 ) flag is set to 1.
1856 \layout Standard
1857
1858
1859 \begin_inset Float table
1860 placement htbp
1861 wide true
1862 collapsed false
1863
1864 \layout Standard
1865
1866
1867 \begin_inset  Tabular
1868 <lyxtabular version="3" rows="16" columns="3">
1869 <features>
1870 <column alignment="center" valignment="top" leftline="true" width="0pt">
1871 <column alignment="center" valignment="top" leftline="true" width="0pt">
1872 <column alignment="center" valignment="top" leftline="true" rightline="true" width="0pt">
1873 <row topline="true" bottomline="true">
1874 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1875 \begin_inset Text
1876
1877 \layout Standard
1878
1879 Field
1880 \end_inset 
1881 </cell>
1882 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1883 \begin_inset Text
1884
1885 \layout Standard
1886
1887 Type
1888 \end_inset 
1889 </cell>
1890 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1891 \begin_inset Text
1892
1893 \layout Standard
1894
1895 Size
1896 \end_inset 
1897 </cell>
1898 </row>
1899 <row topline="true">
1900 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1901 \begin_inset Text
1902
1903 \layout Standard
1904
1905 speex_string
1906 \end_inset 
1907 </cell>
1908 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1909 \begin_inset Text
1910
1911 \layout Standard
1912
1913 char[]
1914 \end_inset 
1915 </cell>
1916 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1917 \begin_inset Text
1918
1919 \layout Standard
1920
1921 8
1922 \end_inset 
1923 </cell>
1924 </row>
1925 <row topline="true">
1926 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1927 \begin_inset Text
1928
1929 \layout Standard
1930
1931 speex_version
1932 \end_inset 
1933 </cell>
1934 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1935 \begin_inset Text
1936
1937 \layout Standard
1938
1939 char[]
1940 \end_inset 
1941 </cell>
1942 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1943 \begin_inset Text
1944
1945 \layout Standard
1946
1947 20
1948 \end_inset 
1949 </cell>
1950 </row>
1951 <row topline="true">
1952 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1953 \begin_inset Text
1954
1955 \layout Standard
1956
1957 speex_version_id
1958 \end_inset 
1959 </cell>
1960 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1961 \begin_inset Text
1962
1963 \layout Standard
1964
1965 int
1966 \end_inset 
1967 </cell>
1968 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1969 \begin_inset Text
1970
1971 \layout Standard
1972
1973 4
1974 \end_inset 
1975 </cell>
1976 </row>
1977 <row topline="true">
1978 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1979 \begin_inset Text
1980
1981 \layout Standard
1982
1983 header_size
1984 \end_inset 
1985 </cell>
1986 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
1987 \begin_inset Text
1988
1989 \layout Standard
1990
1991 int
1992 \end_inset 
1993 </cell>
1994 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
1995 \begin_inset Text
1996
1997 \layout Standard
1998
1999 4
2000 \end_inset 
2001 </cell>
2002 </row>
2003 <row topline="true">
2004 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2005 \begin_inset Text
2006
2007 \layout Standard
2008
2009 rate
2010 \end_inset 
2011 </cell>
2012 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2013 \begin_inset Text
2014
2015 \layout Standard
2016
2017 int
2018 \end_inset 
2019 </cell>
2020 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
2021 \begin_inset Text
2022
2023 \layout Standard
2024
2025 4
2026 \end_inset 
2027 </cell>
2028 </row>
2029 <row topline="true">
2030 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2031 \begin_inset Text
2032
2033 \layout Standard
2034
2035 mode
2036 \end_inset 
2037 </cell>
2038 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2039 \begin_inset Text
2040
2041 \layout Standard
2042
2043 int
2044 \end_inset 
2045 </cell>
2046 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
2047 \begin_inset Text
2048
2049 \layout Standard
2050
2051 4
2052 \end_inset 
2053 </cell>
2054 </row>
2055 <row topline="true">
2056 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2057 \begin_inset Text
2058
2059 \layout Standard
2060
2061 mode_bitstream_version
2062 \end_inset 
2063 </cell>
2064 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2065 \begin_inset Text
2066
2067 \layout Standard
2068
2069 int
2070 \end_inset 
2071 </cell>
2072 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
2073 \begin_inset Text
2074
2075 \layout Standard
2076
2077 4
2078 \end_inset 
2079 </cell>
2080 </row>
2081 <row topline="true">
2082 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2083 \begin_inset Text
2084
2085 \layout Standard
2086
2087 nb_channels
2088 \end_inset 
2089 </cell>
2090 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2091 \begin_inset Text
2092
2093 \layout Standard
2094
2095 int
2096 \end_inset 
2097 </cell>
2098 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
2099 \begin_inset Text
2100
2101 \layout Standard
2102
2103 4
2104 \end_inset 
2105 </cell>
2106 </row>
2107 <row topline="true">
2108 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2109 \begin_inset Text
2110
2111 \layout Standard
2112
2113 bitrate
2114 \end_inset 
2115 </cell>
2116 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2117 \begin_inset Text
2118
2119 \layout Standard
2120
2121 int
2122 \end_inset 
2123 </cell>
2124 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
2125 \begin_inset Text
2126
2127 \layout Standard
2128
2129 4
2130 \end_inset 
2131 </cell>
2132 </row>
2133 <row topline="true">
2134 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2135 \begin_inset Text
2136
2137 \layout Standard
2138
2139 frame_size
2140 \end_inset 
2141 </cell>
2142 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2143 \begin_inset Text
2144
2145 \layout Standard
2146
2147 int
2148 \end_inset 
2149 </cell>
2150 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
2151 \begin_inset Text
2152
2153 \layout Standard
2154
2155 4
2156 \end_inset 
2157 </cell>
2158 </row>
2159 <row topline="true">
2160 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2161 \begin_inset Text
2162
2163 \layout Standard
2164
2165 vbr
2166 \end_inset 
2167 </cell>
2168 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2169 \begin_inset Text
2170
2171 \layout Standard
2172
2173 int
2174 \end_inset 
2175 </cell>
2176 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
2177 \begin_inset Text
2178
2179 \layout Standard
2180
2181 4
2182 \end_inset 
2183 </cell>
2184 </row>
2185 <row topline="true">
2186 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2187 \begin_inset Text
2188
2189 \layout Standard
2190
2191 frames_per_packet
2192 \end_inset 
2193 </cell>
2194 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2195 \begin_inset Text
2196
2197 \layout Standard
2198
2199 int
2200 \end_inset 
2201 </cell>
2202 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
2203 \begin_inset Text
2204
2205 \layout Standard
2206
2207 4
2208 \end_inset 
2209 </cell>
2210 </row>
2211 <row topline="true">
2212 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2213 \begin_inset Text
2214
2215 \layout Standard
2216
2217 extra_headers
2218 \end_inset 
2219 </cell>
2220 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2221 \begin_inset Text
2222
2223 \layout Standard
2224
2225 int
2226 \end_inset 
2227 </cell>
2228 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
2229 \begin_inset Text
2230
2231 \layout Standard
2232
2233 4
2234 \end_inset 
2235 </cell>
2236 </row>
2237 <row topline="true">
2238 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2239 \begin_inset Text
2240
2241 \layout Standard
2242
2243 reserved1
2244 \end_inset 
2245 </cell>
2246 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2247 \begin_inset Text
2248
2249 \layout Standard
2250
2251 int
2252 \end_inset 
2253 </cell>
2254 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
2255 \begin_inset Text
2256
2257 \layout Standard
2258
2259 4
2260 \end_inset 
2261 </cell>
2262 </row>
2263 <row topline="true" bottomline="true">
2264 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2265 \begin_inset Text
2266
2267 \layout Standard
2268
2269 reserved2
2270 \end_inset 
2271 </cell>
2272 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
2273 \begin_inset Text
2274
2275 \layout Standard
2276
2277 int
2278 \end_inset 
2279 </cell>
2280 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
2281 \begin_inset Text
2282
2283 \layout Standard
2284
2285 4
2286 \end_inset 
2287 </cell>
2288 </row>
2289 </lyxtabular>
2290
2291 \end_inset 
2292
2293
2294 \layout Caption
2295
2296 Ogg/Speex header packet
2297 \begin_inset LatexCommand \label{cap:ogg_speex_header}
2298
2299 \end_inset 
2300
2301
2302 \end_inset 
2303
2304
2305 \layout Section
2306 \pagebreak_top 
2307 Introduction to CELP Coding
2308 \begin_inset LatexCommand \index{CELP}
2309
2310 \end_inset 
2311
2312
2313 \begin_inset LatexCommand \label{sec:Introduction-to-CELP}
2314
2315 \end_inset 
2316
2317
2318 \layout Standard
2319
2320 Speex is based on CELP, which stands for Code Excited Linear Prediction.
2321  This section attempts to introduce the principles behind CELP, so if you
2322  are already familiar with CELP, you can safely skip to section 
2323 \begin_inset LatexCommand \ref{sec:Speex-narrowband-mode}
2324
2325 \end_inset 
2326
2327 .
2328  The CELP technique is based on three ideas:
2329 \layout Enumerate
2330
2331 The use of a linear prediction (LP) model to model the vocal tract
2332 \layout Enumerate
2333
2334 The use of (adaptive and fixed) codebook entries as input (excitation) of
2335  the LP model
2336 \layout Enumerate
2337
2338 The search performed in closed-loop in a 
2339 \begin_inset Quotes eld
2340 \end_inset 
2341
2342 perceptually weighted domain
2343 \begin_inset Quotes erd
2344 \end_inset 
2345
2346
2347 \layout Standard
2348
2349 This section describes the basic ideas behind CELP.
2350  Note that it's still incomplete.
2351 \layout Subsection
2352
2353 Linear Prediction (LPC)
2354 \begin_inset LatexCommand \index{linear prediction}
2355
2356 \end_inset 
2357
2358
2359 \layout Standard
2360
2361 Linear prediction is at the base of many speech coding techniques, including
2362  CELP.
2363  The idea behind it is to predict the signal 
2364 \begin_inset Formula $x[n]$
2365 \end_inset 
2366
2367  using a linear combination of its past samples:
2368 \layout Standard
2369
2370
2371 \begin_inset Formula \[
2372 y[n]=\sum_{i=1}^{N}a_{i}x[n-i]\]
2373
2374 \end_inset 
2375
2376 where 
2377 \begin_inset Formula $y[n]$
2378 \end_inset 
2379
2380  is the linear prediction of 
2381 \begin_inset Formula $x[n]$
2382 \end_inset 
2383
2384 .
2385  The prediction error is thus given by:
2386 \begin_inset Formula \[
2387 e[n]=x[n]-y[n]=x[n]-\sum_{i=1}^{N}a_{i}x[n-i]\]
2388
2389 \end_inset 
2390
2391
2392 \layout Standard
2393
2394 The goal of the LPC analysis is to find the best prediction coefficients
2395  
2396 \begin_inset Formula $a_{i}$
2397 \end_inset 
2398
2399  which minimize the quadratic error function:
2400 \begin_inset Formula \[
2401 E=\sum_{n=0}^{L-1}\left[e[n]\right]^{2}=\sum_{n=0}^{L-1}\left[x[n]-\sum_{i=1}^{N}a_{i}x[n-i]\right]^{2}\]
2402
2403 \end_inset 
2404
2405 That can be done by making all derivatives 
2406 \begin_inset Formula $\frac{\partial E}{\partial a_{i}}$
2407 \end_inset 
2408
2409  equal to zero:
2410 \begin_inset Formula \[
2411 \frac{\partial E}{\partial a_{i}}=\frac{\partial}{\partial a_{i}}\sum_{n=0}^{L-1}\left[x[n]-\sum_{i=1}^{N}a_{i}x[n-i]\right]^{2}=0\]
2412
2413 \end_inset 
2414
2415
2416 \layout Standard
2417
2418 The 
2419 \begin_inset Formula $a_{i}$
2420 \end_inset 
2421
2422  filter coefficients are computed using the Levinson-Durbin
2423 \begin_inset LatexCommand \index{Levinson-Durbin}
2424
2425 \end_inset 
2426
2427  algorithm, which starts from the auto-correlation
2428 \begin_inset LatexCommand \index{auto-correlation}
2429
2430 \end_inset 
2431
2432  
2433 \begin_inset Formula $R(m)$
2434 \end_inset 
2435
2436  of the signal 
2437 \begin_inset Formula $x[n]$
2438 \end_inset 
2439
2440 .
2441 \layout Standard
2442
2443
2444 \begin_inset Formula \[
2445 R(m)=\sum_{i=0}^{N-1}x[i]x[i-m]\]
2446
2447 \end_inset 
2448
2449
2450 \layout Standard
2451
2452 For an order 
2453 \begin_inset Formula $N$
2454 \end_inset 
2455
2456  filter, we have:
2457 \begin_inset Formula \[
2458 \mathbf{R}=\left[\begin{array}{cccc}
2459 R(0) & R(1) & \cdots & R(N-1)\\
2460 R(1) & R(0) & \cdots & R(N-2)\\
2461 \vdots & \vdots & \ddots & \vdots\\
2462 R(N-1) & R(N-2) & \cdots & R(0)\end{array}\right]\]
2463
2464 \end_inset 
2465
2466
2467 \begin_inset Formula \[
2468 \mathbf{r}=\left[\begin{array}{c}
2469 R(1)\\
2470 R(2)\\
2471 \vdots\\
2472 R(N)\end{array}\right]\]
2473
2474 \end_inset 
2475
2476
2477 \layout Standard
2478
2479 The filter coefficients 
2480 \begin_inset Formula $a_{i}$
2481 \end_inset 
2482
2483  are found by solving the system 
2484 \begin_inset Formula $\mathbf{Ra}=\mathbf{r}$
2485 \end_inset 
2486
2487 .
2488  What the Levinson-Durbin algorithm does here is making the solution to
2489  the problem 
2490 \begin_inset Formula $\mathcal{O}\left(N^{2}\right)$
2491 \end_inset 
2492
2493  instead of 
2494 \begin_inset Formula $\mathcal{O}\left(N^{3}\right)$
2495 \end_inset 
2496
2497  by exploiting the fact that matrix 
2498 \begin_inset Formula $\mathbf{R}$
2499 \end_inset 
2500
2501  is toeplitz hermitian.
2502  Also, it can be proven that all the roots of 
2503 \begin_inset Formula $A(z)$
2504 \end_inset 
2505
2506  are within the unit circle, which means that 
2507 \begin_inset Formula $1/A(z)$
2508 \end_inset 
2509
2510  is always stable.
2511  This is in theory; in practice because of finite precision, there are two
2512  commonly used techniques to make sure we have a stable filter.
2513  First, we multiply 
2514 \begin_inset Formula $R(0)$
2515 \end_inset 
2516
2517  by a number slightly above one (such as 1.0001), which is equivalent to
2518  adding noise to the signal.
2519  Also, we can apply a window to the auto-correlation, which is equivalent
2520  to filtering in the frequency domain, reducing sharp resonances.
2521 \layout Standard
2522
2523 The linear prediction model represents each speech sample as a linear combinatio
2524 n of past samples, plus an error signal called the excitation (or residual).
2525 \begin_inset Formula \[
2526 x[n]=\sum_{i=1}^{N}a_{i}x[n-i]+e[n]\]
2527
2528 \end_inset 
2529
2530
2531 \layout Standard
2532
2533 In the 
2534 \emph on 
2535 z
2536 \emph default 
2537 -domain, this can be expressed as
2538 \layout Standard
2539
2540
2541 \begin_inset Formula \[
2542 x(z)=\frac{1}{A(z)}\: e(z)\]
2543
2544 \end_inset 
2545
2546
2547 \layout Standard
2548
2549 where 
2550 \begin_inset Formula $A(z)$
2551 \end_inset 
2552
2553  is defined as
2554 \layout Standard
2555
2556
2557 \begin_inset Formula \[
2558 A(z)=1-\sum_{i=1}^{N}a_{i}z^{-i}\]
2559
2560 \end_inset 
2561
2562
2563 \layout Standard
2564
2565 We usually refer to 
2566 \begin_inset Formula $A(z)$
2567 \end_inset 
2568
2569  as the analysis filter and 
2570 \begin_inset Formula $1/A(z)$
2571 \end_inset 
2572
2573  as the synthesis filter.
2574  The whole process is called short-term prediction as it predicts the signal
2575  
2576 \begin_inset Formula $x[n]$
2577 \end_inset 
2578
2579  using a prediction using only the 
2580 \begin_inset Formula $N$
2581 \end_inset 
2582
2583  past samples, where 
2584 \begin_inset Formula $N$
2585 \end_inset 
2586
2587  is usually around 10.
2588 \layout Standard
2589
2590 Because LPC coefficients have very little robustness to quantization, they
2591  are converted to Line Spectral Pair
2592 \begin_inset LatexCommand \index{line spectral pair}
2593
2594 \end_inset 
2595
2596  (LSP) coefficients which have a much better behaviour with quantization,
2597  one of them being that it's easy to keep the filter stable.
2598  
2599 \layout Comment
2600
2601 Describe LSP's
2602 \layout Subsection
2603
2604 Pitch Prediction
2605 \begin_inset LatexCommand \index{pitch}
2606
2607 \end_inset 
2608
2609
2610 \layout Standard
2611
2612 During voiced segments, the speech signal is periodic, so it is possible
2613  to take advantage of that property by approximating the excitation signal
2614  
2615 \begin_inset Formula $e[n]$
2616 \end_inset 
2617
2618  by a gain times the past of the excitation:
2619 \layout Standard
2620
2621
2622 \begin_inset Formula \[
2623 e[n]\simeq p[n]=\beta e[n-T]\]
2624
2625 \end_inset 
2626
2627
2628 \layout Standard
2629
2630 where 
2631 \begin_inset Formula $T$
2632 \end_inset 
2633
2634  is the pitch period, 
2635 \begin_inset Formula $\beta$
2636 \end_inset 
2637
2638  is the pitch gain.
2639  We call that long-term prediction since the excitation is predicted from
2640  
2641 \begin_inset Formula $e[n-T]$
2642 \end_inset 
2643
2644  with 
2645 \begin_inset Formula $T\gg N$
2646 \end_inset 
2647
2648 .
2649 \layout Subsection
2650
2651 Innovation Codebook
2652 \layout Standard
2653
2654 The final excitation 
2655 \begin_inset Formula $e[n]$
2656 \end_inset 
2657
2658  will be the sum of the pitch prediction and an 
2659 \emph on 
2660 innovation
2661 \emph default 
2662  signal 
2663 \begin_inset Formula $c[n]$
2664 \end_inset 
2665
2666  taken from a fixed codebook, hence the name 
2667 \emph on 
2668 Code
2669 \emph default 
2670  Excited Linear Prediction.
2671  The final excitation is given by:
2672 \layout Standard
2673
2674
2675 \begin_inset Formula \[
2676 e[n]=p[n]+c[n]=\beta e[n-T]+c[n]\]
2677
2678 \end_inset 
2679
2680 The quantization of 
2681 \begin_inset Formula $c[n]$
2682 \end_inset 
2683
2684  is where most of the bits in a CELP codec are allocated.
2685  It represents the information that couldn't be obtained either from linear
2686  prediction or pitch prediction.
2687  In the 
2688 \emph on 
2689 z
2690 \emph default 
2691 -domain we can represent the final signal 
2692 \begin_inset Formula $X(z)$
2693 \end_inset 
2694
2695  as 
2696 \begin_inset Formula \[
2697 X(z)=\frac{C(z)}{A(z)\left(1-\beta z^{-T}\right)}\]
2698
2699 \end_inset 
2700
2701
2702 \layout Subsection
2703
2704 Analysis-by-Synthesis and Error Weighting
2705 \begin_inset LatexCommand \index{error weighting}
2706
2707 \end_inset 
2708
2709
2710 \begin_inset LatexCommand \index{analysis-by-synthesis}
2711
2712 \end_inset 
2713
2714
2715 \layout Standard
2716
2717 Most (if not all) modern audio codecs attempt to 
2718 \begin_inset Quotes eld
2719 \end_inset 
2720
2721 shape
2722 \begin_inset Quotes erd
2723 \end_inset 
2724
2725  the noise so that it appears mostly in the frequency regions where the
2726  ear cannot detect it.
2727  For example, the ear is more tolerant to noise in parts of the spectrum
2728  that are louder and 
2729 \emph on 
2730 vice versa
2731 \emph default 
2732 .
2733  That's why instead of minimizing the simple quadratic error
2734 \begin_inset Formula \[
2735 E=\sum_{n}\left(x[n]-\overline{x}[n]\right)^{2}\]
2736
2737 \end_inset 
2738
2739 where 
2740 \begin_inset Formula $\overline{x}[n]$
2741 \end_inset 
2742
2743  is the encoder signal, we minimize the error for the perceptually weighted
2744  signal
2745 \begin_inset Formula \[
2746 X_{w}(z)=W(z)X(z)\]
2747
2748 \end_inset 
2749
2750 where 
2751 \begin_inset Formula $W(z)$
2752 \end_inset 
2753
2754  is the weighting filter, usually of the form
2755 \layout Standard
2756
2757
2758 \begin_inset Formula \begin{equation}
2759 W(z)=\frac{A\left(\frac{z}{\gamma_{1}}\right)}{A\left(\frac{z}{\gamma_{2}}\right)}\label{eq:weighting_filter}\end{equation}
2760
2761 \end_inset 
2762
2763
2764 \layout Standard
2765
2766 with control parameters 
2767 \begin_inset Formula $\gamma_{1}>\gamma_{2}$
2768 \end_inset 
2769
2770 .
2771  If the noise is white in the perceptually weighted domain, then in the
2772  signal domain its spectral shape will be of the form
2773 \begin_inset Formula \[
2774 A_{noise}(z)=\frac{1}{W(z)}=\frac{A\left(\frac{z}{\gamma_{2}}\right)}{A\left(\frac{z}{\gamma_{1}}\right)}\]
2775
2776 \end_inset 
2777
2778
2779 \layout Standard
2780
2781 If a filter 
2782 \begin_inset Formula $A(z)$
2783 \end_inset 
2784
2785  has (complex) poles at 
2786 \begin_inset Formula $p_{i}$
2787 \end_inset 
2788
2789  in the 
2790 \begin_inset Formula $z$
2791 \end_inset 
2792
2793 -plane, the filter 
2794 \begin_inset Formula $A(z/\gamma)$
2795 \end_inset 
2796
2797  will have its poles at 
2798 \begin_inset Formula $p'_{i}=\gamma p_{i}$
2799 \end_inset 
2800
2801 , making it a flatter version of 
2802 \begin_inset Formula $A(z)$
2803 \end_inset 
2804
2805 .
2806 \layout Standard
2807
2808 Analysis-by-synthesis refers to the fact that when trying to find the best
2809  pitch parameters (
2810 \begin_inset Formula $T$
2811 \end_inset 
2812
2813
2814 \begin_inset Formula $\beta$
2815 \end_inset 
2816
2817 ) and innovation signal 
2818 \begin_inset Formula $c[n]$
2819 \end_inset 
2820
2821 , we do not work by making the excitation 
2822 \begin_inset Formula $e[n]$
2823 \end_inset 
2824
2825  as close as the original one (which would be simpler), but apply the synthesis
2826  (and weighting) filter and try making 
2827 \begin_inset Formula $X_{w}(z)$
2828 \end_inset 
2829
2830  as close to the original as possible.
2831 \layout Section
2832 \pagebreak_top 
2833 Speex narrowband mode
2834 \begin_inset LatexCommand \label{sec:Speex-narrowband-mode}
2835
2836 \end_inset 
2837
2838
2839 \begin_inset LatexCommand \index{narrowband}
2840
2841 \end_inset 
2842
2843
2844 \layout Standard
2845
2846 This section looks at how Speex works for narrowband (
2847 \begin_inset Formula $8\:\mathrm{kHz}$
2848 \end_inset 
2849
2850  sampling rate) operation.
2851  The frame size for this mode is 
2852 \begin_inset Formula $20\:\mathrm{ms}$
2853 \end_inset 
2854
2855 , corresponding to 160 samples.
2856  Each frame is also subdivided into 4 sub-frames of 40 samples each.
2857 \layout Standard
2858
2859 Also many design decisions were based on the original goals and assumptions:
2860 \layout Itemize
2861
2862 Minimizing the amount of information extracted from past frames (for robustness
2863  to packet loss)
2864 \layout Itemize
2865
2866 Dynamically-selectable codebooks (LSP, pitch and innovation)
2867 \layout Itemize
2868
2869 sub-vector fixed (innovation) codebooks
2870 \layout Subsection
2871
2872 LPC Analysis
2873 \begin_inset LatexCommand \index{linear prediction}
2874
2875 \end_inset 
2876
2877
2878 \layout Standard
2879
2880 An LPC analysis is first performed on a (asymetric Hamming) window that
2881  spans all of the current frame and half a frame in advance.
2882  The LPC coefficients are then converted to Line Spectral Pair
2883 \begin_inset LatexCommand \index{line spectral pair}
2884
2885 \end_inset 
2886
2887  (LSP), a representation that is more robust to quantization.
2888  The LSP's are considered to be associated to the 
2889 \begin_inset Formula $4^{th}$
2890 \end_inset 
2891
2892  sub-frames and the LSP's associated to the first 3 sub-frames are linearly
2893  interpolated using the current and previous LSP's.
2894 \layout Standard
2895
2896 The LSP's are encoded using 30 bits for higher quality modes and 18 bits
2897  for lower quality, through the use of a multi-stage split-vector quantizer.
2898  For the lower quality modes, the 10 coefficients are first quantized with
2899  6 bits and the error is then divided in two 5-coefficient sub-vectors.
2900  Each of them is quantized with 6 bits, for a total of 18 bits.
2901  For the higher quality modes, the remaining error on both sub-vectors is
2902  further quantized with 6 bits each, for a total of 30 bits.
2903 \layout Standard
2904
2905 The perceptual weighting filter 
2906 \begin_inset Formula $W(z)$
2907 \end_inset 
2908
2909  used by Speex is derived from the LPC filter 
2910 \begin_inset Formula $A(z)$
2911 \end_inset 
2912
2913  and corresponds to the one described by eq.
2914  
2915 \begin_inset LatexCommand \ref{eq:weighting_filter}
2916
2917 \end_inset 
2918
2919  with 
2920 \begin_inset Formula $\gamma_{1}=0.9$
2921 \end_inset 
2922
2923  and 
2924 \begin_inset Formula $\gamma_{2}=0.6$
2925 \end_inset 
2926
2927 .
2928  We can use the unquantized 
2929 \begin_inset Formula $A(z)$
2930 \end_inset 
2931
2932  filter since the weighting filter is only used in the encoder.
2933 \layout Subsection
2934
2935 Pitch Prediction (adaptive codebook)
2936 \begin_inset LatexCommand \index{pitch}
2937
2938 \end_inset 
2939
2940
2941 \layout Standard
2942
2943 Speex uses a 3-tap prediction for pitch.
2944  That is, the pitch prediction signal 
2945 \begin_inset Formula $p[n]$
2946 \end_inset 
2947
2948  is obtained by the past of the excitation by:
2949 \begin_inset Formula \[
2950 p[n]=\beta_{0}e[n-T-1]+\beta_{1}e[n-T]+\beta_{2}e[n-T+1]\]
2951
2952 \end_inset 
2953
2954
2955 \layout Standard
2956
2957 where 
2958 \begin_inset Formula $T$
2959 \end_inset 
2960
2961  is the pitch period and the 
2962 \begin_inset Formula $\beta_{i}$
2963 \end_inset 
2964
2965  are the prediction (filter) taps.
2966  It is worth noting that when the pitch is smaller than the sub-frame size,
2967  we repeat the excitation at a period 
2968 \begin_inset Formula $T$
2969 \end_inset 
2970
2971 .
2972  For example, when 
2973 \begin_inset Formula $n-T+1$
2974 \end_inset 
2975
2976 , we use 
2977 \begin_inset Formula $n-2T+1$
2978 \end_inset 
2979
2980  instead.
2981  The period and quantized gains are determined in closed loop (analysis-by-synth
2982 esis).
2983  In most modes, the pitch period is encoded with 7 bits in the 
2984 \begin_inset Formula $\left[17,144\right]$
2985 \end_inset 
2986
2987  range and the 
2988 \begin_inset Formula $\beta_{i}$
2989 \end_inset 
2990
2991  coefficients are vector-quantized using 7 bits (15 kbps narrowband and
2992  above) at higher bit-rates and 5 bits at lower bit-rates (11 kbps narrowband
2993  and below).
2994 \layout Subsection
2995
2996 Innovation Codebook
2997 \layout Standard
2998
2999 In Speex, the innovation signal is quantized using sub-vector shape-only
3000  vector quantization (VQ).
3001  That means that the innovation signal is divided in sub-vectors (of size
3002  5 to 20) and quantized using a codebook that represents both the shape
3003  and the gain at the same time.
3004  This saves many bits that would otherwise be allocated for a separate gain
3005  at the price of a slight increase in complexity.
3006  
3007 \layout Subsection
3008
3009 Bit allocation
3010 \layout Standard
3011
3012 There are 7 different narrowband bit-rates defined for Speex, ranging from
3013  250 bps to 24.6 kbps, although the modes below 5.9 kbps should not be used
3014  for speech.
3015  The bit-allocation for each mode is detailed in table 
3016 \begin_inset LatexCommand \ref{cap:bits-narrowband}
3017
3018 \end_inset 
3019
3020 .
3021  Each frame starts with the mode ID encoded with 4 bits which allows a range
3022  from 0 to 15, though only the first 7 values are used (the others are reserved).
3023  The parameters are listed in the table in the order they are packed in
3024  the bit-stream.
3025  All frame-based parameters are packed before sub-frame parameters.
3026  The parameters for a certain sub-frame are all packed before the following
3027  sub-frame is packed.
3028  Note that the 
3029 \begin_inset Quotes eld
3030 \end_inset 
3031
3032 OL
3033 \begin_inset Quotes erd
3034 \end_inset 
3035
3036  in the parameter description means that the parameter is an open loop estimatio
3037 n based on the whole frame.
3038 \layout Standard
3039
3040
3041 \begin_inset Float table
3042 placement h
3043 wide true
3044 collapsed false
3045
3046 \layout Standard
3047
3048
3049 \begin_inset  Tabular
3050 <lyxtabular version="3" rows="12" columns="11">
3051 <features>
3052 <column alignment="center" valignment="top" leftline="true" width="0pt">
3053 <column alignment="center" valignment="top" leftline="true" width="0pt">
3054 <column alignment="center" valignment="top" leftline="true" width="0pt">
3055 <column alignment="center" valignment="top" leftline="true" width="0pt">
3056 <column alignment="center" valignment="top" leftline="true" width="0pt">
3057 <column alignment="center" valignment="top" leftline="true" width="0pt">
3058 <column alignment="center" valignment="top" leftline="true" width="0pt">
3059 <column alignment="center" valignment="top" leftline="true" width="0pt">
3060 <column alignment="center" valignment="top" leftline="true" width="0pt">
3061 <column alignment="center" valignment="top" leftline="true" width="0pt">
3062 <column alignment="center" valignment="top" leftline="true" rightline="true" width="0pt">
3063 <row topline="true" bottomline="true">
3064 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3065 \begin_inset Text
3066
3067 \layout Standard
3068
3069 Parameter
3070 \end_inset 
3071 </cell>
3072 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3073 \begin_inset Text
3074
3075 \layout Standard
3076
3077 Update rate
3078 \end_inset 
3079 </cell>
3080 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3081 \begin_inset Text
3082
3083 \layout Standard
3084
3085 0
3086 \end_inset 
3087 </cell>
3088 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3089 \begin_inset Text
3090
3091 \layout Standard
3092
3093 1
3094 \end_inset 
3095 </cell>
3096 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3097 \begin_inset Text
3098
3099 \layout Standard
3100
3101 2
3102 \end_inset 
3103 </cell>
3104 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3105 \begin_inset Text
3106
3107 \layout Standard
3108
3109 3
3110 \end_inset 
3111 </cell>
3112 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3113 \begin_inset Text
3114
3115 \layout Standard
3116
3117 4
3118 \end_inset 
3119 </cell>
3120 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3121 \begin_inset Text
3122
3123 \layout Standard
3124
3125 5
3126 \end_inset 
3127 </cell>
3128 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3129 \begin_inset Text
3130
3131 \layout Standard
3132
3133 6
3134 \end_inset 
3135 </cell>
3136 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3137 \begin_inset Text
3138
3139 \layout Standard
3140
3141 7
3142 \end_inset 
3143 </cell>
3144 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3145 \begin_inset Text
3146
3147 \layout Standard
3148
3149 8
3150 \end_inset 
3151 </cell>
3152 </row>
3153 <row topline="true">
3154 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3155 \begin_inset Text
3156
3157 \layout Standard
3158
3159 Wideband bit
3160 \end_inset 
3161 </cell>
3162 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3163 \begin_inset Text
3164
3165 \layout Standard
3166
3167 frame
3168 \end_inset 
3169 </cell>
3170 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3171 \begin_inset Text
3172
3173 \layout Standard
3174
3175 1
3176 \end_inset 
3177 </cell>
3178 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3179 \begin_inset Text
3180
3181 \layout Standard
3182
3183 1
3184 \end_inset 
3185 </cell>
3186 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3187 \begin_inset Text
3188
3189 \layout Standard
3190
3191 1
3192 \end_inset 
3193 </cell>
3194 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3195 \begin_inset Text
3196
3197 \layout Standard
3198
3199 1
3200 \end_inset 
3201 </cell>
3202 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3203 \begin_inset Text
3204
3205 \layout Standard
3206
3207 1
3208 \end_inset 
3209 </cell>
3210 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3211 \begin_inset Text
3212
3213 \layout Standard
3214
3215 1
3216 \end_inset 
3217 </cell>
3218 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3219 \begin_inset Text
3220
3221 \layout Standard
3222
3223 1
3224 \end_inset 
3225 </cell>
3226 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3227 \begin_inset Text
3228
3229 \layout Standard
3230
3231 1
3232 \end_inset 
3233 </cell>
3234 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3235 \begin_inset Text
3236
3237 \layout Standard
3238
3239 1
3240 \end_inset 
3241 </cell>
3242 </row>
3243 <row topline="true">
3244 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3245 \begin_inset Text
3246
3247 \layout Standard
3248
3249 Mode ID
3250 \end_inset 
3251 </cell>
3252 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3253 \begin_inset Text
3254
3255 \layout Standard
3256
3257 frame
3258 \end_inset 
3259 </cell>
3260 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3261 \begin_inset Text
3262
3263 \layout Standard
3264
3265 4
3266 \end_inset 
3267 </cell>
3268 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3269 \begin_inset Text
3270
3271 \layout Standard
3272
3273 4
3274 \end_inset 
3275 </cell>
3276 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3277 \begin_inset Text
3278
3279 \layout Standard
3280
3281 4
3282 \end_inset 
3283 </cell>
3284 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3285 \begin_inset Text
3286
3287 \layout Standard
3288
3289 4
3290 \end_inset 
3291 </cell>
3292 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3293 \begin_inset Text
3294
3295 \layout Standard
3296
3297 4
3298 \end_inset 
3299 </cell>
3300 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3301 \begin_inset Text
3302
3303 \layout Standard
3304
3305 4
3306 \end_inset 
3307 </cell>
3308 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3309 \begin_inset Text
3310
3311 \layout Standard
3312
3313 4
3314 \end_inset 
3315 </cell>
3316 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3317 \begin_inset Text
3318
3319 \layout Standard
3320
3321 4
3322 \end_inset 
3323 </cell>
3324 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3325 \begin_inset Text
3326
3327 \layout Standard
3328
3329 4
3330 \end_inset 
3331 </cell>
3332 </row>
3333 <row topline="true">
3334 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3335 \begin_inset Text
3336
3337 \layout Standard
3338
3339 LSP
3340 \end_inset 
3341 </cell>
3342 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3343 \begin_inset Text
3344
3345 \layout Standard
3346
3347 frame
3348 \end_inset 
3349 </cell>
3350 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3351 \begin_inset Text
3352
3353 \layout Standard
3354
3355 0
3356 \end_inset 
3357 </cell>
3358 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3359 \begin_inset Text
3360
3361 \layout Standard
3362
3363 18
3364 \end_inset 
3365 </cell>
3366 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3367 \begin_inset Text
3368
3369 \layout Standard
3370
3371 18
3372 \end_inset 
3373 </cell>
3374 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3375 \begin_inset Text
3376
3377 \layout Standard
3378
3379 18
3380 \end_inset 
3381 </cell>
3382 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3383 \begin_inset Text
3384
3385 \layout Standard
3386
3387 18
3388 \end_inset 
3389 </cell>
3390 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3391 \begin_inset Text
3392
3393 \layout Standard
3394
3395 30
3396 \end_inset 
3397 </cell>
3398 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3399 \begin_inset Text
3400
3401 \layout Standard
3402
3403 30
3404 \end_inset 
3405 </cell>
3406 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3407 \begin_inset Text
3408
3409 \layout Standard
3410
3411 30
3412 \end_inset 
3413 </cell>
3414 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3415 \begin_inset Text
3416
3417 \layout Standard
3418
3419 18
3420 \end_inset 
3421 </cell>
3422 </row>
3423 <row topline="true">
3424 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3425 \begin_inset Text
3426
3427 \layout Standard
3428
3429 OL pitch
3430 \end_inset 
3431 </cell>
3432 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3433 \begin_inset Text
3434
3435 \layout Standard
3436
3437 frame
3438 \end_inset 
3439 </cell>
3440 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3441 \begin_inset Text
3442
3443 \layout Standard
3444
3445 0
3446 \end_inset 
3447 </cell>
3448 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3449 \begin_inset Text
3450
3451 \layout Standard
3452
3453 7
3454 \end_inset 
3455 </cell>
3456 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3457 \begin_inset Text
3458
3459 \layout Standard
3460
3461 7
3462 \end_inset 
3463 </cell>
3464 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3465 \begin_inset Text
3466
3467 \layout Standard
3468
3469 0
3470 \end_inset 
3471 </cell>
3472 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3473 \begin_inset Text
3474
3475 \layout Standard
3476
3477 0
3478 \end_inset 
3479 </cell>
3480 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3481 \begin_inset Text
3482
3483 \layout Standard
3484
3485 0
3486 \end_inset 
3487 </cell>
3488 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3489 \begin_inset Text
3490
3491 \layout Standard
3492
3493 0
3494 \end_inset 
3495 </cell>
3496 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3497 \begin_inset Text
3498
3499 \layout Standard
3500
3501 0
3502 \end_inset 
3503 </cell>
3504 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3505 \begin_inset Text
3506
3507 \layout Standard
3508
3509 7
3510 \end_inset 
3511 </cell>
3512 </row>
3513 <row topline="true">
3514 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3515 \begin_inset Text
3516
3517 \layout Standard
3518
3519 OL pitch gain
3520 \end_inset 
3521 </cell>
3522 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3523 \begin_inset Text
3524
3525 \layout Standard
3526
3527 frame
3528 \end_inset 
3529 </cell>
3530 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3531 \begin_inset Text
3532
3533 \layout Standard
3534
3535 0
3536 \end_inset 
3537 </cell>
3538 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3539 \begin_inset Text
3540
3541 \layout Standard
3542
3543 4
3544 \end_inset 
3545 </cell>
3546 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3547 \begin_inset Text
3548
3549 \layout Standard
3550
3551 0
3552 \end_inset 
3553 </cell>
3554 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3555 \begin_inset Text
3556
3557 \layout Standard
3558
3559 0
3560 \end_inset 
3561 </cell>
3562 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3563 \begin_inset Text
3564
3565 \layout Standard
3566
3567 0
3568 \end_inset 
3569 </cell>
3570 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3571 \begin_inset Text
3572
3573 \layout Standard
3574
3575 0
3576 \end_inset 
3577 </cell>
3578 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3579 \begin_inset Text
3580
3581 \layout Standard
3582
3583 0
3584 \end_inset 
3585 </cell>
3586 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3587 \begin_inset Text
3588
3589 \layout Standard
3590
3591 0
3592 \end_inset 
3593 </cell>
3594 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3595 \begin_inset Text
3596
3597 \layout Standard
3598
3599 4
3600 \end_inset 
3601 </cell>
3602 </row>
3603 <row topline="true">
3604 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3605 \begin_inset Text
3606
3607 \layout Standard
3608
3609 OL Exc gain
3610 \end_inset 
3611 </cell>
3612 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3613 \begin_inset Text
3614
3615 \layout Standard
3616
3617 frame
3618 \end_inset 
3619 </cell>
3620 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3621 \begin_inset Text
3622
3623 \layout Standard
3624
3625 0
3626 \end_inset 
3627 </cell>
3628 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3629 \begin_inset Text
3630
3631 \layout Standard
3632
3633 5
3634 \end_inset 
3635 </cell>
3636 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3637 \begin_inset Text
3638
3639 \layout Standard
3640
3641 5
3642 \end_inset 
3643 </cell>
3644 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3645 \begin_inset Text
3646
3647 \layout Standard
3648
3649 5
3650 \end_inset 
3651 </cell>
3652 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3653 \begin_inset Text
3654
3655 \layout Standard
3656
3657 5
3658 \end_inset 
3659 </cell>
3660 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3661 \begin_inset Text
3662
3663 \layout Standard
3664
3665 5
3666 \end_inset 
3667 </cell>
3668 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3669 \begin_inset Text
3670
3671 \layout Standard
3672
3673 5
3674 \end_inset 
3675 </cell>
3676 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3677 \begin_inset Text
3678
3679 \layout Standard
3680
3681 5
3682 \end_inset 
3683 </cell>
3684 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3685 \begin_inset Text
3686
3687 \layout Standard
3688
3689 5
3690 \end_inset 
3691 </cell>
3692 </row>
3693 <row topline="true">
3694 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3695 \begin_inset Text
3696
3697 \layout Standard
3698
3699 Fine pitch
3700 \end_inset 
3701 </cell>
3702 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3703 \begin_inset Text
3704
3705 \layout Standard
3706
3707 sub-frame
3708 \end_inset 
3709 </cell>
3710 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3711 \begin_inset Text
3712
3713 \layout Standard
3714
3715 0
3716 \end_inset 
3717 </cell>
3718 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3719 \begin_inset Text
3720
3721 \layout Standard
3722
3723 0
3724 \end_inset 
3725 </cell>
3726 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3727 \begin_inset Text
3728
3729 \layout Standard
3730
3731 0
3732 \end_inset 
3733 </cell>
3734 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3735 \begin_inset Text
3736
3737 \layout Standard
3738
3739 7
3740 \end_inset 
3741 </cell>
3742 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3743 \begin_inset Text
3744
3745 \layout Standard
3746
3747 7
3748 \end_inset 
3749 </cell>
3750 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3751 \begin_inset Text
3752
3753 \layout Standard
3754
3755 7
3756 \end_inset 
3757 </cell>
3758 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3759 \begin_inset Text
3760
3761 \layout Standard
3762
3763 7
3764 \end_inset 
3765 </cell>
3766 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3767 \begin_inset Text
3768
3769 \layout Standard
3770
3771 7
3772 \end_inset 
3773 </cell>
3774 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3775 \begin_inset Text
3776
3777 \layout Standard
3778
3779 0
3780 \end_inset 
3781 </cell>
3782 </row>
3783 <row topline="true">
3784 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3785 \begin_inset Text
3786
3787 \layout Standard
3788
3789 Pitch gain
3790 \end_inset 
3791 </cell>
3792 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3793 \begin_inset Text
3794
3795 \layout Standard
3796
3797 sub-frame
3798 \end_inset 
3799 </cell>
3800 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3801 \begin_inset Text
3802
3803 \layout Standard
3804
3805 0
3806 \end_inset 
3807 </cell>
3808 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3809 \begin_inset Text
3810
3811 \layout Standard
3812
3813 0
3814 \end_inset 
3815 </cell>
3816 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3817 \begin_inset Text
3818
3819 \layout Standard
3820
3821 5
3822 \end_inset 
3823 </cell>
3824 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3825 \begin_inset Text
3826
3827 \layout Standard
3828
3829 5
3830 \end_inset 
3831 </cell>
3832 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3833 \begin_inset Text
3834
3835 \layout Standard
3836
3837 5
3838 \end_inset 
3839 </cell>
3840 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3841 \begin_inset Text
3842
3843 \layout Standard
3844
3845 7
3846 \end_inset 
3847 </cell>
3848 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3849 \begin_inset Text
3850
3851 \layout Standard
3852
3853 7
3854 \end_inset 
3855 </cell>
3856 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3857 \begin_inset Text
3858
3859 \layout Standard
3860
3861 7
3862 \end_inset 
3863 </cell>
3864 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3865 \begin_inset Text
3866
3867 \layout Standard
3868
3869 0
3870 \end_inset 
3871 </cell>
3872 </row>
3873 <row topline="true">
3874 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3875 \begin_inset Text
3876
3877 \layout Standard
3878
3879 Innovation gain
3880 \end_inset 
3881 </cell>
3882 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3883 \begin_inset Text
3884
3885 \layout Standard
3886
3887 sub-frame
3888 \end_inset 
3889 </cell>
3890 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3891 \begin_inset Text
3892
3893 \layout Standard
3894
3895 0
3896 \end_inset 
3897 </cell>
3898 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3899 \begin_inset Text
3900
3901 \layout Standard
3902
3903 1
3904 \end_inset 
3905 </cell>
3906 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3907 \begin_inset Text
3908
3909 \layout Standard
3910
3911 0
3912 \end_inset 
3913 </cell>
3914 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3915 \begin_inset Text
3916
3917 \layout Standard
3918
3919 1
3920 \end_inset 
3921 </cell>
3922 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3923 \begin_inset Text
3924
3925 \layout Standard
3926
3927 1
3928 \end_inset 
3929 </cell>
3930 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3931 \begin_inset Text
3932
3933 \layout Standard
3934
3935 3
3936 \end_inset 
3937 </cell>
3938 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3939 \begin_inset Text
3940
3941 \layout Standard
3942
3943 3
3944 \end_inset 
3945 </cell>
3946 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3947 \begin_inset Text
3948
3949 \layout Standard
3950
3951 3
3952 \end_inset 
3953 </cell>
3954 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
3955 \begin_inset Text
3956
3957 \layout Standard
3958
3959 0
3960 \end_inset 
3961 </cell>
3962 </row>
3963 <row topline="true" bottomline="true">
3964 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3965 \begin_inset Text
3966
3967 \layout Standard
3968
3969 Innovation VQ
3970 \end_inset 
3971 </cell>
3972 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3973 \begin_inset Text
3974
3975 \layout Standard
3976
3977 sub-frame
3978 \end_inset 
3979 </cell>
3980 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3981 \begin_inset Text
3982
3983 \layout Standard
3984
3985 0
3986 \end_inset 
3987 </cell>
3988 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3989 \begin_inset Text
3990
3991 \layout Standard
3992
3993 0
3994 \end_inset 
3995 </cell>
3996 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
3997 \begin_inset Text
3998
3999 \layout Standard
4000
4001 16
4002 \end_inset 
4003 </cell>
4004 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4005 \begin_inset Text
4006
4007 \layout Standard
4008
4009 20
4010 \end_inset 
4011 </cell>
4012 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4013 \begin_inset Text
4014
4015 \layout Standard
4016
4017 35
4018 \end_inset 
4019 </cell>
4020 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4021 \begin_inset Text
4022
4023 \layout Standard
4024
4025 48
4026 \end_inset 
4027 </cell>
4028 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
4029 \begin_inset Text
4030
4031 \layout Standard
4032
4033 64
4034 \end_inset 
4035 </cell>
4036 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
4037 \begin_inset Text
4038
4039 \layout Standard
4040
4041 96
4042 \end_inset 
4043 </cell>
4044 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
4045 \begin_inset Text
4046
4047 \layout Standard
4048
4049 10
4050 \end_inset 
4051 </cell>
4052 </row>
4053 <row topline="true" bottomline="true">
4054 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4055 \begin_inset Text
4056
4057 \layout Standard
4058
4059 Total
4060 \end_inset 
4061 </cell>
4062 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4063 \begin_inset Text
4064
4065 \layout Standard
4066
4067 frame
4068 \end_inset 
4069 </cell>
4070 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4071 \begin_inset Text
4072
4073 \layout Standard
4074
4075 5
4076 \end_inset 
4077 </cell>
4078 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4079 \begin_inset Text
4080
4081 \layout Standard
4082
4083 43
4084 \end_inset 
4085 </cell>
4086 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4087 \begin_inset Text
4088
4089 \layout Standard
4090
4091 119
4092 \end_inset 
4093 </cell>
4094 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4095 \begin_inset Text
4096
4097 \layout Standard
4098
4099 160
4100 \end_inset 
4101 </cell>
4102 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4103 \begin_inset Text
4104
4105 \layout Standard
4106
4107 220
4108 \end_inset 
4109 </cell>
4110 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4111 \begin_inset Text
4112
4113 \layout Standard
4114
4115 300
4116 \end_inset 
4117 </cell>
4118 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
4119 \begin_inset Text
4120
4121 \layout Standard
4122
4123 364
4124 \end_inset 
4125 </cell>
4126 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
4127 \begin_inset Text
4128
4129 \layout Standard
4130
4131 492
4132 \end_inset 
4133 </cell>
4134 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
4135 \begin_inset Text
4136
4137 \layout Standard
4138
4139 79
4140 \end_inset 
4141 </cell>
4142 </row>
4143 </lyxtabular>
4144
4145 \end_inset 
4146
4147
4148 \layout Caption
4149
4150 Bit allocation for narrowband modes
4151 \begin_inset LatexCommand \label{cap:bits-narrowband}
4152
4153 \end_inset 
4154
4155
4156 \end_inset 
4157
4158
4159 \layout Standard
4160
4161 So far, no MOS (Mean Opinion Score
4162 \begin_inset LatexCommand \index{mean opinion score}
4163
4164 \end_inset 
4165
4166 ) subjective evaluation has been performed for Speex.
4167  In order to give an idea of the quality achivable with it, table 
4168 \begin_inset LatexCommand \ref{cap:quality_vs_bps}
4169
4170 \end_inset 
4171
4172  presents my own subjective opinion on it.
4173  It sould be noted that different people will perceive the quality differently
4174  and that the person that designed the codec often has a bias (one way or
4175  another) when it comes to subjective evaluation.
4176  Last thing, it should be noted that for most codecs (including Speex) encoding
4177  quality sometimes varies depending on the input.
4178  Note that the complexity is only approximate (within 0.5 mflops and using
4179  the lowest complexity setting).
4180  Decoding requires approximately 0.5 mflops
4181 \begin_inset LatexCommand \index{complexity}
4182
4183 \end_inset 
4184
4185  in most modes (1 mflops with perceptual enhancement).
4186 \layout Standard
4187
4188
4189 \begin_inset Float table
4190 placement h
4191 wide true
4192 collapsed false
4193
4194 \layout Standard
4195
4196
4197 \begin_inset  Tabular
4198 <lyxtabular version="3" rows="17" columns="4">
4199 <features>
4200 <column alignment="center" valignment="top" leftline="true" width="0pt">
4201 <column alignment="center" valignment="top" leftline="true" width="0pt">
4202 <column alignment="center" valignment="top" leftline="true" width="0pt">
4203 <column alignment="center" valignment="top" leftline="true" rightline="true" width="0pt">
4204 <row topline="true" bottomline="true">
4205 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4206 \begin_inset Text
4207
4208 \layout Standard
4209
4210 Mode
4211 \end_inset 
4212 </cell>
4213 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4214 \begin_inset Text
4215
4216 \layout Standard
4217
4218 Bit-rate
4219 \begin_inset LatexCommand \index{bit-rate}
4220
4221 \end_inset 
4222
4223  (bps)
4224 \end_inset 
4225 </cell>
4226 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4227 \begin_inset Text
4228
4229 \layout Standard
4230
4231 mflops
4232 \begin_inset LatexCommand \index{complexity}
4233
4234 \end_inset 
4235
4236
4237 \end_inset 
4238 </cell>
4239 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
4240 \begin_inset Text
4241
4242 \layout Standard
4243
4244 Quality/description
4245 \end_inset 
4246 </cell>
4247 </row>
4248 <row topline="true">
4249 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4250 \begin_inset Text
4251
4252 \layout Standard
4253
4254 0
4255 \end_inset 
4256 </cell>
4257 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4258 \begin_inset Text
4259
4260 \layout Standard
4261
4262 250
4263 \end_inset 
4264 </cell>
4265 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4266 \begin_inset Text
4267
4268 \layout Standard
4269
4270 N/A
4271 \end_inset 
4272 </cell>
4273 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
4274 \begin_inset Text
4275
4276 \layout Standard
4277
4278 No transmission (DTX)
4279 \end_inset 
4280 </cell>
4281 </row>
4282 <row topline="true">
4283 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4284 \begin_inset Text
4285
4286 \layout Standard
4287
4288 1
4289 \end_inset 
4290 </cell>
4291 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4292 \begin_inset Text
4293
4294 \layout Standard
4295
4296 2,150
4297 \end_inset 
4298 </cell>
4299 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4300 \begin_inset Text
4301
4302 \layout Standard
4303
4304 6
4305 \end_inset 
4306 </cell>
4307 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
4308 \begin_inset Text
4309
4310 \layout Standard
4311
4312 Vocoder (mostly for comfort noise)
4313 \end_inset 
4314 </cell>
4315 </row>
4316 <row topline="true">
4317 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4318 \begin_inset Text
4319
4320 \layout Standard
4321
4322 2
4323 \end_inset 
4324 </cell>
4325 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4326 \begin_inset Text
4327
4328 \layout Standard
4329
4330 5,950
4331 \end_inset 
4332 </cell>
4333 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4334 \begin_inset Text
4335
4336 \layout Standard
4337
4338 9
4339 \end_inset 
4340 </cell>
4341 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
4342 \begin_inset Text
4343
4344 \layout Standard
4345
4346 Very noticeable artifacts/noise, good intelligibility
4347 \end_inset 
4348 </cell>
4349 </row>
4350 <row topline="true">
4351 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4352 \begin_inset Text
4353
4354 \layout Standard
4355
4356 3
4357 \end_inset 
4358 </cell>
4359 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4360 \begin_inset Text
4361
4362 \layout Standard
4363
4364 8,000
4365 \end_inset 
4366 </cell>
4367 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4368 \begin_inset Text
4369
4370 \layout Standard
4371
4372 10
4373 \end_inset 
4374 </cell>
4375 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
4376 \begin_inset Text
4377
4378 \layout Standard
4379
4380 Artifacts/noise sometimes noticeable
4381 \end_inset 
4382 </cell>
4383 </row>
4384 <row topline="true">
4385 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4386 \begin_inset Text
4387
4388 \layout Standard
4389
4390 4
4391 \end_inset 
4392 </cell>
4393 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4394 \begin_inset Text
4395
4396 \layout Standard
4397
4398 11,000
4399 \end_inset 
4400 </cell>
4401 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4402 \begin_inset Text
4403
4404 \layout Standard
4405
4406 14
4407 \end_inset 
4408 </cell>
4409 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
4410 \begin_inset Text
4411
4412 \layout Standard
4413
4414 Artifacts usually noticeable only with headphones
4415 \end_inset 
4416 </cell>
4417 </row>
4418 <row topline="true">
4419 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4420 \begin_inset Text
4421
4422 \layout Standard
4423
4424 5
4425 \end_inset 
4426 </cell>
4427 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4428 \begin_inset Text
4429
4430 \layout Standard
4431
4432 15,000
4433 \end_inset 
4434 </cell>
4435 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4436 \begin_inset Text
4437
4438 \layout Standard
4439
4440 11
4441 \end_inset 
4442 </cell>
4443 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
4444 \begin_inset Text
4445
4446 \layout Standard
4447
4448 Need good headphones to tell the difference
4449 \end_inset 
4450 </cell>
4451 </row>
4452 <row topline="true">
4453 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4454 \begin_inset Text
4455
4456 \layout Standard
4457
4458 6
4459 \end_inset 
4460 </cell>
4461 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4462 \begin_inset Text
4463
4464 \layout Standard
4465
4466 18,200
4467 \end_inset 
4468 </cell>
4469 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4470 \begin_inset Text
4471
4472 \layout Standard
4473
4474 17.5
4475 \end_inset 
4476 </cell>
4477 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
4478 \begin_inset Text
4479
4480 \layout Standard
4481
4482 Hard to tell the difference even with good headphones
4483 \end_inset 
4484 </cell>
4485 </row>
4486 <row topline="true">
4487 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4488 \begin_inset Text
4489
4490 \layout Standard
4491
4492 7
4493 \end_inset 
4494 </cell>
4495 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4496 \begin_inset Text
4497
4498 \layout Standard
4499
4500 24,600
4501 \end_inset 
4502 </cell>
4503 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4504 \begin_inset Text
4505
4506 \layout Standard
4507
4508 14.5
4509 \end_inset 
4510 </cell>
4511 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
4512 \begin_inset Text
4513
4514 \layout Standard
4515
4516 Completely transparent for voice, good quality music
4517 \end_inset 
4518 </cell>
4519 </row>
4520 <row topline="true">
4521 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4522 \begin_inset Text
4523
4524 \layout Standard
4525
4526 8
4527 \end_inset 
4528 </cell>
4529 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4530 \begin_inset Text
4531
4532 \layout Standard
4533
4534 3,950
4535 \end_inset 
4536 </cell>
4537 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4538 \begin_inset Text
4539
4540 \layout Standard
4541
4542 10.5
4543 \end_inset 
4544 </cell>
4545 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
4546 \begin_inset Text
4547
4548 \layout Standard
4549
4550 Very noticeable artifacts/noise, good intelligibility
4551 \end_inset 
4552 </cell>
4553 </row>
4554 <row topline="true">
4555 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4556 \begin_inset Text
4557
4558 \layout Standard
4559
4560 9
4561 \end_inset 
4562 </cell>
4563 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4564 \begin_inset Text
4565
4566 \layout Standard
4567
4568 N/A
4569 \end_inset 
4570 </cell>
4571 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4572 \begin_inset Text
4573
4574 \layout Standard
4575
4576 N/A
4577 \end_inset 
4578 </cell>
4579 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
4580 \begin_inset Text
4581
4582 \layout Standard
4583
4584 reserved
4585 \end_inset 
4586 </cell>
4587 </row>
4588 <row topline="true">
4589 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4590 \begin_inset Text
4591
4592 \layout Standard
4593
4594 10
4595 \end_inset 
4596 </cell>
4597 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4598 \begin_inset Text
4599
4600 \layout Standard
4601
4602 N/A
4603 \end_inset 
4604 </cell>
4605 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4606 \begin_inset Text
4607
4608 \layout Standard
4609
4610 N/A
4611 \end_inset 
4612 </cell>
4613 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
4614 \begin_inset Text
4615
4616 \layout Standard
4617
4618 reserved
4619 \end_inset 
4620 </cell>
4621 </row>
4622 <row topline="true">
4623 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4624 \begin_inset Text
4625
4626 \layout Standard
4627
4628 11
4629 \end_inset 
4630 </cell>
4631 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4632 \begin_inset Text
4633
4634 \layout Standard
4635
4636 N/A
4637 \end_inset 
4638 </cell>
4639 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4640 \begin_inset Text
4641
4642 \layout Standard
4643
4644 N/A
4645 \end_inset 
4646 </cell>
4647 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
4648 \begin_inset Text
4649
4650 \layout Standard
4651
4652 reserved
4653 \end_inset 
4654 </cell>
4655 </row>
4656 <row topline="true">
4657 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4658 \begin_inset Text
4659
4660 \layout Standard
4661
4662 12
4663 \end_inset 
4664 </cell>
4665 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4666 \begin_inset Text
4667
4668 \layout Standard
4669
4670 N/A
4671 \end_inset 
4672 </cell>
4673 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4674 \begin_inset Text
4675
4676 \layout Standard
4677
4678 N/A
4679 \end_inset 
4680 </cell>
4681 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
4682 \begin_inset Text
4683
4684 \layout Standard
4685
4686 reserved
4687 \end_inset 
4688 </cell>
4689 </row>
4690 <row topline="true">
4691 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4692 \begin_inset Text
4693
4694 \layout Standard
4695
4696 13
4697 \end_inset 
4698 </cell>
4699 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4700 \begin_inset Text
4701
4702 \layout Standard
4703
4704 N/A
4705 \end_inset 
4706 </cell>
4707 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4708 \begin_inset Text
4709
4710 \layout Standard
4711
4712 N/A
4713 \end_inset 
4714 </cell>
4715 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
4716 \begin_inset Text
4717
4718 \layout Standard
4719
4720 Application-defined, interpreted by callback or skipped
4721 \end_inset 
4722 </cell>
4723 </row>
4724 <row topline="true">
4725 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4726 \begin_inset Text
4727
4728 \layout Standard
4729
4730 14
4731 \end_inset 
4732 </cell>
4733 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4734 \begin_inset Text
4735
4736 \layout Standard
4737
4738 N/A
4739 \end_inset 
4740 </cell>
4741 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4742 \begin_inset Text
4743
4744 \layout Standard
4745
4746 N/A
4747 \end_inset 
4748 </cell>
4749 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
4750 \begin_inset Text
4751
4752 \layout Standard
4753
4754 Speex in-band signaling
4755 \end_inset 
4756 </cell>
4757 </row>
4758 <row topline="true" bottomline="true">
4759 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4760 \begin_inset Text
4761
4762 \layout Standard
4763
4764 15
4765 \end_inset 
4766 </cell>
4767 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4768 \begin_inset Text
4769
4770 \layout Standard
4771
4772 N/A
4773 \end_inset 
4774 </cell>
4775 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4776 \begin_inset Text
4777
4778 \layout Standard
4779
4780 N/A
4781 \end_inset 
4782 </cell>
4783 <cell alignment="center" valignment="top" topline="true" leftline="true" rightline="true" usebox="none">
4784 \begin_inset Text
4785
4786 \layout Standard
4787
4788 Terminator code
4789 \end_inset 
4790 </cell>
4791 </row>
4792 </lyxtabular>
4793
4794 \end_inset 
4795
4796
4797 \layout Caption
4798
4799 Quality versus bit-rate
4800 \begin_inset LatexCommand \label{cap:quality_vs_bps}
4801
4802 \end_inset 
4803
4804
4805 \end_inset 
4806
4807
4808 \layout Subsection
4809
4810 Perceptual enhancement
4811 \begin_inset LatexCommand \index{perceptual enhancement}
4812
4813 \end_inset 
4814
4815
4816 \layout Standard
4817
4818 This part of the codec only applies to the decoder and can even be changed
4819  without affecting inter-operability.
4820  For that reason, the implementation provided and described here should
4821  only be considered as a reference implementation.
4822  The enhancement system is divided into two parts.
4823  First, the synthesis filter 
4824 \begin_inset Formula $S(z)=1/A(z)$
4825 \end_inset 
4826
4827  is replaced by an enhanced filter
4828 \begin_inset Formula \[
4829 S'(z)=\frac{A\left(z/a_{2}\right)A\left(z/a_{3}\right)}{A\left(z\right)A\left(z/a_{1}\right)}\]
4830
4831 \end_inset 
4832
4833 where 
4834 \begin_inset Formula $a_{1}$
4835 \end_inset 
4836
4837  and 
4838 \begin_inset Formula $a_{2}$
4839 \end_inset 
4840
4841  depend on the mode in use and 
4842 \begin_inset Formula $a_{3}=\frac{1}{r}\left(1-\frac{1-ra_{1}}{1-ra_{2}}\right)$
4843 \end_inset 
4844
4845  with 
4846 \begin_inset Formula $r=.9$
4847 \end_inset 
4848
4849 .
4850  The second part of the enhancement consists of using a comb filter to enhance
4851  the pitch in the excitation domain.
4852  
4853 \layout Section
4854 \pagebreak_top 
4855 Speex wideband mode (sub-band CELP)
4856 \begin_inset LatexCommand \index{wideband}
4857
4858 \end_inset 
4859
4860
4861 \begin_inset LatexCommand \label{sec:Speex-wideband-mode}
4862
4863 \end_inset 
4864
4865
4866 \layout Standard
4867
4868 For wideband, the Speex approach uses a 
4869 \emph on 
4870 q
4871 \emph default 
4872 uadrature 
4873 \emph on 
4874 m
4875 \emph default 
4876 irror 
4877 \emph on 
4878 f
4879 \emph default 
4880 ilter
4881 \begin_inset LatexCommand \index{quadrature mirror filter}
4882
4883 \end_inset 
4884
4885  (QMF) to split the band in two.
4886  The 16 kHz signal is thus divided into two 8 kHz signals, one representing
4887  the low band (0-4 kHz), the other the high band (4-8 kHz).
4888  The low band is encoded with the narrowband mode described in section 
4889 \begin_inset LatexCommand \ref{sec:Speex-narrowband-mode}
4890
4891 \end_inset 
4892
4893  in such a way that the resulting 
4894 \begin_inset Quotes eld
4895 \end_inset 
4896
4897 embedded narrowband bit-stream
4898 \begin_inset Quotes erd
4899 \end_inset 
4900
4901  can also be decoded with the narrowband decoder.
4902  Since the low band encoding has already been described, only the high band
4903  encoding is described in this section.
4904 \layout Subsection
4905
4906 Linear Prediction
4907 \layout Standard
4908
4909 The linear prediction part used for the high-band is very similar to what
4910  is done for narrowband.
4911  The only difference is that we use only 12 bits to encode the high-band
4912  LSP's using a multi-stage vector quantizer (MSVQ).
4913  The first level quantizes the 10 coefficients with 6 bits and the error
4914  is then quantized using 6 bits, too.
4915 \layout Subsection
4916
4917 Pitch Prediction
4918 \layout Standard
4919
4920 That part is easy: there's no pitch prediction for the high-band.
4921  There are two reasons for that.
4922  First, there is usually little harmonic structure in this band (above 4
4923  kHz).
4924  Second, it would be very hard to implement since the QMF folds the 4-8
4925  kHz band into 4-0 kHz (reversing the frequency axis), which means that
4926  the location of the harmonics is no longer at multiples of the fundamental
4927  (pitch).
4928 \layout Subsection
4929
4930 Excitation Quantization
4931 \layout Standard
4932
4933 The high-band excitation is coded in the same way as for narrowband.
4934  
4935 \layout Subsection
4936
4937 Bit allocation
4938 \layout Standard
4939
4940 For the wideband mode, the entire narrowband frame is packed before the
4941  high-band is encoded.
4942  The narrowband part of the bit-stream is as defined in table 
4943 \begin_inset LatexCommand \ref{cap:bits-narrowband}
4944
4945 \end_inset 
4946
4947 .
4948  The high-band follows, as described in table 
4949 \begin_inset LatexCommand \ref{cap:bits-wideband}
4950
4951 \end_inset 
4952
4953 .
4954  This also means that a wideband frame may be correctly decoded by a narrowband
4955  decoder with the only caveat that if more than one frame is packed in the
4956  same packet, the decoder will need to skip the high-band parts in order
4957  to sync with the bit-stream.
4958 \layout Standard
4959
4960
4961 \begin_inset Float table
4962 placement h
4963 wide true
4964 collapsed false
4965
4966 \layout Standard
4967
4968
4969 \begin_inset  Tabular
4970 <lyxtabular version="3" rows="7" columns="7">
4971 <features>
4972 <column alignment="center" valignment="top" leftline="true" width="0pt">
4973 <column alignment="center" valignment="top" leftline="true" width="0pt">
4974 <column alignment="center" valignment="top" leftline="true" width="0pt">
4975 <column alignment="center" valignment="top" leftline="true" width="0pt">
4976 <column alignment="center" valignment="top" leftline="true" width="0pt">
4977 <column alignment="center" valignment="top" leftline="true" width="0pt">
4978 <column alignment="center" valignment="top" leftline="true" rightline="true" width="0pt">
4979 <row topline="true" bottomline="true">
4980 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4981 \begin_inset Text
4982
4983 \layout Standard
4984
4985 Parameter
4986 \end_inset 
4987 </cell>
4988 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4989 \begin_inset Text
4990
4991 \layout Standard
4992
4993 Update rate
4994 \end_inset 
4995 </cell>
4996 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
4997 \begin_inset Text
4998
4999 \layout Standard
5000
5001 0
5002 \end_inset 
5003 </cell>
5004 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5005 \begin_inset Text
5006
5007 \layout Standard
5008
5009 1
5010 \end_inset 
5011 </cell>
5012 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5013 \begin_inset Text
5014
5015 \layout Standard
5016
5017 2
5018 \end_inset 
5019 </cell>
5020 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5021 \begin_inset Text
5022
5023 \layout Standard
5024
5025 3
5026 \end_inset 
5027 </cell>
5028 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5029 \begin_inset Text
5030
5031 \layout Standard
5032
5033 4
5034 \end_inset 
5035 </cell>
5036 </row>
5037 <row topline="true">
5038 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5039 \begin_inset Text
5040
5041 \layout Standard
5042
5043 Wideband bit
5044 \end_inset 
5045 </cell>
5046 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5047 \begin_inset Text
5048
5049 \layout Standard
5050
5051 frame
5052 \end_inset 
5053 </cell>
5054 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5055 \begin_inset Text
5056
5057 \layout Standard
5058
5059 1
5060 \end_inset 
5061 </cell>
5062 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5063 \begin_inset Text
5064
5065 \layout Standard
5066
5067 1
5068 \end_inset 
5069 </cell>
5070 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5071 \begin_inset Text
5072
5073 \layout Standard
5074
5075 1
5076 \end_inset 
5077 </cell>
5078 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5079 \begin_inset Text
5080
5081 \layout Standard
5082
5083 1
5084 \end_inset 
5085 </cell>
5086 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5087 \begin_inset Text
5088
5089 \layout Standard
5090
5091 1
5092 \end_inset 
5093 </cell>
5094 </row>
5095 <row topline="true">
5096 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5097 \begin_inset Text
5098
5099 \layout Standard
5100
5101 Mode ID
5102 \end_inset 
5103 </cell>
5104 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5105 \begin_inset Text
5106
5107 \layout Standard
5108
5109 frame
5110 \end_inset 
5111 </cell>
5112 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5113 \begin_inset Text
5114
5115 \layout Standard
5116
5117 3
5118 \end_inset 
5119 </cell>
5120 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5121 \begin_inset Text
5122
5123 \layout Standard
5124
5125 3
5126 \end_inset 
5127 </cell>
5128 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5129 \begin_inset Text
5130
5131 \layout Standard
5132
5133 3
5134 \end_inset 
5135 </cell>
5136 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5137 \begin_inset Text
5138
5139 \layout Standard
5140
5141 3
5142 \end_inset 
5143 </cell>
5144 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5145 \begin_inset Text
5146
5147 \layout Standard
5148
5149 3
5150 \end_inset 
5151 </cell>
5152 </row>
5153 <row topline="true">
5154 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5155 \begin_inset Text
5156
5157 \layout Standard
5158
5159 LSP
5160 \end_inset 
5161 </cell>
5162 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5163 \begin_inset Text
5164
5165 \layout Standard
5166
5167 frame
5168 \end_inset 
5169 </cell>
5170 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5171 \begin_inset Text
5172
5173 \layout Standard
5174
5175 0
5176 \end_inset 
5177 </cell>
5178 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5179 \begin_inset Text
5180
5181 \layout Standard
5182
5183 12
5184 \end_inset 
5185 </cell>
5186 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5187 \begin_inset Text
5188
5189 \layout Standard
5190
5191 12
5192 \end_inset 
5193 </cell>
5194 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5195 \begin_inset Text
5196
5197 \layout Standard
5198
5199 12
5200 \end_inset 
5201 </cell>
5202 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5203 \begin_inset Text
5204
5205 \layout Standard
5206
5207 12
5208 \end_inset 
5209 </cell>
5210 </row>
5211 <row topline="true">
5212 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5213 \begin_inset Text
5214
5215 \layout Standard
5216
5217 Excitation gain
5218 \end_inset 
5219 </cell>
5220 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5221 \begin_inset Text
5222
5223 \layout Standard
5224
5225 sub-frame
5226 \end_inset 
5227 </cell>
5228 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5229 \begin_inset Text
5230
5231 \layout Standard
5232
5233 0
5234 \end_inset 
5235 </cell>
5236 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5237 \begin_inset Text
5238
5239 \layout Standard
5240
5241 5
5242 \end_inset 
5243 </cell>
5244 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5245 \begin_inset Text
5246
5247 \layout Standard
5248
5249 4
5250 \end_inset 
5251 </cell>
5252 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5253 \begin_inset Text
5254
5255 \layout Standard
5256
5257 4
5258 \end_inset 
5259 </cell>
5260 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5261 \begin_inset Text
5262
5263 \layout Standard
5264
5265 4
5266 \end_inset 
5267 </cell>
5268 </row>
5269 <row topline="true" bottomline="true">
5270 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5271 \begin_inset Text
5272
5273 \layout Standard
5274
5275 Excitation VQ
5276 \end_inset 
5277 </cell>
5278 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5279 \begin_inset Text
5280
5281 \layout Standard
5282
5283 sub-frame
5284 \end_inset 
5285 </cell>
5286 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5287 \begin_inset Text
5288
5289 \layout Standard
5290
5291 0
5292 \end_inset 
5293 </cell>
5294 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5295 \begin_inset Text
5296
5297 \layout Standard
5298
5299 0
5300 \end_inset 
5301 </cell>
5302 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5303 \begin_inset Text
5304
5305 \layout Standard
5306
5307 20
5308 \end_inset 
5309 </cell>
5310 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5311 \begin_inset Text
5312
5313 \layout Standard
5314
5315 40
5316 \end_inset 
5317 </cell>
5318 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5319 \begin_inset Text
5320
5321 \layout Standard
5322
5323 80
5324 \end_inset 
5325 </cell>
5326 </row>
5327 <row topline="true" bottomline="true">
5328 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5329 \begin_inset Text
5330
5331 \layout Standard
5332
5333 Total
5334 \end_inset 
5335 </cell>
5336 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5337 \begin_inset Text
5338
5339 \layout Standard
5340
5341 frame
5342 \end_inset 
5343 </cell>
5344 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5345 \begin_inset Text
5346
5347 \layout Standard
5348
5349 4
5350 \end_inset 
5351 </cell>
5352 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5353 \begin_inset Text
5354
5355 \layout Standard
5356
5357 36
5358 \end_inset 
5359 </cell>
5360 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5361 \begin_inset Text
5362
5363 \layout Standard
5364
5365 112
5366 \end_inset 
5367 </cell>
5368 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5369 \begin_inset Text
5370
5371 \layout Standard
5372
5373 192
5374 \end_inset 
5375 </cell>
5376 <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none">
5377 \begin_inset Text
5378
5379 \layout Standard
5380
5381 352
5382 \end_inset 
5383 </cell>
5384 </row>
5385 </lyxtabular>
5386
5387 \end_inset 
5388
5389
5390 \layout Caption
5391
5392 Bit allocation for high-band in wideband mode
5393 \begin_inset LatexCommand \label{cap:bits-wideband}
5394
5395 \end_inset 
5396
5397
5398 \end_inset 
5399
5400
5401 \layout Standard
5402
5403
5404 \begin_inset ERT
5405 status Open
5406
5407 \layout Standard
5408
5409 \backslash 
5410 clearpage
5411 \end_inset 
5412
5413
5414 \layout Standard
5415
5416
5417 \begin_inset ERT
5418 status Collapsed
5419
5420 \layout Standard
5421
5422 \backslash 
5423 clearpage
5424 \end_inset 
5425
5426
5427 \layout Section
5428 \start_of_appendix 
5429 FAQ
5430 \layout Subsection*