diff --git a/Android.bp b/Android.bp index 7c8464e..31d5d9b 100644 --- a/Android.bp +++ b/Android.bp @@ -341,4 +341,140 @@ cc_library_static { }, } -subdirs = ["test"] +cc_library_static { + name: "libxaacenc", + + vendor_available: true, + host_supported: true, + cflags: [ + "-O3", + ], + + export_include_dirs: [ + "common", + "encoder", + ], + + srcs: [ + "common/ixheaac_esbr_fft.c", + "common/ixheaac_esbr_rom.c", + "common/ixheaac_fft_ifft_32x32_rom.c", + "encoder/iusace_bitbuffer.c", + "encoder/iusace_fft.c", + "encoder/iusace_rom.c", + "encoder/ixheaace_adjust_threshold.c", + "encoder/ixheaace_api.c", + "encoder/ixheaace_asc_write.c", + "encoder/ixheaace_basic_ops.c", + "encoder/ixheaace_bitbuffer.c", + "encoder/ixheaace_bitbuffer_hp.c", + "encoder/ixheaace_bits_count.c", + "encoder/ixheaace_block_switch.c", + "encoder/ixheaace_calc_ms_band_energy.c", + "encoder/ixheaace_channel_map.c", + "encoder/ixheaace_common_rom.c", + "encoder/ixheaace_dynamic_bits.c", + "encoder/ixheaace_enc_init.c", + "encoder/ixheaace_enc_main.c", + "encoder/ixheaace_fft.c", + "encoder/ixheaace_group_data.c", + "encoder/ixheaace_huffman_rom.c", + "encoder/ixheaace_hybrid.c", + "encoder/ixheaace_hybrid_init.c", + "encoder/ixheaace_interface.c", + "encoder/ixheaace_mdct_480.c", + "encoder/ixheaace_mps_bitstream.c", + "encoder/ixheaace_mps_dct.c", + "encoder/ixheaace_mps_delay.c", + "encoder/ixheaace_mps_dmx_tdom_enh.c", + "encoder/ixheaace_mps_enc.c", + "encoder/ixheaace_mps_filter.c", + "encoder/ixheaace_mps_frame_windowing.c", + "encoder/ixheaace_mps_huff_tab.c", + "encoder/ixheaace_mps_hybrid_filter.c", + "encoder/ixheaace_mps_nlc_enc.c", + "encoder/ixheaace_mps_onset_detect.c", + "encoder/ixheaace_mps_param_extract.c", + "encoder/ixheaace_mps_polyphase.c", + "encoder/ixheaace_mps_qmf.c", + "encoder/ixheaace_mps_rom.c", + "encoder/ixheaace_mps_static_gain.c", + "encoder/ixheaace_mps_tools_rom.c", + "encoder/ixheaace_mps_tree.c", + "encoder/ixheaace_mps_vector_functions.c", + "encoder/ixheaace_ms_stereo.c", + "encoder/ixheaace_ps_bitenc.c", + "encoder/ixheaace_ps_enc.c", + "encoder/ixheaace_ps_enc_init.c", + "encoder/ixheaace_psy_configuration.c", + "encoder/ixheaace_psy_mod.c", + "encoder/ixheaace_psy_utils.c", + "encoder/ixheaace_psy_utils_spreading.c", + "encoder/ixheaace_qc_main_hp.c", + "encoder/ixheaace_qc_util.c", + "encoder/ixheaace_quant.c", + "encoder/ixheaace_radix2_fft.c", + "encoder/ixheaace_resampler.c", + "encoder/ixheaace_resampler_init.c", + "encoder/ixheaace_rom.c", + "encoder/ixheaace_sbr_code_envelope.c", + "encoder/ixheaace_sbr_code_envelope_lp.c", + "encoder/ixheaace_sbr_crc.c", + "encoder/ixheaace_sbr_env_est.c", + "encoder/ixheaace_sbr_env_est_init.c", + "encoder/ixheaace_sbr_frame_info_gen.c", + "encoder/ixheaace_sbr_freq_scaling.c", + "encoder/ixheaace_sbr_hbe_dft_trans.c", + "encoder/ixheaace_sbr_hbe_trans.c", + "encoder/ixheaace_sbr_inv_filtering_estimation.c", + "encoder/ixheaace_sbr_main.c", + "encoder/ixheaace_sbr_misc.c", + "encoder/ixheaace_sbr_missing_harmonics_det.c", + "encoder/ixheaace_sbr_noise_floor_est.c", + "encoder/ixheaace_sbr_qmf_enc.c", + "encoder/ixheaace_sbr_qmf_enc_init.c", + "encoder/ixheaace_sbr_rom.c", + "encoder/ixheaace_sbr_ton_corr.c", + "encoder/ixheaace_sbr_ton_corr_hp.c", + "encoder/ixheaace_sbr_tran_det.c", + "encoder/ixheaace_sbr_tran_det_hp.c", + "encoder/ixheaace_sbr_write_bitstream.c", + "encoder/ixheaace_sf_estimation.c", + "encoder/ixheaace_static_bits.c", + "encoder/ixheaace_stereo_preproc.c", + "encoder/ixheaace_tns.c", + "encoder/ixheaace_tns_hp.c", + "encoder/ixheaace_tns_init.c", + "encoder/ixheaace_tns_params.c", + "encoder/ixheaace_write_adts_adif.c", + "encoder/ixheaace_write_bitstream.c", + ], + + sanitize: { + misc_undefined: [ + "unsigned-integer-overflow", + "signed-integer-overflow", + "bounds", + ], + cfi: true, + config: { + cfi_assembly_support: true, + }, + }, + + arch: { + arm64: { + cflags: [ + "-DBUILD_ARM64", + ], + }, + + x86_64: { + cflags: [ + "-DBUILD_ARM64", + ], + }, + }, +} + +subdirs = ["test"] \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 884be08..9762750 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.5.1) project(libxaac C CXX) enable_language(ASM) +option(BUILD64 "Build for 64 bit" OFF) set(XAAC_ROOT "${CMAKE_CURRENT_SOURCE_DIR}") set(XAAC_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}") find_package(Threads REQUIRED) @@ -21,3 +22,7 @@ include("${XAAC_ROOT}/common/common.cmake") include("${XAAC_ROOT}/decoder/libxaacdec.cmake") include("${XAAC_ROOT}/test/decoder/xaacdec.cmake") include("${XAAC_ROOT}/fuzzer/xaac_dec_fuzzer.cmake") + +include("${XAAC_ROOT}/encoder/libxaacenc.cmake") +include("${XAAC_ROOT}/test/encoder/xaacenc.cmake") +include("${XAAC_ROOT}/fuzzer/xaac_enc_fuzzer.cmake") diff --git a/README.md b/README.md index 0f93dff..4bea36b 100644 --- a/README.md +++ b/README.md @@ -1,109 +1,24 @@ -# Introduction of the Ex-HEAAC Decoder +# Introduction to Ex-HEAAC (libxaac) +Ex-HEAAC, the latest innovation member of the MPEG AAC codec family, is ideally suited for adaptive bit rate streaming and digital radio applications. Ex-HEAAC bridges the gap between speech and audio coding and ensures consistent high-quality audio for all signal types, including speech, music, and mixed material. It is the required audio codec for DRM (Digital Radio Mondiale). When it comes to coding, the codec is incredibly effective, generating high-quality audio for music and speech at bitrates as low as 6 kbit/s for mono and 12 kbit/s for stereo services. By switching to extremely low bitrate streams, Ex-HEAAC streaming apps and streaming radio players can provide uninterrupted playback even during very congested network conditions. -Ex-HEAAC (Extended HE AAC), the latest upgrade to the MPEG AAC codec family, -is the audio codec of choice for digital radio and low bit rate -streaming applications. Selected as the mandatory audio codec for DRM -(Digital Radio Mondiale), Ex-HEAAC bridges the gap between speech and -audio coding, and provides consistent high quality audio for all signal -types, such as speech, music or mixed content. +As the Extended High Efficiency AAC Profile is a logical evolution of the MPEG Audio's popular AAC Family profiles, the codec supports AAC-LC, HE-AACv1 (AAC+) and HE-AACv2 (eAAC+) audio object type encoding. The bitrate that was saved with AAC family tools can be used to enhance video quality. Ex-HEAAC is a well-liked option for a number of applications since it is a strong and effective audio codec that provides high-quality audio at low bitrates. -Another important feature is the codec’s coding efficiency. The audio -codec produces excellent sound for both music and speech, delivering -high quality performance at bit rates starting as low as 6 kbit/s for -mono and 12 kbit/s for stereo services. Thus Ex-HEAAC streaming apps and -streaming radio players may switch to very low bit rate streams and -offer a continuous playback even while the network is congested. Once -more bandwidth becomes available on the network again, the Ex-HEAAC -client can request a higher bitrate version and seamless switch over -the full range of bitrates. Audio bitrate that’s being saved due to the -improved coding efficiency can be used to improve video quality. Ex-HEAAC -supports AAC and HEAAC v2 as well. +![Architecture](docs/Exheaac_Block_Diagram.jpg) -AAC is a popular audio coding technique recommended by MPEG committee. -The codec handles audio signals sampled in the range of 8 kHz to 96 -kHz. It operates on a frame of 1024 samples. The bit-rates supported -are in the range of 8 kbps to 576 kbps per channel. +One of the key features of Ittiam's Ex-HEAAC (refer to above image) is that it has support for AAC-LD (Low Delay), AAC-ELD (Enhanced Low Delay), and AAC-ELDv2 (Enhanced Low Delay version 2) modes. AAC-LD mode provides low latency encoding, making it suitable for applications such as interactive communication and live audio streaming. It helps to reduce the delay in the encoding process to improve the real-time performance of the system. AAC-ELD mode improves the low-delay performance of HE-AAC by reducing the coding delay while maintaining high audio quality. It was observed that minimum delay it can achieve is 15ms. In order to achieve low delay coding scheme and low bitrate, it uses the Low Delay SBR tool. AAC-ELDv2 is the most advanced version of AAC-based low delay coding. It provides an enhanced version of AAC-ELD, which provides even lower coding delay and higher audio quality. -SBR and PS are the tools used in combination with the AAC general audio -codec resulting in HEAAC v2 (also known as Enhanced AAC Plus). It -provides significant increase in coding gain. In SBR, the high-band, -i.e. the high frequency part of the spectrum is replicated using the -low-band. In PS, channel redundancy is exploited and parameters are -extracted from a down-mixed channel.The bit-rate is by far below the -bit-rate required when using conventional AAC coding. This translates -into better quality at lower bit-rates. +Overall, Ittiam's Ex-HEAAC, with support for AAC-LD, AAC-ELD, and AAC-ELDv2 modes, is a versatile audio coding technology that can be used for a wide range of applications, such as broadcasting, streaming, and teleconferencing which requires high-quality audio compression with minimal delay. +#### Note +* MPEG-D USAC (Unified Speech and Audio Coding) support for Ittiam's Ex-HEAAC Encoder will be coming soon, which will help in improved audio quality at reduced bitrates. USAC technology will provide efficient and high quality compression of speech and audio signals, making it a valuable addition to our Ex-HEAAC capabilities and features. +* Further Quality enhancements for AAC-ELD and AAC-ELDv2 modes may be pushed as quality assessment is in progress. -# Introduction to Ex-HEAAC Decoder APIs - -## Files to be included are -* [`ixheaacd_apicmd_standards.h`](decoder/ixheaacd_apicmd_standards.h) -* [`ixheaac_type_def.h`](common/ixheaac_type_def.h) -* [`ixheaacd_memory_standards.h`](decoder/ixheaacd_memory_standards.h) -* [`ixheaac_error_standards.h`](common/ixheaac_error_standards.h) -* [`ixheaacd_error_handler.h`](decoder/ixheaacd_error_handler.h) -* [`ixheaacd_aac_config.h`](decoder/ixheaacd_aac_config.h) - -## Decoder APIs - -A single API is used to get and set configurations and execute the decode thread, based on command index passed. -* ia_xheaacd_dec_api - -| **API Command** | **API Sub Command** | **Description** | -|------|------|------| -|IA_API_CMD_GET_LIB_ID_STRINGS | IA_CMD_TYPE_LIB_NAME | Gets the decoder library name | -|IA_API_CMD_GET_LIB_ID_STRINGS | IA_CMD_TYPE_LIB_VERSION | Gets the decoder version | -|IA_API_CMD_GET_API_SIZE | 0 | Gets the memory requirements size of the API | -|IA_API_CMD_INIT | IA_CMD_TYPE_INIT_API_PRE_CONFIG_PARAMS | Sets the configuration parameters of the Ex-HEAAC v2 Decoder to default values | -|IA_API_CMD_INIT | IA_CMD_TYPE_INIT_API_POST_CONFIG_PARAMS | Sets the attributes(size, priority, alignment) of all memory types required by the application onto the memory structure | -|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_SAMP_FREQ | Sets the core AAC sampling frequency for RAW header decoding | -|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PCM_WDSZ | Sets the bit width of the output pcm samples.The value has to be 16 | -|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_DOWNMIX | Sets the parameter whether the output needs to be down-mix to mono(1) or not(0) | -|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_TOSTEREO | Sets the flag to disable interleave mono to stereo | -|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_DSAMPLE | Sets the parameter whether the output needs to be downsampled(1) or not(0).This is valid only for Ex-HEAAC v2 build | -|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_FRAMEOK | Sets the flag to 0 or 1 to indicate whether the current frame is valid(1) or not(0) | -|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_ISMP4 | Sets the flag to 0 or 1 to indicate whether given test vector is an mp4 file or not | -|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_DISABLE_SYNC | Sets the flag of ADTS syncing or not ADTS syncing as 0 or 1 | -|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_AUTO_SBR_UPSAMPLE | Sets the parameter auto SBR upsample to 0 or 1.Used in case of stream changing from SBR present to SBR not present.This is valid only for Ex-HEAAC v2 build | -|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_MAX_CHANNEL | Sets the maximum number of channels present.Its maximum value is 2 for stereo library and 8 for multichannel library | -|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_COUP_CHANNEL | Sets the number of coupling channels to be used for coupling.It can take values from 0 to 16.This command is supported only if the library has multichannel support | -|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_DOWNMIX_STEREO | Sets the flag of downmixing n number of channels to stereo.Can be 0 or 1. This command is supported only if the library has multichannel support | -|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_ISLOAS | Sets the flag indicating that the input file is a .loas file.Can be 0 or 1 | -|IA_API_CMD_GET_N_MEMTABS | 0 | Gets the number of memory types | -|IA_API_CMD_GET_N_TABLES | 0 | Gets the number of tables | -|IA_API_CMD_GET_MEM_INFO_SIZE | 0 | Gets the size of the memory type being referred to by the index | -|IA_API_CMD_GET_MEM_INFO_ALIGNMENT | 0 | Gets the alignment information of the memory-type being referred to by the index | -|IA_API_CMD_GET_MEM_INFO_TYPE | 0 | Gets the type of memory being referred to by the index | -|IA_API_CMD_SET_MEM_PTR | 0 | Sets the pointer to the memory being referred to by the index to the input value | -|IA_API_CMD_GET_TABLE_INFO_SIZE | 0 | Gets the size of the memory type being referred to by the index | -|IA_API_CMD_GET_TABLE_INFO_ALIGNMENT | 0 | Gets the alignment information of the memory-type being referred to by the index | -|IA_API_CMD_GET_TABLE_PTR | 0 | Gets the address of the current location of the table | -|IA_API_CMD_SET_TABLE_PTR | 0 | Sets the relocated table address | -|IA_API_CMD_INPUT_OVER | 0 | Signals the end of bit-stream to the library | -|IA_API_CMD_SET_INPUT_BYTES | 0 | Sets the number of bytes available in the input buffer for initialization | -|IA_API_CMD_INIT | IA_CMD_TYPE_INIT_PROCESS | Search for the valid header, does header decode to get the parameters and initializes state and configuration structure | -|IA_API_CMD_INIT | IA_CMD_TYPE_INIT_DONE_QUERY | Checks if the initialization process has completed | -|IA_API_CMD_GET_CURIDX_INPUT_BUF | 0 | Gets the number of input buffer bytes consumed by the last initialization | -|IA_API_CMD_GET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_SAMP_FREQ | Gets the sampling frequency | -|IA_API_CMD_GET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_NUM_CHANNELS | Gets the output number of channels | -|IA_API_CMD_GET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_PCM_WDSZ | Gets the output PCM word size | -|IA_API_CMD_GET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_CHANNEL_MODE | Gets the channel mode. (Mono or PS/Stereo/Dual-mono) | -|IA_API_CMD_GET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_CHANNEL_MASK | Gets the channel mask | -|IA_API_CMD_GET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_SBR_MODE | Gets the SBR mode (Present/ Not Present).This is valid only for Ex-HEAAC v2 build | -|IA_API_CMD_EXECUTE | IA_CMD_TYPE_DO_EXECUTE | Executes the decode thread | -|IA_API_CMD_EXECUTE | IA_CMD_TYPE_DONE_QUERY | Checks if the end of decode has been reached | -|IA_API_CMD_GET_OUTPUT_BYTES | 0 | Gets the number of bytes output by the decoder in the last frame | - -## Flowchart of calling sequence - -![API Flowchart](docs/Api_flowchart.png) - -# Building the Ex-HEAAC Decoder +# Building the Ex-HEAAC Decoder and Encoder ## Building for AOSP -* Makefiles for building the Ex-HEAAC decoder library is provided in root(`libxaac/`) folder. -* Makefiles for building the Ex-HEAAC decoder testbench is provided in `test` folder. +* Makefile for building the Ex-HEAAC decoder and encoder library is provided in root(`libxaac/`) folder. +* Makefile for building the Ex-HEAAC decoder and encoder testbench is provided in `test` folder. * Build the library followed by the application using the below commands: Go to root directory ``` @@ -111,12 +26,12 @@ $ mm ``` ## Using CMake -Users can also use cmake to build for `x86`, `x86_64`, and Windows (MSVS project) platforms. +Users can also use cmake to build for `x86`, `x86_64`, `armv7`, `armv8` and Windows (MSVS project) platforms. ### Creating MSVS project files -To create MSVS project files for the Ex-HEAAC decoder from cmake, run the following commands: +To create MSVS project files for the Ex-HEAAC decoder and encoder from cmake, run the following commands: ``` -Go to the root directory(libxaac/) of the Ex-HEAAC Decoder. +Go to the root directory(libxaac/). Create a new folder in the project root directory and move to the newly created folder. $ cd @@ -125,29 +40,37 @@ $ cd bin $ cmake -G "Visual Studio 15 2017" .. ``` +Above command will create Win32 version of MSVS workspace +To create MSVS project files for Win64 version from cmake, run the following commands: +``` +$ mkdir cmake_build +$ cd cmake_build +$ cmake -G "Visual Studio 15 2017 Win64" .. -DBUILD64=ON +``` The above command creates MSVS 2017 project files. If the version is different, modify the generator name accordingly. -The Ex-HEAAC decoder can be built using these project files. ### Building for native platforms -Run the following commands to build the Ex-HEAAC Decoder for native platform: +Run the following commands to build the Ex-HEAAC decoder and encoder for native platform: ``` -Go to the root directory(libxaac/) of the Ex-HEAAC Decoder. +Go to the root directory(libxaac/). Create a new folder in the project root directory and move to the newly created folder. $ cd $ mkdir bin $ cd bin $ cmake .. -$ cmake --build . +$ make ``` ### Cross-compiler based builds +Ensure to edit the file cmake/toolchains/*_toolchain.cmake to set proper paths in host for corresponding platforms. + ### Building for x86_32 on a x86_64 Linux machine ``` $ cd $ mkdir build $ cd build -$ CFLAGS="-m32" CXXFLAGS="-m32" LDFLAGS="-m32" cmake .. +$ cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/x86_toolchain.cmake $ make ``` @@ -171,84 +94,5 @@ $ cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/aarch32_toolchain.cmake $ make ``` -# Running the Ex-HEAAC Decoder - -The Ex-HEAAC Decoder can be run by providing command-line parameters(CLI options) directly or by providing a parameter file as a command line argument. - -Command line usage : -``` - -ifile: -imeta: -ofile: [options] - -[options] can be, -[-mp4:] -[-pcmsz:] -[-dmix:] -[-esbr_hq:] -[-esbr_ps:] -[-tostereo:] -[-dsample:] -[-drc_cut_fac:] -[-drc_boost_fac:] -[-drc_target_level:] -[-drc_heavy_comp:] -[-effect:] -[-target_loudness:] -[-nosync:] -[-sbrup:] -[-flflag:} -[-fs:] -[-maxchannel:] -[-coupchannel:] -[-downmix:] -[-fs480:] -[-ld_testing:] -[-peak_limiter_off:] -[-err_conceal:] -[-esbr:] - -where, - is the input AAC/HEAACv1/HEAACv2/USAC file name. - is a text file which contains metadata. To be given when -mp4:1 is enabled. - is the output file name. - is a flag that should be set to 1 when passing raw stream along with meta data text file. - is the bits per sample info. value can be 16 or 24. - is to enable/disable always mono output. Default 1. - is to enable/disable high quality eSBR. Default 0. - is to indicate eSBR with PS. Default 0. - is to enable/disable always interleaved to stereo output. Default 1. - is to enable/disable down-sampled SBR output. Default auto identification from header. - is to set DRC cut factor value. Default value is 0. - is to set DRC boost factor. Default value is 0. - is to set DRC target reference level. Default value is 108. - is to enable/disable DRC heavy compression. Default value is 0. - is to set DRC effect type. Default value is 0. - is to set target loudness level. Default value is -24. - is to disable the ADTS/ADIF sync search i.e when enabled the decoder expects the header to be at the start of input buffer. Default 0. - is to enable(1) or disable(0) auto SBR upsample in case of stream changing from SBR present to SBR not present. Default 1. - is flag for decoding framelength of 1024 or 960. 1 to decode 960 frame length, 0 to decode 1024 frame length. - Frame length value in the GA header will override this option. Default 0. - is to indicate the core AAC sample rate for a RAW stream. If this is specified no other file format headers are searched for. - is the number of maxiumum channels the input may have. Default is 6 for multichannel libraries and 2 for stereo libraries. - is element instance tag of independent coupling channel to be mixed. Default is 0. - is flag for Downmix. Give 1 to get stereo (downmix) output. Default is 0. - is to indicate ld frame size. 0 is for 512 frame length, 1 is for 480 frame length. Default value is 512 (0). - is to enable/disable ld decoder testing. Default value is 0. - is to enable/disable peak limiter. Default value is 0. - is to enable/disable error concealment. Default value is 0. - is to enable/disable eSBR. Default value is 1. - -``` -Sample CLI: -``` - -ifile:in_file.aac -ofile:out_file.wav -pcmsz:16 -``` - -# Validating the Ex-HEAAC Decoder - -Conformance testing for AAC/HEAAC v1/HEAAC v2 mainly involves comparing -decoder under test output with the ISO and 3GPP reference decoded output. - -Testing for USAC is done using encoded streams generated using ISO USAC -reference encoder. The output generated by ITTIAM USAC decoder is -compared against the output generated by ISO USAC decoder for 16-bit -conformance on the respective(ARMv7, ARMv8, X86_32, X86_64) platforms. +### For API and testbench usage of decoder, please refer [`README_dec.md`](README_dec.md) +### For API and testbench usage of encoder, please refer [`README_enc.md`](README_enc.md) diff --git a/README_dec.md b/README_dec.md new file mode 100644 index 0000000..b2f6c22 --- /dev/null +++ b/README_dec.md @@ -0,0 +1,241 @@ + + +# Introduction to Ex-HEAAC Decoder APIs + +## Decoder APIs + +A single API is used to get and set configurations and execute the decode thread, based on command index passed. +* ia_xheaacd_dec_api + +| **API Command** | **API Sub Command** | **Description** | +|------|------|------| +|IA_API_CMD_GET_LIB_ID_STRINGS | IA_CMD_TYPE_LIB_NAME | Gets the decoder library name | +|IA_API_CMD_GET_LIB_ID_STRINGS | IA_CMD_TYPE_LIB_VERSION | Gets the decoder version | +|IA_API_CMD_GET_API_SIZE | 0 | Gets the memory requirements size of the API | +|IA_API_CMD_INIT | IA_CMD_TYPE_INIT_API_PRE_CONFIG_PARAMS | Sets the configuration parameters of the Ex-HEAAC v2 Decoder to default values | +|IA_API_CMD_INIT | IA_CMD_TYPE_INIT_API_POST_CONFIG_PARAMS | Sets the attributes(size, priority, alignment) of all memory types required by the application onto the memory structure | +|IA_API_CMD_INIT | IA_CMD_TYPE_INIT_PROCESS | Search for the valid header, does header decode to get the parameters and initializes state and configuration structure | +|IA_API_CMD_INIT | IA_CMD_TYPE_INIT_DONE_QUERY | Checks if the initialization process has completed | +|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_PCM_WDSZ | Sets the bit width of the output PCM samples. The value has to be 16 | +|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_SAMP_FREQ | Sets the core AAC sampling frequency for RAW header decoding | +|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_DRC_EFFECT_TYPE | Sets the value of DRC effect type | +|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_DRC_TARGET_LOUDNESS | Sets the value of DRC target loudness | +|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_DOWNMIX | Sets the parameter whether the output needs to be down-mix to mono(1) or not(0) | +|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_TOSTEREO | Sets the flag to disable interleave mono to stereo | +|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_DSAMPLE | Sets the parameter whether the output needs to be downsampled(1) or not(0. This is valid only for Ex-HEAAC v2 build | +|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_ISMP4 | Sets the flag to 0 or 1 to indicate whether given test vector is an mp4 file or not | +|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_MAX_CHANNEL | Sets the maximum number of channels present. Its maximum value is 2 for stereo library and 8 for multichannel library | +|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_COUP_CHANNEL | Sets the number of coupling channels to be used for coupling. It can take values from 0 to 16. This command is supported only if the library has multichannel support | +|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_DOWNMIX_STEREO | Sets the flag of downmixing n number of channels to stereo. Can be 0 or 1. This command is supported only if the library has multichannel support | +|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_DISABLE_SYNC | Sets the flag of ADTS syncing or not ADTS syncing as 0 or 1 | +|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_AUTO_SBR_UPSAMPLE | Sets the parameter auto SBR upsample to 0 or 1. Used in case of stream changing from SBR present to SBR not present. This is valid only for Ex-HEAAC v2 build | +|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_DRC_CUT | Sets the value of DRC cut factor | +|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_DRC_BOOST | Sets the value of DRC boost factor | +|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_DRC_HEAVY_COMP | Sets the parameter to either enable/disable DRC heavy compression | +|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_FRAMESIZE | Sets the parameter whether decoder should decode for frame length 480 or 512 | +|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_LD_TESTING | Sets the flag to enable LD testing in decoder | +|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_HQ_ESBR | Sets the flag to enable/disable high quality eSBR | +|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_PS_ENABLE | Sets the flag to indicate the presence of PS data in eSBR bit stream | +|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_PEAK_LIMITER | Sets the flag to disable/enable peak limiter | +|IA_API_CMD_SET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_FRAMELENGTH_FLAG | Sets to flag to indicate whether decoder should decode for frame length 960 or 1024 | +|IA_API_CMD_SET_CONFIG_PARAM | IA_XHEAAC_DEC_CONFIG_PARAM_DRC_TARGET_LEVEL | Sets the value of DRC target level | +|IA_API_CMD_SET_CONFIG_PARAM | IA_XHEAAC_DEC_CONFIG_ERROR_CONCEALMENT | Sets to flag to disable/enable error concealment | +|IA_API_CMD_SET_CONFIG_PARAM | IA_XHEAAC_DEC_CONFIG_PARAM_ESBR | Sets to flag to disable/enable eSBR | +|IA_API_CMD_GET_N_MEMTABS | 0 | Gets the number of memory types | +|IA_API_CMD_GET_N_TABLES | 0 | Gets the number of tables | +|IA_API_CMD_GET_MEM_INFO_SIZE | 0 | Gets the size of the memory type being referred to by the index | +|IA_API_CMD_GET_MEM_INFO_ALIGNMENT | 0 | Gets the alignment information of the memory-type being referred to by the index | +|IA_API_CMD_GET_MEM_INFO_TYPE | 0 | Gets the type of memory being referred to by the index | +|IA_API_CMD_SET_MEM_PTR | 0 | Sets the pointer to the memory being referred to by the index to the input value | +|IA_API_CMD_GET_TABLE_INFO_SIZE | 0 | Gets the size of the memory type being referred to by the index | +|IA_API_CMD_GET_TABLE_INFO_ALIGNMENT | 0 | Gets the alignment information of the memory-type being referred to by the index | +|IA_API_CMD_GET_TABLE_PTR | 0 | Gets the address of the current location of the table | +|IA_API_CMD_SET_TABLE_PTR | 0 | Sets the relocated table address | +|IA_API_CMD_GET_MEMTABS_SIZE | 0 | Gets the size of the memory structures | +|IA_API_CMD_SET_MEMTABS_PTR | 0 | Sets the memory structure pointer in the library to the allocated value | +|IA_API_CMD_INPUT_OVER | 0 | Signals the end of bit-stream to the library | +|IA_API_CMD_SET_INPUT_BYTES | 0 | Sets the number of bytes available in the input buffer for initialization | +|IA_API_CMD_GET_CURIDX_INPUT_BUF | 0 | Gets the number of input buffer bytes consumed by the last initialization | +|IA_API_CMD_GET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_PCM_WDSZ | Gets the output PCM word size | +|IA_API_CMD_GET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_SAMP_FREQ | Gets the sampling frequency | +|IA_API_CMD_GET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_NUM_CHANNELS | Gets the output number of channels | +|IA_API_CMD_GET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_CHANNEL_MASK | Gets the channel mask | +|IA_API_CMD_GET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_CHANNEL_MODE | Gets the channel mode. (Mono or PS/Stereo/Dual-mono) | +|IA_API_CMD_GET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_SBR_MODE | Gets the SBR mode (Present/ Not Present). This is valid only for Ex-HEAAC v2 build | +|IA_API_CMD_GET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_DRC_EFFECT_TYPE | Gets the value of DRC effect type | +|IA_API_CMD_GET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_DRC_TARGET_LOUDNESS | Gets the value of DRC target loudness | +|IA_API_CMD_GET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_DRC_LOUD_NORM | Gets the value of DRC loudness normalization level | +|IA_API_CMD_GET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_PARAM_AOT | Gets the value of audio object type | +|IA_API_CMD_GET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_EXT_ELE_PTR | Gets the extension element pointer | +|IA_API_CMD_GET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_EXT_ELE_BUF_SIZES | Gets the extension element buffer sizes | +|IA_API_CMD_GET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_NUM_ELE | Gets the number of configuration elements | +|IA_API_CMD_GET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_NUM_CONFIG_EXT | Gets the number of extension elements | +|IA_API_CMD_GET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_GAIN_PAYLOAD_LEN | Gets the gain payload length | +|IA_API_CMD_GET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_GAIN_PAYLOAD_BUF | Gets the gain payload buffer | +|IA_API_CMD_GET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_CONFIG_GET_NUM_PRE_ROLL_FRAMES | Gets the number of preroll frames | +|IA_API_CMD_GET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_DRC_IS_CONFIG_CHANGED | Gets the value of DRC config change flag | +|IA_API_CMD_GET_CONFIG_PARAM | IA_ENHAACPLUS_DEC_DRC_APPLY_CROSSFADE | Gets the value of DRC crossfade flag | +|IA_API_CMD_EXECUTE | IA_CMD_TYPE_DO_EXECUTE | Executes the decode thread | +|IA_API_CMD_EXECUTE | IA_CMD_TYPE_DONE_QUERY | Checks if the end of decode has been reached | +|IA_API_CMD_GET_OUTPUT_BYTES | 0 | Gets the number of bytes output by the decoder in the last frame | + +### Aliases for some of the macros exist as XHEAAC + +| **Macro** | **Alias** | +|------|------| +|IA_ENHAACPLUS_DEC_CONFIG_PARAM_PCM_WDSZ | IA_XHEAAC_DEC_CONFIG_PARAM_PCM_WDSZ | +|IA_ENHAACPLUS_DEC_CONFIG_PARAM_SAMP_FREQ | IA_XHEAAC_DEC_CONFIG_PARAM_SAMP_FREQ | +|IA_ENHAACPLUS_DEC_CONFIG_PARAM_NUM_CHANNELS | IA_XHEAAC_DEC_CONFIG_PARAM_NUM_CHANNELS | +|IA_ENHAACPLUS_DEC_CONFIG_PARAM_CHANNEL_MASK | IA_XHEAAC_DEC_CONFIG_PARAM_CHANNEL_MASK | +|IA_ENHAACPLUS_DEC_CONFIG_PARAM_CHANNEL_MODE | IA_XHEAAC_DEC_CONFIG_PARAM_CHANNEL_MODE | +|IA_ENHAACPLUS_DEC_CONFIG_PARAM_SBR_MODE | IA_XHEAAC_DEC_CONFIG_PARAM_SBR_MODE | +|IA_ENHAACPLUS_DEC_CONFIG_PARAM_DRC_EFFECT_TYPE | IA_XHEAAC_DEC_CONFIG_PARAM_DRC_EFFECT_TYPE | +|IA_ENHAACPLUS_DEC_CONFIG_PARAM_DRC_TARGET_LOUDNESS | IA_XHEAAC_DEC_CONFIG_PARAM_DRC_TARGET_LOUDNESS | +|IA_ENHAACPLUS_DEC_CONFIG_PARAM_DRC_LOUD_NORM | IA_XHEAAC_DEC_CONFIG_PARAM_DRC_LOUD_NORM | +|IA_ENHAACPLUS_DEC_CONFIG_PARAM_DOWNMIX | IA_XHEAAC_DEC_CONFIG_PARAM_DOWNMIX | +|IA_ENHAACPLUS_DEC_CONFIG_PARAM_TOSTEREO | IA_XHEAAC_DEC_CONFIG_PARAM_TOSTEREO | +|IA_ENHAACPLUS_DEC_CONFIG_PARAM_DSAMPLE | IA_XHEAAC_DEC_CONFIG_PARAM_DSAMPLE | +|IA_ENHAACPLUS_DEC_CONFIG_PARAM_ISMP4 | IA_XHEAAC_DEC_CONFIG_PARAM_MP4FLAG | +|IA_ENHAACPLUS_DEC_CONFIG_PARAM_MAX_CHANNEL | IA_XHEAAC_DEC_CONFIG_PARAM_MAX_CHANNEL | +|IA_ENHAACPLUS_DEC_CONFIG_PARAM_COUP_CHANNEL | IA_XHEAAC_DEC_CONFIG_PARAM_COUP_CHANNEL | +|IA_ENHAACPLUS_DEC_CONFIG_PARAM_DOWNMIX_STEREO | IA_XHEAAC_DEC_CONFIG_PARAM_DOWNMIX_STEREO | +|IA_ENHAACPLUS_DEC_CONFIG_DISABLE_SYNC | IA_XHEAAC_DEC_CONFIG_DISABLE_SYNC | +|IA_ENHAACPLUS_DEC_CONFIG_PARAM_AUTO_SBR_UPSAMPLE | IA_XHEAAC_DEC_CONFIG_PARAM_AUTO_SBR_UPSAMPLE | +|IA_ENHAACPLUS_DEC_CONFIG_PARAM_DRC_CUT | IA_XHEAAC_DEC_CONFIG_PARAM_DRC_CUT | +|IA_ENHAACPLUS_DEC_CONFIG_PARAM_DRC_BOOST | IA_XHEAAC_DEC_CONFIG_PARAM_DRC_BOOST | +|IA_ENHAACPLUS_DEC_CONFIG_PARAM_DRC_HEAVY_COMP | IA_XHEAAC_DEC_CONFIG_PARAM_DRC_HEAVY_COMP | +|IA_ENHAACPLUS_DEC_CONFIG_PARAM_FRAMESIZE | IA_XHEAAC_DEC_CONFIG_PARAM_FRAMESIZE | +|IA_ENHAACPLUS_DEC_CONFIG_PARAM_LD_TESTING | IA_XHEAAC_DEC_CONFIG_PARAM_LD_TESTING | +|IA_ENHAACPLUS_DEC_CONFIG_PARAM_HQ_ESBR | IA_XHEAAC_DEC_CONFIG_PARAM_HQ_ESBR | +|IA_ENHAACPLUS_DEC_CONFIG_PARAM_PS_ENABLE | IA_XHEAAC_DEC_CONFIG_PARAM_PS_ENABLE | +|IA_ENHAACPLUS_DEC_CONFIG_PARAM_AOT | IA_XHEAAC_DEC_CONFIG_PARAM_AOT | +|IA_ENHAACPLUS_DEC_CONFIG_PARAM_PEAK_LIMITER | IA_XHEAAC_DEC_CONFIG_PARAM_PEAK_LIMITER | +|IA_ENHAACPLUS_DEC_CONFIG_PARAM_FRAMELENGTH_FLAG | IA_XHEAAC_DEC_CONFIG_PARAM_FRAMELENGTH_FLAG | + +## DRC APIs + +A single API is used to get and set configurations and execute the decode thread, based on command index passed. +* ia_drc_dec_api + +| **API Command** | **API Sub Command** | **Description** | +|------|------|------| +|IA_API_CMD_GET_API_SIZE | 0 | Gets the memory requirements size of the API | +|IA_API_CMD_INIT | IA_CMD_TYPE_INIT_API_PRE_CONFIG_PARAMS | Sets the configuration parameters of the Ex-HEAAC v2 Decoder to default values | +|IA_API_CMD_INIT | IA_CMD_TYPE_INIT_API_POST_CONFIG_PARAMS | Sets the attributes(size, priority, alignment) of all memory types required by the application onto the memory structure | +|IA_API_CMD_INIT | IA_CMD_TYPE_INIT_PROCESS | Search for the valid header, does header decode to get the parameters and initializes state and configuration structure | +|IA_API_CMD_INIT | IA_CMD_TYPE_INIT_CPY_BSF_BUFF | Sets the bitstream split format buffer | +|IA_API_CMD_INIT | IA_CMD_TYPE_INIT_CPY_IC_BSF_BUFF | Sets the configuration bitstream split format buffer | +|IA_API_CMD_INIT | IA_CMD_TYPE_INIT_CPY_IL_BSF_BUFF | Sets the loudness bitstream split format buffer | +|IA_API_CMD_INIT | IA_CMD_TYPE_INIT_CPY_IN_BSF_BUFF | Sets the interface bitstream split format buffer | +|IA_API_CMD_INIT | IA_CMD_TYPE_INIT_SET_BUFF_PTR | Sets the input buffer pointer | +|IA_API_CMD_SET_CONFIG_PARAM | IA_DRC_DEC_CONFIG_PARAM_SAMP_FREQ | Sets the sampling frequency of the input stream/data | +|IA_API_CMD_SET_CONFIG_PARAM | IA_DRC_DEC_CONFIG_PARAM_NUM_CHANNELS | Sets the number of channels in the input stream/data | +|IA_API_CMD_SET_CONFIG_PARAM | IA_DRC_DEC_CONFIG_PARAM_PCM_WDSZ | Sets the PCM word size of the input data | +|IA_API_CMD_SET_CONFIG_PARAM | IA_DRC_DEC_CONFIG_PARAM_BITS_FORMAT | Sets the bit stream format | +|IA_API_CMD_SET_CONFIG_PARAM | IA_DRC_DEC_CONFIG_PARAM_INT_PRESENT | Sets the DRC decoder’s interface present flag to 1 or 0 | +|IA_API_CMD_SET_CONFIG_PARAM | IA_DRC_DEC_CONFIG_PARAM_FRAME_SIZE | Sets the frame size | +|IA_API_CMD_SET_CONFIG_PARAM | IA_DRC_DEC_CONFIG_DRC_EFFECT_TYPE | Sets the value of DRC effect type | +|IA_API_CMD_SET_CONFIG_PARAM | IA_DRC_DEC_CONFIG_DRC_TARGET_LOUDNESS | Sets the value of DRC target loudness | +|IA_API_CMD_SET_CONFIG_PARAM | IA_DRC_DEC_CONFIG_DRC_LOUD_NORM | Sets the value of DRC loudness normalization level | +|IA_API_CMD_SET_CONFIG_PARAM | IA_DRC_DEC_CONFIG_PARAM_APPLY_CROSSFADE | Sets the value of DRC crossfade flag | +|IA_API_CMD_SET_CONFIG_PARAM | IA_DRC_DEC_CONFIG_PARAM_CONFIG_CHANGED | Sets the value of DRC config change flag | +|IA_API_CMD_GET_MEM_INFO_SIZE | 0 | Gets the size of the memory type being referred to by the index | +|IA_API_CMD_GET_MEMTABS_SIZE | 0 | Gets the size of the memory structures | +|IA_API_CMD_SET_MEMTABS_PTR | 0 | Sets the memory structure pointer in the library to the allocated value | +|IA_API_CMD_GET_N_MEMTABS | 0 | Gets the number of memory types | +|IA_API_CMD_SET_INPUT_BYTES | 0 | Sets the number of bytes available in the input buffer for initialization | +|IA_API_CMD_GET_MEM_INFO_ALIGNMENT | 0 | Gets the alignment information of the memory-type being referred to by the index | +|IA_API_CMD_GET_MEM_INFO_TYPE | 0 | Gets the type of memory being referred to by the index | +|IA_API_CMD_SET_MEM_PTR | 0 | Sets the pointer to the memory being referred to by the index to the input value | +|IA_API_CMD_SET_INPUT_BYTES_BS | 0 | Sets the number of bytes to be processed in bitstream split format | +|IA_API_CMD_SET_INPUT_BYTES_IC_BS | 0 | Sets the number of bytes to be processed in configuration bitstream split format | +|IA_API_CMD_SET_INPUT_BYTES_IL_BS | 0 | Sets the number of bytes to be processed in loudness bitstream split format | +|IA_API_CMD_GET_CONFIG_PARAM | IA_DRC_DEC_CONFIG_PARAM_NUM_CHANNELS | Gets the output number of channels | +|IA_API_CMD_EXECUTE | IA_CMD_TYPE_DO_EXECUTE | Executes the decode thread | + +## Flowchart of calling sequence + +![API Flowchart](docs/Api_flowchart_dec.png) + +# Running the Ex-HEAAC Decoder + +The Ex-HEAAC Decoder can be run by providing command-line parameters(CLI options) directly or by providing a parameter file as a command line argument. + +Command line usage : +``` + -ifile: -imeta: -ofile: [options] + +[options] can be, +[-mp4:] +[-pcmsz:] +[-dmix:] +[-esbr_hq:] +[-esbr_ps:] +[-tostereo:] +[-dsample:] +[-drc_cut_fac:] +[-drc_boost_fac:] +[-drc_target_level:] +[-drc_heavy_comp:] +[-effect:] +[-target_loudness:] +[-nosync:] +[-sbrup:] +[-flflag:} +[-fs:] +[-maxchannel:] +[-coupchannel:] +[-downmix:] +[-fs480:] +[-ld_testing:] +[-peak_limiter_off:] +[-err_conceal:] +[-esbr:] + +where, + is the input AAC/HEAACv1/HEAACv2/USAC file name. + is a text file which contains metadata. To be given when -mp4:1 is enabled. + is the output file name. + is a flag that should be set to 1 when passing raw stream along with meta data text file. + is the bits per sample info. value can be 16 or 24. + is to enable/disable always mono output. Default 1. + is to enable/disable high quality eSBR. Default 0. + is to indicate eSBR with PS. Default 0. + is to enable/disable always interleaved to stereo output. Default 1. + is to enable/disable down-sampled SBR output. Default auto identification from header. + is to set DRC cut factor value. Default value is 0. + is to set DRC boost factor. Default value is 0. + is to set DRC target reference level. Default value is 108. + is to enable/disable DRC heavy compression. Default value is 0. + is to set DRC effect type. Default value is 0. + is to set target loudness level. Default value is -24. + is to disable the ADTS/ADIF sync search i.e when enabled the decoder expects the header to be at the start of input buffer. Default 0. + is to enable(1) or disable(0) auto SBR upsample in case of stream changing from SBR present to SBR not present. Default 1. + is flag for decoding framelength of 1024 or 960. 1 to decode 960 frame length, 0 to decode 1024 frame length. + Frame length value in the GA header will override this option. Default 0. + is to indicate the core AAC sample rate for a RAW stream. If this is specified no other file format headers are searched for. + is the number of maxiumum channels the input may have. Default is 6 for multichannel libraries and 2 for stereo libraries. + is element instance tag of independent coupling channel to be mixed. Default is 0. + is flag for Downmix. Give 1 to get stereo (downmix) output. Default is 0. + is to indicate ld frame size. 0 is for 512 frame length, 1 is for 480 frame length. Default value is 512 (0). + is to enable/disable ld decoder testing. Default value is 0. + is to enable/disable peak limiter. Default value is 0. + is to enable/disable error concealment. Default value is 0. + is to enable/disable eSBR. Default value is 1. + +``` +Sample CLI: +``` + -ifile:in_file.aac -ofile:out_file.wav -pcmsz:16 +``` + +# Validating the Ex-HEAAC Decoder + +Conformance testing for AAC/HEAAC v1/HEAAC v2 mainly involves comparing +decoder under test output with the ISO and 3GPP reference decoded output. + +Testing for USAC is done using encoded streams generated using ISO USAC +reference encoder. The output generated by ITTIAM USAC decoder is +compared against the output generated by ISO USAC decoder for 16-bit +conformance on the respective(ARMv7, ARMv8, X86_32, X86_64) platforms. + diff --git a/README_enc.md b/README_enc.md new file mode 100644 index 0000000..e1abe90 --- /dev/null +++ b/README_enc.md @@ -0,0 +1,86 @@ +# Introduction Extended HE-AAC Encoder APIs + +# Encoder APIs + +| **API Call** | **Description** | +|------|------| +|ixheaace_get_lib_id_strings| Gets the encoder library name and version number details | +|ixheaace_create| Sets the encoder configuration parameters, gets the memory requirements and allocates required memory | +|ixheaace_process| Encodes the input frame data | +|ixheaace_delete| Frees the allocated memories for the encoder | + +## Flowchart of calling sequence +![API Flowchart](docs/Api_flowchart_enc.png) + +# Audio Object Types(AOT) +| **AOT** | **Description** | +|------|------| +|2|AAC LC| +|5|HEAACv1| +|23|AAC LD| +|29|HEAACv2| +|39|AAC ELD| +|42|USAC (support will be added soon)| + +# Running the Ex-HEAAC Encoder +The Ex-HEAAC Encoder can be run by providing command-line parameters(CLI options) directly or by providing a parameter file as a command line argument. +The reference paramfile is placed in smoke_test_suite(paramfilesimple.txt) + +# Command line usage : +``` + -ifile: -ofile: [options] + + -paramfile: +[options] can be, +[-br:] +[-mps:] +[-adts:] +[-tns:] +[-framesize:] +[-aot:] +[-esbr:] +[-full_bandwidth:] +[-max_out_buffer_per_ch:] +[-tree_cfg:] + + +where, + is the parameter file with multiple commands + is the input 16-bit WAV or PCM file name + is the output ADTS/ES file name + is the bit-rate in bits per second. Valid values are Plain AAC: 8000-576000 bps per channel + When set to 1 MPS is enable. Default 0. + when set to 1 ADTS header generated. Default is 0 + controls usage of TNS in encoding. Default is 1. + is the framesize to be used For AOT 23, 39 (LD core coder profiles) valid values are 480 and 512 .Default is 512 + For AOT 2, 5, 29 (LC core coder profiles) valid values are 960 and 1024 .Default is 1024 + is the Audio object type + 2 for AAC LC + 5 for HEAACv1(Legacy SBR) + 23 for AAC LD + 29 for HEAACv2 + 39 for AAC ELD + Default is 2 for AAC LC + when set to 1 enables eSBR in HEAACv1 encoding Default is 0 + Enable use of full bandwidth of input. Valid values are 0(disable) and 1(enable). Default is 0. + is the maximum size of bit reservoir to be used. Valid values are from -1 to 6144. -1 to omit use of bit reservoir. Default is 384. + MPS tree config + 0 for '212' + 1 for '5151' + 2 for '5152' + 3 for '525' + Default '212' for stereo input '515' for 6 ch input +``` +Sample CLI: +``` +-ifile:input_file.wav -ofile:out_file.aac -br: –aot: