Re: hardware image processing - log computation

Ray Andraka wrote in news: snipped-for-privacy@andraka.com:

Never divide by a constant... multiply by its reciprocal! -Stan

Unfortunately this algorithm is rather nasty to do in hardware, > requiring a multiply and divide at each iteration. Methods similar to > CORDIC and to hardware division are easier to implement in a hardware > design. > > Kip > >> The general approach to rapidly computing logarithms (used by Henry >> Briggs to generate the log tables he published in 1617) is to first >> reduce the problem to the computation of the logarithm of a value >> very near 1. Then use the power series >> >> log (1+x) = x - x^2/2 + x^3/3 - x^4/4 ...... >> >> to get a value of whatever accuracy you need. The "cleverness" is in >> how to creatively move the argument near 1. >> >> A full treatment of this is given in _Dead Reckoning - Calculating >> Without Instruments_ by Ronald Doerfler (ISBN 0-88415-087-9). >> >> Good luck. :-) >> >> Kip Ingram >> >> -- >> Get daily news and analysis from the FPGA market for pennies a day. >> Subscribe to >> The FPGA Roundup today:
formatting link
>> >> -- >> > [snip] >> > > The ip algorithm requires that I compute logarithms. This can >> > > prove quite a computationally expensive operation, but I only >> > > need accuracy down to around 4/5 significant figures. >> > [snip] >> > > This method is inexpensive but gives limited accuracy. >> > > Operations shown below >> > > >> > > >> > > z = a + b*mant + c*mant^2 + d*mant^3; >> > > >> > > if (e ~= 0) >> > > z = z + exp * C1; >> > > end; >> > > >> > > This requires 6* and 4+. >> > >> > Hi Tim, >> > I don't have anything to add to the existing discussion >> > of logs (sorry), but if you are evaluating polynomials, >> > you should be aware of Horner's rule ( a personal favorite ): >> > >> > a + b*x + c*x^2 + d*x^3 = >> > ( a + x*(b + x*(c + x*d ) ) ) >> > >> > this reduces your 6 mults (??? 7) to 3 (??? 4). >> > >> > [snip] >> > >> > > >> > > Thanks very much for your time. >> > > >> > > Tim >> > > > > -- > --Ray Andraka, P.E. > President, the Andraka Consulting Group, Inc. > 401/884-7930 Fax 401/884-7950 > email snipped-for-privacy@andraka.com >
formatting link
> > "They that give up essential liberty to obtain a little > temporary safety deserve neither liberty nor safety." > -Benjamin Franklin, 1759 > > >
Reply to
Stan
Loading thread data ...

Who said anything about the divisor being a constant?

--

--Ray Andraka, P.E. President, the Andraka Consulting Group, Inc.

401/884-7930 Fax 401/884-7950 email snipped-for-privacy@andraka.com
formatting link

"They that give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin, 1759

Reply to
Ray Andraka

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.