[vorbis-dev] optimizing float to int conversions

dean gaudet dean-list-vorbis-dev at arctic.org
Wed May 5 09:29:23 PDT 2004



On Wed, 5 May 2004 shabi at 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 at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Vorbis-dev mailing list