[EMAIL PROTECTED] on  wrote...
| We need to investigate further but ImageMagick appears to be slower
| because it now uses a more sophisticated resampling algorithm-- for swirl,
| implode, and wave-- rather than the previous interpolation algorithm.
|
| Anthony wrote the algorithm so he can explain why resampling is better
| than straight interpolation.  However, its possible to set the image
| filter to revert to the previous interpolation algorithm.  We will still
| need a few days to investigate further.  In the mean-time we did replace
| the XML DOM parser with a SAX parser in 6.4.5-0 so that should reduce
| some startup time.
| 
| Will get back to you in a few days.

I never said it was better for those functions.  In fact at the time the
change occurred, I was against it being used so universally.
But it was done before I know what had happened, it was working.

It was also pointed out that the API interface was cleaner and more well
defined, with proper initialization, working functions, and finalization
methods. The older method by contrast used methods from multiple areas
of the IM API to initialize and finalize the proceedures.


The Details...

The Resampling algorithm was a wrapper around the old "Interpolated
Pixel Lookup" function (single value lookup from the source image),
I created it for use by the new image distortion functions which was
being co-developed at the same time.

See the whole section in IM Examples:   General Distortion Techniques
  http://www.imagemagick.org/Usage/distorts/#summary
for an explaination o fthe various techniques involved.

Basically it takes not only the point of the lookup, but also 4 scaling
factors (actually two scaling vectors) which it uses to do a
cylindrically filters elliptical area, when the scaling is larger than
one.   That is it allows for correct anti-aliasing filtering in areas
where a distortion shrinks an image into a smaller area,  especially in
the extreme case of  tiled perspective distortion.

Special Thanks goes to Fred Weinhaus for his help with the algorithm.

This is in actal fact very simular to Imge Resizing (Shrinking Images)
except that resize uses a two pass one dimensional filter, where area
resampling is a single pass 2 dimentional cylindrical filter, with
variable (localized) scaling.  This is also slower than resize but more
freeform whcih is needed for generalized distortions.

It isn't even quite finished as it is currently using a blurry gaussian
filter which was part of the original algorithms definition, by default,
and while other filters can be used, the filters have a 'limited' suport
factor handling (to get technical).

This multiple point area lookup is automatically disabled if the scaling
factors are not used (only -distort uses them), the scaling is smaller
than 1 (enlargement), or the setting   -filter point   is set.  In this
case it just calls the old interpolated pixel lookup.

However the algorthim still needs fee form access to the image requiring
some extra setup and handling of the image chache. Which is where the
slower speed is comming in, even if the area resampling aspect is NOT used.

After I added the Area resampling function, and with some mis-givings by
myself, most of the other functions were modified to start using this
'wrapper', even though none of those functions even needed area
resampling, only the point lookup.

At this time ONLY DistortImage() actually needs to perform
area-resampling. Though eventually I would expect other functions like
the planned replacement for   Distortion and Displacement LUT Mapping
to also use this method.

All other operators, which are only doing single 'point' lookups, does
not need to use Area Resampling, and could be changed back to the direct
use of the simpler Interpolated Point Sampling.  This will improve IM
speed back to previous levels.


  Anthony Thyssen ( System Programmer )    <[EMAIL PROTECTED]>
 -----------------------------------------------------------------------------
       "Never argue with a computer.'   --   Avon, "Blake's 7"
 -----------------------------------------------------------------------------
     Anthony's Home is his Castle     http://www.cit.gu.edu.au/~anthony/
_______________________________________________
Magick-developers mailing list
Magick-developers@imagemagick.org
http://studio.imagemagick.org/mailman/listinfo/magick-developers

Reply via email to