faad2.library 2.11.4
====================
faad2.library is a port of FAAD2 2.11.4, the free AAC decoder
(https://github.com/knik0/faad2), as an AmigaOS 3.x shared library.
It decodes the formats used by internet radio stations, podcasts and
MP4/M4A files:
* AAC-LC, HE-AAC (SBR), HE-AACv2 (PS), LTP, LD, ER
(AAC Main in the fpu variant only)
* ADTS, ADIF and MP4 containers (MP4 via the faad command)
The library offers the complete libfaad API (NeAACDec...), so existing
libfaad code usually works unchanged. It is reentrant: any number of
tasks may decode at the same time. Every decoder runs on its own
private stack, so callers do not need a large task stack.
This archive contains everything: the libraries, the command line
decoder and the developer files (headers, static libfaad.a, example).
Which variant?
--------------
fpu floating point decoder with hand optimised FPU assembler.
For every 68k with FPU: 68020/030 + 68881/68882, 68040,
68060, 68080 (Vampire V4/V4SA). Best sound quality.
fixed fixed point decoder for 68020-68060 without FPU
(68020/030, 68LC040, 68LC060/EC060, Vampire V2).
Contains two codes and picks the right one when loaded:
native 64 bit multiplication + assembler for 68020-68040 and
68080, C code for the 68060 (which lacks 64 bit muls.l in
hardware). Force a choice with SetEnv FAAD2_CPU 68060 / 68020.
Rule of thumb: if your machine has an FPU, use fpu, otherwise fixed.
Since FAAD2 2.11.4 both are about equally accurate; on the 68080
fpu is faster for HE-AAC.
Installation
------------
Copy ONE of the two libraries to LIBS:
Copy faad2/Libs/fpu/faad2.library LIBS:
or
Copy faad2/Libs/fixed/faad2.library LIBS:
Optionally copy the matching command line decoder to C:
Copy faad2/C/fpu/faad C:
"Version faad2.library FULL" shows which variant is installed. The
fixed point variant needs mathieeedoubbas.library (in ROM).
Speed
-----
Vampire V4 Standalone (Apollo 68080, ~93 MHz), 20 s of audio via
faad2.library, without file output:
Stream fixed fpu
AAC-LC 128 kbit/s stereo 5.8 s (3.5x) 6.0 s (3.3x)
HE-AAC 48 kHz stereo 17.2 s (1.2x) 13.4 s (1.5x)
HE-AACv2 48 kHz 18.8 s (1.1x) 13.1 s (1.5x)
Real internet radio (fpu): AAC-LC 192 kbit/s 2.6x, HE-AAC 64 kbit/s
1.6x, HE-AACv2 48 kbit/s 1.5x real time.
For programmers
---------------
SDK/ contains the include files (proto, inline, clib, pragmas, fd,
lvo, neaacdec.h), the SFD, the static libfaad.a of both variants and
an example.
The library functions are identical to libfaad's neaacdec.h
(NeAACDecOpen, NeAACDecInit, NeAACDecDecode, ...). Include
<proto/faad2.h>, open "faad2.library" version 2 and existing libfaad
code usually works unchanged. Every decoder runs on its own private
stack (default 128 KB, NeAACDecSetStackSize() changes it), so your
program needs no large stack. Handles are reentrant per task.
In the directory SDK:
GCC: m68k-amigaos-gcc -noixemul -Iinclude examples/example.c
VBCC/SAS: include/pragmas/faad2_pragmas.h, or generate stubs from
include/fd/faad2_lib.fd or sfd/faad2_lib.sfd
examples/example.c is a complete decoder using the library.
Static linking (bebbo GCC, libnix):
lib/fixed/libfaad.a fixed point, runs on 68020-68060 without FPU.
Contains a 68020-68040/68080 code and a 68060
code and picks the right one at run time.
m68k-amigaos-gcc -noixemul -m68020 -O2 -o prog prog.c \
-Iinclude lib/fixed/libfaad.a -lm
lib/fpu/libfaad.a floating point with FPU assembler, any 68k with
FPU (68881/68882, 68040, 68060, 68080).
m68k-amigaos-gcc -noixemul -m68020 -m68881 -O2 -o prog prog.c \
-Iinclude lib/fpu/libfaad.a -lm
libfaad needs up to ~96 KB of stack (HE-AACv2) when linked
statically, e.g. unsigned long __stack = 256 * 1024;
Changes in FAAD2 2.11.4
-----------------------
* The fixed point decoder now really performs the SBR envelope
adjustment (FAAD2 bug fix): HE-AAC and HE-AACv2 sound as good as
with the fpu variant (69 dB / 46 dB against ffmpeg, before 33 dB
/ 15 dB). It needs ~10 % more CPU time for HE-AAC than before.
* Mono streams now decode to ONE channel (before: duplicated to
stereo). HE-AACv2 in ADTS, typical for radio streams, starts as
mono (NeAACDecInit reports 1 channel) and switches to 2 channels
when PS data appears. Programs must use
NeAACDecFrameInfo.channels of every decoded frame and size buffers
for the maximum - see README.amiga.md, "Changes in FAAD2 2.11.4".
* mp4AudioSpecificConfig has a new last field ps_present_flag.
faad2.library fills only the 2.11.3 part of the structure, so
programs built with the old headers stay safe; ps_present_flag is
filled by the static libfaad.a only.
* HE-AACv2 in MP4 is recognised correctly, PNS fix, the faad
command trims MP4 files gaplessly.
Older programs keep working with the new library; it stays
compatible with programs built with the 2.11.3 headers.
Skipping SBR (Amiga extension)
------------------------------
On slow machines HE-AAC can be decoded without SBR - only the AAC core,
at half the rate, for a fraction of the CPU time:
cfg->dontUpSampleImplicitSBR = 2; /* before NeAACDecInit/Init2 */
HE-AACv2 then comes out as mono (one channel). For MP4 files that
signal HE-AAC explicitly (object type 5 or 29), pass NeAACDecInit2 a
two byte AudioSpecificConfig that only describes the AAC-LC core.
Values 0 and 1 behave as in upstream FAAD2. An older library treats 2
like 1 and keeps decoding SBR - check the sample rate of the first
decoded frame.
Details in README.amiga.md, "Skipping SBR".
Tested
------
Tested on real hardware only on a Vampire V4 Standalone (68080,
Kickstart 3.2.1): output is bit-exact (fixed) or within 1 LSB (fpu)
compared to FAAD2 on x86-64, no memory leaks. The 68060 code of the
fixed variant was tested in an emulator only. Nothing has been tested
on real 68020/030/040/060 CPUs yet - reports are welcome.
Contents
--------
faad2/Libs/fixed/faad2.library fixed point library
faad2/Libs/fpu/faad2.library FPU library
faad2/C/fixed/faad command line decoder, fixed point
faad2/C/fpu/faad command line decoder, FPU
faad2/SDK/include/ neaacdec.h, proto/, inline/, clib/,
pragmas/, fd/, lvo/
faad2/SDK/lib/fixed/libfaad.a static library, fixed point
faad2/SDK/lib/fpu/libfaad.a static library, FPU
faad2/SDK/sfd/faad2_lib.sfd interface description
faad2/SDK/examples/example.c example program
faad2/README.amiga.md full documentation
faad2/faad2.readme this file
faad2/COPYING GNU GPL v2
History
-------
2.11.4 (1.10.2026) update to FAAD2 2.11.4; since 1.11.2026 library and
SDK come in this one archive (before: separate
-lib and -sdk archives), the binaries are unchanged
2.11.3 (28.9.2026) first release
License
-------
FAAD2 is licensed under the GNU GPL v2 or later; so are faad2.library,
libfaad.a and every program using them. Commercial use of AAC may
require patent licenses.
|