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

--- Comment #7 from Tim Starling <[email protected]> 2011-12-06 00:15:34 
UTC ---
(In reply to comment #5)
> The whole problem is that the PNG reader is WIO instead of PIO right? I'm
> wondering whether it is easier to write a PIO PNG reader for VIPS than to fix
> all the memory leaks a things like that in pngds. It was my first C project, 
> so
> it is probably rather leaky and buggy.

Yes, the problem is that it's WIO rather than PIO. Have a look at
read_tilewise() versus read_stripwise() in im_tiff2vips.c. In read_tilewise(),
im_generate() is called, which is the main PIO function. 

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.

Maybe if an out-of-order region is requested, we can just make a temporary copy
of the whole image and serve subsequent requests from that copy.

There's a comment in im_png2vips.c: "Noninterlaced images can be read without
needing enough RAM for the whole image." Maybe I was misled by it. Both 
png2vips_interlace() and png2vips_noninterlace() call im_outcheck(), which will
allocate a full-size temporary image either in memory or on disk.
png2vips_interlace() is allocating a second full-size buffer, so it'll require
twice as much total storage space as an uncompressed image.

I think a PIO version of png2vips_noninterlace() for upstream inclusion would
be a good project, and more likely to be of use to the rest of the world than
pngds.

-- 
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
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to