AminetAminet
Search:
85771 packages online
• About
• Recent
• Browse
• Search
• Upload
• Setup
• Services

util/libs/flacdec.lha

Mirror:Random
Showing: generic icon
No screenshot available
Short:FLAC decoder library (68020+/060/080)
Author:Renaud Schweingruber, David Reid (dr_flac)
Uploader:renaud schweingruber protonmail com (Renaud Schweingruber)
Type:util/libs
Version:1.1 (2.11.2026)
Architecture:m68k-amigaos >= 3.0
Date:2026-11-03
Requires:68020
Distribution:Aminet
Download:util/libs/flacdec.lha - View contents
Readme:util/libs/flacdec.readme
Downloads:99

flacdec.library 1.1
===================

A shared library that decodes FLAC (Free Lossless Audio Codec) to
16-bit PCM for AmigaOS 3, bit for bit what the reference decoder
gives. Inside is dr_flac by David Reid, with its decoding loops
(LPC prediction, Rice residuals, stereo output) rewritten in 68020
assembler and tuned for the Apollo 68080.

Programs that use it: AmiPlexAmp (Plex client), and yours: the
interface is five functions (see Developer/).

Three builds
------------

  Libs/flacdec.library      any 68020 or better. On a 68060 use the
                            68060 build: the 24-bit prediction here
                            needs an instruction that 68060.library
                            has to emulate
  Libs/flacdec.library.060  68060 only (and 68080, for testing); the
                            same prediction from 16-bit multiplies.
                            Checked on a 68080 only: it has not run
                            on a real 68060 yet
  Libs/flacdec.library.080  Apollo 68080 (Vampire) only; refuses to
                            open on another CPU. With the FPU on, the
                            prediction of 24-bit files runs on it,
                            bit for bit the same

Copy one of them to LIBS:flacdec.library.

Speed on a Vampire V4 (68080, 99 MHz), CPU time in % of real time,
decoding only:

                              68080 build   68020 build
  44.1 kHz / 16-bit stereo       4.9 %         4.9 %
  96 kHz / 24-bit stereo        12.6 %        13.9 %
  88.2 kHz / 24-bit, verbatim    2.3 %         2.4 %

Formats: 4 to 32 bits per sample (16-bit output), 1 to 8 channels,
any sample rate, native FLAC (not Ogg FLAC). CRCs are not checked.
Not decoded: 32-bit stereo frames with a side channel, which has 33
bits. Decoding stops at the first such frame.
Seeking is supported. Input comes from a file or from your own I/O
hook (for example a file that is still being downloaded). Several
programs and tasks can decode at the same time. The 68020 build does
not use the FPU; the 68080 build uses it when it is on (checked for
every subframe: the V4 can switch it off). The 68060 build does not
use the FPU either.

For programmers
---------------

  Developer/doc/flacdec.doc               the autodoc
  Developer/include/libraries/flacdec.h   structures and constants
  Developer/include/clib, proto, inline   prototypes, GCC inlines
  Developer/fd/flacdec_lib.fd

  struct FLACDecInfo info;
  APTR dec = FLACDecOpenFile("song.flac", &info);
  LONG n;
  while ((n = FLACDecRead(dec, buffer, 4096)) > 0)
      ... n frames of info.fdi_Channels interleaved WORDs ...
  FLACDecClose(dec);

The functions use up to about 4.6 KB of the caller's stack: call them
with at least 8 KB free.

Tested
------

Against ffmpeg's decoder: 23 files (CD and 96 kHz/24-bit music,
ffmpeg compression levels 0 to 12, LPC orders up to 32, mono, 48 kHz,
every stereo mode, wasted bits), whole decodes and seeks at 7
positions each, both builds; the read hook; the stack use. The FPU
prediction against the integer one on 1152 cases and under constant
interrupts. Since 1.1 also synthetic files against their known samples:
verbatim subframes from 4 to 32 bits, residuals mixing Rice and unencoded
partitions. All three builds gave the same results on a 68080, the
68060 prediction also against a model on 13772 cases.

License
-------

flacdec.library is free to use and to redistribute in this unchanged
archive. (C) 2026 Renaud Schweingruber. dr_flac by David Reid is
public domain (or MIT-0), https://github.com/mackron/dr_libs.

History
-------

1.1  Verbatim subframes in assembler, 7 times faster. The prediction
     runs once per subframe instead of once per partition, the library
     is 5 KB smaller. 16-bit files that do not need the 64-bit
     prediction no longer use it, and its loops are 2 to 3 cycles per
     sample shorter (68020 build: up to 11 % faster on 16-bit files, 5 %
     on 96 kHz/24-bit; 68080 build: up to 5 %). New 68060 build. 32-bit files from libFLAC 1.4 now decode (they gave no
     samples). The output is unchanged for everything that decoded before.
1.0  First release.


Contents of util/libs/flacdec.lha
 PERMSSN    UID  GID    PACKED    SIZE  RATIO METHOD CRC     STAMP          NAME
---------- ----------- ------- ------- ------ ---------- ------------ -------------
[Amiga]                   2060    5515  37.4% -lh5- 441a Nov  2 09:30 flacdec/Developer/doc/flacdec.doc
[Amiga]                    184     308  59.7% -lh5- 35a9 Nov  2 09:30 flacdec/Developer/fd/flacdec_lib.fd
[Amiga]                    435     821  53.0% -lh5- 6065 Nov  2 09:30 flacdec/Developer/include/clib/flacdec_protos.h
[Amiga]                    492    1364  36.1% -lh5- 213d Nov  2 09:30 flacdec/Developer/include/inline/flacdec.h
[Amiga]                    919    1819  50.5% -lh5- 5e60 Nov  2 09:30 flacdec/Developer/include/libraries/flacdec.h
[Amiga]                    345     756  45.6% -lh5- 2fbc Nov  2 09:30 flacdec/Developer/include/proto/flacdec.h
[Amiga]                   2051    4474  45.8% -lh5- 64d0 Nov  2 09:30 flacdec/flacdec.readme
[Amiga]                  11021   20172  54.6% -lh5- 1532 Nov  2 09:30 flacdec/Libs/flacdec.library
[Amiga]                  11248   20736  54.2% -lh5- 11de Nov  2 09:30 flacdec/Libs/flacdec.library.060
[Amiga]                  13089   26056  50.2% -lh5- 887b Nov  2 09:30 flacdec/Libs/flacdec.library.080
---------- ----------- ------- ------- ------ ---------- ------------ -------------
 Total        10 files   41844   82021  51.0%            Nov  3 00:16
Page generated in 0.02 seconds
Aminet © 1992-2024 Urban Müller and the Aminet team. Aminet contact address: <aminetaminet net>