On 19 March 2013 12:14, Pascal Massimino <
pascal.m...@gmail.com> wrote:
> actually, neither WebPGetInfo() nor WebPGetFeatures() need the full
> data to be available to verify the bitstream (and even get the width/height
> information). They only need the headers (roughly: ~60bytes, depending
> on the content) and can reasonably operate with truncated input.
> WebPGetFeatures() returns a finer diagnostic about input:
> * VP8_STATUS_OK if the header-parsing was OK
> * VP8_STATUS_NOT_ENOUGH_DATA if the header is not complete and
> more bytes are needed
> * any other error status if there's a real format error (like: invalid
> signature,
> damaged data, etc.) in the header.
This can be used if the header's length necessary for WebPGetInfo() is
known. Using this API will make sure that future versions of the webp
format with different signature will also be taken care of properly.
Is that documented some where? Just asking this just to make sure
future changes to WebPGetInfo() function will not break this code.
Note:
1. If the current documented header ("VP8 " / "VP8L" / "VP8X") will
not change in future then WebPDecoder::checkSignature() need not use
WebPGetInfo() function. As WebPDecoder::checkSignature()'s purpose is
just to check for the signature and determine the type of the image
and not to do anything else.
2. WebPDecoder::readHeader() reads the file contents fully to get the
height and width of the image. Reading full file content seems not
necessary. The information on size of the header needed for
WebPGetInfo() will be useful there also.
>
> (In fact, you even have a fully incremental decoding mode where input bytes
> can be processed as they arrive and attempted decoding. See WebPINewDecoder
> as a starting point).
>
Guess progressive decoding cannot be done in this case because OpenCV
reads the file contents (finds the length of the signature and reads
only that many bytes) and provides that data for signature comparison.
Thanks and Regards,
PrasannaKumar