Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

241 lines
10 KiB

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