Commit 59f67687 authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

ietf doc: better description of the bitstream

parent f1b5006d
......@@ -162,12 +162,68 @@ mode data. This data includes:
<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>).
<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>
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:
<list style="symbols">
<t>Feature flags (2-4 bits)</t>
<t>if P=1
<list style="symbols">
<t>Pitch period</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>
<t>if scalefactor=3
<list style="symbols">
<t>Transient time</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
<t>Pitch gain bit</t>
<t>PVQ indices</t>
<t>More fine energy (using all remaining bits)</t>
......@@ -180,6 +236,7 @@ celt_encode() (<xref target="celt.c">celt.c</xref>).
<postamble>Fields within parentheses are not included in every packet</postamble>
<section anchor="pre-emphasis" title="Pre-emphasis">
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment