https://bugzilla.wikimedia.org/show_bug.cgi?id=32721

John Cupitt <jcup...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jcup...@gmail.com

--- Comment #8 from John Cupitt <jcup...@gmail.com> 2012-02-08 14:16:08 UTC ---
(this was part of an email chain, posting here for reference, I hope that's OK)

(In reply to comment #7)
> The challenge for writing an im_generate() callback for PNG is that the 
> regions
> could be requested any order, due to some other part of the pipeline calling
> im_prepare(). For example im_flipver() looks like it reads the source image
> from bottom to top. It probably doesn't matter for us in practice, the
> transforms we're interested in will probably request regions in strips from 
> top
> to bottom, so a row buffer like in pngds will allow the necessary tiles or
> strips to be generated efficiently. But it will matter if we want to get our
> patch accepted upstream.

I've added this to vips master, build that and you should get the new option. 

There's a new flag to the PNG loader called "sequential". Setting this option
means "I promise to only request pixels top-to-bottom". This is fine for
thumbnailing, but will obviously break for things like up-down flip. If you try
an up-down flip despite setting :sequential you'll get an error.

With the flag set, the PNG loader pretends to hand out pixels on demand.
There's a cache of (currently) 256 scan lines behind the read point to give the
downstream operations a little leeway.

Benchmarks --- old behaviour:

$ time vips --vips-leak im_shrink Chicago.png tn.jpg 36 36
memory: high-water mark 12.05 MB
real    0m7.744s
user    0m5.104s
sys    0m1.104s

Memuse is low but sys is high because a large temp image is being created and
deleted.

With the :seq flag enabled:

$ time vips --vips-leak im_shrink Chicago.png:seq tn.jpg 36 36
memory: high-water mark 45.54 MB
real    0m5.289s
user    0m5.424s
sys    0m0.136s

Memuse is higher (it's caching many more pixels now), but real time is lower
and sys is much lower since it's no longer creating the 400 MB intermediate
file.

I've also updated vipsthumbnail to automatically turn on :seq mode for all png
images. This program should make downsized images as good as ImageMagick
(hopefully).

$ time vipsthumbnail --vips-leak Chicago.png --size 800 -p bicubic
memory: high-water mark 34.53 MB
real    0m5.751s
user    0m5.376s
sys    0m0.176s

I'll add the :seq flag to the jpeg and tiff readers as well. It should be in
the upcoming 7.28 stable release.

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to