| 357 | } |
| 358 | |
| 359 | int 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 | |
| 379 | static VP8StatusCode ParseHeadersInternal(const uint8_t* data, size_t data_size, int* const width, |
| 380 | int* const height, int* const has_alpha, |
no test coverage detected