![]() |
Encoding MP3's on the slugIntroductionFor quite a while I wanted to encode .mp3 files on my slug. However as the slug does not have floating point hardware and virtually all encoders use this, this takes ages. At one point I tried 'lame' and it told me it needed about 3 hrs for one track. Not really what I had in mind. For decoding there are some integer decoders (e.g. madplay). However integer encoders are very rare. I found one for Amiga, but this one was a rough one with not a very good quality. Therefore I was happy to notice that the new Intel Integrated Performance Primitives 5.0. (IPP 5.0). IPP has several sample codecs (aac_dec_int, aac_enc_int, dv, h261_dec, h261_enc, h263_dec, h263_enc, h264_dec, h264_enc, jpeg, mp3_dec_int, mp3_enc_int mpeg2_dec, mpeg2_enc, mpeg2_spl, mpeg4_dec, mpeg4_enc, mpeg4_spl), a supporting streaming architecture (umc), some supporting modules and some demonstrator applications (audio_codec_con, sample_player, video_enc_con) My interest and experiments only focused on the mp3 decoding and encoding codecs and the associated audio_codec_con sample application. All other software compiles fine with me, but has not really been tested (and I think things like h264 encoding is not really a task you want to do on a slug as it will take ages). Constraints/Starting pointIn order to get this software you'll need to have a cross environment set up on your PC. I am running openslug on my NSLU2 and my PC runs Fedora Core 3. I have already built sources before so on my PC is a full development tree. When you start you should also get such a tree. Mine is set up using MasterMakefile, but you can also get there from BuildingTheTarball. If you haven't cross-compiled things first you probably want to try a few simpler things first. If you want to rip audio from CD you also need other tools for that and you'll need to have the necessary modules on your system (cdrom.ko, sr_mod.ko, sg.ko). Note that I haven't tried to make a .bb file for this. First of all there are some manual steps involved anyway. Also I do not really have enough knowledge to do that, and finally I am rather short on time. Feel free to add a .bb file yourself. Getting the softwareIn order to get access to the software you'll need to execute a license agreement. This can be found at https://registrationcenter.intel.com/EvalCenter/EvalForm.aspx?ProductID=493. They will mail you a message with a license key. Attached to that message is also a copy of the license file. You'll need that one! After registering (or even before) you can download the IPP library at http://www.intel.com/software/products/ipp/downloads/ipplin.htm. You need to get the very last file: Intel® Integrated Performance Primitives 5.0 for Linux* on the IXP4XX product line. I got version 5.0.043 from here. Note that downloading alone is not enough. You still need to obtain a license file as mentioned before. The last part to get are the samples. These can be found at http://www.intel.com/cd/software/products/asmo-na/eng/238686.htm. As I was interested in mp3, I went to Media Encoding and then selected Download Linux Samples. This brought me to http://www.intel.com/cd/software/products/asmo-na/eng/220044.htm where you need to accept an EULA before you can download the stuff. If you are interested in the other samples (e.g. for jpeg or speech coding) the former of these web pages will also provide you with the necessary links. Installing the sourcesAfter uncompressing/untarring the ipp download you'll get a directory l_ipp_ixp_p_5.0.043 (the number at the end will be different if you got a newer version). In this directory there is an install.sh, but for me this did not work. It only gave the possibilitiy to show a few txt files. Instead I moved to the The other thing needed is to install the sample sources. Mine came in Creating the environmentThe last thing is to get our compiler in place. There are no settings for our cross compiler (armeb-linux-gcc and friends). Instead the cross compiler is called xscale_be-gcc. Also the build scripts check for the directory where the compiler was installed. There are two ways to fix this. One way is to patch all build scripts in the ipp_sample directory to change compiler name and directory. This is something you probably want to do when creating a .bb file. Next I moved to the directory with my compiler binaries (for me @.../openslug/tmp/cross/bin@@ and executed the following script:
Note that for me the compiler and /opt were on the same filesystem. Perhaps you are better off with ln -s. For the remainder of this HowTo the opt directory does not need to be touched. Patching the softwareWhen compiling for the first time I got an error in Compiling and linkingIt's getting easier and easier. For this you only need to go to Testing your workThe output of the build process is in Now on the slug you can issue the command: Encoding a wav file can be done by: Closing remarksSome last remarks that did not fit anywhere.
Enjoy!! Alternative way for Openslug 2.7Get the 2 files like described above. Uncompress l_ipp_ixp_p_5.0.XXX.tgz and run install.sh. Choose "1" (not "1a", "1b", "1c"...). Follow the instructions on the screen. On rpm-based system that will create a dev-tree under /opt/intel. (On debian it fails, leaving 2 rpm-files in the tmp-directory. Uncompress these). Now copy the whole dev-tree from /opt/intel onto the slug under /opt/intel. Install the package "openslug-native" onto the slug. That will get you a native gcc. For openslug 3.10 you need to install slugos-native. Create the directory /opt/hardhat/devkit/arm/xscale_be/bin. Inside create these links: xscale_be-addr2line -> /usr/bin/addr2line xscale_be-ar -> /usr/bin/ar xscale_be-as -> /usr/bin/as xscale_be-c++ -> /usr/bin/c++ xscale_be-c++filt -> /usr/bin/c++filt xscale_be-cpp -> /usr/bin/cpp xscale_be-depmod -> /sbin/depmod xscale_be-g++ -> /usr/bin/g++ xscale_be-gcc -> /usr/bin/gcc xscale_be-ld -> /usr/bin/ld (You don't need them all, but i cannot remember which ones are important...) Uncompress l_ipp-sample-media_p_5.0.XXX.tgz on the slug. Goto ipp_sample/media and run buildxscale_be.sh. Get a good book, it takes some time. The important lines start with *******, forget the "[: ==: binary operator expected"-messages. And the endresult hides under _bin. pumpkin0 Performance update for Debian armelUsing the Debian armel build (lenny) with substantially improved floating point performance, encoding of 128kbps mp3 files using lame and high quality (lame -b 128 -h), encoding performance is typically between 10% and 11% of realtime, so a 4 minute track takes around 38 minutes to encode. |