• Home
  • Raw
  • Download

Lines Matching refs:enc

24 static int IsVP8XNeeded(const VP8Encoder* const enc) {  in IsVP8XNeeded()  argument
25 return !!enc->has_alpha_; // Currently the only case when VP8X is needed. in IsVP8XNeeded()
37 static WebPEncodingError PutRIFFHeader(const VP8Encoder* const enc, in PutRIFFHeader() argument
39 const WebPPicture* const pic = enc->pic_; in PutRIFFHeader()
51 static WebPEncodingError PutVP8XHeader(const VP8Encoder* const enc) { in PutVP8XHeader() argument
52 const WebPPicture* const pic = enc->pic_; in PutVP8XHeader()
58 assert(IsVP8XNeeded(enc)); in PutVP8XHeader()
62 if (enc->has_alpha_) { in PutVP8XHeader()
76 static WebPEncodingError PutAlphaChunk(const VP8Encoder* const enc) { in PutAlphaChunk() argument
77 const WebPPicture* const pic = enc->pic_; in PutAlphaChunk()
82 assert(enc->has_alpha_); in PutAlphaChunk()
85 PutLE32(alpha_chunk_hdr + TAG_SIZE, enc->alpha_data_size_); in PutAlphaChunk()
91 if (!pic->writer(enc->alpha_data_, enc->alpha_data_size_, pic)) { in PutAlphaChunk()
96 if ((enc->alpha_data_size_ & 1) && !PutPaddingByte(pic)) { in PutAlphaChunk()
149 static int PutWebPHeaders(const VP8Encoder* const enc, size_t size0, in PutWebPHeaders() argument
151 WebPPicture* const pic = enc->pic_; in PutWebPHeaders()
155 err = PutRIFFHeader(enc, riff_size); in PutWebPHeaders()
159 if (IsVP8XNeeded(enc)) { in PutWebPHeaders()
160 err = PutVP8XHeader(enc); in PutWebPHeaders()
165 if (enc->has_alpha_) { in PutWebPHeaders()
166 err = PutAlphaChunk(enc); in PutWebPHeaders()
175 err = PutVP8FrameHeader(pic, enc->profile_, size0); in PutWebPHeaders()
188 const VP8Encoder* const enc) { in PutSegmentHeader() argument
189 const VP8EncSegmentHeader* const hdr = &enc->segment_hdr_; in PutSegmentHeader()
190 const VP8EncProba* const proba = &enc->proba_; in PutSegmentHeader()
200 VP8PutSignedBits(bw, enc->dqm_[s].quant_, 7); in PutSegmentHeader()
203 VP8PutSignedBits(bw, enc->dqm_[s].fstrength_, 6); in PutSegmentHeader()
238 const VP8Encoder* const enc) { in PutQuant() argument
239 VP8PutBits(bw, enc->base_quant_, 7); in PutQuant()
240 VP8PutSignedBits(bw, enc->dq_y1_dc_, 4); in PutQuant()
241 VP8PutSignedBits(bw, enc->dq_y2_dc_, 4); in PutQuant()
242 VP8PutSignedBits(bw, enc->dq_y2_ac_, 4); in PutQuant()
243 VP8PutSignedBits(bw, enc->dq_uv_dc_, 4); in PutQuant()
244 VP8PutSignedBits(bw, enc->dq_uv_ac_, 4); in PutQuant()
248 static int EmitPartitionsSize(const VP8Encoder* const enc, in EmitPartitionsSize() argument
252 for (p = 0; p < enc->num_parts_ - 1; ++p) { in EmitPartitionsSize()
253 const size_t part_size = VP8BitWriterSize(enc->parts_ + p); in EmitPartitionsSize()
266 static int GeneratePartition0(VP8Encoder* const enc) { in GeneratePartition0() argument
267 VP8BitWriter* const bw = &enc->bw_; in GeneratePartition0()
268 const int mb_size = enc->mb_w_ * enc->mb_h_; in GeneratePartition0()
273 return WebPEncodingSetError(enc->pic_, VP8_ENC_ERROR_OUT_OF_MEMORY); in GeneratePartition0()
278 PutSegmentHeader(bw, enc); in GeneratePartition0()
279 PutFilterHeader(bw, &enc->filter_hdr_); in GeneratePartition0()
280 VP8PutBits(bw, enc->num_parts_ == 8 ? 3 : in GeneratePartition0()
281 enc->num_parts_ == 4 ? 2 : in GeneratePartition0()
282 enc->num_parts_ == 2 ? 1 : 0, 2); in GeneratePartition0()
283 PutQuant(bw, enc); in GeneratePartition0()
285 VP8WriteProbas(bw, &enc->proba_); in GeneratePartition0()
287 VP8CodeIntraModes(enc); in GeneratePartition0()
293 if (enc->pic_->stats) { in GeneratePartition0()
294 enc->pic_->stats->header_bytes[0] = (int)((pos2 - pos1 + 7) >> 3); in GeneratePartition0()
295 enc->pic_->stats->header_bytes[1] = (int)((pos3 - pos2 + 7) >> 3); in GeneratePartition0()
296 enc->pic_->stats->alpha_data_size = (int)enc->alpha_data_size_; in GeneratePartition0()
304 return WebPEncodingSetError(enc->pic_, VP8_ENC_ERROR_OUT_OF_MEMORY); in GeneratePartition0()
309 void VP8EncFreeBitWriters(VP8Encoder* const enc) { in VP8EncFreeBitWriters() argument
311 VP8BitWriterWipeOut(&enc->bw_); in VP8EncFreeBitWriters()
312 for (p = 0; p < enc->num_parts_; ++p) { in VP8EncFreeBitWriters()
313 VP8BitWriterWipeOut(enc->parts_ + p); in VP8EncFreeBitWriters()
317 int VP8EncWrite(VP8Encoder* const enc) { in VP8EncWrite() argument
318 WebPPicture* const pic = enc->pic_; in VP8EncWrite()
319 VP8BitWriter* const bw = &enc->bw_; in VP8EncWrite()
321 const int percent_per_part = task_percent / enc->num_parts_; in VP8EncWrite()
322 const int final_percent = enc->percent_ + task_percent; in VP8EncWrite()
328 ok = GeneratePartition0(enc); in VP8EncWrite()
334 3 * (enc->num_parts_ - 1); in VP8EncWrite()
335 for (p = 0; p < enc->num_parts_; ++p) { in VP8EncWrite()
336 vp8_size += VP8BitWriterSize(enc->parts_ + p); in VP8EncWrite()
344 if (IsVP8XNeeded(enc)) { // Add size for: VP8X header + data. in VP8EncWrite()
347 if (enc->has_alpha_) { // Add size for: ALPH header + data. in VP8EncWrite()
348 const uint32_t padded_alpha_size = enc->alpha_data_size_ + in VP8EncWrite()
349 (enc->alpha_data_size_ & 1); in VP8EncWrite()
361 ok = ok && PutWebPHeaders(enc, size0, vp8_size, riff_size) in VP8EncWrite()
363 && EmitPartitionsSize(enc, pic); in VP8EncWrite()
368 for (p = 0; p < enc->num_parts_; ++p) { in VP8EncWrite()
369 const uint8_t* const buf = VP8BitWriterBuf(enc->parts_ + p); in VP8EncWrite()
370 const size_t size = VP8BitWriterSize(enc->parts_ + p); in VP8EncWrite()
372 VP8BitWriterWipeOut(enc->parts_ + p); // will free the internal buffer. in VP8EncWrite()
373 ok = ok && WebPReportProgress(pic, enc->percent_ + percent_per_part, in VP8EncWrite()
374 &enc->percent_); in VP8EncWrite()
382 enc->coded_size_ = (int)(CHUNK_HEADER_SIZE + riff_size); in VP8EncWrite()
383 ok = ok && WebPReportProgress(pic, final_percent, &enc->percent_); in VP8EncWrite()