|
| 1 | +# liboac |
| 2 | + |
| 3 | +## Introduction |
| 4 | + |
| 5 | +liboac is the reference implementation of the Open Audio Codec (OAC) specification. |
| 6 | + |
| 7 | +OAC intends to be the successor to [Opus](https://tools.ietf.org/html/rfc6716) and liboac is based on [libopus](https://gitlab.xiph.org/xiph/opus). Both are works in progress. |
| 8 | + |
| 9 | +This package implements a shared library for encoding and decoding raw OAC |
| 10 | +bitstreams. It also includes a number of test tools used for testing the |
| 11 | +correct operation of the library. The bitstreams read/written by these |
| 12 | +tools should not be used for OAC file distribution: they include |
| 13 | +additional debugging data and cannot support seeking. |
| 14 | + |
| 15 | +## Software License |
| 16 | + |
| 17 | +Modifications and additions made to the software by the Alliance for Open Media are licensed as specified in (COPYING)[./COPYING]. |
| 18 | + |
| 19 | +See the git commit logs for a list of modifications. |
| 20 | + |
| 21 | +The libopus COPYING file is preserved as (OPUS_LICENSE)[./OPUS_LICENSE]. |
| 22 | + |
| 23 | +## Compiling |
| 24 | + |
| 25 | +To build from a distribution tarball, you only need to do the following: |
| 26 | + |
| 27 | + % ./configure |
| 28 | + % make |
| 29 | + |
| 30 | +To build from the git repository, the following steps are necessary: |
| 31 | + |
| 32 | +0. Set up a development environment: |
| 33 | + |
| 34 | +On an Ubuntu or Debian family Linux distribution: |
| 35 | + |
| 36 | + % sudo apt-get install git autoconf automake libtool gcc make |
| 37 | + |
| 38 | +On a Fedora/Redhat based Linux: |
| 39 | + |
| 40 | + % sudo dnf install git autoconf automake libtool gcc make |
| 41 | + |
| 42 | +Or for older Redhat/Centos Linux releases: |
| 43 | + |
| 44 | + % sudo yum install git autoconf automake libtool gcc make |
| 45 | + |
| 46 | +On Apple macOS, install Xcode and brew.sh, then in the Terminal enter: |
| 47 | + |
| 48 | + % brew install autoconf automake libtool |
| 49 | + |
| 50 | +1. Clone the repository: |
| 51 | + |
| 52 | + % git clone https://github.com/AOMediaCodec/oac.git |
| 53 | + % cd oac |
| 54 | + |
| 55 | +2. Compiling the source |
| 56 | + |
| 57 | + % ./autogen.sh |
| 58 | + % ./configure |
| 59 | + % make |
| 60 | + |
| 61 | +On x86, it's a good idea to use a -march= option that allows the use of AVX2. |
| 62 | + |
| 63 | +3. Install the codec libraries (optional) |
| 64 | + |
| 65 | + % sudo make install |
| 66 | + |
| 67 | +Once you have compiled the codec, there will be a oac_demo executable |
| 68 | +in the top directory. |
| 69 | + |
| 70 | +``` |
| 71 | +Usage: oac_demo [-e] <application> <sampling rate (Hz)> <channels (1/2)> |
| 72 | + <bits per second> [options] <input> <output> |
| 73 | + oac_demo -d <sampling rate (Hz)> <channels (1/2)> [options] |
| 74 | + <input> <output> |
| 75 | +
|
| 76 | +mode: voip | audio | restricted-lowdelay |
| 77 | +options: |
| 78 | + -e : only runs the encoder (output the bit-stream) |
| 79 | + -d : only runs the decoder (reads the bit-stream as input) |
| 80 | + -cbr : enable constant bitrate; default: variable bitrate |
| 81 | + -cvbr : enable constrained variable bitrate; default: |
| 82 | + unconstrained |
| 83 | + -bandwidth <NB|MB|WB|SWB|FB> |
| 84 | + : audio bandwidth (from narrowband to fullband); |
| 85 | + default: sampling rate |
| 86 | + -framesize <2.5|5|10|20|40|60> |
| 87 | + : frame size in ms; default: 20 |
| 88 | + -max_payload <bytes> |
| 89 | + : maximum payload size in bytes, default: 1024 |
| 90 | + -complexity <comp> |
| 91 | + : complexity, 0 (lowest) ... 10 (highest); default: 10 |
| 92 | + -inbandfec : enable SILK inband FEC |
| 93 | + -forcemono : force mono encoding, even for stereo input |
| 94 | + -dtx : enable SILK DTX |
| 95 | + -loss <perc> : simulate packet loss, in percent (0-100); default: 0 |
| 96 | +``` |
| 97 | + |
| 98 | +input and output are little-endian signed 16-bit PCM files or OAC |
| 99 | +bitstreams with simple oac_demo custom framing. |
| 100 | + |
| 101 | +## Testing |
| 102 | + |
| 103 | +This package includes a collection of automated unit and system tests |
| 104 | +which SHOULD be run after compiling the package especially the first |
| 105 | +time it is run on a new platform. |
| 106 | + |
| 107 | +To run the integrated tests: |
| 108 | + |
| 109 | + % make check |
| 110 | + |
| 111 | +## Compiling liboac for Windows and alternative build systems |
| 112 | + |
| 113 | +See cmake/README.md or meson/README.md. |
| 114 | + |
| 115 | +## Portability notes |
| 116 | + |
| 117 | +This implementation uses floating-point by default but can be compiled to |
| 118 | +use only fixed-point arithmetic by setting --enable-fixed-point (if using |
| 119 | +autoconf) or by defining the FIXED_POINT macro (if building manually). |
| 120 | +The fixed point implementation has somewhat lower audio quality and is |
| 121 | +slower on platforms with fast FPUs, it is normally only used in embedded |
| 122 | +environments. |
| 123 | + |
| 124 | +The implementation can be compiled with any compiler supporting C89 or later. |
| 125 | +While it does not rely on any _undefined behavior_ as defined by C89 or |
| 126 | +C99, it relies on common _implementation-defined behavior_ for two's |
| 127 | +complement architectures: |
| 128 | + |
| 129 | +- Right shifts of negative values are consistent with two's complement |
| 130 | + arithmetic, so that a>>b is equivalent to floor(a/(2^b)), |
| 131 | + |
| 132 | +- For conversion to a signed integer of N bits, the value is reduced modulo 2^N |
| 133 | + to be within range of the type, |
| 134 | + |
| 135 | +- The result of integer division of a negative value is truncated towards zero, |
| 136 | + and |
| 137 | + |
| 138 | +- The compiler provides a 64-bit integer type (a C99 requirement which is |
| 139 | + supported by most C89 compilers). |
0 commit comments