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:
#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 #include "interface.h"
to #include "../mpglib/interface.h"
7. Edit C:\msys\1.0\home\<username>\lame-3.96.1\libmp3lame\mpglib_interface.c in this way:
change #include "interface.h"
to #include "../mpglib/interface.h"
8. Start MSYS and do a:
$ 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 NASMFLAGS = -f elf -i $(top_srcdir)/libmp3lame/i386/
to NASMFLAGS = -f win32 -DWIN32 -i $(top_srcdir)/libmp3lame/i386/
also change NASM_FORMAT = -f elf
to NASM_FORMAT = -f win32 -DWIN32
9b. Edit C:\msys\1.0\home\<username>\lame-3.96.1\mpglib\Makefile
change NASM_FORMAT = -f elf
to NASM_FORMAT = -f win32 -DWIN32
10. Now do a:
$ make
and check for errors, if none are present, do a $ 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: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