Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > LAME uses AltiVec???

LAME uses AltiVec???
Thread Tools
Senior User
Join Date: Mar 1999
Location: Somewhere near 1º18'N 103º50'E
Status: Offline
Reply With Quote
Jan 21, 2002, 09:44 AM
 
Anyone know if the default configure and compiling of LAME from source do make use of the G4's AltiVec unit? If not, how do I patch the source so that it's AltiVec aware?

Thanks in advance
     
Fresh-Faced Recruit
Join Date: May 2001
Status: Offline
Reply With Quote
Jan 21, 2002, 08:20 PM
 
Originally posted by oeyvind:
<STRONG>Anyone know if the default configure and compiling of LAME from source do make use of the G4's AltiVec unit? If not, how do I patch the source so that it's AltiVec aware?

Thanks in advance</STRONG>
I don't know how much benefit will be seen simply by enabling the compiler's default AltiVec optimization, but the compiler directive that turns it on is:

-faltivec

To see any serious benefit I'd imagine you'd have to go in and create your own process branch in LAME that has AltiVec specific function calls. But hey tell me how it goes for you just flipping the toggle switch.

[ 01-21-2002: Message edited by: NoAuthoritaw ]
     
oeyvind  (op)
Senior User
Join Date: Mar 1999
Location: Somewhere near 1º18'N 103º50'E
Status: Offline
Reply With Quote
Jan 21, 2002, 08:53 PM
 
<font face = "courier">% CFLAGS=-faltivec; export CFLAGS
% CPPFLAGS=-faltivec; export CPPFLAGS
% ./configure
% make</font>

hmmm, seem a bit faster, I didn't do much benchmark, but seem to be a bit faster (or is it all in my imagination)?

LAME version 3.92 Alpha 1 (20020121)

[ 01-31-2002: Message edited by: oeyvind ]
     
Fresh-Faced Recruit
Join Date: May 2001
Status: Offline
Reply With Quote
Jan 21, 2002, 08:56 PM
 
Originally posted by oeyvind:
<STRONG>&lt;font face = "courier"&gt;% CFLAGS=-altivec; export CFLAGS
% CPPFLAGS=-altivec; export CPPFLAGS
% ./configure
% make&lt;/font&gt;

hmmm, seem a bit faster, I didn't do much benchmark, but seem to be a bit faster (or is it all in my imagination)?

LAME version 3.92 Alpha 1 (20020121)

[ 01-21-2002: Message edited by: oeyvind ]</STRONG>
Only way to tell is to benchmark it
     
oeyvind  (op)
Senior User
Join Date: Mar 1999
Location: Somewhere near 1º18'N 103º50'E
Status: Offline
Reply With Quote
Jan 21, 2002, 10:02 PM
 
LAME version 3.92 alpha 1 (released 20020122)

Configure option used:
./configure --disable-nls --enable-mp3x --enable-brhist

Track used: Track 1 of Buena Vista Social Club: Chan Chan

A (without CFLAGS & CPPFLAG with the extra -faltivec)

lame option: <font face = "courier">--r3mix -b 112</font> (histogram removed)
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
Encoding as <font color = blue>44.1</font> kHz VBR(q=<font color = blue>1</font>) j-stereo MPEG-<font color = blue>1</font> Layer III (ca. <font color = blue>6.</font>5x) qval=<font color = blue>2</font>
Frame | CPU time/estim | REAL time/estim | play/CPU | ETA
<font color = blue>9873</font>/<font color = blue>9876</font> (<font color = blue>100</font>%)| <font color = blue>2</font>:<font color = blue>18</font>/ <font color = blue>2</font>:<font color = blue>18</font>| <font color = blue>2</font>:<font color = blue>29</font>/ <font color = blue>2</font>:<font color = blue>29</font>| <font color = blue>1.</font>8596x| <font color = blue>0</font>:<font color = blue>00</font>
average: <font color = blue>173.3</font> kbps LR: <font color = blue>2160</font> (<font color = blue>21.87</font>%) MS: <font color = blue>7716</font> (<font color = blue>78.13</font>%)
</font>[/code]

lame option: <font face = "courier">-h -b 160</font>
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
Encoding as <font color = blue>44.1</font> kHz <font color = blue>160</font> kbps j-stereo MPEG-<font color = blue>1</font> Layer III (<font color = blue>8.</font>8x) qval=<font color = blue>2</font>
Frame | CPU time/estim | REAL time/estim | play/CPU | ETA
<font color = blue>9873</font>/<font color = blue>9876</font> (<font color = blue>100</font>%)| <font color = blue>1</font>:<font color = blue>27</font>/ <font color = blue>1</font>:<font color = blue>27</font>| <font color = blue>1</font>:<font color = blue>32</font>/ <font color = blue>1</font>:<font color = blue>32</font>| <font color = blue>2.</font>9593x| <font color = blue>0</font>:<font color = blue>00</font>
average: <font color = blue>160.0</font> kbps LR: <font color = blue>1195</font> (<font color = blue>12.10</font>%) MS: <font color = blue>8681</font> (<font color = blue>87.90</font>%)
</font>[/code]

B (WITH CFLAGS & CPPFLAG with the extra -faltivec)

