Short: mpega.library clone (libmad) for 68080 Author: Renaud Schweingruber (68080 version), Sigbjørn Skjæret (clone), Underbit Technologies (libmad) Uploader: renaud schweingruber protonmail com (Renaud Schweingruber) Type: util/libs Version: 2.6.1 (27.10.2026) Requires: 68080 (Apollo Vampire) Architecture: m68k-amigaos >= 3.0 Distribution: Aminet mpega.library 2.6.1 [080] ========================= 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. Programs that use mpega.library (players, AmiPlexAmp, ...) work unchanged: just replace the library. 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; - C code compiled for the 68080, laid out for its 16 KB instruction cache. 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): dithered rounded 2.5.2 22.1 % 20.0 % 2.6, FPU off 16.4 % 15.6 % 2.6, FPU on 15.7 % 14.8 % 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 FPU is used 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. Installation ------------ Copy mpega.library 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: mpega.library 2.6.1 (27.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. The library uses instructions that only the 68080 has, and refuses to open on any other CPU (programs then see that mpega.library cannot be opened): use another mpega.library there. 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 version 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.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.