Please note as of Wednesday, August 15th, 2018 this wiki has been set to read only. If you are a TI Employee and require Edit ability please contact x0211426 from the company directory.

MP3 Decoder Integration in EZSDK

From Texas Instruments Wiki
Jump to: navigation, search

How to integrate MP3 Decoder in EZSDK


Introduction


The EZSDK supports both AAC-LC Decoder & MP3 Decoder. However, MP3 Decoder is not part of the EZSDK package and needs to be downloaded separately. This article explains the steps to download, install, integrate, build and test MP3 Decoder in EZSDK.

The following should be noted with respect to the pre-built DSP & IL Client omx examples -

1. The pre-built DSP binary & A8 IL Client does not support MP3 Decoder. The steps mentioned in this article needs to be followed to add MP3 & decode MP3 files. The pre-built dsp binary is available at /usr/share/ti/ti-media-controller-utils/*.xe674 in the EZSDK.

2. Sample IL client is intended for decoding of a MP3 or AAC elementary bit stream. Currently the decoded output does not play out, instead decoded output is written back to a file in 16 bit linear format (Intel format). Playing out the PCM is scoped for future EZSDK release. The pre-built sample IL Client is available at /usr/share/ti/ti-omx

Throughout this document there will be commands spelled out to execute. Some are to be executed on the Linux development host, some on the Linux target and some on the u-boot (bootloader) prompt. They are distinguished by different command prompts as follows:

host $ <this command is to be executed on the host>

target # <this command is to be executed on the target> u-boot :> <this command is to be executed on the u-boot prompt>

Version Information and Compatibility

Note! These instructions have been validated on EZSDK 5.02.01.59. These instructions are applicable to DM816x and DM814x devices.

Installing MP3 Decoder


Users may download MP3 Decoder from the following URL - http://software-dl.ti.com/dsps/dsps_public_sw/codecs/C674X_Audio_Codecs/01_00_001/index_FDS.html.

This URL contains linux installer for MP3 Decoder. Although users may install MP3 Decoder anywhere in the linux filesystem, it is recommended to install the MP3 Decoder along side the AAC Decoder in the EZSDK host filesystem under component-sources. This simplifies setting up the build environment variables to point to the MP3 Decoder package.

Integration and Build steps

1. Update / provide the path of mp3 decoder in $EZSDK/ Rules.mk file.

Update the path in OMX_BUILD_VARS

aaclcdec_PATH=${AACLCDEC_INSTALL_DIR}
mp3dec_PATH=${MP3DEC_INSTALL_DIR}

Provide the path of mp3 codec installed -

AACLCDEC_INSTALL_DIR=$(DVSDK_INSTALL_DIR)/component-sources/c674x-aaclcdec_01_41_00_00_elf

  MP3DEC_INSTALL_DIR=$(DVSDK_INSTALL_DIR)/component-sources/c674x-mp3dec_01_41_00_00_elf

  2. Update the build environment variables in $EZSDK/component-sources/omx_xx_yy_zz_bb/makerules/env.mk to point to the installation of MP3 Decoder. Here xx_yy_zz_bb represents the installed omx version. See example below -

 host $ cd $EZSDK/component-sources/omx_xx_yy_zz_bb/makerules/

host $ vi env.mk

# MP3DEC - MP3 Decoder
mp3dec_PATH = $(EXTERNAL_SW_ROOT)/c674x_mp3dec_01_41_00_00_elf
mp3dec_INCLUDE = $(mp3dec_PATH)/packages
 
# AACDEC - AAC Decoder
aaclcdec_PATH = $(EXTERNAL_SW_ROOT)/c674x_aaclcdec_01_41_00_00_elf
aaclcdec_INCLUDE = $(aaclcdec_PATH)/packages

3. Modify the Codec Engine create parameters in $EZSDK/component-sources/omx_xx_yy_zz_bb/packages/ti/omx/demos/dm81xx/DspAppMain.cfg to include MP3 Decoder as shown below -

 host $ cd $EZSDK/component-sources/omx_xx_yy_zz_bb/examples/ti/omx/demos/dm81xx/

host $ vi DspAppMain.cfg

 // use mp3dec
 var mp3dec = xdc.useModule('ti.sdo.codecs.mp3dec.ce.MP3DEC');
 
 // ======== Engine Configuration ========
 var Engine = xdc.useModule('ti.sdo.ce.Engine');
 var myEngine = Engine.create("adec", [
 {
 name : "mp3dec",
 mod : mp3dec,
 local: true
 },
 {
 name : "aaclcdec",
 mod : aaclcdec,
 local: true
 }
 ]);

This results in the inclusion of MP3 Decoder libraries in the build and also includes MP3 decoder in the list of algorithms codec engine supports. Note that AAC Decoder is already present by default.

4. Add MP3 Decoder to the list of codecs in $EZSDK/component-sources/omx_xx_yy_zz_bb/examples/ti/omx/demos/dm81xx/app_properties.mk as shown below -

 host $ cd $EZSDK/component-sources/omx_xx_yy_zz_bb/examples/ti/omx/demos/dm81xx/

host $ vi app_properties.mk

CODECS_IN_APP = aaclcdec mp3dec

5. Add MP3 Decoder to the list of header files in $EZSDK/component-sources/omx_xx_yy_zz_bb/src/ti/omx/comp/aenc/makefile as shown below -

 host $ cd $EZSDK/component-sources/omx_xx_yy_zz_bb/packages/ti/omx/comp/aenc

host $ vi makefile

INCLUDE_EXERNAL_INTERFACES = bios xdc omx omxcore omxbase timmosal fc xdais \
 ce aaclcenc aaclcdec mp3dec
note: This step is required as common header file in encode / decode will access these codec files.


This step completes modifications on DSP side.

6. Add MP3 Decoder to the list of codecs in $EZSDK/component-sources/omx_xx_yy_zz_bb/examples/ti/omx/demos/adec_snt/app_properties.mk as shown below -

 host $ cd $EZSDK/component-sources/omx_xx_yy_zz_bb/examples/ti/omx/demos/adec_snt/

host $ vi app_properties.mk

CODECS_IN_APP = aaclcdec mp3dec

This step completes modification on A8 side (IL Client)

7. Go to the root directory of EZSDK and execute the following make command to rebuild omx -

host $ cd $EZSDK

host $ make omx_clean

host $ make omx

8. The following DSP and A8 side binaries are rebuilt as a result of 5 above -

For DM816x:
$EZSDK/component-sources/omx_xx_yy_zz_bb/bin/dm81xx/bin/ti816x-evm/dm81xx_c6xdsp_debug.xe674
$EZSDK/component-sources/omx_xx_yy_zz_bb/bin/adec_snt/bin/ti816x-evm/adec_snt_a8host_debug.xv5T
For DM814x:
$EZSDK/component-sources/omx_xx_yy_zz_bb/bin/dm81xx/bin/ti814x-evm/dm81xx_c6xdsp_debug.xe674
$EZSDK/component-sources/omx_xx_yy_zz_bb/bin/adec_snt/bin/ti814x-evm/adec_snt_a8host_debug.xv5T

9. Rename the DSP binary to match the names on the target filesystem as shown below -

For DM816x, rename to dm816x_c6xdsp.xe674
For DM814x, rename to dm814x_c6xdsp.xe674

10. Copy the newly generated DSP binary to the target filesystem under /usr/share/ti/ti-media-controller-utils

11. Copy the newly generated A8 binary to the target filesystem under /usr/share/ti/ti-omx

How to test


The IL Client executable adec_snt_a8host_debug.xv5T is used in the following way to test MP3 Decoder -

target # firmware_loader 0 dm81xx_c6xdsp_debug.xe674 start
target # ./adec_snt_a8host_debug.xv5T -i input.mp3 -o output.pcm -c mp3


FAQ


1. What has changed with regard to MP3 Audio Decoder in EZSDK 05.03.00.09 which uses OMX 05.02.00.26? Some streams which were being decoded earlier are not working now.

Ans: The IL-Client on A8 (adec_snt) has been modified to exit safely if the decoder returns bytesConsumed as zero. This is a new feature that has been added for application safety with the proper message saying (see adec_snt\src\ilclient.c around line 774):

"Bytes Consumed is zero by the decoder. Hence stopping further decoding".

It is possible that streams with ID3 header is being given for decoding (not elementary streams). For this case, the decoder returns bytesConsumed as zero. Therefore, such streams fail to decode now. The user may either -

  • strip off the ID3 header and pass only the elementary stream for decoding
  • or, continue decoding ignoring this error, for which the IL-Client needs to be modified by removing the following lines (around line 770 to 774)
 if((gbytesInInputBuffer - pBuffer->nFilledLen) == 0) {
   gEOF = 1;
   gbytesInInputBuffer = 0;
   pBuffer->nFilledLen = 0;
   printf("\nBytes Consumed is Zero by decoder......\nHence Stopping further decoding\n");
 }

Download the Latest EZSDK

The latest EZSDK is available for download from http://software-dl.ti.com/dsps/dsps_public_sw/ezsdk/latest/index_FDS.html.

The current version is 5.05.02.00. The supported platforms are DM816x and DM814x.

EZSDK Support