Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ Moderated > Re: Look-up tab...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 5 Topic 9543 of 9775
Post > Topic >>

Re: Look-up table with anonymous functions

by Francis Glassborow <francis.glassborow@[EMAIL PROTECTED] > Apr 29, 2008 at 10:37 AM

Simon Johan wrote:
> Hi all,
> 
> I'm programming some image convolutions which I want to speed up.When 
> convolving an image (two-dimensional array of integers) with a filter
matrix
> 
> (the same), the center of the filter is placed on every image pixel and
the 
> elements on top of each other are multiplied and summed. This implies
that a
> 
> lot of the same multiplications are performed and I got an optimization
idea
> 
> but I don't know if it is possible or practical in C++.
> 
> The idea is to generate a look-up table with all the computed 
> multiplications, so when an output pixel is to be calculated it only 
> multiplies numbers not previously multiplied. Otherwise it fetches the 
> result from the table. Provided that a look-up operation is faster than
a 
> multiplication, this will lead to speed improvements.
> 
I find it difficult to imagine any modern hardware where a lookup in a
dynamic table would be faster than an integer multiplication (division
could be different, but even that is getting pretty good on modern
processors)

There is a place for lookup tables but they need to be for operations
that are rather more computational demanding (20 years ago I used a 257
element (each 4 bytes) for sines and cosines (the table covered a right
angle and used linear interpolation for intermediate values, it actually
worked fast and efficiently)

-- 
      [ See http://www.gotw.ca/resources/clcm.htm
for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]
 




 5 Posts in Topic:
Look-up table with anonymous functions
"Simon Johan" &  2008-04-24 15:43:19 
Re: Look-up table with anonymous functions
Greg Herlihy <greghe@[  2008-04-25 10:14:20 
Re: Look-up table with anonymous functions
Le Chaud Lapin <jaibud  2008-04-28 23:29:06 
Re: Look-up table with anonymous functions
Francis Glassborow <fr  2008-04-29 10:37:33 
Re: Look-up table with anonymous functions
Alan McKenney <alan_mc  2008-04-30 17:02:10 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Jul 8 23:22:30 CDT 2008.