On Tue, Feb 22, 2000 at 03:24:44PM -0800, Kevin Turner <Kevin.Turner@xxxxxxxxxxx> wrote: > is, do you use three seperate buffers, or a single buffer like RGB data > is commonly in? I am not sure of this one-- people will surely want > rgb data in one buffer, but my experience suggests that if you are Something I only mentioned to Daniel before: When we meet Hollywood (which means a multitude of new datatypes) these kind of problems only get worse. WARNING: LONG TIME IDEA, THIS IS NOT 1.2 STUFF ;-> PDL (who already has the problem of multiple data) solved the problem through a (kind-of) preprocessor. You write: pp_def 'polynomial', Pars => 'coeffs(n); x(m); [o]out(m)', Doc => 'evaluate the polynomial with coefficients C<coeffs> at the position(s) C<x>. C<coeffs[0]> is the constant term.', Code => q! loop(m) %{ $GENERIC() x = 1; $GENERIC() o = 0; loop(n) %{ o += $coeffs() * x; x *= $x(); %} $out() = o; %} ! ; And PDL automatically creates many different versions for different usage patterns (affine transformations or linear buffers, which datatype), and the compiler generates optimal code (at least it has the chance to), for example it could choose to use altivec or katmai instructions to parallelize byte-sized calculations. The code after the "Code =>" clause is actually C-code, with datatype declarations replaced by macros. REALLY IMPORTANT NOTE: I do _not_ think the syntax is great (I think the syntax is 'orrible), but I think the idea of generating many functions from one is a good idea. In C, it might look like this: #BEGIN GENERIC(unsigned char, int, float) void rgb2hsv(GENERIC *r, GENERIC *g, GENERIC *b) { GENERIC temp1 ... } #END or something similar... Affine transformations would help, but need slightly more control, like: #BEGIN GENERIC(unsigned char, int, float) void rgb2hsv(GENERIC *r, GENERIC *g, GENERIC *b) { GENERIC temp1 #LOOP #g = #r + #b; #ENDLOOP } #END -- -----==- | ----==-- _ | ---==---(_)__ __ ____ __ Marc Lehmann +-- --==---/ / _ \/ // /\ \/ / pcg@xxxxxxxxxxxxx |e| -=====/_/_//_/\_,_/ /_/\_\ XX11-RIPE --+ The choice of a GNU generation | |