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), and
AAC Enhanced Low-Delay (AAC-ELD)
decoder
Fraunhofer Institut 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, electronic or mechanical, including
photocopying and microfilm, without permission in writing from the publisher.
Revision 2.5.17 , December 15, 2015
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.3 Buffer System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3 Decoder audio output 7
3.1 Obtaining channel mapping information . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.2 Changing the audio output format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.3 Channel mapping examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.3.1 Stereo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.3.2 Surround 5.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.3.3 ARIB coding mode 2/1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
4 Class Index 11
4.1 Class List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
5 File Index 13
5.1 File List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
6 Class Documentation 15
6.1 CStreamInfo Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
6.1.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
6.1.2 Member Data Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
6.1.2.1 aacNumChannels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
6.1.2.2 aacSampleRate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
6.1.2.3 aacSamplesPerFrame . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
6.1.2.4 aot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
6.1.2.5 bitRate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
6.1.2.6 channelConfig . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
6.1.2.7 drcPresMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
6.1.2.8 drcProgRefLev . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
6.1.2.9 epConfig . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
6.1.2.10 extAot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
6.1.2.11 extSamplingRate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
6.1.2.12 flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
6.1.2.13 frameSize . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
6.1.2.14 numBadAccessUnits . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
6.1.2.15 numBadBytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
6.1.2.16 numChannels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
ii CONTENTS
6.1.2.17 numLostAccessUnits . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
6.1.2.18 numTotalAccessUnits . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6.1.2.19 numTotalBytes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6.1.2.20 outputDelay . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6.1.2.21 pChannelIndices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6.1.2.22 pChannelType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6.1.2.23 profile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6.1.2.24 sampleRate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
7 File Documentation 19
7.1 aacdecoder_lib.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
7.1.1 Detailed Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
7.1.2 Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . 23
7.1.2.1 AACDEC_CLRHIST . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
7.1.2.2 AACDEC_CONCEAL . . . . . . . . . . . . . . . . . . . . . . . . . . 23
7.1.2.3 AACDEC_FLUSH . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
7.1.2.4 AACDEC_INTR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
7.1.2.5 IS_DECODE_ERROR . . . . . . . . . . . . . . . . . . . . . . . . . . 23
7.1.2.6 IS_INIT_ERROR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
7.1.2.7 IS_OUTPUT_VALID . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
7.1.3 Typedef Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
7.1.3.1 HANDLE_AACDECODER . . . . . . . . . . . . . . . . . . . . . . . 24
7.1.4 Enumeration Type Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . 24
7.1.4.1 AAC_DECODER_ERROR . . . . . . . . . . . . . . . . . . . . . . . . 24
7.1.4.2 AACDEC_PARAM . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
7.1.5 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
7.1.5.1 aacDecoder_AncDataGet . . . . . . . . . . . . . . . . . . . . . . . . . 27
7.1.5.2 aacDecoder_AncDataInit . . . . . . . . . . . . . . . . . . . . . . . . . 28
7.1.5.3 aacDecoder_Close . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
7.1.5.4 aacDecoder_ConfigRaw . . . . . . . . . . . . . . . . . . . . . . . . . . 28
7.1.5.5 aacDecoder_DecodeFrame . . . . . . . . . . . . . . . . . . . . . . . . 29
7.1.5.6 aacDecoder_Fill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
7.1.5.7 aacDecoder_GetFreeBytes . . . . . . . . . . . . . . . . . . . . . . . . 29
7.1.5.8 aacDecoder_GetLibInfo . . . . . . . . . . . . . . . . . . . . . . . . . . 30
7.1.5.9 aacDecoder_GetStreamInfo . . . . . . . . . . . . . . . . . . . . . . . . 30
7.1.5.10 aacDecoder_Open . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
7.1.5.11 aacDecoder_SetParam . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Chapter 1
Introduction
1.1 Scope
This document describes the high-level 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,
it implements decoding of AAC-LC (Low-Complexity), HE-AAC (High-Efficiency AAC, v1 and v2), A-
AC-LD (Low-Delay) and AAC-ELD (Enhanced Low-Delay).
All references to SBR (Spectral Band Replication) are only applicable to HE-AAC and AAC-ELD versions
of the library. All references to PS (Parametric Stereo) are only applicable to HE-AAC v2 versions of the
library.
1.2 Decoder Basics
This document can only give a rough overview about the ISO/MPEG-2 and ISO/MPEG-4 AAC audio
coding standard. To understand all the terms in this document, you are encouraged to read the following
documents.
• ISO/IEC 13818-7 (MPEG-2 AAC), which defines the syntax of MPEG-2 AAC audio bitstreams.
• ISO/IEC 14496-3 (MPEG-4 AAC, subpart 1 and 4), which defines the syntax of MPEG-4 AAC
audio bitstreams.
• Lutzky, Schuller, Gayer, Krämer, Wabnik, "A guideline to audio codec delay", 116th AES Conven-
tion, May 8, 2004
MPEG Advanced Audio Coding is based on a time-to-frequency mapping of the signal. The signal is
partitioned into overlapping portions and transformed into frequency domain. The spectral components are
then quantized and coded.
An MPEG2 or MPEG4 AAC audio bitstream is 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 on any
length between 1 and 768 bytes.