Lines Matching refs:enc
162 static void SetupMatrices(VP8Encoder* enc) {
165 (enc->method_ >= 4) ? enc->config_->sns_strength
167 const int num_segments = enc->segment_hdr_.num_segments_;
169 VP8SegmentInfo* const m = &enc->dqm_[i];
172 m->y1_.q_[0] = kDcTable[clip(q + enc->dq_y1_dc_, 0, 127)];
175 m->y2_.q_[0] = kDcTable[ clip(q + enc->dq_y2_dc_, 0, 127)] * 2;
176 m->y2_.q_[1] = kAcTable2[clip(q + enc->dq_y2_ac_, 0, 127)];
178 m->uv_.q_[0] = kDcTable[clip(q + enc->dq_uv_dc_, 0, 117)];
179 m->uv_.q_[1] = kAcTable[clip(q + enc->dq_uv_ac_, 0, 127)];
206 static void SetupFilterStrength(VP8Encoder* const enc) {
208 const int level0 = enc->config_->filter_strength;
211 const int level = level0 * 256 * enc->dqm_[i].quant_ / 128;
212 const int f = level / (256 + enc->dqm_[i].beta_);
213 enc->dqm_[i].fstrength_ = (f < FSTRENGTH_CUTOFF) ? 0 : (f > 63) ? 63 : f;
216 enc->filter_hdr_.level_ = enc->dqm_[0].fstrength_;
217 enc->filter_hdr_.simple_ = (enc->config_->filter_type == 0);
218 enc->filter_hdr_.sharpness_ = enc->config_->filter_sharpness;
267 static void SimplifySegments(VP8Encoder* const enc) {
269 const int num_segments = enc->segment_hdr_.num_segments_;
273 const VP8SegmentInfo* const S1 = &enc->dqm_[s1];
277 const VP8SegmentInfo* const S2 = &enc->dqm_[s2];
286 enc->dqm_[num_final_segments] = enc->dqm_[s1];
292 int i = enc->mb_w_ * enc->mb_h_;
293 while (i-- > 0) enc->mb_info_[i].segment_ = map[enc->mb_info_[i].segment_];
294 enc->segment_hdr_.num_segments_ = num_final_segments;
297 enc->dqm_[i] = enc->dqm_[num_final_segments - 1];
302 void VP8SetSegmentParams(VP8Encoder* const enc, float quality) {
305 const int num_segments = enc->segment_hdr_.num_segments_;
306 const double amp = SNS_TO_DQ * enc->config_->sns_strength / 100. / 128.;
308 const double c_base = enc->config_->emulate_jpeg_size ?
309 QualityToJPEGCompression(Q, enc->alpha_ / 255.) :
314 const double expn = 1. - amp * enc->dqm_[i].alpha_;
318 enc->dqm_[i].quant_ = clip(q, 0, 127);
322 enc->base_quant_ = enc->dqm_[0].quant_;
326 enc->dqm_[i].quant_ = enc->base_quant_;
332 dq_uv_ac = (enc->uv_alpha_ - MID_ALPHA) * (MAX_DQ_UV - MIN_DQ_UV)
335 dq_uv_ac = dq_uv_ac * enc->config_->sns_strength / 100;
341 dq_uv_dc = -4 * enc->config_->sns_strength / 100;
344 enc->dq_y1_dc_ = 0; // TODO(skal): dq-lum
345 enc->dq_y2_dc_ = 0;
346 enc->dq_y2_ac_ = 0;
347 enc->dq_uv_dc_ = dq_uv_dc;
348 enc->dq_uv_ac_ = dq_uv_ac;
350 SetupFilterStrength(enc); // initialize segments' filtering, eventually
352 if (num_segments > 1) SimplifySegments(enc);
354 SetupMatrices(enc); // finalize quantization matrices
370 const VP8Encoder* const enc = it->enc_;
371 const uint8_t* const left = it->x_ ? enc->y_left_ : NULL;
372 const uint8_t* const top = it->y_ ? enc->y_top_ + it->x_ * 16 : NULL;
377 const VP8Encoder* const enc = it->enc_;
378 const uint8_t* const left = it->x_ ? enc->u_left_ : NULL;
379 const uint8_t* const top = it->y_ ? enc->uv_top_ + it->x_ * 16 : NULL;
651 const VP8Encoder* const enc = it->enc_;
654 const VP8SegmentInfo* const dqm = &enc->dqm_[it->mb_->segment_];
698 const VP8Encoder* const enc = it->enc_;
700 const VP8SegmentInfo* const dqm = &enc->dqm_[it->mb_->segment_];
719 const VP8Encoder* const enc = it->enc_;
722 const VP8SegmentInfo* const dqm = &enc->dqm_[it->mb_->segment_];
771 const VP8Encoder* const enc = it->enc_;
772 const VP8SegmentInfo* const dqm = &enc->dqm_[it->mb_->segment_];
822 const VP8Encoder* const enc = it->enc_;
823 const VP8SegmentInfo* const dqm = &enc->dqm_[it->mb_->segment_];
831 if (enc->max_i4_header_bits_ == 0) {
877 total_header_bits > enc->max_i4_header_bits_) {
898 const VP8Encoder* const enc = it->enc_;
899 const VP8SegmentInfo* const dqm = &enc->dqm_[it->mb_->segment_];
937 const VP8Encoder* const enc = it->enc_;
947 it->preds_[(it->i4_ & 3) + (it->i4_ >> 2) * enc->preds_w_];