mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-16 22:09:57 +02:00
Add support for raw lossless bitstream in decoder.
Previously, it used to assume any raw bitstream is a VP8 one. Also, - Factor out VP8CheckSignature() & VP8LCheckSignature(). - Use a local var for *data_ptr in ParseVP8Header() for readability. Change-Id: I0fa8aa177dad7865e00c8898f7e7ce76a9db19d5
This commit is contained in:
@ -78,11 +78,15 @@ static int DecodeImageStream(int xsize, int ysize,
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
int VP8LCheckSignature(const uint8_t* const data, size_t size) {
|
||||
return (size >= 1) &&
|
||||
(data[0] == VP8L_MAGIC_BYTE || data[0] == VP8L_MAGIC_BYTE_RSVD);
|
||||
}
|
||||
|
||||
static int ReadImageSize(VP8LBitReader* const br,
|
||||
int* const width, int* const height) {
|
||||
const int signature = VP8LReadBits(br, 8);
|
||||
if (signature != VP8L_MAGIC_BYTE &&
|
||||
signature != VP8L_MAGIC_BYTE_RSVD) {
|
||||
const uint8_t signature = VP8LReadBits(br, 8);
|
||||
if (!VP8LCheckSignature(&signature, 1)) {
|
||||
return 0;
|
||||
}
|
||||
*width = VP8LReadBits(br, VP8L_IMAGE_SIZE_BITS) + 1;
|
||||
|
Reference in New Issue
Block a user