idnits 2.17.1 draft-valin-codec-prototype-01.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (July 8, 2010) is 5033 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Outdated reference: A later version (-02) exists of draft-vos-silk-01 Summary: 0 errors (**), 0 flaws (~~), 2 warnings (==), 1 comment (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group JM. Valin 3 Internet-Draft Octasic Inc. 4 Intended status: Standards Track K. Vos 5 Expires: January 9, 2011 Skype Technologies S.A. 6 July 8, 2010 8 Prototype for IETF Interactive Audio Codec 9 draft-valin-codec-prototype-01 11 Abstract 13 This document provides a quick overview of a prototype codec 14 combining a linear prediction layer (SILK) with an MDCT-based layer 15 (CELT). These codecs are used because of the authors' familiarity 16 with the source code, but it does not prevent inclusion of code from 17 other codecs as well. This is a work in progress. 19 Status of this Memo 21 This Internet-Draft is submitted in full conformance with the 22 provisions of BCP 78 and BCP 79. 24 Internet-Drafts are working documents of the Internet Engineering 25 Task Force (IETF). Note that other groups may also distribute 26 working documents as Internet-Drafts. The list of current Internet- 27 Drafts is at http://datatracker.ietf.org/drafts/current/. 29 Internet-Drafts are draft documents valid for a maximum of six months 30 and may be updated, replaced, or obsoleted by other documents at any 31 time. It is inappropriate to use Internet-Drafts as reference 32 material or to cite them other than as "work in progress." 34 This Internet-Draft will expire on January 9, 2011. 36 Copyright Notice 38 Copyright (c) 2010 IETF Trust and the persons identified as the 39 document authors. All rights reserved. 41 This document is subject to BCP 78 and the IETF Trust's Legal 42 Provisions Relating to IETF Documents 43 (http://trustee.ietf.org/license-info) in effect on the date of 44 publication of this document. Please review these documents 45 carefully, as they describe your rights and restrictions with respect 46 to this document. Code Components extracted from this document must 47 include Simplified BSD License text as described in Section 4.e of 48 the Trust Legal Provisions and are provided without warranty as 49 described in the Simplified BSD License. 51 Table of Contents 53 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 54 2. Hybrid Codec . . . . . . . . . . . . . . . . . . . . . . . . . 4 55 2.1. Source Code . . . . . . . . . . . . . . . . . . . . . . . 4 56 3. Codec Modes . . . . . . . . . . . . . . . . . . . . . . . . . 5 57 3.1. Examples . . . . . . . . . . . . . . . . . . . . . . . . . 6 58 4. Security Considerations . . . . . . . . . . . . . . . . . . . 8 59 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 9 60 6. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 10 61 7. Informative References . . . . . . . . . . . . . . . . . . . . 11 62 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 12 64 1. Introduction 66 We propose a hybrid codec based on a linear prediction layer (LP) and 67 an MDCT-based enhancement layer. The main idea behind the proposal 68 is that the speech low frequencies are usually more efficiently coded 69 using linear prediction codecs (such as CELP variants), while the 70 higher frequencies are more efficiently coded in the transform domain 71 (e.g. MDCT). For low sampling rates, the MDCT layer is not useful 72 and only the LP-based layer is used. On the other hand, non-speech 73 signals are not always adequately coded using linear prediction, so 74 for music only the MDCT-based layer is used. 76 In this proposed prototype, the LP layer is based on the SILK [1] 77 codec [SILK] and the MDCT layer is based on the CELT [2] codec 78 [CELT]. These codecs are used because of the authors' familiarity 79 with the source code, but it does not prevent inclusion of code from 80 other codecs in the future. 82 This is a work in progress. 84 2. Hybrid Codec 86 In hybrid mode, each frame is coded first by the LP layer and then by 87 the MDCT layer. In the current prototype, the cutoff frequency is 8 88 kHz. In the MDCT layer, all bands below 8 kHz are discarded, such 89 that there is no coding redundancy between the two layers. Also both 90 layers use the same instance of the range coder to encode the signal, 91 which ensures that no "padding bits" are wasted. The hybrid approach 92 makes it easy to support both constant bit-rate (CBR) and varaible 93 bit-rate (VBR) coding. Although the SILK layer used is VBR, it is 94 easy to make the bit allocation of the CELT layer produce a final 95 stream that is CBR by using all the bits left unused by the SILK 96 layer. 98 The implementation of SILK-based LP layer is similar to the 99 description in the SILK Internet-Draft [SILK] with the main exception 100 that SILK was modified to use the same range coder as CELT. The 101 implementation of the CELT-based MDCT layer is available from the 102 CELT website and is a more recent version (0.8.1) of the CELT 103 Internet-Draft [CELT]. The main changes include better support for 104 20 ms frames as well as the ability to encode only the higher bands 105 using a range coder partially filled by the SILK layer. 107 In addition to their frame size, the SILK and CELT codecs require a 108 look-ahead of 5.2 ms and 2.5 ms, respectively. SILK's look-ahead is 109 due to noise shaping estimation (5 ms) and the internal resampling 110 (0.2 ms), while CELT's look-ahead is due to the overlapping MDCT 111 windows. To compensate for the difference, the CELT encoder input is 112 delayed by 2.7 ms. This ensures that low frequencies and high 113 frequencies arrive at the same time. 115 2.1. Source Code 117 The source code is currently available in a Git repository [3] which 118 references two other repositories (for SILK and CELT). Some 119 snapshots are provided for convenience at 120 along with sample files. 121 Although the build system is very primitive, some instructions are 122 provided in the toplevel README file. This is very early development 123 so both the quality and feature set should greatly improve over time. 124 In the current version, only 48 kHz audio is supported, but support 125 for all configurations listed in Section 3 is planned. 127 3. Codec Modes 129 There are three possible operating modes for the proposed prototype: 131 1. A linear prediction (LP) mode for use in low bit-rate connections 132 with up to 8 kHz audio bandwidth (16 kHz sampling rate) 134 2. A hybrid (LP+MDCT) mode for full-bandwidth speech at medium 135 bitrates 137 3. An MDCT-only mode for very low delay speech transmission as well 138 as music transmission. 140 Each of these modes supports a number of difference frame sizes and 141 sampling rates. In order to distinguish between the various modes 142 and configurations, we need to define a simple header that can used 143 in the transport layer (e.g RTP) to signal this information. The 144 following describes the proposed header. 146 The LP mode supports the following configurations (numbered from 147 00000...01011 in binary): 149 o 16 kHz: 10, 20, 40, 60 ms (00000...00011) 151 o 12 kHz: 10, 20, 40, 60 ms (00100...00111) 153 o 8 kHz: 10, 20, 40, 60 ms (01000...01011) 155 for a total of 12 configurations. 157 The hybrid mode supports the following configurations (numbered from 158 01100...01111): 160 o 48 kHz: 10, 20 ms (01100...01101) 162 o 32 kHz: 10, 20 ms (01110...01111) 164 for a total of 4 configurations. 166 The MDCT-only mode supports the following configurations (numbered 167 from 10000...11101): 169 o 48 kHz: 2.5, 5, 10, 20 ms (10000...10011) 171 o 32 kHz: 2.5, 5, 10, 20 ms (10100...10111) 173 o 16 kHz: 2.5, 5, 10, 20 ms (11000...11011) 174 o 8 kHz: 2.5, 5, 10, 20 ms (11100...11111) 176 for a total of 16 configurations. 178 There is thus a total of 32 configurations, so 5 bits are necessary 179 to indicate the mode, frame size and sampling rate (MFS). This 180 leaves 3 bits for the number of frames per packets (codes 0 to 7): 182 o 0-2: 1-3 frames in the packet, each with equal compressed size 184 o 3: arbitrary number of frames in the packet, each with equal 185 compressed size (one size needs to be encoded) 187 o 4-5: 2-3 frames in the packet, with different compressed sizes, 188 which need to be encoded (except the last one) 190 o 6: arbitrary number of frames in the packet, with different 191 compressed sizes, each of which needs to be encoded 193 o 7: The first frame has this MFS, but others have different MFS. 194 Each compressed size needs to be encoded. 196 When code 7 is used and the last frames of a packet have the same 197 MFS, it is allowed to switch to another code for them. 199 The compressed size of the frames (if needed) is indicated -- usually 200 -- with one byte, with the following meaning: 202 o 0: No frame (DTX or lost packet) 204 o 1-251: Size of the frame in bytes 206 o 252-255: A second byte is needed. The total size is (size[1]*4)+ 207 (size[0]%4)+252 209 The maximum size representable is 255*4+3+252=1275 bytes. For 20 ms 210 frames, that represents a bit-rate of 510 kb/s, which is really the 211 highest rate anyone would want to use in stereo mode (beyond that 212 point, lossless codecs would be more appropriate). 214 3.1. Examples 216 Simplest case: one packet 217 0 1 2 3 218 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 219 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 220 | MFS |0|0|0| compressed data... | 221 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 223 Four frames of the same compressed size: 225 0 1 2 3 226 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 227 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 228 | MFS |0|1|1| compressed data... | 229 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 231 Two frames of different compressed size: 233 0 1 2 3 234 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 235 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 236 | MFS |1|0|1| frame size | compressed data... | 237 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 239 Three frames of different _durations_: 241 0 1 2 3 242 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 243 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 244 | 1st MFS |1|1|1| frame size | 2nd MFS |1|1|1| frame size | 245 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 246 | 3rd MFS |1|1|1| frame size | compressed data... | 247 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 249 4. Security Considerations 251 The codec needs to take appropriate security considerations into 252 account, as outlined in [DOS] and [SECGUIDE]. It is extremely 253 important for the decoder to be robust against malicious payloads. 254 Malicious payloads must not cause the decoder to overrun its 255 allocated memory or to take much more resources to decode. Although 256 problems in encoders are typically rarer, the same applies to the 257 encoder. Malicious audio stream must not cause the encoder to 258 misbehave because this would allow an attacker to attack transcoding 259 gateways. 261 In its current version, this prototype codec likely does NOT meet 262 these security considerations, so it should be used with caution. 264 5. IANA Considerations 266 This document has no actions for IANA. 268 6. Acknowledgments 270 Thanks to all other developers, including Soeren Skak Jensen, Gregory 271 Maxwell, Christopher Montgomery, Karsten Vandborg Soerensen, and 272 Timothy Terriberry. 274 7. Informative References 276 [SILK] Vos, K., Jensen, S., and K. Soerensen, "SILK Speech 277 Codec", draft-vos-silk-01 (work in progress), March 2010. 279 [CELT] Valin, J-M., Terriberry, T., Maxwell, G., and C. 280 Montgomery, "Constrained-Energy Lapped Transform (CELT) 281 Codec", draft-valin-celt-codec-02 (work in progress), 282 July 2010. 284 [DOS] Handley, M., Rescorla, E., and IAB, "Internet Denial-of- 285 Service Considerations", RFC 4732, December 2006. 287 [SECGUIDE] 288 Rescorla, E. and B. Korver, "Guidelines for Writing RFC 289 Text on Security Considerations", BCP 72, RFC 3552, 290 July 2003. 292 [1] 294 [2] 296 [3] 298 Authors' Addresses 300 Jean-Marc Valin 301 Octasic Inc. 302 4101, Molson Street 303 Montreal, Quebec 304 Canada 306 Phone: +1 514 282-8858 307 Email: jean-marc.valin@octasic.com 309 Koen Vos 310 Skype Technologies S.A. 311 Stadsgaarden 6 312 Stockholm, 11645 313 SE 315 Phone: +46 855 921 989 316 Email: koen.vos@skype.net