I see that I've not been constructive, so let me post something
contstructive today :-)
You can easily "loose the floating point". This will make things somewhat
faster on most processors.
This is elementary "fixed point calculations".
float ip;
int iip, ap;
int array [MAX_ARRAY];
ip /* Interpolation position */ = ..... ;
/* the "ip" can be a float value, if it is 33.4 we want 60% of the
33rd and 40% of the 34th value. */
ap = ip;
iip = (ip * 256) - (ap * 256);
/* rv becomes 256 times the value you really want.... */
rv = array[ap] * (256-iip) + array[ap+1] * (iip);
/* so we scale it back. We could forget this if the output format
can use the extra bits... */
rv >>= 8;
Regards,
Roger.
-- If it's there and you can see it, it's REAL |___R.E.Wolff@BitWizard.nl | If it's there and you can't see it, it's TRANSPARENT | Tel: +31-15-2137555 | If it's not there and you can see it, it's VIRTUAL |__FAX:_+31-15-2138217 | If it's not there and you can't see it, it's GONE! -- Roy Wilks, 1983 |_____|
-- Source code, list archive, and docs: http://www.mostang.com/sane/ To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com