Lines Matching refs:wpi
76 int MuxImageFinalize(WebPMuxImage* const wpi) { in MuxImageFinalize() argument
77 const WebPChunk* const img = wpi->img_; in MuxImageFinalize()
88 if (is_lossless && (wpi->alpha_ != NULL)) { in MuxImageFinalize()
89 ChunkDelete(wpi->alpha_); in MuxImageFinalize()
90 wpi->alpha_ = NULL; in MuxImageFinalize()
92 wpi->width_ = w; in MuxImageFinalize()
93 wpi->height_ = h; in MuxImageFinalize()
94 wpi->has_alpha_ = vp8l_has_alpha || (wpi->alpha_ != NULL); in MuxImageFinalize()
100 WebPMuxImage* const wpi) { in MuxImageParse() argument
106 WebPChunk** unknown_chunk_list = &wpi->unknown_; in MuxImageParse()
110 assert(!wpi->is_partial_); in MuxImageParse()
121 ChunkSetHead(&subchunk, &wpi->header_); in MuxImageParse()
122 wpi->is_partial_ = 1; // Waiting for ALPH and/or VP8/VP8L chunks. in MuxImageParse()
137 if (wpi->alpha_ != NULL) goto Fail; // Consecutive ALPH chunks. in MuxImageParse()
138 if (ChunkSetHead(&subchunk, &wpi->alpha_) != WEBP_MUX_OK) goto Fail; in MuxImageParse()
139 wpi->is_partial_ = 1; // Waiting for a VP8 chunk. in MuxImageParse()
142 if (wpi->img_ != NULL) goto Fail; // Only 1 image chunk allowed. in MuxImageParse()
143 if (ChunkSetHead(&subchunk, &wpi->img_) != WEBP_MUX_OK) goto Fail; in MuxImageParse()
144 if (!MuxImageFinalize(wpi)) goto Fail; in MuxImageParse()
145 wpi->is_partial_ = 0; // wpi is completely filled. in MuxImageParse()
148 if (wpi->is_partial_) { in MuxImageParse()
163 if (wpi->is_partial_) goto Fail; in MuxImageParse()
180 WebPMuxImage* wpi = NULL; in WebPMuxCreateInternal() local
232 wpi = (WebPMuxImage*)WebPSafeMalloc(1ULL, sizeof(*wpi)); in WebPMuxCreateInternal()
233 if (wpi == NULL) goto Err; in WebPMuxCreateInternal()
234 MuxImageInit(wpi); in WebPMuxCreateInternal()
248 if (wpi->alpha_ != NULL) goto Err; // Consecutive ALPH chunks. in WebPMuxCreateInternal()
249 if (ChunkSetHead(&chunk, &wpi->alpha_) != WEBP_MUX_OK) goto Err; in WebPMuxCreateInternal()
250 wpi->is_partial_ = 1; // Waiting for a VP8 chunk. in WebPMuxCreateInternal()
253 if (ChunkSetHead(&chunk, &wpi->img_) != WEBP_MUX_OK) goto Err; in WebPMuxCreateInternal()
254 if (!MuxImageFinalize(wpi)) goto Err; in WebPMuxCreateInternal()
255 wpi->is_partial_ = 0; // wpi is completely filled. in WebPMuxCreateInternal()
258 if (MuxImagePush(wpi, &mux->images_) != WEBP_MUX_OK) goto Err; in WebPMuxCreateInternal()
259 MuxImageInit(wpi); // Reset for reading next image. in WebPMuxCreateInternal()
262 if (wpi->is_partial_) goto Err; // Previous wpi is still incomplete. in WebPMuxCreateInternal()
263 if (!MuxImageParse(&chunk, copy_data, wpi)) goto Err; in WebPMuxCreateInternal()
267 if (wpi->is_partial_) goto Err; // Encountered a non-image chunk before in WebPMuxCreateInternal()
287 if (wpi->is_partial_) goto Err; in WebPMuxCreateInternal()
292 MuxImageDelete(wpi); in WebPMuxCreateInternal()
297 MuxImageDelete(wpi); in WebPMuxCreateInternal()
338 const WebPMuxImage* const wpi = mux->images_; in MuxGetCanvasInfo() local
344 assert(wpi != NULL); in MuxGetCanvasInfo()
345 w = wpi->width_; in MuxGetCanvasInfo()
346 h = wpi->height_; in MuxGetCanvasInfo()
348 if (wpi != NULL) { in MuxGetCanvasInfo()
349 if (wpi->has_alpha_) f |= ALPHA_FLAG; in MuxGetCanvasInfo()
387 static WebPMuxError SynthesizeBitstream(const WebPMuxImage* const wpi, in SynthesizeBitstream() argument
392 const int need_vp8x = (wpi->alpha_ != NULL); in SynthesizeBitstream()
394 const size_t alpha_size = need_vp8x ? ChunkDiskSize(wpi->alpha_) : 0; in SynthesizeBitstream()
397 ChunkDiskSize(wpi->img_); in SynthesizeBitstream()
402 assert(wpi->alpha_ == NULL || wpi->alpha_->next_ == NULL); in SynthesizeBitstream()
403 assert(wpi->img_ != NULL && wpi->img_->next_ == NULL); in SynthesizeBitstream()
409 dst = EmitVP8XChunk(dst, wpi->width_, wpi->height_, ALPHA_FLAG); // VP8X. in SynthesizeBitstream()
410 dst = ChunkListEmit(wpi->alpha_, dst); // ALPH. in SynthesizeBitstream()
414 dst = ChunkListEmit(wpi->img_, dst); in SynthesizeBitstream()
443 static WebPMuxError MuxGetImageInternal(const WebPMuxImage* const wpi, in MuxGetImageInternal() argument
452 info->id = ChunkGetIdFromTag(wpi->img_->tag_); in MuxGetImageInternal()
453 return SynthesizeBitstream(wpi, &info->bitstream); in MuxGetImageInternal()
456 static WebPMuxError MuxGetFrameInternal(const WebPMuxImage* const wpi, in MuxGetFrameInternal() argument
458 const int is_frame = (wpi->header_->tag_ == kChunks[IDX_ANMF].tag); in MuxGetFrameInternal()
461 assert(wpi->header_ != NULL); // Already checked by WebPMuxGetFrame(). in MuxGetFrameInternal()
463 frame_data = &wpi->header_->data_; in MuxGetFrameInternal()
475 frame->id = ChunkGetIdFromTag(wpi->header_->tag_); in MuxGetFrameInternal()
476 return SynthesizeBitstream(wpi, &frame->bitstream); in MuxGetFrameInternal()
482 WebPMuxImage* wpi; in WebPMuxGetFrame() local
490 err = MuxImageGetNth((const WebPMuxImage**)&mux->images_, nth, &wpi); in WebPMuxGetFrame()
494 if (wpi->header_ == NULL) { in WebPMuxGetFrame()
495 return MuxGetImageInternal(wpi, frame); in WebPMuxGetFrame()
497 return MuxGetFrameInternal(wpi, frame); in WebPMuxGetFrame()