mpeg3play version 0.9.5 February 23, 1997 Home page: The Solaris Helpers Page at http://home1.swipnet.se/%7Ew-10694/helpers.html Authors: Fraunhofer Institute and Johan Hagman mpeg3play is an MPEG audio layer 2 and layer 3 audio decoder/player for Solaris 2.4 or later versions, based on public ISO/MPEG audio decoder source code. The original software is a slow but portable MPEG to AIFF decoder, impossible to use as a real-time player. I have optimized it to the point where it becomes possible to use the decoder for real-time playback and have modified it for output to the Solaris audio device. Only 16-bit (CD-quality) audio devices are supported. The various data files that the original decoder needs at runtime are also integrated to make is a self-contained executable. Version 0.9 for Solaris was the initial release of the player, but it can now also be compiled for Linux (since version 0.9.1), HPUX (version 0.9.3), Amiga (version 0.9.4) and IBM AIX (version 0.9.5). The ports were done by Tim Newsome (Linux) Damien Clermonte (HPUX) Troels Walsted Hansen (Amiga) Terje Malmedal (AIX) Note that the Solaris/SPARC binary available from the Solaris Helpers page includes some SPARC assembly optimizations in addition to the C optimizations in the source distribution. The -h (help) command line option shows the usage: % mpeg3play -h +----------------------------------------+ | mpeg3play version 0.9.5, 23-Feb-97 | +----------------------------------------+ This is an MPEG audio layer 2 and layer 3 decoder/player based on public ISO/MPEG audio decoder source code. Solaris port and optimizations by Johan.Hagman@mailbox.swipnet.se. Copyright (C) 1996, 1997 by Johan Hagman. This program is free software. usage: mpeg3play [-v] [-h] [-f] [-o outfile.aiff] filename -v enable verbose mode -h display program help information -f fork off new player and return -o outfile write an AIFF output PCM sound file filename bit stream of encoded audio ("-" means stdin) ---------------------------------------------------------------------- ABOUT THE SOURCE CODE mpeg3play was developed on Solaris 2.4 with Sun SPARCompiler C 4.0. This is the portable C version of mpeg3play. The Solaris/SPARC binary available from the Solaris Helpers page includes some assembly optimizations in addition to the C optimizations in this source. A number of customization flags can be set in the makefile: FSINGLE Use single precision math. OPTIMIZE Select optimized C routines. If this is not defined, the original, slow code is selected. BUILTIN_TABLES Build lookup tables into the binary. Must always be defined with this source distribution. DETECT_CLIP Check and correct clipped samples. Slows down the player somewhat, but sounds better with (too) loud audio samples. ASM_OPTIMIZE Select optimized assembly functions. As shipped, the following function is expected to be optimized in some external file: II_dequantize_sample() INT_MATH Select integer math routines. A somewhat optimized integer math version of the function SubBandSynthesis() is included in decode.c. But fp math is faster than integer math on CPUs like SPARC and Pentium, so this is normally not a good way to optimize anyway. This is a runtime profile that lists the most important functions to optimize for playback of layer 3 audio: granularity: each sample hit covers 2 byte(s) for 0.03% of 33.36 seconds % cumulative self self total time seconds seconds calls ms/call ms/call name 41.8 13.95 13.95 170928 0.08 0.08 SubBandSynthesis [3] 10.3 17.38 3.43 303872 0.01 0.01 inv_mdct [7] 9.5 20.56 3.18 9496 0.33 0.33 III_dequantize_sample [8] 6.9 22.87 2.31 9496 0.24 0.39 III_hufman_decode [5] 5.6 24.73 1.86 4748 0.39 0.75 out_fifo [6] 5.1 26.44 1.71 1346 1.27 1.27 _write [9] 4.5 27.95 1.52 4748 0.32 0.32 III_stereo [10] 2.4 29.76 0.82 1052029 0.00 0.00 huffman_decoder [11] 1.8 30.37 0.61 4775924 0.00 0.00 hget1bit [12] 1.2 30.77 0.40 1 400.01 31751.16 main [1] 1.1 31.54 0.38 9496 0.04 0.04 III_antialias [15] 1.0 31.89 0.35 303872 0.00 0.01 III_hybrid [4] 0.8 32.16 0.27 9496 0.03 0.03 III_reorder [16] 0.7 32.40 0.25 767752 0.00 0.00 getbits [13] 0.6 32.60 0.20 93 2.15 2.15 _read [20] 0.5 32.78 0.18 9001 0.02 0.02 _memcpy [21] 0.3 32.88 0.10 7 14.29 14.29 _ioctl [22] 0.2 33.02 0.07 214608 0.00 0.00 hgetbits [26] 0.2 33.14 0.06 659390 0.00 0.00 hputbuf [28] 0.1 33.18 0.04 72752 0.00 0.00 get1bit [29] 0.1 33.22 0.04 25371 0.00 0.00 _memset [30] 0.1 33.25 0.03 9496 0.00 0.01 III_get_scale_factors [24] 0.1 33.27 0.02 2374 0.01 0.01 hdr_to_frps [35] 0.1 33.29 0.02 182 0.11 1.39 refill_buffer [17] 0.0 33.32 0.01 179285 0.00 0.00 hsstell [40] 0.0 33.33 0.01 4748 0.00 0.00 main_data_slots [41] 0.0 33.33 0.01 2375 0.00 0.00 end_bs [42] 0.0 33.34 0.01 2374 0.00 0.00 sstell [43] 0.0 33.34 0.01 983 0.01 0.01 __libmopt__k_cos_ [48] 0.0 33.35 0.01 96 0.05 0.05 __sin [49] 0.0 33.35 0.01 III_i_stereo_k_values [44] 0.0 33.36 0.01 huffman_coder [45] 0.0 33.36 0.01 look_ahead [46] 0.0 33.36 0.00 10010 0.00 0.00 __tan [284] And this is the corresponding profile for playback of layer 2 files: granularity: each sample hit covers 2 byte(s) for 0.04% of 26.15 seconds % cumulative self self total time seconds seconds calls ms/call ms/call name 55.0 14.37 14.37 245376 0.06 0.06 SubBandSynthesis [3] 11.2 17.29 2.92 40897 0.07 0.12 out_fifo [4] 11.1 20.18 2.89 40896 0.07 0.07 II_dequantize_sample [5] 7.3 22.09 1.91 1929 0.99 0.99 _write [7] 6.0 23.65 1.56 40896 0.04 0.06 II_buffer_sample [6] 3.1 24.46 0.81 2363383 0.00 0.00 getbits [8] 1.6 24.89 0.43 40896 0.01 0.01 II_denormalize_sample [9] 0.8 25.67 0.20 176 1.14 1.14 _read [15] 0.5 25.79 0.12 3408 0.04 0.09 II_decode_scale [10] 0.4 25.89 0.10 7 14.29 14.29 _ioctl [16] 0.3 25.98 0.09 1 90.00 25453.59 main [1] 0.2 26.02 0.04 349 0.11 0.85 refill_buffer [11] 0.1 26.05 0.04 look_ahead [18] 0.1 26.08 0.03 523 0.06 0.06 _memcpy [19] 0.1 26.10 0.02 3408 0.01 0.02 II_decode_bitalloc [17] 0.0 26.13 0.01 3408 0.00 0.01 decode_info [24] 0.0 26.14 0.01 3408 0.00 0.00 pick_table [28] 0.0 26.15 0.00 20448 0.00 0.00 get1bit [34] 0.0 26.15 0.00 3409 0.00 0.00 end_bs [35] 0.0 26.15 0.00 3409 0.00 0.00 seek_sync [32] 0.0 26.15 0.00 3409 0.00 0.00 sstell [36] 0.0 26.15 0.00 3408 0.00 0.00 hdr_to_frps [27] 0.0 26.15 0.00 2048 0.00 0.00 __cos [280] 0.0 26.15 0.00 1920 0.00 0.00 sound_write [37] 0.0 26.15 0.00 1917 0.00 0.00 __libmopt__rem_pio2 [281] 0.0 26.15 0.00 959 0.00 0.00 __libmopt__k_cos_ [282] 0.0 26.15 0.00 958 0.00 0.00 __libmopt__k_sin_ [283] 0.0 26.15 0.00 351 0.00 0.74 fread [12] The original source code for the decoder can be found in ftp://ftp.tnt.uni-hannover.de/pub/MPEG/audio/mpeg2/software/ technical_report/dist08.tar.gz To make it easier to update and improve mpeg3play, I would like to be notified of enhancements to this source, so that they can be merged into future versions of mpeg3play. ---------------------------------------------------------------------- KNOWN PROBLEMS - Audio streams through Netscape sometimes fail (probably a caching issue, try to clear the Netscape cache if this happens). - Cannot play some 16kbps mono files. This is probably due to the very crude implementation of bitstream synchword detection. It may not be able to correctly decode valid bitstreams which have false synchword patterns in the ancillary data portion of the bitstream. - mpeg3play makes the Linux audio driver leak memory (presumably by not cleaning up nicely once it's done). ---------------------------------------------------------------------- HISTORY 16-Dec-96 0.9 Initial release. 30-Jan-97 0.9.1 Code cleanups to remove compiler warnings, audio device initialization moved to its own function. The implementation of SubBandSynthesis slightly changed. Ported to Linux. 31-Jan-97 0.9.2 Some additional optimizations, single precision floats (-DFSINGLE) now works on Linux. 2-Feb-97 0.9.3 The source was ported to HPUX 9.05. Minor optimizations. 16-Feb-97 0.9.4 System-dependent audio routines were moved into separate files audio-.c. The source was ported to Amiga. SubBandSynthesis was optimized to reduce the CPU load from 65% to 56% for a typical layer 3 file. 23-Feb-97 0.9.5 Several functions were optimized, and combined they reduce the CPU load another 12% to 25% (at least on Solaris, with my test files). This version also runs on IBM AIX. ---------------------------------------------------------------------- Copyright (C) 1996, 1997 by Johan Hagman Johan Hagman disclaims all warranties with regard to this software, including all implied warranties of merchantability and fitness. In no event will Johan Hagman be liable for direct, incidental or consequential damages resulting from loss of data or business opportunities, resulting from mpeg3play, or any part of same, either alone or in conjunction with other programs. mpeg3play is distributed "as is" at no additional charge.