shabi@t2.technion.ac.il
2004-May-05 02:19 UTC
[vorbis-dev] optimizing float to int conversions
Hi, We compiled libvorbis with vc6 enviroment. We've discovered that changing float to int conversion results in a 4% speedup on a benchmark we've come with on pentium4 3GHz. We'd like to submit the code. We haven't checked it on AMD. Yet, as you can see in the code, it shouldn't be a problem. Should we think of other machines except for AMD/Intel machines? Tal&Adir P.S. you can diff the files in zips <p><p> -------------- next part -------------- A non-text attachment was scrubbed... Name: floatToInt.zip Type: application/x-zip-compressed Size: 39671 bytes Desc: floatToInt.zip Url : http://lists.xiph.org/pipermail/vorbis-dev/attachments/20040505/02033933/floatToInt-0001.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: src.zip Type: application/x-zip-compressed Size: 19350 bytes Desc: src.zip Url : http://lists.xiph.org/pipermail/vorbis-dev/attachments/20040505/02033933/src-0001.bin
On Wed, 5 May 2004 shabi@t2.technion.ac.il wrote:> Hi, > We compiled libvorbis with vc6 enviroment. > We've discovered that changing float to int conversion results in a 4% speedup > on a benchmark we've come with on pentium4 3GHz.i'm curious where the real gains are coming from here -- is your compiler generating cmov instructions after your patches? it looks like most of the potential for gains are in parallelising the code in and around where you've made these float to int conversions -- p4 is a lot happier parallizing cmov than it is fcmov. i gather vc6 is too old to generate sse code instead of x87 code? because the places where you're changing things are vectorizable. also -- you might want to try out this change to psy.c as well: /* this is for per-channel noise normalization */ static int apsort(const void *a, const void *b){ #if 0 float f1=fabs(**(float**)a); float f2=fabs(**(float**)b); return (f1<f2)-(f1>f2); #else uint32_t u1 = **(uint32_t **)a; uint32_t u2 = **(uint32_t **)b; u1 *= 2; // clear sign bit u2 *= 2; //return (u1<u2)-(u1>u2); return (int32_t)u2 - (int32_t)u1; #endif } -dean --- >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 'vorbis-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.