mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 06:08:21 +01:00
WebPGetFeatures() out of if condition for clarity.
Also, some comment tweaks in decode.h Change-Id: I9d4e80f2ffdc51d35bd3215486e26448bddd143b
This commit is contained in:
parent
6933d91057
commit
988b8f56b3
@ -234,19 +234,22 @@ static ParseStatus StoreFrame(int frame_num, uint32_t min_size,
|
||||
case MKFOURCC('V', 'P', '8', ' '):
|
||||
case MKFOURCC('V', 'P', '8', 'L'):
|
||||
if (image_chunks == 0) {
|
||||
// Extract the bitstream features, tolerating failures when the data
|
||||
// is incomplete.
|
||||
WebPBitstreamFeatures features;
|
||||
ChunkData* const image = frame->img_components_;
|
||||
++image_chunks;
|
||||
image->offset_ = chunk_start_offset;
|
||||
image->size_ = chunk_size;
|
||||
// Extract the width and height from the bitstream, tolerating
|
||||
// failures when the data is incomplete.
|
||||
if ((WebPGetFeatures(mem->buf_ + image->offset_, image->size_,
|
||||
&features) != VP8_STATUS_OK) &&
|
||||
status != PARSE_NEED_MORE_DATA) {
|
||||
const VP8StatusCode vp8_status =
|
||||
WebPGetFeatures(mem->buf_ + chunk_start_offset, chunk_size,
|
||||
&features);
|
||||
if (status == PARSE_NEED_MORE_DATA &&
|
||||
vp8_status == VP8_STATUS_NOT_ENOUGH_DATA) {
|
||||
return PARSE_NEED_MORE_DATA;
|
||||
} else if (vp8_status != VP8_STATUS_OK) {
|
||||
// We have enough data, and yet WebPGetFeatures() failed.
|
||||
return PARSE_ERROR;
|
||||
}
|
||||
|
||||
++image_chunks;
|
||||
frame->img_components_[0].offset_ = chunk_start_offset;
|
||||
frame->img_components_[0].size_ = chunk_size;
|
||||
frame->width_ = features.width;
|
||||
frame->height_ = features.height;
|
||||
if (has_vp8l_alpha != NULL) *has_vp8l_alpha = features.has_alpha;
|
||||
|
@ -412,8 +412,8 @@ WEBP_EXTERN(VP8StatusCode) WebPGetFeaturesInternal(
|
||||
// Retrieve features from the bitstream. The *features structure is filled
|
||||
// with information gathered from the bitstream.
|
||||
// Returns VP8_STATUS_OK when the features are successfully retrieved. Returns
|
||||
// VP8_STATUS_NOT_ENOUGH_DATA when more data is needed to retrieved the
|
||||
// features. Returns error in other cases.
|
||||
// VP8_STATUS_NOT_ENOUGH_DATA when more data is needed to retrieve the
|
||||
// features from headers. Returns error in other cases.
|
||||
static WEBP_INLINE VP8StatusCode WebPGetFeatures(
|
||||
const uint8_t* data, size_t data_size,
|
||||
WebPBitstreamFeatures* features) {
|
||||
|
Loading…
Reference in New Issue
Block a user