[vorbis-dev] optimizing float to int conversions

Tal tabir at actcom.net.il
Wed May 5 12:21:04 PDT 2004



We'll look into using sse code.
But I have a few questions:
Sse code is platform specific,
I need a method to distinguish between an AMD build to INTEL build,
I'm not that familiar with the build enviroment,
I suggest there will be a macro for each platform and one for a regular
build.

If you accept this idea then it has implications on other things as
well:
The dsp file should be changed elegantly
The instructions of how to build the project won't be straight forward.
Is there a way that the compiler itself will check if it runs over
INTEL/AMD and make the proper defines?
I would like to do such a change but I need someone with experience to
guide me how to do it in the most elegant way...
Maybe I could ask other open source programers for advice.

Tal.

<p>-----Original Message-----
From: owner-vorbis-dev at xiph.org [mailto:owner-vorbis-dev at xiph.org] On
Behalf Of dean gaudet
Sent: Wednesday, May 05, 2004 6:29 PM
To: vorbis-dev at xiph.org
Subject: Re: [vorbis-dev] optimizing float to int conversions

<p>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.

--- >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