ref: ed8e1b49370e39b776930918e5d5f7d6408c1a3c
dir: /doc/draft-valin-codec-prototype.xml/
<?xml version='1.0'?> <!DOCTYPE rfc SYSTEM 'rfc2629.dtd'> <?rfc toc="yes" symrefs="yes" ?> <rfc ipr="trust200902" category="std" docName="draft-valin-codec-prototype-00"> <front> <title abbrev="Codec Prototype">Prototype for IETF Interactive Audio Codec</title> <author initials="JM" surname="Valin" fullname="Jean-Marc Valin"> <organization>Octasic Inc.</organization> <address> <postal> <street>4101, Molson Street</street> <city>Montreal</city> <region>Quebec</region> <code></code> <country>Canada</country> </postal> <phone>+1 514 383-8858</phone> <email>[email protected]</email> </address> </author> <author initials="K." surname="Vos" fullname="Koen Vos"> <organization>Skype Technologies S.A.</organization> <address> <postal> <street>Stadsgaarden 6</street> <city>Stockholm</city> <region></region> <code>11645</code> <country>SE</country> </postal> <phone>+46 855 921 989</phone> <email>[email protected]</email> </address> </author> <date day="5" month="July" year="2010" /> <area>General</area> <workgroup></workgroup> <abstract> <t> This document provides a quick overview of a prototype codec combining a linear prediction layer (SILK) with an MDCT-based layer (CELT). These codecs are used because of the authors' familiarity with the source code, but it does not prevent inclusion of code from other codecs as well. This is a work in progress. </t> </abstract> </front> <middle> <section anchor="introduction" title="Introduction"> <t> We propose a hybrid codec based on a linear prediction layer (LP) and an MDCT-based enhancement layer. The main idea behind the proposal is that the speech low frequencies are usually more efficiently coded using linear prediction codecs (such as CELP variants), while the higher frequencies are more efficiently coded in the transform domain (e.g. MDCT). For low sampling rates, the MDCT layer is not useful and only the LP-based layer is used. On the other hand, non-speech signals are not always adequately coded using linear prediction, so for music only the MDCT-based layer is used. </t> <t> In this proposed prototype, the LP layer is based on the <eref target='http://developer.skype.com/silk'>SILK</eref> codec <xref target="SILK"></xref> and the MDCT layer is based on the <eref target='http://www.celt-codec.org/'>CELT</eref> codec <xref target="CELT"></xref>. These codecs are used because of the authors' familiarity with the source code, but it does not prevent inclusion of code from other codecs in the future. </t> <t>This is a work in progress.</t> </section> <section anchor="hybrid" title="Hybrid Codec"> <t> In hybrid mode, each frame is coded first by the LP layer and then by the MDCT layer. In the current prototype, the cutoff frequency is 8 kHz. In the MDCT layer, all bands below 8 kHz are discarded, such that there is no coding redundancy between the two layers. Also both layers use the same instance of the range coder to encode the signal, which ensures that no "padding bits" are wasted. The hybrid approach makes it easy to support both constant bit-rate (CBR) and varaible bit-rate (VBR) coding. Although the SILK layer used is VBR, it is easy to make the bit allocation of the CELT layer produce a final stream that is CBR by using all the bits left unused by the SILK layer. </t> <t>The implementation of SILK-based LP layer is similar to the description in the <xref target="SILK">SILK Internet-Draft</xref> with the main exception that SILK was modified to use the same range coder as CELT. The implementation of the CELT-based MDCT layer is available from the CELT website and is a more recent version (0.8.0) of the (now expired) <xref target="CELT">CELT Internet-Draft</xref>. The main changes include better support for 20 ms frames as well as the ability to encode only the higher bands using a range coder partially filled by the SILK layer.</t> <section title="Source Code"> <t> The source code is currently available in a <eref target='git://git.xiph.org/users/jm/ietfcodec.git'>Git repository</eref> which references two other repositories (for SILK and CELT). Some snapshots are provided for convenience at <eref target='http://people.xiph.org/~jm/ietfcodec/'/> along with sample files. Although the build system is very primitive, some instructions are provided in the toplevel README file. This is very early development so both the quality and feature set should greatly improve over time. In the current version, only 48 kHz audio is supported, but support for all configurations listed in <xref target="modes"></xref> is planned. </t> </section> </section> <section anchor="modes" title="Codec Modes"> <t> There are three possible operating modes for the proposed prototype: <list style="numbers"> <t>A linear prediction (LP) mode for use in low bit-rate connections with up to 8 kHz audio bandwidth (16 kHz sampling rate)</t> <t>A hybrid (LP+MDCT) mode for full-bandwidth speech at medium bitrates</t> <t>An MDCT-only mode for very low delay speech transmission as well as music transmission.</t> </list> Each of these modes supports a number of difference frame sizes and sampling rates. In order to distinguish between the various modes and configurations, we need to define a simple header that can used in the transport layer (e.g RTP) to signal this information. The following describes the proposed header. </t> <t> The LP mode supports the following configurations (numbered from 00000...01011 in binary): <list style="symbols"> <t>16 kHz: 10, 20, 40, 60 ms (00000...00011)</t> <t>12 kHz: 10, 20, 40, 60 ms (00100...00111)</t> <t>8 kHz: 10, 20, 40, 60 ms (01000...01011)</t> </list> for a total of 12 configurations. </t> <t> The hybrid mode supports the following configurations (numbered from 01100...01111): <list style="symbols"> <t>48 kHz: 10, 20 ms (01100...01101)</t> <t>32 kHz: 10, 20 ms (01110...01111)</t> </list> for a total of 4 configurations. </t> <t> The MDCT-only mode supports the following configurations (numbered from 10000...11101): <list style="symbols"> <t>48 kHz: 2.5, 5, 10, 20 ms (10000...10011)</t> <t>32 kHz: 2.5, 5, 10, 20 ms (10100...10111)</t> <t>16 kHz: 5, 10, 20 ms (11000...11010)</t> <t>8 kHz: 5, 10, 20 ms (11011...11101)</t> </list> for a total of 14 configurations. </t> <t> There is thus a total of 30 configurations, so 5 bits are necessary (with 2 codes unused) to indicate the mode, frame size and sampling rate (MFS). This leaves 3 bits for the number of frames per packets (codes 0 to 7): <list style="symbols"> <t>0-2: 1-3 frames in the packet, each with equal compressed size</t> <t>3: arbitrary number of frames in the packet, each with equal compressed size (one size needs to be encoded)</t> <t>4-5: 2-3 frames in the packet, with different compressed sizes, which need to be encoded (except the last one)</t> <t>6: arbitrary number of frames in the packet, with different compressed sizes, each of which needs to be encoded</t> <t>7: The first frame has this MFS, but others have different MFS. Each compressed size needs to be encoded.</t> </list> When code 7 is used and the last frames of a packet have the same MFS, it is allowed to switch to another code for them. </t> <t> The compressed size of the frames (if needed) is indicated -- usually -- with one byte, with the following meaning: <list style="symbols"> <t>0: No frame (DTX or lost packet)</t> <t>1-251: Size of the frame in bytes</t> <t>252-255: A second byte is needed. The total size is (size[1]*4)+(size[0]%4)+252</t> </list> </t> <t> The maximum size representable is 255*4+3+252=1275 bytes. For 20 ms frames, that represents a bit-rate of 510 kb/s, which is really the highest rate anyone would want to use in stereo mode (beyond that point, lossless codecs would be more appropriate). </t> <section anchor="examples" title="Examples"> <t> Simplest case: one packet </t> <t> <figure> <artwork><![CDATA[ 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MFS |0|0|0| compressed data... | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ]]></artwork> </figure> </t> <t> Four frames of the same compressed size: </t> <t> <figure> <artwork><![CDATA[ 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MFS |0|1|1| compressed data... | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ]]></artwork> </figure> </t> <t> Two frames of different compressed size: </t> <t> <figure> <artwork><![CDATA[ 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MFS |1|0|1| frame size | compressed data... | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ]]></artwork> </figure> </t> <t> Three frames of different <spanx style="emph">durations</spanx>: </t> <t> <figure> <artwork><![CDATA[ 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 1st MFS |1|1|1| frame size | 2nd MFS |1|1|1| frame size | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | 3rd MFS |1|1|1| frame size | compressed data... | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ ]]></artwork> </figure> </t> </section> </section> <section anchor="security" title="Security Considerations"> <t> The codec needs to take appropriate security considerations into account, as outlined in <xref target="DOS"/> and <xref target="SECGUIDE"/>. It is extremely important for the decoder to be robust against malicious payloads. Malicious payloads must not cause the decoder to overrun its allocated memory or to take much more resources to decode. Although problems in encoders are typically rarer, the same applies to the encoder. Malicious audio stream must not cause the encoder to misbehave because this would allow an attacker to attack transcoding gateways. </t> </section> <section title="IANA Considerations "> <t> This document has no actions for IANA. </t> </section> <!-- <section anchor="Acknowledgments" title="Acknowledgments"> <t> </t> </section> --> </middle> <back> <references title="Informative References"> <reference anchor='SILK'> <front> <title>SILK Speech Codec</title> <author initials='K.' surname='Vos' fullname='K. Vos'> <organization /></author> <author initials='S.' surname='Jensen' fullname='S. Jensen'> <organization /></author> <author initials='K.' surname='Soerensen' fullname='K. Soerensen'> <organization /></author> <date year='2010' month='March' /> <abstract> <t></t> </abstract></front> <seriesInfo name='Internet-Draft' value='draft-vos-silk-01' /> <format type='TXT' target='http://tools.ietf.org/html/draft-vos-silk-01' /> </reference> <reference anchor='CELT'> <front> <title>Constrained-Energy Lapped Transform (CELT) Codec</title> <author initials='J-M.' surname='Valin' fullname='J-M. Valin'> <organization /></author> <author initials='T.' surname='Terriberry' fullname='T. Terriberry'> <organization /></author> <author initials='G.' surname='Maxwell' fullname='G. Maxwell'> <organization /></author> <author initials='C.' surname='Montgomery' fullname='C. Montgomery'> <organization /></author> <date year='2009' month='July' /> <abstract> <t></t> </abstract></front> <seriesInfo name='Internet-Draft' value='draft-valin-celt-codec-01' /> <format type='TXT' target='http://tools.ietf.org/html/draft-valin-celt-codec-01' /> </reference> <reference anchor='DOS'> <front> <title>Internet Denial-of-Service Considerations</title> <author initials='M.' surname='Handley' fullname='M. Handley'> <organization /></author> <author initials='E.' surname='Rescorla' fullname='E. Rescorla'> <organization /></author> <author> <organization>IAB</organization></author> <date year='2006' month='December' /> <abstract> <t>This document provides an overview of possible avenues for denial-of-service (DoS) attack on Internet systems. The aim is to encourage protocol designers and network engineers towards designs that are more robust. We discuss partial solutions that reduce the effectiveness of attacks, and how some solutions might inadvertently open up alternative vulnerabilities. This memo provides information for the Internet community.</t></abstract></front> <seriesInfo name='RFC' value='4732' /> <format type='TXT' octets='91844' target='ftp://ftp.isi.edu/in-notes/rfc4732.txt' /> </reference> <reference anchor='SECGUIDE'> <front> <title>Guidelines for Writing RFC Text on Security Considerations</title> <author initials='E.' surname='Rescorla' fullname='E. Rescorla'> <organization /></author> <author initials='B.' surname='Korver' fullname='B. Korver'> <organization /></author> <date year='2003' month='July' /> <abstract> <t>All RFCs are required to have a Security Considerations section. Historically, such sections have been relatively weak. This document provides guidelines to RFC authors on how to write a good Security Considerations section. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t></abstract></front> <seriesInfo name='BCP' value='72' /> <seriesInfo name='RFC' value='3552' /> <format type='TXT' octets='110393' target='ftp://ftp.isi.edu/in-notes/rfc3552.txt' /> </reference> </references> </back> </rfc>