annotate src/opus-1.3/README @ 83:ae30d91d2ffe

Replace these with versions built using an older toolset (so as to avoid ABI compatibilities when linking on Ubuntu 14.04 for packaging purposes)
author Chris Cannam
date Fri, 07 Feb 2020 11:51:13 +0000
parents 7aeed7906520
children
rev   line source
Chris@69 1 == Opus audio codec ==
Chris@69 2
Chris@69 3 Opus is a codec for interactive speech and audio transmission over the Internet.
Chris@69 4
Chris@69 5 Opus can handle a wide range of interactive audio applications, including
Chris@69 6 Voice over IP, videoconferencing, in-game chat, and even remote live music
Chris@69 7 performances. It can scale from low bit-rate narrowband speech to very high
Chris@69 8 quality stereo music.
Chris@69 9
Chris@69 10 Opus, when coupled with an appropriate container format, is also suitable
Chris@69 11 for non-realtime stored-file applications such as music distribution, game
Chris@69 12 soundtracks, portable music players, jukeboxes, and other applications that
Chris@69 13 have historically used high latency formats such as MP3, AAC, or Vorbis.
Chris@69 14
Chris@69 15 Opus is specified by IETF RFC 6716:
Chris@69 16 https://tools.ietf.org/html/rfc6716
Chris@69 17
Chris@69 18 The Opus format and this implementation of it are subject to the royalty-
Chris@69 19 free patent and copyright licenses specified in the file COPYING.
Chris@69 20
Chris@69 21 This package implements a shared library for encoding and decoding raw Opus
Chris@69 22 bitstreams. Raw Opus bitstreams should be used over RTP according to
Chris@69 23 https://tools.ietf.org/html/rfc7587
Chris@69 24
Chris@69 25 The package also includes a number of test tools used for testing the
Chris@69 26 correct operation of the library. The bitstreams read/written by these
Chris@69 27 tools should not be used for Opus file distribution: They include
Chris@69 28 additional debugging data and cannot support seeking.
Chris@69 29
Chris@69 30 Opus stored in files should use the Ogg encapsulation for Opus which is
Chris@69 31 described at:
Chris@69 32 https://tools.ietf.org/html/rfc7845
Chris@69 33
Chris@69 34 An opus-tools package is available which provides encoding and decoding of
Chris@69 35 Ogg encapsulated Opus files and includes a number of useful features.
Chris@69 36
Chris@69 37 Opus-tools can be found at:
Chris@69 38 https://git.xiph.org/?p=opus-tools.git
Chris@69 39 or on the main Opus website:
Chris@69 40 https://opus-codec.org/
Chris@69 41
Chris@69 42 == Compiling libopus ==
Chris@69 43
Chris@69 44 To build from a distribution tarball, you only need to do the following:
Chris@69 45
Chris@69 46 % ./configure
Chris@69 47 % make
Chris@69 48
Chris@69 49 To build from the git repository, the following steps are necessary:
Chris@69 50
Chris@69 51 0) Set up a development environment:
Chris@69 52
Chris@69 53 On an Ubuntu or Debian family Linux distribution:
Chris@69 54
Chris@69 55 % sudo apt-get install git autoconf automake libtool gcc make
Chris@69 56
Chris@69 57 On a Fedora/Redhat based Linux:
Chris@69 58
Chris@69 59 % sudo dnf install git autoconf automake libtool gcc make
Chris@69 60
Chris@69 61 Or for older Redhat/Centos Linux releases:
Chris@69 62
Chris@69 63 % sudo yum install git autoconf automake libtool gcc make
Chris@69 64
Chris@69 65 On Apple macOS, install Xcode and brew.sh, then in the Terminal enter:
Chris@69 66
Chris@69 67 % brew install autoconf automake libtool
Chris@69 68
Chris@69 69 1) Clone the repository:
Chris@69 70
Chris@69 71 % git clone https://git.xiph.org/opus.git
Chris@69 72 % cd opus
Chris@69 73
Chris@69 74 2) Compiling the source
Chris@69 75
Chris@69 76 % ./autogen.sh
Chris@69 77 % ./configure
Chris@69 78 % make
Chris@69 79
Chris@69 80 3) Install the codec libraries (optional)
Chris@69 81
Chris@69 82 % sudo make install
Chris@69 83
Chris@69 84 Once you have compiled the codec, there will be a opus_demo executable
Chris@69 85 in the top directory.
Chris@69 86
Chris@69 87 Usage: opus_demo [-e] <application> <sampling rate (Hz)> <channels (1/2)>
Chris@69 88 <bits per second> [options] <input> <output>
Chris@69 89 opus_demo -d <sampling rate (Hz)> <channels (1/2)> [options]
Chris@69 90 <input> <output>
Chris@69 91
Chris@69 92 mode: voip | audio | restricted-lowdelay
Chris@69 93 options:
Chris@69 94 -e : only runs the encoder (output the bit-stream)
Chris@69 95 -d : only runs the decoder (reads the bit-stream as input)
Chris@69 96 -cbr : enable constant bitrate; default: variable bitrate
Chris@69 97 -cvbr : enable constrained variable bitrate; default:
Chris@69 98 unconstrained
Chris@69 99 -bandwidth <NB|MB|WB|SWB|FB>
Chris@69 100 : audio bandwidth (from narrowband to fullband);
Chris@69 101 default: sampling rate
Chris@69 102 -framesize <2.5|5|10|20|40|60>
Chris@69 103 : frame size in ms; default: 20
Chris@69 104 -max_payload <bytes>
Chris@69 105 : maximum payload size in bytes, default: 1024
Chris@69 106 -complexity <comp>
Chris@69 107 : complexity, 0 (lowest) ... 10 (highest); default: 10
Chris@69 108 -inbandfec : enable SILK inband FEC
Chris@69 109 -forcemono : force mono encoding, even for stereo input
Chris@69 110 -dtx : enable SILK DTX
Chris@69 111 -loss <perc> : simulate packet loss, in percent (0-100); default: 0
Chris@69 112
Chris@69 113 input and output are little-endian signed 16-bit PCM files or opus
Chris@69 114 bitstreams with simple opus_demo proprietary framing.
Chris@69 115
Chris@69 116 == Testing ==
Chris@69 117
Chris@69 118 This package includes a collection of automated unit and system tests
Chris@69 119 which SHOULD be run after compiling the package especially the first
Chris@69 120 time it is run on a new platform.
Chris@69 121
Chris@69 122 To run the integrated tests:
Chris@69 123
Chris@69 124 % make check
Chris@69 125
Chris@69 126 There is also collection of standard test vectors which are not
Chris@69 127 included in this package for size reasons but can be obtained from:
Chris@69 128 https://opus-codec.org/docs/opus_testvectors-rfc8251.tar.gz
Chris@69 129
Chris@69 130 To run compare the code to these test vectors:
Chris@69 131
Chris@69 132 % curl -OL https://opus-codec.org/docs/opus_testvectors-rfc8251.tar.gz
Chris@69 133 % tar -zxf opus_testvectors-rfc8251.tar.gz
Chris@69 134 % ./tests/run_vectors.sh ./ opus_newvectors 48000
Chris@69 135
Chris@69 136 == Portability notes ==
Chris@69 137
Chris@69 138 This implementation uses floating-point by default but can be compiled to
Chris@69 139 use only fixed-point arithmetic by setting --enable-fixed-point (if using
Chris@69 140 autoconf) or by defining the FIXED_POINT macro (if building manually).
Chris@69 141 The fixed point implementation has somewhat lower audio quality and is
Chris@69 142 slower on platforms with fast FPUs, it is normally only used in embedded
Chris@69 143 environments.
Chris@69 144
Chris@69 145 The implementation can be compiled with either a C89 or a C99 compiler.
Chris@69 146 While it does not rely on any _undefined behavior_ as defined by C89 or
Chris@69 147 C99, it relies on common _implementation-defined behavior_ for two's
Chris@69 148 complement architectures:
Chris@69 149
Chris@69 150 o Right shifts of negative values are consistent with two's
Chris@69 151 complement arithmetic, so that a>>b is equivalent to
Chris@69 152 floor(a/(2^b)),
Chris@69 153
Chris@69 154 o For conversion to a signed integer of N bits, the value is reduced
Chris@69 155 modulo 2^N to be within range of the type,
Chris@69 156
Chris@69 157 o The result of integer division of a negative value is truncated
Chris@69 158 towards zero, and
Chris@69 159
Chris@69 160 o The compiler provides a 64-bit integer type (a C99 requirement
Chris@69 161 which is supported by most C89 compilers).