Median Filter for floating points

Apr 29, 2005 2 Replies

Hi Folks,



I was wondering what is the best way of finding the median of a floating point array in hardware. I am currently thinking of using a bit voter scheme for fixed point but I don't think this will be able to differentiate the exponent in the floating point. Would I have to adopt a sorting method for floating?



Any help will be useful.



Thanks



Paul


Floating point numbers (at least in IEEE representation) sort in the same way as integers; any FP number with exponent e+1 is larger than any FP number with exponent e. Just think of them as 32- or 64-bit numbers, and use the integer median algorithm.

I wonder why you want to use hardware for median of an FP array, when it's a nearly-linear-time algorithm in software. You want the Yth-largest element. So pick a random element X, partition the array into X counting how many elements were Y elements

Why do you want to do this in hardware? The answer to your question depends much on why. How many numbers might you have, how fast do they come in, and how fast do you need the result? How many times will you be doing this? Otherwise...

As long as they all have the same sign. If you convert the entire word to twos complement, then they will sort independent of sign. That is, if the sign bit is a '1' complement the rest of the bits and add one. (The PDP-10 does that, though it isn't IEEE.) Well, you need to do a twos complement comparison, or just invert the sign bit first.

-- glen

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required