Search found 1945 matches

by NicolasRobidoux
2010-09-08T14:01:34-07:00
Forum: Developers
Topic: Cheaper Blackman computation for resize.c
Replies: 13
Views: 22588

Re: Cheaper Blackman computation for resize.c

Anthony: There are a number of very small improvements that could be done to the code. Perfectionist improvements, one may call them. Maybe even a cosmetic waste of your time. I'd like to know if you are interested in me going through the code for such. I'm not talking about things which do make som...
by NicolasRobidoux
2010-09-07T14:39:28-07:00
Forum: Developers
Topic: Cheaper sinc computation for resize.c
Replies: 83
Views: 143342

Re: Cheaper sinc computation for resize.c

Anthony:

This is all wonderful.

More later.

nicolas
by NicolasRobidoux
2010-09-06T19:45:44-07:00
Forum: Developers
Topic: Cheaper sinc computation for resize.c
Replies: 83
Views: 143342

Re: Cheaper sinc computation for resize.c

Anthony: Given the (apparently) heavy caching of coefficient values in resize.c, would you agree that there is little to be gained by using an approximate, as opposed to "exact", Sinc, even if the approximate one is much faster? Of course I'd like to boast that my stuff is in IM, but not to the exte...
by NicolasRobidoux
2010-09-06T09:12:53-07:00
Forum: Developers
Topic: Cheaper sinc computation for resize.c
Replies: 83
Views: 143342

Re: Cheaper sinc computation for resize.c

In light of the above discussion, I think that it may be a good thing if I produce a version with slightly tighter tolerances. That is, up to c7 for up to 8-bit, up to c9 for up to 16-bit. c11 (the current version) should be more than enough for up to 32-bit, and above, c13 should take care of up to...
by NicolasRobidoux
2010-09-06T04:05:17-07:00
Forum: Developers
Topic: Cheaper sinc computation for resize.c
Replies: 83
Views: 143342

Re: Cheaper sinc computation for resize.c

I do not mind seeing a faster version, but would it really provide any great speed increase? The filter is only setup one for each row and column of the output image, and the results cached for that whole row and column. I come from the "pull" (demand driven) world (VIPS and GEGL), and had forgotte...
by NicolasRobidoux
2010-09-05T19:00:00-07:00
Forum: Developers
Topic: Cheaper sinc computation for resize.c
Replies: 83
Views: 143342

Re: Cheaper sinc computation for resize.c

I'm just mentioning this so it's out there (even though I don't think it's really useful). Given that IM computes with long doubles (when quantum-depth is high), we could produce versions of most of the filtering kernels (Sinc, for example) for which filtering results are within 1 or the "infinite p...
by NicolasRobidoux
2010-09-05T13:16:20-07:00
Forum: Developers
Topic: Cheaper sinc computation for resize.c
Replies: 83
Views: 143342

Re: Cheaper sinc computation for resize.c

I just added an 8-bit quantumdepth version. The new code is at

http://web.cs.laurentian.ca/nrobidoux/misc/IM/resize.c

A minor typo is also fixed in the brand new blackman code comments.

This code is based on today's SVN, so it's "on top" of Cristy's recent svn commits.
by NicolasRobidoux
2010-09-04T17:26:04-07:00
Forum: Developers
Topic: Cheaper Blackman computation for resize.c
Replies: 13
Views: 22588

Cheaper Blackman computation for resize.c

Suggested code only needs one trig call instead of two and two muladds and one * instead of two muladds and two *. static MagickRealType Blackman(const MagickRealType x, const ResizeFilter *magick_unused(resize_filter)) { /* Blackman: 2rd Order cosine windowing function: .42 + .5 cos(pi x) + .08 cos...
by NicolasRobidoux
2010-09-04T14:42:20-07:00
Forum: Developers
Topic: Cheaper sinc computation for resize.c
Replies: 83
Views: 143342

Re: Cheaper sinc computation for resize.c

There is something I forgot to take into account in my error estimates :

It is that generally the filter is used twice, once in each direction. This doubles all the relative error estimates given above for the filtering results.
by NicolasRobidoux
2010-09-04T05:00:08-07:00
Forum: Developers
Topic: Cheaper sinc computation for resize.c
Replies: 83
Views: 143342

Re: Cheaper sinc computation for resize.c

One last thing (before I move on to approximating other kernels): The difference between the frequency response obtained with the Quantum_Depth <= 16 Sinc approximation and the frequency response of the "infinite precision" Sinc is minuscule. So, if it is the quality of the results which matter, as ...
by NicolasRobidoux
2010-09-03T07:03:27-07:00
Forum: Developers
Topic: Cheaper sinc computation for resize.c
Replies: 83
Views: 143342

Re: Cheaper sinc computation for resize.c

I just double checked, and the maximum relative error for the QuantumDepth = 16 approximate sinc when used to filter with lanczos 2 or lanczos 3 is 2.5e-5 < 2/(2^16-1) = 3.1e-5. So, my earlier statement that using it is guaranteed to lead to an answer within 2 of using infinite precision lanczos2 or...
by NicolasRobidoux
2010-09-02T06:17:19-07:00
Forum: Developers
Topic: Cheaper sinc computation for resize.c
Replies: 83
Views: 143342

Re: Cheaper sinc computation for resize.c

Thank you. ----- Sorry for being so picky about such a small piece of code, but I recommend that if (x == 0.0) return(1.0); be removed. If, for whatever reason, you want to leave it there, I will produce a slightly inferior version of the approximations which is not affected by Sinc(0) being hardwir...
by NicolasRobidoux
2010-08-31T23:42:50-07:00
Forum: Developers
Topic: Cheaper sinc computation for resize.c
Replies: 83
Views: 143342

Re: Cheaper sinc computation for resize.c

So that people not have to download the source from my web site to look at it, here is the key new piece of resize.c. static MagickRealType Sinc(const MagickRealType x, const ResizeFilter *magick_unused(resize_filter)) { const MagickRealType xx = x*x; if (xx <= 16.0) { /* Approximations of the sinc ...
by NicolasRobidoux
2010-08-31T22:28:01-07:00
Forum: Developers
Topic: Cheaper sinc computation for resize.c
Replies: 83
Views: 143342

Re: Cheaper sinc computation for resize.c

Forgive me again for sticking my nose in. I would suggest that it might be useful for evaluation purposes to see a graph showing the difference in the "fast" sinc from the more formal "exact" one and a difference graph and error measure. Thus, if differences are significant enough (or results diffe...
by NicolasRobidoux
2010-08-31T21:48:17-07:00
Forum: Developers
Topic: Cheaper sinc computation for resize.c
Replies: 83
Views: 143342

Re: Cheaper sinc computation for resize.c

I just put an updated version of resize.c at http://web.cs.laurentian.ca/nrobidoux/misc/IM/resize.c I'm a bit short on time right now, but I would like to explain a few things, very quickly: 1) A polynomial is used if |x|<=4 which, I understand, is the overwhelming majority of calls to Sinc. If |x|>...