On Thu, Oct 4, 2012 at 6:12 PM, Steinar H. Gunderson
<sgunderson@???> wrote:
> So, the simple solution is to have a 32768-element array, and just use
> rand() % 32768. No off-by-ones needed. If you are on a PDP-11 and RAND_MAX
>...
> You generate two values in [0,32768> and then swap if a > b. That's not
> needed; you can just generate a=[0,32768> and b=[a,32768>, and you will be
> ...
> Yes, after the table lookup you have a float. The output of your filter is
> not a float; it's an int, and thus, you need a float-to-int conversion
> (in your case, you use an explicit cast to int). That conversion is not free
> (although it is relatively cheap if you have SSE2).
You're (probably) correct on all these points. I'm just not good
enough of a C programmer to contest your assertions.
My goal here is to to add functionality to Flowblade by doing ports
from gimp / jhlabs / gstreamer, and to create plugins that are as good
as I can make them. I've been able to make this plugin a bit faster;
if you're capable of further improving it, submit a patch that does
the changes that you suggest.
BTW, if you're looking for a challenge, port some of these to Frei0r.
Doing the mental mapping from Java to C can be fun, and if you're
interested in math needed for graphics programming you may learn
something.
http://www.jhlabs.com/ip/filters/index.html