A few things - 1. I think that run-time processor detection should not be included in Speex. 2. There a few ways of doing per-file compiling flags. a. Make a new static library that is just the files that have the SSE / Altivec code in them. You can then use target_CFLAGS in the Makefile.am script to set what you need b. Do tricks with file extensions. CFLAGS applies to files that have a .c ending. CXXFLAGS applies to files that have .cpp . If you place all the SSE intrinics into .cpp files, then you can add in libspeex\Makefile.am a line like: libspeex_la_CXXFLAGS = -march=pentium3. Even better, you can use the configure.in magic from our patch. You define the CXXFLAGS to add based upon the target architecture. (Note, you will need to add AC_PROG_CXX into configure.in). That way you add both #ifdef inside those files and you have runtime selection of the function to use. ex (configure.in): echo -n "Checking for Platform ASM Speedups..." case "$target" in i?86*) CFLAGS="$CFLAGS -D_USE_SSE" CXXFLAGS="$CXXFLAGS -march=pentium3 -D_USE_SSE" echo "Found x86 - Adding SSE." ;; powerpc-apple-darwin*) CFLAGS="-D_USE_ALTIVEC" CXXFLAGS="$CXXFLAGS -faltivec -O3 -fPIC -D_USE_ALTIVEC" echo "Found Altivec" ;; *) echo "None Found" ;; esac <p>Since speex only uses .c files, 2b is a viable option. Aron Rosenberg SightSpeed At 12:28 PM 1/21/2004, you wrote:> > Is it a problem if all the files are compiled with > -march=pentium3 > > ? The patch that we sent in already detects in the configure.in script > > which system you are on and sets a define correctly, i.e. _USE_SSE. > >Well, if what you want is auto-detection, turning on -march=pentium3 >means that the code will crash on anything lower than a pentium3. Not >really useful. Of course, you can make it auto-detect at compile-time, >but that means you can't use the same binary on SSE and non-SSE >machines. > > Jean-Marc > >-- >Jean-Marc Valin, M.Sc.A., ing. jr. >LABORIUS (http://www.gel.usherb.ca/laborius) >Université de Sherbrooke, Québec, Canada<p>--- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'speex-dev-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
> 1. I think that run-time processor detection should not be included in Speex.Definitely. Detection belongs to the application, not libspeex.> 2. There a few ways of doing per-file compiling flags. > a. Make a new static library that is just the files that have the > SSE / Altivec code in them. You can then use target_CFLAGS in the > Makefile.am script to set what you needThat wouldn't work well on non-x86 though.> b. Do tricks with file extensions. CFLAGS applies to files that > have a .c ending. CXXFLAGS applies to files that have .cpp . If you place > all the SSE intrinics into .cpp files, then you can add in > libspeex\Makefile.am a line like: libspeex_la_CXXFLAGS = -march=pentium3. > Even better, you can use the configure.in magic from our patch. You define > the CXXFLAGS to add based upon the target architecture. (Note, you will > need to add AC_PROG_CXX into configure.in). That way you add both #ifdef > inside those files and you have runtime selection of the function to use.The problem with this one is that it's really unclean. I don't want to force people to have a C++ compiler just because gcc is to stupid to handle this properly. Jean-Marc -- Jean-Marc Valin, M.Sc.A., ing. jr. LABORIUS (http://www.gel.usherb.ca/laborius) Université de Sherbrooke, Québec, Canada -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 190 bytes Desc: Ceci est une partie de message numériquement signée. Url : http://lists.xiph.org/pipermail/speex-dev/attachments/20040121/0a8cb0f2/signature-0001.pgp
> Is it a problem if all the files are compiled with -march=pentium3 > ? The patch that we sent in already detects in the configure.in script > which system you are on and sets a define correctly, i.e. _USE_SSE.Well, if what you want is auto-detection, turning on -march=pentium3 means that the code will crash on anything lower than a pentium3. Not really useful. Of course, you can make it auto-detect at compile-time, but that means you can't use the same binary on SSE and non-SSE machines. Jean-Marc -- Jean-Marc Valin, M.Sc.A., ing. jr. LABORIUS (http://www.gel.usherb.ca/laborius) Université de Sherbrooke, Québec, Canada -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 190 bytes Desc: Ceci est une partie de message numériquement signée. Url : http://lists.xiph.org/pipermail/speex-dev/attachments/20040121/47a4e499/signature-0001.pgp
On Wed, 21 Jan 2004, Aron Rosenberg wrote:> A few things - > > 1. I think that run-time processor detection should not be included in Speex.That approach only works for environments where people are compiling their own code for their own use on their own machine. Some people want to ship binaries. To begin with, not everyone has a compiler installed on their machine and even among those that do, not everyone knows how to use it. Run time detection is the user friendly way to do things, even if it is more work for the developer. Ian <p>--------------------------------------------------- Ian Ollmann, Ph.D. iano@cco.caltech.edu --------------------------------------------------- --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'speex-dev-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.