Skip to main content
Topic: MinGW to compile processor specific lame (Read 7321 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

MinGW to compile processor specific lame

Howto Compile a Processor Specific Lame using Freeware (MinGW).

This guide is written at a very basic level so be warned.  If you've searching on this topic, you've undoubtedly found three threads I've started.  I wanted to write the solution in a single thread so anyone who searched, could find the answer easily.  The guide assumes default options on your installs.  At the time this guide was written, the versions of the programs were as stated in the text.  Also, this guide assumes you're compiling lame for use on an athlon xp chip.  For others, like pentium4, athlon thunderbird, etc. I will post the flags tomorrow (31-Jan) around 15:00 EST.

*Special thanks to robert who was the real trouble shooter on this issue.


1. Download MinGW 3.2.0-rc3, MSYS 1.0.11, and nasm win32 binary 0.98.39.

2. Install MinGW and then install MSYS.

3. Edit C:\msys\1.0\etc\fstab to look like this:
Code: [Select]
#Win32_Path  Mount_Point
c:\MinGW      /mingw


4. Extract "nasmw.exe from nasm-0.98.39.zip and rename it to "nasm.exe" then copy it into your C:\MinGW\bin

5. Download the lame source tarball and unpack it to C:\msys\1.0\home\<username>

6. Edit C:\msys\1.0\home\<username>\lame-3.96.1\mpglib\interface.c in this way:
change
Code: [Select]
#include "interface.h"
to
Code: [Select]
#include "../mpglib/interface.h"


7. Edit C:\msys\1.0\home\<username>\lame-3.96.1\libmp3lame\mpglib_interface.c in this way:
change
Code: [Select]
#include "interface.h"
to
Code: [Select]
#include "../mpglib/interface.h"


8. Start MSYS and do a:

Code: [Select]
$ cd lame-3.96.1
$ ./configure --enable-nasm CFLAGS="-fomit-frame-pointer -O3 -march=athlon-xp"


(There are different flags you can use here, I have listed this simple one in this guide, but feel free to change it to your needs.)  At some point, I'll publish my results of different flags here and their speed results in another post.  I will update this guide with a link to that post once I finish.

9a. After the configure finishes, edit C:\msys\1.0\home\<username>\lame-3.96.1\libmp3lame\i386\Makefile in this way:
change
Code: [Select]
NASMFLAGS = -f elf -i $(top_srcdir)/libmp3lame/i386/
to
Code: [Select]
NASMFLAGS = -f win32 -DWIN32 -i $(top_srcdir)/libmp3lame/i386/

also change
Code: [Select]
NASM_FORMAT = -f elf
to
Code: [Select]
NASM_FORMAT = -f win32 -DWIN32


9b. Edit C:\msys\1.0\home\<username>\lame-3.96.1\mpglib\Makefile
change
Code: [Select]
NASM_FORMAT = -f elf
to
Code: [Select]
NASM_FORMAT = -f win32 -DWIN32



10. Now do a:

Code: [Select]
$ make
and check for errors, if none are present, do a
Code: [Select]
$ make install


11. Look in your C:\msys\1.0\local\bin for your new lame.exe

If all went well, you should have a fresh lame.exe that is optimized for an athlon xp CPU:
Code: [Select]
D:\Incoming\junk>lame test.wav --alt-preset standard
LAME version 3.96.1 (http://lame.sourceforge.net/)
CPU features: MMX (ASM used), 3DNow! (ASM used), SSE
Using polyphase lowpass filter, transition band: 18671 Hz - 19205 Hz
Encoding test.wav to test.wav.mp3
Encoding as 44.1 kHz VBR(q=2) j-stereo MPEG-1 Layer III (ca. 7.3x) qval=3
   Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA
10798/10800 (100%)|    0:34/    0:34|    0:34/    0:34|   8.1246x|    0:00
32 [   80] **
128 [  499] %%*****
160 [ 3200] %%%%%%%%%%%%%%%%%%%%%************************
192 [ 4785] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%************************************
224 [ 1567] %%%%%%%%**************
256 [  474] %%%%***
320 [  195] %%*
average: 188.1 kbps   LR: 4638 (42.94%)   MS: 6162 (57.06%)

Writing LAME Tag...done
ReplayGain: -6.5dB

MinGW to compile processor specific lame

Reply #1
May I ask what the point of compiling an application is, if you're not a developer/programmer?
"To understand me, you'll have to swallow a world." Or maybe your words.

MinGW to compile processor specific lame

Reply #2
Given that there is a great world of open-source stuff out there (lame, xvid, mplayerc, vdmod, mozilla, etc.) that is available as source as well as binaries, I wanted to see if I could get some to compile with processor specific optimizations under win32 to see if I could appreciate any speed gains over the standard binaries.

I started playing with xvid, and I've noticed some speed gains when compiling the 1.0.3 source with some optimizations for my CPU.  I wanted to experiment doing so with lame also (knowing that the ICL compiles are going to be the fastest anyway).  I just thought I'd share with the group as there could be others out there like me who don't have hundreds of dollars to spend on MSVC and ICL compilers, but who want to play around with some optimizations also.  So to answer your question: it's just a curiosity for me.

MinGW to compile processor specific lame

Reply #3
Quote
May I ask what the point of compiling an application is, if you're not a developer/programmer?
[a href="index.php?act=findpost&pid=269358"][{POST_SNAPBACK}][/a]

Only geeks can understand the point 
Stupidity is root of all evil.

MinGW to compile processor specific lame

Reply #4
No, geeks would learn C and try to actually understand what they are doing.
Compiling software yourself with optimized GCC switches (which you probably don't even understand) does not make you look any smarter or geeky, period.
"To understand me, you'll have to swallow a world." Or maybe your words.

MinGW to compile processor specific lame

Reply #5
Quote
No, geeks would learn C and try to actually understand what they are doing.
Compiling software yourself with optimized GCC switches (which you probably don't even understand) does not make you look any smarter or geeky, period.
[a href="index.php?act=findpost&pid=269387"][{POST_SNAPBACK}][/a]

Damn, it was just a pun... Compiling yourself just gives a fuzzy feeling of power. But that's not really useful, indeed. That's just good in some cases with some specific processors and apps.
Stupidity is root of all evil.

MinGW to compile processor specific lame

Reply #6
Reminds me of http://funroll-loops.org/ :
"Watching shit scroll by for hours makes me a Linux expert overnight!"
"To understand me, you'll have to swallow a world." Or maybe your words.

MinGW to compile processor specific lame

Reply #7
Usually, windows users simply download compressed binaries for their systems.  It's a bit empowering to think that one can build an app specifically for one's CPU type.

In the case of lame 3.96.1, I cannot (nor did I think I would be able to) get the speed faster than the gold standard: rarewares.org ICL4.5 build of lame.  I have made 12 attempts now and if anyone's interested, I've been keeping a spreadsheet containing the switches I used, an average play/CPU etc. for a given test file.  Actually, it was damaki's suggestion for switches that have come nearest to the icl4.5 build's speed.

MinGW to compile processor specific lame

Reply #8
Empower you in what way?
What features does your build provide the rarewares.org build does not?
"To understand me, you'll have to swallow a world." Or maybe your words.

MinGW to compile processor specific lame

Reply #9
Quote
Empower you in what way?
What features does your build provide the rarewares.org build does not?
[a href="index.php?act=findpost&pid=269394"][{POST_SNAPBACK}][/a]

A strong placebo effect... and self-satisfaction.
Stupidity is root of all evil.

MinGW to compile processor specific lame

Reply #10
Quote
Usually, windows users simply download compressed binaries for their systems.  It's a bit empowering to think that one can build an app specifically for one's CPU type.

In the case of lame 3.96.1, I cannot (nor did I think I would be able to) get the speed faster than the gold standard: rarewares.org ICL4.5 build of lame.  I have made 12 attempts now and if anyone's interested, I've been keeping a spreadsheet containing the switches I used, an average play/CPU etc. for a given test file.  Actually, it was damaki's suggestion for switches that have come nearest to the icl4.5 build's speed.
[a href="index.php?act=findpost&pid=269393"][{POST_SNAPBACK}][/a]


Bluesky, could you compile recomended 3.90.3 and 3.96.1 versions and upload them to somewhere? Tnanks in advance and for guidance too.
Gabber, Jazz and IDM

MinGW to compile processor specific lame

Reply #11
Quote
Empower you in what way?[a href="index.php?act=findpost&pid=269394"][{POST_SNAPBACK}][/a]


For me, the empowerment comes in the fact that I can use different options in the configure step and test the resulting binaries.  Hopefully I'll learn, albeit indirectly, from the options I used.  For example, I've made 12 different lame.exes now using suggestions for switches from here, elseswhere, and from my own guesses.  I'm still testing them; it's very interesting how they vary in their respective CPU clock efficiencies.

Quote
What features does your build provide the rarewares.org build does not?
[a href="index.php?act=findpost&pid=269394"][{POST_SNAPBACK}][/a]


In terms of the application itself, none.  In terms of learning the process to get them, lots.  The point of the exercise for me, wasn't to compile an app that was run faster than the rarewares.org build -- there are many threads in the forums that describe how the ICL versions will be faster than any build I can make with MinGW.  I wanted to see how it was accomplished, and perhaps apply what I found out to an ICL compiler and maybe make a faster lame.exe for my athlonxp.

As I said in my other post, I would like to learn how to compile various open-source applications I commonly use with the right switches to yield the most of my CPU -- even if that means only a trivial increase in speed.  I know many devs here do this for a living, for me it's an interesting curiosity, and since the complier is freeware, I can indulge it.

A question I have is: can I use the MSVC/ICL compliers on PCs at work with the right switches to build a lame.exe optimized for my athlonxp that will be faster than the rareware.org build?

MinGW to compile processor specific lame

Reply #12
Quote
Bluesky, could you compile recomended 3.90.3 and 3.96.1 versions and upload them to somewhere? Tnanks in advance and for guidance too.[a href="index.php?act=findpost&pid=269399"][{POST_SNAPBACK}][/a]


Sure, lemme finish the testing I've been doing to figure out the fastest build I can make with MinGW.  Do you have an athlonxp CPU?  PM me a place to them... don't you want to give it a shot yourself?

MinGW to compile processor specific lame

Reply #13
Quote
May I ask what the point of compiling an application is, if you're not a developer/programmer?

Maybe there's no big point but I don't see any problems with it. Musepack latest problem was solved by simply changing compilation options (yes, the actual developers would get to it fast, but nonetheless an user helped solving it). bluesky asked about doing it and then retributed by writing this small tutorial that may end up being useful to someone. Again, I don't see any problems with that and I found your posts in this thread a bit harsh.

Cya

MinGW to compile processor specific lame

Reply #14
I have the results of my speed test compiling several wav files with 12 builds (13 if you could the rarewares.org build) of lame 3.92.1 on my Athlon XP 3200+ system.  The data are in an excel spreadsheet.  Can anyone host the file for me?  My webserver has me locked-out at the moment.  I'd be glad to email to you and then update this thread with the link to your webserver.  The file is only 27 kb uncompressed.

MinGW to compile processor specific lame

Reply #15
Quote
Bluesky, could you compile recomended 3.90.3 and 3.96.1 versions and upload them to somewhere? Tnanks in advance and for guidance too.[{POST_SNAPBACK}][/a]


Sorry man, all I can find on [a href="http://sourceforge.net/project/showfiles.php?group_id=290]sourceforge.net[/url] is the source to 3.90.1.  Anyone know where the source to 3.90.3 can be had?


MinGW to compile processor specific lame

Reply #17
The test results are published here

 
SimplePortal 1.0.0 RC1 © 2008-2019