<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="country-region"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="PostalCode"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="State"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="Street"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="PlaceType"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="PlaceName"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="address"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="place"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="City"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
p.MsoAutoSig, li.MsoAutoSig, div.MsoAutoSig
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:Arial;
        color:windowtext;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>Jieun,<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>I just wanted to follow up
on our discussion yesterday on Huffman coding.&nbsp; As you may already know, Layers
I and II do not do any Huffman coding but Layer III Huffman encodes quantized
mantissas using an approach similar to that used in AAC.&nbsp; I will describe
below what Layer III does and then summarize the differences between the Layer
III and AAC approaches. <o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>In general, you can design your
Huffman coding following their general guidelines but you should base it on you
coder characteristics. I would strongly recommend not using their tables (you
need to build your own based on your coder structure).&nbsp; (Also, you don't
necessarily need to follow their spectral subdivision.&nbsp; The documentation
should serve you as a guideline for their approach, but you cannot apply it
verbatim to your coder.)&nbsp; I will also distribute in class today some general
notes for Huffman code that may help.<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>In Layer III, the spectral
lines are divided in up to 5 groups that can use different Huffman coding
books.&nbsp; The basic idea is that the highest frequency lines aren't passed
at all (zero bits) and the number of bits allocated gets higher as the
frequency gets lower.&nbsp; This leads to using different codebooks that are
geared to mantissa magnitudes that get higher as the line frequencies get
lower.&nbsp;&nbsp; (In all cases, the Huffman encoding applies only to the
mantissa's magnitude and Huffman codes are followed by sign bits for each
non-zero magnitude.)&nbsp; <o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>The frequency lines are
broken into 3 sections: the zeroes section which includes all the highest
frequency lines that aren't given any bits so don't need encoding, the ones
section which includes the next set of lines (moving downward in frequency)
that are only quantized as values {-1,0,1}, and then the &#8220;bigvalues&#8221;
section which includes all other lines.<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>Lines in the &#8220;ones&#8221;
section are encoded in groups of 4 using one of 2 Huffman Tables (one of which
doesn't actually Huffman code -- it assumes equal probabilities of all
outcomes). Lines in the bigvalues section can be broken into up to 3 groups,
each of which can use its own Huffman codebook to encode pairs of values.&nbsp;
(Note: to make the pairing work out, the zeroes section must include an even
number of lines and the ones section must include a multiple of 4 lines -- a
last odd zero line becomes part of the ones section and any loose lines in the
ones section get included in the bigvalues section.)&nbsp; The encoder can try
different choices of how to split the bigvalues region as well as deciding
which codebook to use in each region and then can send that information to the
decoder.<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>The bigvalues codebooks are
of 2 types:&nbsp; books that only allow mantissas up to a specified maximum
absolute value and books that are capped at mantissa magnitudes equal to 15 but
which have an &quot;escape code&quot; allowing bigger magnitudes to be
handled.&nbsp; (Note: in AAC there is the pulse method to handle bigger values
in the non-escape codebooks but this method isn't included in Layer III.)&nbsp;
<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>The way the larger
amplitudes are handled is that each escape-code book has a specified number of
bits that are read after the escape code is received and the number represented
in those bits is added to 14 to represent the mantissa magnitude.&nbsp; (The
escape code is 15 in these tables so the largest magnitude they can represent
w/o the escape code is 14. &nbsp;The bits after the escape code tell how much
higher the actual magnitude was.)&nbsp; Clearly, large values much higher than
14 need more bits to describe and so the main difference in the escape code
tables is the number of bits that follow each escape code.&nbsp; &nbsp;&nbsp;(Note:
AAC has changed the syntax following the escape code and follows it with a
sequence of 1 bits followed by a zero bit that tells how many bits are needed
to describe the large magnitude and then those bits follow.&nbsp; Due to that
change in escape syntax, AAC only has one escape code table.)<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>That's basically it -- AAC
builds upon this basic method in a number of ways.&nbsp; Firstly, AAC also
Huffman encodes scale factors (or more accurately, differences in frequency-adjacent
scale factors).&nbsp; Secondly, AAC offers a bit more flexibility in how lines
are grouped into sets using different codebooks -- AAC allows any groupings of
adjacent critical bands to get their own codebooks.&nbsp; Thirdly, AAC has an
additional way to handle magnitudes beyond the table maxima (the pulse method)
that applies to the non-escape code tables so they can be used even when a few
lines have magnitudes beyond the maximum for the codebook table. &nbsp;Finally,
the escape code syntax was made more flexible so each instance of an escape
code tells how many bits are needed to describe the large magnitude so all the
extra escape code tables were eliminated.&nbsp; (A minor other difference is
that Layer III only Huffman encodes mantissa magnitudes, appending sign bits to
the codes as needed, while AAC also includes a few Huffman codebooks that
encode signed mantissas.)<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoAutoSig><strong><b><font size=3 color=green face=Arial><span
style='font-size:12.0pt;font-family:Arial;color:green'>Marina Bosi</span></font></b></strong><font
color=navy face=Arial><span style='font-family:Arial;color:navy'><o:p></o:p></span></font></p>

<p class=MsoAutoSig><i><font size=2 color=navy face="Times New Roman"><span
style='font-size:11.0pt;color:navy;font-style:italic'>Consulting Professor,
Department of</span></font></i><i><font size=2 color=navy><span
style='font-size:10.0pt;color:navy;font-style:italic'> </span></font></i><i><font
size=2 color=navy><span style='font-size:11.0pt;color:navy;font-style:italic'>Music</span></font></i><i><font
size=2 color=navy><span style='font-size:10.0pt;color:navy;font-style:italic'><o:p></o:p></span></font></i></p>

<p class=MsoAutoSig><st1:place w:st="on"><st1:PlaceName w:st="on"><i><font
  size=3 color=navy face="Times New Roman"><span style='font-size:12.0pt;
  color:navy;font-style:italic'>Stanford</span></font></i></st1:PlaceName><i><font
 color=navy><span style='color:navy;font-style:italic'> <st1:PlaceType w:st="on">University</st1:PlaceType></span></font></i></st1:place><i><font
color=navy><span style='color:navy;font-style:italic'><o:p></o:p></span></font></i></p>

<p class=MsoAutoSig><font size=2 color=navy face="Times New Roman"><span
style='font-size:10.0pt;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoAutoSig><st1:place w:st="on"><st1:PlaceName w:st="on"><i><font
  size=2 face="Times New Roman"><span style='font-size:11.0pt;font-style:italic'>Computer</span></font></i></st1:PlaceName><i><font
 size=2><span style='font-size:11.0pt;font-style:italic'> <st1:PlaceType w:st="on">Center</st1:PlaceType></span></font></i></st1:place><i><font
size=2><span style='font-size:11.0pt;font-style:italic'> for Research in Music
and Acoustics<o:p></o:p></span></font></i></p>

<p class=MsoAutoSig><font size=2 face="Times New Roman"><span style='font-size:
10.0pt'>The Knoll,&nbsp; <st1:Street w:st="on"><st1:address w:st="on">660
  Lomita Court</st1:address></st1:Street><o:p></o:p></span></font></p>

<p class=MsoAutoSig><st1:place w:st="on"><st1:City w:st="on"><font size=2
  face="Times New Roman"><span style='font-size:10.0pt'>Stanford</span></font></st1:City><font
 size=2><span style='font-size:10.0pt'>, <st1:State w:st="on">California</st1:State>
 <st1:PostalCode w:st="on">94305-8180</st1:PostalCode>, <st1:country-region
 w:st="on">USA</st1:country-region></span></font></st1:place><font size=2><span
style='font-size:10.0pt'><o:p></o:p></span></font></p>

<p class=MsoAutoSig><u><font size=2 color=blue face="Times New Roman"><span
style='font-size:10.0pt;color:blue'>http://ccrma.stanford.edu<o:p></o:p></span></font></u></p>

<p class=MsoAutoSig><font size=2 color=blue face="Times New Roman"><span
style='font-size:10.0pt;color:blue'>mbosi@stanford.edu</span></font><font
color=blue><span style='color:blue'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

</div>

</body>

</html>