shithub: opus

Download patch

ref: 59f676875013a6ffbcb02fb7f4421145ccbfc98a
parent: f1b5006d8c0b4fc1c136bb485d8ae3b100f69dc3
author: Jean-Marc Valin <[email protected]>
date: Fri Jun 12 07:49:28 EDT 2009

ietf doc: better description of the bitstream

--- a/doc/ietf/draft-valin-celt-codec.xml
+++ b/doc/ietf/draft-valin-celt-codec.xml
@@ -162,12 +162,68 @@
 
 <section anchor="CELT Encoder" title="CELT Encoder">
 
-<t>Insert encoder overview</t>
+<!--Insert encoder overview-->
 
 <t>The top-level function for encoding a CELT frame in the reference implementation is
 celt_encode() (<xref target="celt.c">celt.c</xref>).
 </t>
 
+<!--
+<texttable anchor="bitstream">
+        <ttcol align='center'>Parameter(s)</ttcol>
+        <ttcol align='center'>Condition</ttcol>
+        <ttcol align='center'>Synbol(s)</ttcol>
+        <c>Feature flags</c><c>Always</c><c>2-4 bits</c>
+        <c>Pitch period</c><c>P=1</c><c>1 Integer (8-9 bits)</c>
+        <c>Transient scalefactor</c><c>S=1</c><c>2 bits</c>
+        <c>Coarse energy</c><c>Always</c><c>one symbol per band</c>
+        <c>Fine energy</c><c>Always</c><c>one symbol per band</c>
+        <c>PVQ indices</c><c>Always</c><c>one symbol per band</c>
+        <c>Remaining fine energy</c><c>bits available</c><c>one bit per band</c>
+</texttable>
+-->
+
+<t>
+The CELT codec does not use a standard <spanx style="emph">bit-packer</spanx>, 
+but rather uses a range coder to pack both integers and entropy-coded symbols. 
+The bit-stream generated by the encoder contains (in the same order) the 
+following symbols:
+</t>
+
+<t>
+<list style="symbols">
+<t>Feature flags (2-4 bits)</t>
+<t>if P=1
+   <list style="symbols">
+      <t>Pitch period</t>
+   </list></t>
+<t>if S=1
+   <list style="symbols">
+      <t>Transient scalefactor</t>
+      <t>if scalefactor=(1 or 2) AND more than 2 short MDCTs
+	     <list style="symbols">
+		    <t>ID of block before transient</t>
+		 </list></t>
+      <t>if scalefactor=3
+	     <list style="symbols">
+		    <t>Transient time</t>
+      </list></t>
+   </list></t>
+<t>Coarse energy encoding (for each band)</t>
+<t>Fine energy encoding (for each band)</t>
+<t>For each band
+   <list style="symbols">
+      <t>if P=1 and band is at the beginning of a pitch band
+	  <list>
+	     <t>Pitch gain bit</t>
+	  </list></t>
+	  <t>PVQ indices</t>
+   </list></t>
+<t>More fine energy (using all remaining bits)</t>
+</list>
+</t>
+
+<!--
 <figure>
 <artwork>
 +-----------------+---------------------+------------------------------+
@@ -180,6 +236,7 @@
 </artwork>
 <postamble>Fields within parentheses are not included in every packet</postamble>
 </figure>
+-->
 
 <section anchor="pre-emphasis" title="Pre-emphasis">