annotate src/libmad-0.15.1b/README @ 23:619f715526df sv_v2.1

Update Vamp plugin SDK to 2.5
author Chris Cannam
date Thu, 09 May 2013 10:52:46 +0100
parents c7265573341e
children
rev   line source
Chris@0 1
Chris@0 2 libmad - MPEG audio decoder library
Chris@0 3 Copyright (C) 2000-2004 Underbit Technologies, Inc.
Chris@0 4
Chris@0 5 $Id: README,v 1.4 2004/01/23 09:41:32 rob Exp $
Chris@0 6
Chris@0 7 ===============================================================================
Chris@0 8
Chris@0 9 INTRODUCTION
Chris@0 10
Chris@0 11 MAD (libmad) is a high-quality MPEG audio decoder. It currently supports
Chris@0 12 MPEG-1 and the MPEG-2 extension to Lower Sampling Frequencies, as well as
Chris@0 13 the so-called MPEG 2.5 format. All three audio layers (Layer I, Layer II,
Chris@0 14 and Layer III a.k.a. MP3) are fully implemented.
Chris@0 15
Chris@0 16 MAD does not yet support MPEG-2 multichannel audio (although it should be
Chris@0 17 backward compatible with such streams) nor does it currently support AAC.
Chris@0 18
Chris@0 19 MAD has the following special features:
Chris@0 20
Chris@0 21 - 24-bit PCM output
Chris@0 22 - 100% fixed-point (integer) computation
Chris@0 23 - completely new implementation based on the ISO/IEC standards
Chris@0 24 - distributed under the terms of the GNU General Public License (GPL)
Chris@0 25
Chris@0 26 Because MAD provides full 24-bit PCM output, applications using MAD are
Chris@0 27 able to produce high quality audio. Even when the output device supports
Chris@0 28 only 16-bit PCM, applications can use the extra resolution to increase the
Chris@0 29 audible dynamic range through the use of dithering or noise shaping.
Chris@0 30
Chris@0 31 Because MAD uses integer computation rather than floating point, it is
Chris@0 32 well suited for architectures without a floating point unit. All
Chris@0 33 calculations are performed with a 32-bit fixed-point integer
Chris@0 34 representation.
Chris@0 35
Chris@0 36 Because MAD is a new implementation of the ISO/IEC standards, it is
Chris@0 37 unencumbered by the errors of other implementations. MAD is NOT a
Chris@0 38 derivation of the ISO reference source or any other code. Considerable
Chris@0 39 effort has been expended to ensure a correct implementation, even in cases
Chris@0 40 where the standards are ambiguous or misleading.
Chris@0 41
Chris@0 42 Because MAD is distributed under the terms of the GPL, its redistribution
Chris@0 43 is not generally restricted, so long as the terms of the GPL are followed.
Chris@0 44 This means MAD can be incorporated into other software as long as that
Chris@0 45 software is also distributed under the GPL. (Should this be undesirable,
Chris@0 46 alternate arrangements may be possible by contacting Underbit.)
Chris@0 47
Chris@0 48 ===============================================================================
Chris@0 49
Chris@0 50 ABOUT THE CODE
Chris@0 51
Chris@0 52 The code is optimized and performs very well, although specific
Chris@0 53 improvements can still be made. The output from the decoder library
Chris@0 54 consists of 32-bit signed linear fixed-point values that can be easily
Chris@0 55 scaled for any size PCM output, up to 24 bits per sample.
Chris@0 56
Chris@0 57 The API for libmad can be found in the `mad.h' header file. Note that this
Chris@0 58 file is automatically generated, and will not exist until after you have
Chris@0 59 built the library.
Chris@0 60
Chris@0 61 There are two APIs available, one high-level, and the other low-level.
Chris@0 62 With the low-level API, each step of the decoding process must be handled
Chris@0 63 explicitly, offering the greatest amount of control. With the high-level
Chris@0 64 API, after callbacks are configured, a single routine will decode an
Chris@0 65 entire bitstream.
Chris@0 66
Chris@0 67 The high-level API may either be used synchronously or asynchronously. If
Chris@0 68 used asynchronously, decoding will occur in a separate process.
Chris@0 69 Communication is possible with the decoding process by passing control
Chris@0 70 messages.
Chris@0 71
Chris@0 72 The file `minimad.c' contains an example usage of the libmad API that
Chris@0 73 shows only the bare minimum required to implement a useful decoder. It
Chris@0 74 expects a regular file to be redirected to standard input, and it sends
Chris@0 75 decoded 16-bit signed little-endian PCM samples to standard output. If a
Chris@0 76 decoding error occurs, it is reported to standard error and decoding
Chris@0 77 continues. Note that the scale() routine in this code is only provided as
Chris@0 78 an example; it rounds MAD's high-resolution samples down to 16 bits, but
Chris@0 79 does not perform any dithering or noise shaping. It is therefore not
Chris@0 80 recommended to use this routine as-is in your own code if sound quality is
Chris@0 81 important.
Chris@0 82
Chris@0 83 Integer Performance
Chris@0 84
Chris@0 85 To get the best possible performance, it is recommended that an assembly
Chris@0 86 version of the fixed-point multiply and related routines be selected.
Chris@0 87 Several such assembly routines have been written for various CPUs.
Chris@0 88
Chris@0 89 If an assembly version is not available, a fast approximation version will
Chris@0 90 be used. This will result in reduced accuracy of the decoder.
Chris@0 91
Chris@0 92 Alternatively, if 64-bit integers are supported as a datatype by the
Chris@0 93 compiler, another version can be used that is much more accurate.
Chris@0 94 However, using an assembly version is generally much faster and just as
Chris@0 95 accurate.
Chris@0 96
Chris@0 97 More information can be gathered from the `fixed.h' header file.
Chris@0 98
Chris@0 99 MAD's CPU-intensive subband synthesis routine can be further optimized at
Chris@0 100 the expense of a slight loss in output accuracy due to a modified method
Chris@0 101 for fixed-point multiplication with a small windowing constant. While this
Chris@0 102 is helpful for performance and the output accuracy loss is generally
Chris@0 103 undetectable, it is disabled by default and must be explicitly enabled.
Chris@0 104
Chris@0 105 Under some architectures, other special optimizations may also be
Chris@0 106 available.
Chris@0 107
Chris@0 108 Audio Quality
Chris@0 109
Chris@0 110 The output from MAD has been found to satisfy the ISO/IEC 11172-4
Chris@0 111 computational accuracy requirements for compliance. In most
Chris@0 112 configurations, MAD is a Full Layer III ISO/IEC 11172-3 audio decoder as
Chris@0 113 defined by the standard.
Chris@0 114
Chris@0 115 When the approximation version of the fixed-point multiply is used, MAD is
Chris@0 116 a limited accuracy ISO/IEC 11172-3 audio decoder as defined by the
Chris@0 117 standard.
Chris@0 118
Chris@0 119 MAD can alternatively be configured to produce output with less or more
Chris@0 120 accuracy than the default, as a tradeoff with performance.
Chris@0 121
Chris@0 122 MAD produces output samples with a precision greater than 24 bits. Because
Chris@0 123 most output formats use fewer bits, typically 16, it is recommended that a
Chris@0 124 dithering algorithm be used (rather than rounding or truncating) to obtain
Chris@0 125 the highest quality audio. However, dithering may unfavorably affect an
Chris@0 126 analytic examination of the output (such as compliance testing); you may
Chris@0 127 therefore wish to use rounding in this case instead.
Chris@0 128
Chris@0 129 Portability Issues
Chris@0 130
Chris@0 131 GCC is preferred to compile the code, but other compilers may also work.
Chris@0 132 The assembly code in `fixed.h' depends on the inline assembly features of
Chris@0 133 your compiler. If you're not using GCC or MSVC++, you can either write
Chris@0 134 your own assembly macros or use the default (low quality output) version.
Chris@0 135
Chris@0 136 The union initialization of `huffman.c' may not be portable to all
Chris@0 137 platforms when GCC is not used.
Chris@0 138
Chris@0 139 The code should not be sensitive to word sizes or byte ordering, however
Chris@0 140 it does assume A % B has the same sign as A.
Chris@0 141
Chris@0 142 ===============================================================================
Chris@0 143
Chris@0 144 BUILDING AND INSTALLING
Chris@0 145
Chris@0 146 Windows Platforms
Chris@0 147
Chris@0 148 MAD can be built under Windows using either MSVC++ or Cygwin. A MSVC++
Chris@0 149 project file can be found under the `msvc++' subdirectory.
Chris@0 150
Chris@0 151 To build libmad using Cygwin, you will first need to install the Cygwin
Chris@0 152 tools:
Chris@0 153
Chris@0 154 http://www.cygwin.com/
Chris@0 155
Chris@0 156 You may then proceed with the following POSIX instructions within the
Chris@0 157 Cygwin shell.
Chris@0 158
Chris@0 159 Note that by default Cygwin will build a library that depends on the
Chris@0 160 Cygwin DLL. You can use MinGW to build a library that does not depend on
Chris@0 161 the Cygwin DLL. To do so, give the option --host=mingw32 to `configure'.
Chris@0 162
Chris@0 163 POSIX Platforms (including Cygwin)
Chris@0 164
Chris@0 165 The code is distributed with a `configure' script that will generate for
Chris@0 166 you a `Makefile' and a `config.h' for your platform. See the file
Chris@0 167 `INSTALL' for generic instructions.
Chris@0 168
Chris@0 169 The specific options you may want to give `configure' are:
Chris@0 170
Chris@0 171 --enable-speed optimize for speed over accuracy
Chris@0 172
Chris@0 173 --enable-accuracy optimize for accuracy over speed
Chris@0 174
Chris@0 175 --disable-debugging do not compile with debugging support, and
Chris@0 176 use more optimizations
Chris@0 177
Chris@0 178 --disable-shared do not build a shared library
Chris@0 179
Chris@0 180 Note that you need not specify one of --enable-speed or --enable-accuracy;
Chris@0 181 in its default configuration, MAD is optimized for both. You should only
Chris@0 182 use one of these options if you wish to compromise speed or accuracy for
Chris@0 183 the other.
Chris@0 184
Chris@0 185 By default the package will build a shared library if possible for your
Chris@0 186 platform. If you want only a static library, use --disable-shared.
Chris@0 187
Chris@0 188 It is not normally necessary to use the following options, but you may
Chris@0 189 fine-tune the configuration with them if desired:
Chris@0 190
Chris@0 191 --enable-fpm=ARCH use the ARCH-specific version of the
Chris@0 192 fixed-point math assembly routines
Chris@0 193 (current options are: intel, arm, mips,
Chris@0 194 sparc, ppc; also allowed are: 64bit, approx)
Chris@0 195
Chris@0 196 --enable-sso use the subband synthesis optimization,
Chris@0 197 with reduced accuracy
Chris@0 198
Chris@0 199 --disable-aso do not use certain architecture-specific
Chris@0 200 optimizations
Chris@0 201
Chris@0 202 By default an appropriate fixed-point assembly routine will be selected
Chris@0 203 for the configured host type, if it can be determined. Thus if you are
Chris@0 204 cross-compiling for another architecture, you should be sure either to
Chris@0 205 give `configure' a host type argument (--host) or to use an explicit
Chris@0 206 --enable-fpm option.
Chris@0 207
Chris@0 208 If an appropriate assembly routine cannot be determined, the default
Chris@0 209 approximation version will be used. In this case, use of an alternate
Chris@0 210 --enable-fpm is highly recommended.
Chris@0 211
Chris@0 212 Experimenting and Developing
Chris@0 213
Chris@0 214 Further options for `configure' that may be useful to developers and
Chris@0 215 experimenters are:
Chris@0 216
Chris@0 217 --enable-debugging enable diagnostic debugging support and
Chris@0 218 debugging symbols
Chris@0 219
Chris@0 220 --enable-profiling generate `gprof' profiling code
Chris@0 221
Chris@0 222 --enable-experimental enable code using the EXPERIMENTAL
Chris@0 223 preprocessor define
Chris@0 224
Chris@0 225 ===============================================================================
Chris@0 226
Chris@0 227 COPYRIGHT
Chris@0 228
Chris@0 229 Please read the `COPYRIGHT' file for copyright and warranty information.
Chris@0 230 Also, the file `COPYING' contains the full text of the GNU GPL.
Chris@0 231
Chris@0 232 Send inquiries, comments, bug reports, suggestions, patches, etc. to:
Chris@0 233
Chris@0 234 Underbit Technologies, Inc. <support@underbit.com>
Chris@0 235
Chris@0 236 See also the MAD home page on the Web:
Chris@0 237
Chris@0 238 http://www.underbit.com/products/mad/
Chris@0 239
Chris@0 240 ===============================================================================
Chris@0 241