lame option: <font face = "courier">--r3mix -b 112</font> (histogram removed)
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
Encoding as <font color = blue>44.1</font> kHz VBR(q=<font color = blue>1</font>) j-stereo MPEG-<font color = blue>1</font> Layer III (ca. <font color = blue>6.</font>5x) qval=<font color = blue>2</font>
Frame | CPU time/estim | REAL time/estim | play/CPU | ETA
<font color = blue>9873</font>/<font color = blue>9876</font> (<font color = blue>100</font>%)| <font color = blue>2</font>:<font color = blue>16</font>/ <font color = blue>2</font>:<font color = blue>16</font>| <font color = blue>2</font>:<font color = blue>28</font>/ <font color = blue>2</font>:<font color = blue>28</font>| <font color = blue>1.</font>8847x| <font color = blue>0</font>:<font color = blue>00</font>
average: <font color = blue>173.3</font> kbps LR: <font color = blue>2160</font> (<font color = blue>21.87</font>%) MS: <font color = blue>7716</font> (<font color = blue>78.13</font>%)
</font>[/code]

lame option: <font face = "courier">-h -b 160</font>
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
Encoding as <font color = blue>44.1</font> kHz <font color = blue>160</font> kbps j-stereo MPEG-<font color = blue>1</font> Layer III (<font color = blue>8.</font>8x) qval=<font color = blue>2</font>
Frame | CPU time/estim | REAL time/estim | play/CPU | ETA
<font color = blue>9873</font>/<font color = blue>9876</font> (<font color = blue>100</font>%)| <font color = blue>1</font>:<font color = blue>26</font>/ <font color = blue>1</font>:<font color = blue>26</font>| <font color = blue>1</font>:<font color = blue>30</font>/ <font color = blue>1</font>:<font color = blue>30</font>| <font color = blue>2.</font>9795x| <font color = blue>0</font>:<font color = blue>00</font> average: <font color = blue>160.0</font> kbps LR: <font color = blue>1195</font> (<font color = blue>12.10</font>%) MS: <font color = blue>8681</font> (<font color = blue>87.90</font>%)
</font>[/code]
     
Dedicated MacNNer
Join Date: Jun 2000
Location: Dundas, Ontario, Canada
Status: Offline
Reply With Quote
Jan 22, 2002, 10:28 PM
 
from what I can tell, it doesn't look much better. This most likely means that the compiler doesn't actually do anything on its own except enable the altivec code in your source to be compiled (basically by defining the compiler directive you should be checking for). I was pretty sure that you actually had to write the altivec VecLib calls yourself so you might want to try replacing a few of the computational lines with actual vector code and see what happens.

I don't actually know, though. Ask someone on Apple's dev list to find out what they actually have the compiler doing with that option.

Post back if you pursue this,
Jeff.
Spectral Class
"Shedding Light on Innovation"
     
Fresh-Faced Recruit
Join Date: May 2001
Status: Offline
Reply With Quote
Jan 23, 2002, 01:46 AM
 
Originally posted by Apocalypse:
<STRONG>from what I can tell, it doesn't look much better. This most likely means that the compiler doesn't actually do anything on its own except enable the altivec code in your source to be compiled (basically by defining the compiler directive you should be checking for). I was pretty sure that you actually had to write the altivec VecLib calls yourself so you might want to try replacing a few of the computational lines with actual vector code and see what happens.

I don't actually know, though. Ask someone on Apple's dev list to find out what they actually have the compiler doing with that option.

Post back if you pursue this,
Jeff.</STRONG>
I've not looked at the LAME code so I can't say how difficult it would be to vectorize it with calls to the AltiVec libraries. However if someone does try to simply go in and substitute standard arithmetic operations with vector operations bear in mind that AltiVec is heavily dependent on proper data alignment. This might mean that some amount of work may need to be done to make sure that data gets loaded into the registers properly.

-Nathan
     
oeyvind  (op)
Senior User
Join Date: Mar 1999
Location: Somewhere near 1º18'N 103º50'E
Status: Offline
Reply With Quote
Jan 23, 2002, 04:44 AM
 
Originally posted by NoAuthoritaw:
<STRONG>

I've not looked at the LAME code so I can't say how difficult it would be to vectorize it with calls to the AltiVec libraries. However if someone does try to simply go in and substitute standard arithmetic operations with vector operations bear in mind that AltiVec is heavily dependent on proper data alignment. This might mean that some amount of work may need to be done to make sure that data gets loaded into the registers properly.

-Nathan</STRONG>
Latest lame src is here, really hope someone is actually working to get LAME to use Altivec units in G4...^^
     
Dedicated MacNNer
Join Date: Jun 2000
Location: Dundas, Ontario, Canada
Status: Offline
Reply With Quote
Jan 23, 2002, 11:37 AM
 
We need to find someone with VastC/AltiVec. Apparently it will convert all c language arithmetic to AltiVec library calls as well as perform proper parallelization to ensure that none of the potential has been wasted.

If I had a G4 I would look into it. I am very interested in AltiVec and I think that, due to its advantages, Mac OS XI will probably be G4 or higher using all AltiVec enabled OS code. That would be damn sweet for development knowing that even the API was fully optimized.

Hopefully I will get some money and then pick up an AltiVec system soon. Of course, soon will be when we are referring to G5's or G6's since I am only a student.

Hope someone with the means is interested in our little experiment,
Jeff.
Spectral Class
"Shedding Light on Innovation"
     
oeyvind  (op)
Senior User
Join Date: Mar 1999
Location: Somewhere near 1º18'N 103º50'E
Status: Offline
Reply With Quote
Jan 23, 2002, 08:18 PM
 
Good news, just heard back from Ivnn Cavero Belaunde, one of the LAME developer that there's "some bulk of the work (LAME shared library, QT export component) hasn't been checked in yet."... cool!

and "Someone in the Architecture group at Apple has volunteered to do some Altivec work on the vectorizable parts of LAME, so I expect we'll see some stuff soon, which will be very sweet. He has access to profiling tools us mere mortals do not."

BTW, if you need G4, I think the SourgeForge compile farm has them

[ 01-23-2002: Message edited by: oeyvind ]
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:46 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2