Friday, March 11, 2011

Creating MP3 Decoder



A while ago I wrote in newlc.com created for the Series 60 MP3 player program. I have received a lot about the MP3 decoder and the message used in Symbian. Here using Symbian in MAD (MPEG audio decoder library) use to solve the problem.

Introduction

For Symbian 7.0 smartphones can play through the MMF in the MP3, but if your phone does not support MP3 decode, or if you want your receiver decode MP3. Here I will demonstrate how to use Symbian in the MAD (MPEG audio decoder, libmad) usage.

Why MAD? Because it is a high-quality MPEG audio decoder, and it has been tested through the ARM (ie, different computers, and handheld MP3 can use it). The MAD transplanted to Symbian.

MAD to get source, will need the following documents:

? Inc

o D.dat

o imdct_s.dat

o qc_table.dat

o rq_table.dat

o sf_table.dat

o bit.h

o config.h

o decoder.h

o fixed.h

o frame.h

o global.h

o huffman.h

o layer12.h

o layer3.h

o mad.h

o stream.h

o synth.h

o timer.h

o version.h

? Src

o bit.c

o decoder.c

o fixed.c

o frame.c

o huffman.c

o layer12.c

o layer3.c

o stream.c

o synth.c

o timer.c

o version.c

o imdct_l_arm.S

Fixed static function / variable non-static. (Variable can be converted to "static const").

Edit mad.h,, for the device object and FPM_DEFAULT defined FPM_ARM. If your compiler does not support WINS big inline, need to do:

# Ifndef__WINS__

inline

# Endif

Layer3.c III_decode function may cause a stack error, that is, the string:

mad_fixed_t xr [2] [576];

You can allocate memory for the variable or (in the case of a simple procedure) to use for the WINS target tips, home into a static variable. In the real machine it is running properly.

imdct_l_arm.S is optimized for ARMI, use it to add its header (function III_imdct_l).

# Ifndef __WINS__

void III_imdct_l (mad_fixed_t const X [18], mad_fixed_t z [36], unsigned int block_type);

# Else

static

void III_imdct_l (mad_fixed_t const X [18], mad_fixed_t z [36], unsigned int block_type)

Attention! Optimized imdct_l_arm not THUMB compile, so just ARMI object is used.

Creating MP3 Decoder Dynamic Link Library

Using the MP3 decoder is the best way to DLL, you can compile one or effective number, there is no platform for special events. So use ETTYPE. As libmad to epoc32includelibc join in the MM file SYSTEMINCLUDE. If you want to use the optimized III_imdct_l function, added to the MMP:

# If! Defined (WINS)

SOURCE imdct_l_arm.S

# Endif

Similarly to bld.inf: (So imdct_l_arm on the THUMB compiler)

PRJ_PLATFORMS

ARMI WINS

If iii_decode function for the stack error in the WINS database using the tips and not _chkstk, need to add it (empty void _chkstk ()):

In order to use the program DLL, add the function.

You can use the MP3 decoder based madplay the main loop:

Read file to buffer

MP3 decoding structure

Applied Filters

Synthesis of decoding to PCM samples

PCM samples to re-take

Filter most of the Symbian smartphones do not support stereo playback, so here you can implement a single voice synthesis. And can use the balancer.

Frequency does not need to do unnecessary calculations, if the frequency is greater than the required flow of current frames, the frequency of the half, after applying filter change frames options:

Frame.options | = MAD_OPTION_HALFSAMPLERATE;

Editors compile the procedure using GCC 3. According to my tests it's GCC 2.95 than the average 20% faster decoder. Do not forget the MAD in the GNU General Public License version 2 is licensed under.

Hope that the article can help you, and welcome to write notes or valuable opinions.












Recommend Office Suites And TOOLS



Describe The C # Call An External Process



EVALUATION Nature - Screen Savers



VOB File



Total Video Converter



MJPEG files



The birth of Kissing fish



Expert Backup And Restore



VBScript ReDim Statement



First job Out of the ivory tower beginning how the election



11 Ways Computer Viruses Are Spread



College student hidden hard to guarantee the right to life and health worries



Wizard Personal Interest



Using De exterminate RABBITS annoying ads RMVB movies