I wonder if the following hack makes any change to
speed or audio quality. Add it to the library and see.
Trying it with the "if" commented out is also interesting.
BTW, inline assembly would allow use of the 40-bit
accumulator, increasing the fraction bits from 16 to 20.
//////////////////////////////////////////////////////////////////////
#define likely(x) __builtin_expect(!!(x),1)
#define unlikely(x) __builtin_expect(!!(x),0)
#ifdef _SOFT_FLOAT
int __mulsf3(unsigned f1, unsigned f2) __attribute__((visibility("hidden")));
int __mulsf3(unsigned f1, unsigned f2){
// might work well enough w/o this check >:-)
if(unlikely(!likely(f1&0x7f800000)||!likely(f2&0x7f800000)))
return 0;
unsigned newexp = (f1 & 0x7f800000) + (f2 & 0x7f800000) - (127<<23);
unsigned newsign = (f1^f2) & 0x80000000;
unsigned frac1 = f1 & 0x007fffff;
unsigned frac2 = f2 & 0x007fffff;
// w/o proper rounding, multiply and rebuild the 23-bit fraction
unsigned mulfrac = ((frac1>>7) * (frac2>>7))>>9;
unsigned newfrac = mulfrac + frac1 + frac2 + 0x00800000;
// newfrac is at most 0x01fffffd. CONTAINS EXPLICIT ONE
// this'd be a loop except we never shift by more than one
unsigned adjust = newfrac >> 24;
newfrac >>= adjust;
newexp += adjust<<23;
// ditch the explicit 1 bit
newfrac &= 0x007fffff;
return newsign | newexp | newfrac;
}
#endif
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
_______________________________________________
Freetel-codec2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freetel-codec2