Re: not enough compressed data

Cosmin Truta <[email protected]>
Newsgroups gmane.comp.graphics.png.devel
Message-ID <CAAoVtZzB3=ccF2e5Cic7ib4mQa5EeNZhc-fbZfQCDD5dDd1Niw@mail.gmail.com>
Glenn Randers-Pehrson wrote:
> The mozilla team is requesting that "not enough compressed data" be
> a png_benign_error instead of a png_error.  Objections>

I'd rather not change it, which is ok, because the issue raised by the
Mozilla team can be handled at the application level. I've done
something similar in OptiPNG, when I implemented the option "-fix".

It's one thing to discard spurious compressed input data with a benign
error, and no other fuss. It's different when there's not enough
compressed input, and that's no longer benign. The decision originally
made in the libpng implementation on this matter is the correct one.

Applications may choose to interpret the errors on their own, though.
In the case of OptiPNG, for example, the user may have
incompletely-downloaded, or incorrectly-constructed, or
specially-crafted bad PNGs, and that user may want to salvage whatever
is available, by the means of "optipng -fix".

Here is how it works:

By default, in libpng, success of decoding is classified in two
obvious categories: (1) has no severe errors, and (2) has severe
errors. In OptiPNG, there are three: (1) has no severe errors, (2a)
has severe errors but also some pixel data, and (2b) has severe errors
and no pixel data. They can make a similar classification in Mozilla,
then make their choice for (2a). And it can all be implemented with
plain old libpng API.

In fact, in OptiPNG, "benign-ness" of errors isn't even considered.
Over there, it's only plain opng_error() and opng_warning(), followed
by an a-posteriori look at what kind of image data was successfully
decoded, and what does the user want to do about the unsuccessful part
of it. There isn't a generic "right" or "wrong" answer, only
application-level decisions, and libpng itself should stay neutral.

Sincerely,
Cosmin

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.