Re: bsr-algorithm?
- From: Terje Mathisen <spamtrap@xxxxxxxxxx>
- Date: Fri, 23 May 2008 08:29:17 +0200
spamtrap wrote:
:-)Why didn't you tell us that up front?
Didn't expect somebody want's to crack his head with me.
Please specify exactly what your input format is, and what you need as
the final output!
My input format is any integer-type, my output is any float-format
(even custom ones with let's say 1.15.16).
So what you're really trying to do is to write a custom int->fp conversion algorithm, instead of using one of the formats that the hw supports directly, and which will be orders of magnitude faster?
OK, in that case you absolutely have to use the hw for all inputs that can use the built-in conversion operations, then fixup this result when you need something else!
I.e. assume you need 1:6:9 for a 16-bit float format:
Convert first to 1:8:23 (i.e. standard float!), then inspect the result and clamp it to Inf if the absolute value is too large.
Even with 64-bit inputs you can never need more than 7 biased bits to hold the exponent, so float has enough precision for this field, no matter what.
The only problem you can have is with the mantissa, if the input does have more than 53 significant bits, right?
Well, even that can be handled exactly with the x87 extended/long double (80-bit fp in 1:15:64 format), but at that point you have to give up on SIMD SSE processing.
Doing clamping is of course trivial in both SSE and MMX.
As usual, when you explain the real problem, the fast solution is totally different from what you initially expected.
Good luck!
Terje
--
- <Terje.Mathisen@xxxxxxxxxxxxx>
"almost all programming can be viewed as an exercise in caching"
.
- Follow-Ups:
- Re: bsr-algorithm?
- From: spamtrap
- Re: bsr-algorithm?
- References:
- bsr-algorithm?
- From: spamtrap
- Re: bsr-algorithm?
- From: Terje Mathisen
- Re: bsr-algorithm?
- From: spamtrap
- Re: bsr-algorithm?
- From: Terje Mathisen
- Re: bsr-algorithm?
- From: spamtrap
- bsr-algorithm?
- Prev by Date: Re: bsr-algorithm?
- Next by Date: Re: bsr-algorithm?
- Previous by thread: Re: bsr-algorithm?
- Next by thread: Re: bsr-algorithm?
- Index(es):