• Home
  • Raw
  • Download

Lines Matching refs:enc

40 static void ResetSegmentHeader(VP8Encoder* const enc) {  in ResetSegmentHeader()  argument
41 VP8EncSegmentHeader* const hdr = &enc->segment_hdr_; in ResetSegmentHeader()
42 hdr->num_segments_ = enc->config_->segments; in ResetSegmentHeader()
47 static void ResetFilterHeader(VP8Encoder* const enc) { in ResetFilterHeader() argument
48 VP8EncFilterHeader* const hdr = &enc->filter_hdr_; in ResetFilterHeader()
55 static void ResetBoundaryPredictions(VP8Encoder* const enc) { in ResetBoundaryPredictions() argument
59 uint8_t* const top = enc->preds_ - enc->preds_w_; in ResetBoundaryPredictions()
60 uint8_t* const left = enc->preds_ - 1; in ResetBoundaryPredictions()
61 for (i = -1; i < 4 * enc->mb_w_; ++i) { in ResetBoundaryPredictions()
64 for (i = 0; i < 4 * enc->mb_h_; ++i) { in ResetBoundaryPredictions()
65 left[i * enc->preds_w_] = B_DC_PRED; in ResetBoundaryPredictions()
67 enc->nz_[-1] = 0; // constant in ResetBoundaryPredictions()
95 static void MapConfigToTools(VP8Encoder* const enc) { in MapConfigToTools() argument
96 const WebPConfig* const config = enc->config_; in MapConfigToTools()
99 enc->method_ = method; in MapConfigToTools()
100 enc->rd_opt_level_ = (method >= 6) ? RD_OPT_TRELLIS_ALL in MapConfigToTools()
104 enc->max_i4_header_bits_ = in MapConfigToTools()
109 enc->mb_header_limit_ = in MapConfigToTools()
110 (score_t)256 * 510 * 8 * 1024 / (enc->mb_w_ * enc->mb_h_); in MapConfigToTools()
112 enc->thread_level_ = config->thread_level; in MapConfigToTools()
114 enc->do_search_ = (config->target_size > 0 || config->target_PSNR > 0); in MapConfigToTools()
117 enc->use_tokens_ = (enc->rd_opt_level_ >= RD_OPT_BASIC); // need rd stats in MapConfigToTools()
119 if (enc->use_tokens_) { in MapConfigToTools()
120 enc->num_parts_ = 1; // doesn't work with multi-partition in MapConfigToTools()
146 VP8Encoder* enc; in InitVP8Encoder() local
153 const size_t preds_size = preds_w * preds_h * sizeof(*enc->preds_); in InitVP8Encoder()
155 const size_t nz_size = (mb_w + 1) * sizeof(*enc->nz_) + WEBP_ALIGN_CST; in InitVP8Encoder()
156 const size_t info_size = mb_w * mb_h * sizeof(*enc->mb_info_); in InitVP8Encoder()
158 2 * top_stride * sizeof(*enc->y_top_) // top-luma/u/v in InitVP8Encoder()
161 config->autofilter ? sizeof(*enc->lf_stats_) + WEBP_ALIGN_CST : 0; in InitVP8Encoder()
164 mb_w * sizeof(*enc->top_derr_) : 0; in InitVP8Encoder()
166 const uint64_t size = (uint64_t)sizeof(*enc) // main struct in InitVP8Encoder()
186 sizeof(*enc) + WEBP_ALIGN_CST, info_size, in InitVP8Encoder()
206 enc = (VP8Encoder*)mem; in InitVP8Encoder()
207 mem = (uint8_t*)WEBP_ALIGN(mem + sizeof(*enc)); in InitVP8Encoder()
208 memset(enc, 0, sizeof(*enc)); in InitVP8Encoder()
209 enc->num_parts_ = 1 << config->partitions; in InitVP8Encoder()
210 enc->mb_w_ = mb_w; in InitVP8Encoder()
211 enc->mb_h_ = mb_h; in InitVP8Encoder()
212 enc->preds_w_ = preds_w; in InitVP8Encoder()
213 enc->mb_info_ = (VP8MBInfo*)mem; in InitVP8Encoder()
215 enc->preds_ = mem + 1 + enc->preds_w_; in InitVP8Encoder()
217 enc->nz_ = 1 + (uint32_t*)WEBP_ALIGN(mem); in InitVP8Encoder()
219 enc->lf_stats_ = lf_stats_size ? (LFStats*)WEBP_ALIGN(mem) : NULL; in InitVP8Encoder()
224 enc->y_top_ = mem; in InitVP8Encoder()
225 enc->uv_top_ = enc->y_top_ + top_stride; in InitVP8Encoder()
227 enc->top_derr_ = top_derr_size ? (DError*)mem : NULL; in InitVP8Encoder()
229 assert(mem <= (uint8_t*)enc + size); in InitVP8Encoder()
231 enc->config_ = config; in InitVP8Encoder()
232 enc->profile_ = use_filter ? ((config->filter_type == 1) ? 0 : 1) : 2; in InitVP8Encoder()
233 enc->pic_ = picture; in InitVP8Encoder()
234 enc->percent_ = 0; in InitVP8Encoder()
236 MapConfigToTools(enc); in InitVP8Encoder()
238 VP8DefaultProbas(enc); in InitVP8Encoder()
239 ResetSegmentHeader(enc); in InitVP8Encoder()
240 ResetFilterHeader(enc); in InitVP8Encoder()
241 ResetBoundaryPredictions(enc); in InitVP8Encoder()
243 VP8EncInitAlpha(enc); in InitVP8Encoder()
249 VP8TBufferInit(&enc->tokens_, (int)(mb_w * mb_h * 4 * scale)); in InitVP8Encoder()
251 return enc; in InitVP8Encoder()
254 static int DeleteVP8Encoder(VP8Encoder* enc) { in DeleteVP8Encoder() argument
256 if (enc != NULL) { in DeleteVP8Encoder()
257 ok = VP8EncDeleteAlpha(enc); in DeleteVP8Encoder()
258 VP8TBufferClear(&enc->tokens_); in DeleteVP8Encoder()
259 WebPSafeFree(enc); in DeleteVP8Encoder()
271 static void FinalizePSNR(const VP8Encoder* const enc) { in FinalizePSNR() argument
272 WebPAuxStats* stats = enc->pic_->stats; in FinalizePSNR()
273 const uint64_t size = enc->sse_count_; in FinalizePSNR()
274 const uint64_t* const sse = enc->sse_; in FinalizePSNR()
283 static void StoreStats(VP8Encoder* const enc) { in StoreStats() argument
285 WebPAuxStats* const stats = enc->pic_->stats; in StoreStats()
289 stats->segment_level[i] = enc->dqm_[i].fstrength_; in StoreStats()
290 stats->segment_quant[i] = enc->dqm_[i].quant_; in StoreStats()
292 stats->residual_bytes[s][i] = enc->residual_bytes_[s][i]; in StoreStats()
295 FinalizePSNR(enc); in StoreStats()
296 stats->coded_size = enc->coded_size_; in StoreStats()
298 stats->block_count[i] = enc->block_count_[i]; in StoreStats()
302 WebPReportProgress(enc->pic_, 100, &enc->percent_); // done! in StoreStats()
349 VP8Encoder* enc = NULL; in WebPEncode() local
376 enc = InitVP8Encoder(config, pic); in WebPEncode()
377 if (enc == NULL) return 0; // pic->error is already set. in WebPEncode()
379 ok = VP8EncAnalyze(enc); in WebPEncode()
382 ok = ok && VP8EncStartAlpha(enc); // possibly done in parallel in WebPEncode()
383 if (!enc->use_tokens_) { in WebPEncode()
384 ok = ok && VP8EncLoop(enc); in WebPEncode()
386 ok = ok && VP8EncTokenLoop(enc); in WebPEncode()
388 ok = ok && VP8EncFinishAlpha(enc); in WebPEncode()
390 ok = ok && VP8EncWrite(enc); in WebPEncode()
391 StoreStats(enc); in WebPEncode()
393 VP8EncFreeBitWriters(enc); in WebPEncode()
395 ok &= DeleteVP8Encoder(enc); // must always be called, even if !ok in WebPEncode()