int VP8EncAnalyze(VP8Encoder* const enc) { int ok = 1; const int do_segments = (enc->segment_hdr_.num_segments_ > 1) || (enc->method_ <= 2); // for methods 0,1,2, we need preds_[] to be filled. if (do_segments) { int alphas[MAX_ALPHA + 1] = { 0 }; VP8EncIterator it; VP8IteratorInit(enc, &it); enc->uv_alpha_ = 0; do { VP8IteratorImport(&it); MBAnalyze(&it, alphas, &enc->uv_alpha_); ok = VP8IteratorProgress(&it, 20); // Let's pretend we have perfect lossless reconstruction. } while (ok && VP8IteratorNext(&it, it.yuv_in_)); enc->uv_alpha_ /= enc->mb_w_ * enc->mb_h_; if (ok) AssignSegments(enc, alphas); } else { // Use only one default segment. int n; for (n = 0; n < enc->mb_w_ * enc->mb_h_; ++n) { DefaultMBInfo(&enc->mb_info_[n]); } // Default susceptibilities. enc->dqm_[0].alpha_ = 0; enc->dqm_[0].beta_ = 0; enc->uv_alpha_ = 0; // we can't compute this one. WebPReportProgress(enc->pic_, enc->percent_ + 20, &enc->percent_); } return ok; }
static void ResetAllMBInfo(VP8Encoder* const enc) { int n; for (n = 0; n < enc->mb_w_ * enc->mb_h_; ++n) { DefaultMBInfo(&enc->mb_info_[n]); } // Default susceptibilities. enc->dqm_[0].alpha_ = 0; enc->dqm_[0].beta_ = 0; // Note: we can't compute this alpha_ / uv_alpha_. WebPReportProgress(enc->pic_, enc->percent_ + 20, &enc->percent_); }
static void ResetAllMBInfo(VP8Encoder* const enc) { int n; for (n = 0; n < enc->mb_w_ * enc->mb_h_; ++n) { DefaultMBInfo(&enc->mb_info_[n]); } enc->dqm_[0].alpha_ = 0; enc->dqm_[0].beta_ = 0; WebPReportProgress(enc->pic_, enc->percent_ + 20, &enc->percent_); }