Short: mpega.library clone (libmad), 68020/80 Author: Renaud Schweingruber (68080/68020 versions), Sigbjørn Skjæret (clone), Underbit Technologies (libmad) Uploader: renaud schweingruber protonmail com (Renaud Schweingruber) Type: util/libs Version: 2.6.3 (29.10.2026) Requires: 68080 (Apollo Vampire), or 68020 or better Architecture: m68k-amigaos >= 3.0 Distribution: Aminet mpega.library 2.6.3 [080] and [020] =================================== A 68080 build of Sigbjørn Skjæret's mpega.library clone (v1.7), which decodes MPEG audio (layers I, II and III) with libmad 0.15.1b, and the same library built for the 68020 and better. Programs that use mpega.library (players, AmiPlexAmp, ...) work unchanged: just replace the library. The archive holds two libraries: 68080/mpega.library for the 68080 (Apollo Vampire) 68020/mpega.library for a 68020, 68030 or 68040 (it also runs on a 68060, but slowly: the 68060 has no 64-bit MULS.L, which the 68060.library emulates) What is different ----------------- The 2004 68k binary of the clone uses libmad's fastest but least accurate fixed-point mode. This build uses libmad's full-accuracy mode (64-bit products) and makes it fast on the 68080: - polyphase synthesis window, dct32, IMDCT (with the windowing and the overlap-add) and alias reduction in assembler, made by dedicated generators and scheduled for the 68080; the multiplies keep the high longword of each 64-bit MULS.L product; - with the FPU on, the synthesis window runs on it (single precision, scheduled for the 68080 FPU pipeline) and dct32 hands it floats directly; without the FPU the same work runs on the integer unit; - the ReplayGain is applied inside the synthesis window, at no cost; - Huffman decoding and requantization in assembler, one table lookup per pair of values, BFEXTU straight from the bitstream; - dithered and rounded 16-bit output in assembler; with the FPU on, the rounded output (quality 0 and 1) comes straight out of the synthesis window, which also rounds and clips; - C code compiled for the 68080, laid out for its 32 KB instruction cache. The 68020 library is the same decoder without the 68080 parts: C code compiled for the 68020, no FPU (on a 68881/68882 the integer window is faster), the same assembler otherwise. Measured on a Vampire V4 (68080 at 99 MHz, core 12841), 254 kbit/s VBR MP3, 44.1 kHz stereo, CPU time in % of real time (dithered = quality 2, rounded = quality 1), all on the same day: dithered rounded 2.5.2 23.2 % 20.9 % 2.6.1 15.8 % 14.9 % 2.6.2, 68080 library 15.7 % 14.3 % 2.6.2, 68020 library 17.0 % 16.3 % The last line is the 68020 library run on the 68080; it has not been measured on a real 68020 or 68030. 2.6.3 measures within about 1 % of 2.6.2 (see History). The quality is the same as 2.5: compared with a floating-point reference decoder (ffmpeg), no sample of the rounded output is more than 1 LSB off: it is as close to the reference as 16 bits allow. The previous 68k binary of the clone (040) was off by up to 124 LSB. Also tested with 128 kbit/s CBR, 22 kHz mono and 16 kHz MPEG-2 files, very loud tracks, damaged files, short reads through the bs_access hook, a small caller stack and the 1/2 and 1/4 output rates. The 68080 library uses the FPU when it is on (checked when a stream is opened: the V4 can switch it off), for the synthesis window only: there the pipelined FPU of the 68080 beats the integer multiplier. The output accuracy is the same either way. The 68020 library never uses the FPU. Installation ------------ Copy 68080/mpega.library (Vampire) or 68020/mpega.library (other CPUs) to LIBS: (keep a copy of the old one), then reboot or run "Avail FLUSH" so that the new one is loaded. "Version mpega.library FULL" shows, for the 68080 library: mpega.library 2.6 (29.10.2026) [080] mpega.library clone v1.7 by Sigbjørn (CISC) Skjæret, 68080 version by Renaud Schweingruber, using libmad 0.15.1b - Copyright (C) 2000-2004 Underbit Technologies, Inc. and "[020] ... 68020 version ..." for the 68020 library ("2.6": programs that compare version numbers see 2.6; the identification string and "Version LIBS:mpega.library FILE FULL" show 2.6.3). The 68080 library uses instructions that only the 68080 has, and refuses to open on any other CPU; the 68020 library refuses to open on a 68000 or 68010 (programs then see that mpega.library cannot be opened). License and source code ----------------------- This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. It is distributed WITHOUT ANY WARRANTY; see the file COPYING for details. libmad - MPEG audio decoder library Copyright (C) 2000-2004 Underbit Technologies, Inc. mpega.library clone Copyright (C) Sigbjørn Skjæret and contributors. 68080 and 68020 versions Copyright (C) 2026 Renaud Schweingruber. Written offer of source code (GPL version 2, section 3b): For at least three years from the date of this release, I will give any third party, on request and for no more than the cost of physically performing the source distribution, a complete machine-readable copy of the corresponding source code of this mpega.library, including the scripts used to build it. Write to: Renaud Schweingruber History ------- 2.6.3 Removed 1 KB of padding placed after the synthesis window code. It only helped where the following code landed in the instruction cache of one 68080 core, and the 68080 designer advises against such padding. Same output as 2.6.2; on core 12841 decoding can be about 1 % slower, which is within the run-to-run spread. The 68020 library only changes its version string. 2.6.2 With the FPU on, quality 0 and 1 (rounded output) are about 4 % faster: the synthesis window writes the 16-bit samples itself (rounding and clipping included) instead of a separate pass. Fewer than 0.01 % of the rounded samples differ from 2.6.1, by 1 LSB (one rounding instead of two); quality 2 is unchanged. The IMDCT code is smaller (3.8 KB instead of 12.9 KB), same output. New: a 68020 library, for computers without a 68080. 2.6.1 The synthesis window reads its table in memory order (the table is laid out the way the window walks it): smaller code, about 1 % faster. Same output as 2.6. The ".1" is only in the version string: programs that compare version numbers see 2.6. 2.6 About 30 % faster than 2.5.2 (see above), the synthesis window on the FPU when it is on. The output is no longer bit for bit that of 2.5.x: less than 0.5 % of the samples differ, by 1 LSB, with the same accuracy. Fixed: the last frame of every file was not decoded. Fixed: nothing was decoded when the bs_access hook returned fewer bytes than asked (short reads, e.g. from a network stream), and files with an ID3v2 tag could fail to open that way. Fixed: on files far beyond full scale, the two lowest subbands could wrap around (loud crackle). Compiled for the 68080 only: the library refuses to open on any other CPU (2.5.x ran, slowly, on a 68020 or better). 2.5.2 Fixed crashes when two programs, or two tasks of one program (AmigaAMP has a process with an 8 KB stack), use the library at the same time on a system without a stack patch such as StackAttack: when a caller had less than 16 KB of stack left, the library switched to a stack of its own, but the data for that switch, inherited from the clone, were shared by all callers. Each call now has its own. 2.5.1 Fixed a crash ("CHK instruction" error, or a frozen system) at the start of MP3 files whose LAME header holds a ReplayGain value, which LAME 3.94 and later write by default: the gain was computed with floating-point code that called math libraries the library never opens. It is now computed with integers (same result). 2.4 and 2.5 have the bug. The ".1" is only in the version string: programs that compare version numbers see 2.5 (same for 2.5.2). 2.5 Fixed loud tracks: some products wrapped around beyond +-4.0 (crackle and hiss on heavy bass); dct32 scheduled for the 68080. Fixed a crash or lock-up in programs that decode with a small stack, such as HippoPlayer (garbage requester, frozen system): when the caller had less than 8 KB of stack left, the library switched to a stack of its own, and the switch back left the caller's stack 12 bytes off. The library's own stack is now 16 KB. 2.4 First 68080 version. Credits ------- Robert Leslie / Underbit Technologies for libmad, Sigbjørn Skjæret, Jarmo Laakkonen and Stephan Rupprecht for the mpega.library clone, Stéphane Tavenard for the original mpega.library interface.