idnits 2.17.1 draft-ietf-codec-opus-00.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 (October 15, 2010) is 4941 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: April 18, 2011 Skype Technologies S.A. 6 October 15, 2010 8 Definition of the Opus Audio Codec 9 draft-ietf-codec-opus-00 11 Abstract 13 This document describes the Opus codec, designed for interactive 14 speech and audio transmission over the Internet. 16 Status of this Memo 18 This Internet-Draft is submitted in full conformance with the 19 provisions of BCP 78 and BCP 79. 21 Internet-Drafts are working documents of the Internet Engineering 22 Task Force (IETF). Note that other groups may also distribute 23 working documents as Internet-Drafts. The list of current Internet- 24 Drafts is at http://datatracker.ietf.org/drafts/current/. 26 Internet-Drafts are draft documents valid for a maximum of six months 27 and may be updated, replaced, or obsoleted by other documents at any 28 time. It is inappropriate to use Internet-Drafts as reference 29 material or to cite them other than as "work in progress." 31 This Internet-Draft will expire on April 18, 2011. 33 Copyright Notice 35 Copyright (c) 2010 IETF Trust and the persons identified as the 36 document authors. All rights reserved. 38 This document is subject to BCP 78 and the IETF Trust's Legal 39 Provisions Relating to IETF Documents 40 (http://trustee.ietf.org/license-info) in effect on the date of 41 publication of this document. Please review these documents 42 carefully, as they describe your rights and restrictions with respect 43 to this document. Code Components extracted from this document must 44 include Simplified BSD License text as described in Section 4.e of 45 the Trust Legal Provisions and are provided without warranty as 46 described in the Simplified BSD License. 48 Table of Contents 50 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 51 2. Opus Codec . . . . . . . . . . . . . . . . . . . . . . . . . . 4 52 2.1. Source Code . . . . . . . . . . . . . . . . . . . . . . . 4 53 3. Codec Modes . . . . . . . . . . . . . . . . . . . . . . . . . 5 54 3.1. Examples . . . . . . . . . . . . . . . . . . . . . . . . . 6 55 4. Security Considerations . . . . . . . . . . . . . . . . . . . 8 56 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 9 57 6. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 10 58 7. Informative References . . . . . . . . . . . . . . . . . . . . 11 59 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 12 61 1. Introduction 63 We propose the Opus codec based on a linear prediction layer (LP) and 64 an MDCT-based enhancement layer. The main idea behind the proposal 65 is that the speech low frequencies are usually more efficiently coded 66 using linear prediction codecs (such as CELP variants), while the 67 higher frequencies are more efficiently coded in the transform domain 68 (e.g. MDCT). For low sampling rates, the MDCT layer is not useful 69 and only the LP-based layer is used. On the other hand, non-speech 70 signals are not always adequately coded using linear prediction, so 71 for music only the MDCT-based layer is used. 73 In this proposed prototype, the LP layer is based on the SILK [1] 74 codec [SILK] and the MDCT layer is based on the CELT [2] codec 75 [CELT]. 77 This is a work in progress. 79 2. Opus Codec 81 In hybrid mode, each frame is coded first by the LP layer and then by 82 the MDCT layer. In the current prototype, the cutoff frequency is 8 83 kHz. In the MDCT layer, all bands below 8 kHz are discarded, such 84 that there is no coding redundancy between the two layers. Also both 85 layers use the same instance of the range coder to encode the signal, 86 which ensures that no "padding bits" are wasted. The hybrid approach 87 makes it easy to support both constant bit-rate (CBR) and varaible 88 bit-rate (VBR) coding. Although the SILK layer used is VBR, it is 89 easy to make the bit allocation of the CELT layer produce a final 90 stream that is CBR by using all the bits left unused by the SILK 91 layer. 93 The implementation of SILK-based LP layer is similar to the 94 description in the SILK Internet-Draft [SILK] with the main exception 95 that SILK was modified to use the same range coder as CELT. The 96 implementation of the CELT-based MDCT layer is available from the 97 CELT website and is a more recent version (0.8.1) of the CELT 98 Internet-Draft [CELT]. The main changes include better support for 99 20 ms frames as well as the ability to encode only the higher bands 100 using a range coder partially filled by the SILK layer. 102 In addition to their frame size, the SILK and CELT codecs require a 103 look-ahead of 5.2 ms and 2.5 ms, respectively. SILK's look-ahead is 104 due to noise shaping estimation (5 ms) and the internal resampling 105 (0.2 ms), while CELT's look-ahead is due to the overlapping MDCT 106 windows. To compensate for the difference, the CELT encoder input is 107 delayed by 2.7 ms. This ensures that low frequencies and high 108 frequencies arrive at the same time. 110 2.1. Source Code 112 The source code is currently available in a Git repository [3] which 113 references two other repositories (for SILK and CELT). Some 114 snapshots are provided for convenience at 115 along with sample files. 116 Although the build system is very primitive, some instructions are 117 provided in the toplevel README file. This is very early development 118 so both the quality and feature set should greatly improve over time. 119 In the current version, only 48 kHz audio is supported, but support 120 for all configurations listed in Section 3 is planned. 122 3. Codec Modes 124 There are three possible operating modes for the proposed prototype: 126 1. A linear prediction (LP) mode for use in low bit-rate connections 127 with up to 8 kHz audio bandwidth (16 kHz sampling rate) 129 2. A hybrid (LP+MDCT) mode for full-bandwidth speech at medium 130 bitrates 132 3. An MDCT-only mode for very low delay speech transmission as well 133 as music transmission. 135 Each of these modes supports a number of difference frame sizes and 136 sampling rates. In order to distinguish between the various modes 137 and configurations, we need to define a simple header that can used 138 in the transport layer (e.g RTP) to signal this information. The 139 following describes the proposed header. 141 The LP mode supports the following configurations (numbered from 142 00000...01011 in binary): 144 o 8 kHz: 10, 20, 40, 60 ms (00000...00011) 146 o 12 kHz: 10, 20, 40, 60 ms (00100...00111) 148 o 16 kHz: 10, 20, 40, 60 ms (01000...01011) 150 for a total of 12 configurations. 152 The hybrid mode supports the following configurations (numbered from 153 01100...01111): 155 o 32 kHz: 10, 20 ms (01100...01101) 157 o 48 kHz: 10, 20 ms (01110...01111) 159 for a total of 4 configurations. 161 The MDCT-only mode supports the following configurations (numbered 162 from 10000...11101): 164 o 8 kHz: 2.5, 5, 10, 20 ms (10000...10011) 166 o 16 kHz: 2.5, 5, 10, 20 ms (10100...10111) 168 o 32 kHz: 2.5, 5, 10, 20 ms (11000...11011) 169 o 48 kHz: 2.5, 5, 10, 20 ms (11100...11111) 171 for a total of 16 configurations. 173 There is thus a total of 32 configurations, so 5 bits are necessary 174 to indicate the mode, frame size and sampling rate (MFS). This 175 leaves 3 bits for the number of frames per packets (codes 0 to 7): 177 o 0-2: 1-3 frames in the packet, each with equal compressed size 179 o 3: arbitrary number of frames in the packet, each with equal 180 compressed size (one size needs to be encoded) 182 o 4-5: 2-3 frames in the packet, with different compressed sizes, 183 which need to be encoded (except the last one) 185 o 6: arbitrary number of frames in the packet, with different 186 compressed sizes, each of which needs to be encoded 188 o 7: The first frame has this MFS, but others have different MFS. 189 Each compressed size needs to be encoded. 191 When code 7 is used and the last frames of a packet have the same 192 MFS, it is allowed to switch to another code for them. 194 The compressed size of the frames (if needed) is indicated -- usually 195 -- with one byte, with the following meaning: 197 o 0: No frame (DTX or lost packet) 199 o 1-251: Size of the frame in bytes 201 o 252-255: A second byte is needed. The total size is (size[1]*4)+ 202 (size[0]%4)+252 204 The maximum size representable is 255*4+3+252=1275 bytes. For 20 ms 205 frames, that represents a bit-rate of 510 kb/s, which is really the 206 highest rate anyone would want to use in stereo mode (beyond that 207 point, lossless codecs would be more appropriate). 209 3.1. Examples 211 Simplest case: one packet 212 0 1 2 3 213 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 214 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 215 | MFS |0|0|0| compressed data... | 216 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 218 Four frames of the same compressed size: 220 0 1 2 3 221 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 222 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 223 | MFS |0|1|1| compressed data... | 224 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 226 Two frames of different compressed size: 228 0 1 2 3 229 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 230 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 231 | MFS |1|0|1| frame size | compressed data... | 232 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 234 Three frames of different _durations_: 236 0 1 2 3 237 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 238 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 239 | 1st MFS |1|1|1| frame size | 2nd MFS |1|1|1| frame size | 240 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 241 | 3rd MFS |1|1|1| frame size | compressed data... | 242 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 244 4. Security Considerations 246 The codec needs to take appropriate security considerations into 247 account, as outlined in [DOS] and [SECGUIDE]. It is extremely 248 important for the decoder to be robust against malicious payloads. 249 Malicious payloads must not cause the decoder to overrun its 250 allocated memory or to take much more resources to decode. Although 251 problems in encoders are typically rarer, the same applies to the 252 encoder. Malicious audio stream must not cause the encoder to 253 misbehave because this would allow an attacker to attack transcoding 254 gateways. 256 In its current version, the Opus codec likely does NOT meet these 257 security considerations, so it should be used with caution. 259 5. IANA Considerations 261 This document has no actions for IANA. 263 6. Acknowledgments 265 Thanks to all other developers, including Soeren Skak Jensen, Gregory 266 Maxwell, Christopher Montgomery, Karsten Vandborg Soerensen, and 267 Timothy Terriberry. 269 7. Informative References 271 [SILK] Vos, K., Jensen, S., and K. Soerensen, "SILK Speech 272 Codec", draft-vos-silk-01 (work in progress), March 2010. 274 [CELT] Valin, J-M., Terriberry, T., Maxwell, G., and C. 275 Montgomery, "Constrained-Energy Lapped Transform (CELT) 276 Codec", draft-valin-celt-codec-02 (work in progress), 277 July 2010. 279 [DOS] Handley, M., Rescorla, E., and IAB, "Internet Denial-of- 280 Service Considerations", RFC 4732, December 2006. 282 [SECGUIDE] 283 Rescorla, E. and B. Korver, "Guidelines for Writing RFC 284 Text on Security Considerations", BCP 72, RFC 3552, 285 July 2003. 287 [1] 289 [2] 291 [3] 293 Authors' Addresses 295 Jean-Marc Valin 296 Octasic Inc. 297 4101, Molson Street 298 Montreal, Quebec 299 Canada 301 Phone: +1 514 282-8858 302 Email: jean-marc.valin@octasic.com 304 Koen Vos 305 Skype Technologies S.A. 306 Stadsgaarden 6 307 Stockholm, 11645 308 SE 310 Phone: +46 855 921 989 311 Email: koen.vos@skype.net