Search found 1945 matches

by NicolasRobidoux
2010-09-10T17:26:29-07:00
Forum: Developers
Topic: Cheaper sinc computation for resize.c
Replies: 83
Views: 144815

Re: Cheaper sinc computation for resize.c

I did the same tests Anthony did on my 3 year old laptop with Intel Core 2 and 2GB running 64 bit mint, namely time convert -size 10000000x1 xc: \ -filter SincPolynomial -set option:filter:window SincPolynomial \ -resize 1000x1 null: and a similar one with just Sinc, and I got best of 5 Real time 8....
by NicolasRobidoux
2010-09-10T08:33:08-07:00
Forum: Developers
Topic: Cheaper sinc computation for resize.c
Replies: 83
Views: 144815

Re: Cheaper sinc computation for resize.c

Anthony Thyssen privately pointed out that I had changed the behavior of the gaussian filter. I, indeed, had misread the code (I'm used to formulas having spacing to group things; what a lame excuse!). In any case, here is code which computes the gaussian filter with three multiplies and a call to t...
by NicolasRobidoux
2010-09-10T08:20:56-07:00
Forum: Developers
Topic: Cheaper sinc computation for resize.c
Replies: 83
Views: 144815

Re: Cheaper sinc computation for resize.c

... Update: On my work machine (3 years old) with a Dual Core processor, with OpenMP enabled, the above Lanczos tests, using a starting image 1/10 the length (yes it is that much of an older and slower machine) produced... time convert -size 10000000x1 xc: \ -filter Sinc -set option:filter:window S...
by NicolasRobidoux
2010-09-10T06:02:41-07:00
Forum: Developers
Topic: Cheaper Blackman computation for resize.c
Replies: 13
Views: 22794

Re: Cheaper Blackman computation for resize.c

anthony wrote:I have not delved into assembly since my university days. Most of my actual work is with shell and perl scripts. The only real C programming I get is in the adding of new code to ImageMagick.
Looking at what resample.c does, you don't seem to be doing too badly.
by NicolasRobidoux
2010-09-09T19:31:21-07:00
Forum: Developers
Topic: Cheaper sinc computation for resize.c
Replies: 83
Views: 144815

Re: Cheaper sinc computation for resize.c

P.S. The following is FINE. (Thanks Chantal. Note to self: Do not triple check things when called to make dinner.) How to compute all lanczos n with only ONE TRIG CALL Summary: You can use a recursive formula for the sines of multiples of an angle (http://en.wikipedia.org/wiki/List_of_trigonometric_...
by NicolasRobidoux
2010-09-09T19:13:11-07:00
Forum: Developers
Topic: Cheaper sinc computation for resize.c
Replies: 83
Views: 144815

Re: Cheaper sinc computation for resize.c

Oops! The lanczos 3 snippet actually only needs 6 flops, B/C MagickPI*MagickPI is computed at compile time.
by NicolasRobidoux
2010-09-09T18:03:08-07:00
Forum: Developers
Topic: Cheaper sinc computation for resize.c
Replies: 83
Views: 144815

Re: Cheaper sinc computation for resize.c

Can this be generalized? You mean: Can Chantal and I produce some magical formula which computes Sinc(x)Sinc(x/n) with one trig call for arbitrary positive integer n? Answer: No. We can only do things one n at a time, and for some n's, it's going to be really complicated. ----- With separate formul...
by NicolasRobidoux
2010-09-09T07:15:35-07:00
Forum: Developers
Topic: Cheaper sinc computation for resize.c
Replies: 83
Views: 144815

Re: Cheaper sinc computation for resize.c

Anthony:

Thanks for the updated benchmarks.

-----

If you want me to revert the Q32 version so that the "within 1 guarantee" holds, let me know.
by NicolasRobidoux
2010-09-09T06:43:09-07:00
Forum: Developers
Topic: Cheaper sinc computation for resize.c
Replies: 83
Views: 144815

Re: Cheaper sinc computation for resize.c

I've not triple-checked my recent changes at all quantum levels.

May take me a while.
by NicolasRobidoux
2010-09-09T06:37:42-07:00
Forum: Developers
Topic: Cheaper sinc computation for resize.c
Replies: 83
Views: 144815

Re: Cheaper sinc computation for resize.c

My last mods to resize.c for a while (gotta teach): 1) Loosened the error a bit for Q32 (and cut four flops). Now it's 2.2e-8 < 1/2^25. At least in principle, filtering with SincPolynomial may now deviate from "infinite precision" sinc by more than 1 for 32-bit output images. 2) Added a very high pr...
by NicolasRobidoux
2010-09-09T04:28:12-07:00
Forum: Developers
Topic: Cheaper sinc computation for resize.c
Replies: 83
Views: 144815

Re: Cheaper sinc computation for resize.c

(Note completely fit to IM, but just so you get the picture one "lanczos 3 with one trig call".) /* Sinc(x)*Sinc(x/3) refactored by Nicolas Robidoux and Chantal Racette down to two conditionals, 1 trig call and 7 flops. */ const double xx = x*x; if (xx == 0.0) return(1.0); if (xx <= 9.0) { const dou...
by NicolasRobidoux
2010-09-09T04:23:24-07:00
Forum: Developers
Topic: Cheaper sinc computation for resize.c
Replies: 83
Views: 144815

Re: Cheaper sinc computation for resize.c

It can. If the compiler defines doubles as being really floats. IM will happilly accept that. In this case, I won't propose a very high order version of Sinc to use with quantum > 32. I'll stick to "moderate" levels of approximation. (Bye bye e-17.) --------- Question: As I mentioned before, the "P...
by NicolasRobidoux
2010-09-09T03:50:58-07:00
Forum: Developers
Topic: Cheaper Blackman computation for resize.c
Replies: 13
Views: 22794

Re: Cheaper Blackman computation for resize.c

Perhaps all the constants like MagickPI should have that 'L' for double float added to the end. (set in "magick/image-private.h") Appending an "L" to all the pi-related #define constants will have the unfortunate side effect of making all computations in which the constant appears be done in long d...
by NicolasRobidoux
2010-09-08T19:54:54-07:00
Forum: Developers
Topic: Cheaper sinc computation for resize.c
Replies: 83
Views: 144815

Re: Cheaper sinc computation for resize.c

Arcane question:

Should I code assuming that IM may be compiled on a chip on which long doubles are actually no larger than ordinary doubles?
by NicolasRobidoux
2010-09-08T15:22:53-07:00
Forum: Developers
Topic: Cheaper Blackman computation for resize.c
Replies: 13
Views: 22794

Re: Cheaper Blackman computation for resize.c

Well, I did it anyway. You can find the obsessive-compulsive result (which should give slightly more precise results, esp. when MagickRealType = long double) here: http://web.cs.laurentian.ca/nrobidoux/misc/IM/resize.c A few flops disappeared here and there. The one "nontrivial" thing I did was add ...