MCPcopy Create free account
hub / github.com/Tencent/libpag / VP8LGetInfo

Function VP8LGetInfo

src/codec/utils/WebpDecoder.cpp:359–377  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

357}
358
359int VP8LGetInfo(const uint8_t* data, size_t data_size, int* const width, int* const height,
360 int* const has_alpha) {
361 if (data == nullptr || data_size < VP8L_FRAME_HEADER_SIZE) {
362 return 0; // not enough data
363 } else if (!VP8LCheckSignature(data, data_size)) {
364 return 0; // bad signature
365 } else {
366 int w, h, a;
367 VP8LBitReader br;
368 VP8LInitBitReader(&br, data, data_size);
369 if (!ReadImageInfo(&br, &w, &h, &a)) {
370 return 0;
371 }
372 if (width != nullptr) *width = w;
373 if (height != nullptr) *height = h;
374 if (has_alpha != nullptr) *has_alpha = a;
375 return 1;
376 }
377}
378
379static VP8StatusCode ParseHeadersInternal(const uint8_t* data, size_t data_size, int* const width,
380 int* const height, int* const has_alpha,

Callers 1

ParseHeadersInternalFunction · 0.85

Calls 3

VP8LCheckSignatureFunction · 0.85
VP8LInitBitReaderFunction · 0.85
ReadImageInfoFunction · 0.85

Tested by

no test coverage detected