Advanced Audio Coding Decoder
Library
MPEG-2 and MPEG-4
AAC Low-Complexity (AAC-LC),
High-Efficiency AAC v2 (HE-AAC v2),
AAC Low-Delay (AAC-LD),
AAC Enhanced Low-Delay (AAC-ELD v2),
MPEG-D Extended High Efficiency AAC (xHE-AAC) / USAC,
decoder
Fraunhofer Institut fuer Integrierte Schaltungen IIS,
Fraunhofer Institute for Integrated Circuits IIS
http://www.iis.fraunhofer.de/amm
Disclaimer
Information in this document is subject to change without notice. Companies, names, and data used in
examples herein are fictitious unless otherwise noted. Product and corporate names may be trademarks or
registered trademarks of other companies. They are used for explanation only, with no intent to infringe. All
rights reserved. No part of this publication may be reproduced or utilized in any form or by any means, elec-
tronic or mechanical, including photocopying and microfilm, without permission in writing from the publisher.
© Copyright 1999-2018 Fraunhofer IIS. All rights reserved.
Revision 3.0.0 , February 26, 2018
Contents
1 Introduction 1
1.1 Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Decoder Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 Library Usage 3
2.1 API Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.2 Calling Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.2.1 Error Concealment Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3 Buffer System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3 Decoder audio output 9
3.1 Obtaining channel mapping information . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2 Changing the audio output format . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.3 Channel mapping examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.3.1 Stereo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.3.2 Surround 5.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.3.3 ARIB coding mode 2/1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
4 Class Index 13
4.1 Class List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
5 File Index 15
5.1 File List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
6 Class Documentation 17
6.1 CStreamInfo Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
6.1.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
6.1.2 Member Data Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . 18
sampleRate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
frameSize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
numChannels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
pChannelType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
pChannelIndices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
aacSampleRate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
profile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
aot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
channelConfig . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
bitRate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
aacSamplesPerFrame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
aacNumChannels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
extAot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
extSamplingRate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
outputDelay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
i
CONTENTS CONTENTS
flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
epConfig . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
numLostAccessUnits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
numTotalBytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
numBadBytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
numTotalAccessUnits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
numBadAccessUnits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
drcProgRefLev . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
drcPresMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
7 File Documentation 21
7.1 aacdecoder lib.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
7.1.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
7.1.2 Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . 24
IS INIT ERROR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
IS DECODE ERROR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
IS OUTPUT VALID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
AACDEC CONCEAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
AACDEC FLUSH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
AACDEC INTR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
AACDEC CLRHIST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
7.1.3 Typedef Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
HANDLE AACDECODER . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
7.1.4 Enumeration Type Documentation . . . . . . . . . . . . . . . . . . . . . . . 25
AAC DECODER ERROR . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
AAC MD PROFILE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
AAC DRC DEFAULT PRESENTATION MODE OPTIONS . . . . . . . . . . 28
AACDEC PARAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
7.1.5 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
aacDecoder AncDataInit() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
aacDecoder AncDataGet() . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
aacDecoder SetParam() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
aacDecoder GetFreeBytes() . . . . . . . . . . . . . . . . . . . . . . . . . . 36
aacDecoder Open() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
aacDecoder ConfigRaw() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
aacDecoder LoudnessBox() . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
aacDecoder Fill() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
aacDecoder DecodeFrame() . . . . . . . . . . . . . . . . . . . . . . . . . . 38
aacDecoder Close() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
aacDecoder GetStreamInfo() . . . . . . . . . . . . . . . . . . . . . . . . . . 40
aacDecoder GetLibInfo() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Index 41
ii
Chapter 1
Introduction
1.1 Scope
This document describes the high-level application interface and usage of the ISO/MPEG-2/4
AAC Decoder library developed by the Fraunhofer Institute for Integrated Circuits (IIS). Depending
on the library configuration, decoding of AAC-LC (Low-Complexity), HE-AAC (High-Efficiency
AAC v1 and v2), AAC-LD (Low-Delay) and AAC-ELD (Enhanced Low-Delay) is implemented.
All references to SBR (Spectral Band Replication) are only applicable to HE-AAC and AAC-
ELD configurations of the FDK library. All references to PS (Parametric Stereo) are only applica-
ble to HE-AAC v2 decoder configuration of the library.
1.2 Decoder Basics
This document can only give a rough overview about the ISO/MPEG-2, ISO/MPEG-4 AAC audio
and MPEG-D USAC coding standards. To understand all details referenced in this document,
you are encouraged to read the following documents.
• ISO/IEC 13818-7 (MPEG-2 AAC) Standard, defines the syntax of MPEG-2 AAC audio bit-
streams.
• ISO/IEC 14496-3 (MPEG-4 AAC, subpart 1 and 4) Standard, defines the syntax of MPEG-4
AAC audio bitstreams.
• ISO/IEC 23003-3 (MPEG-D USAC), defines MPEG-D USAC unified speech and audio
codec.
• Lutzky, Schuller, Gayer, Kr
¨
amer, Wabnik, ”A guideline to audio codec delay”, 116th AES
Convention, May 8, 2004
In short, MPEG Advanced Audio Coding is based on a time-to-frequency mapping of the
signal. The signal is partitioned into overlapping time portions and transformed into frequency
domain. The spectral components are then quantized and coded using a highly efficient coding
scheme.
Encoded MPEG-2 and MPEG-4 AAC audio bitstreams are composed of frames. Contrary to
MPEG-1/2 Layer-3 (mp3), the length of individual frames is not restricted to a fixed number of
bytes, but can take any length between 1 and 768 bytes.
In addition to the above mentioned frequency domain coding mode, MPEG-D USAC also
employs a time domain Algebraic Code-Excited Linear Prediction (ACELP) speech coder core.
This operating mode is selected by the encoder in order to achieve the optimum audio quality
for different content type. Several enhancements allow achieving higher quality at lower bit rates
compared to MPEG-4 HE-AAC.
1