Home | History | Annotate | Download | only in enc

Lines Matching refs:enc

160 static void SetupMatrices(VP8Encoder* enc) {
163 (enc->method_ >= 4) ? enc->config_->sns_strength
165 const int num_segments = enc->segment_hdr_.num_segments_;
167 VP8SegmentInfo* const m = &enc->dqm_[i];
170 m->y1_.q_[0] = kDcTable[clip(q + enc->dq_y1_dc_, 0, 127)];
173 m->y2_.q_[0] = kDcTable[ clip(q + enc->dq_y2_dc_, 0, 127)] * 2;
174 m->y2_.q_[1] = kAcTable2[clip(q + enc->dq_y2_ac_, 0, 127)];
176 m->uv_.q_[0] = kDcTable[clip(q + enc->dq_uv_dc_, 0, 117)];
177 m->uv_.q_[1] = kAcTable[clip(q + enc->dq_uv_ac_, 0, 127)];
204 static void SetupFilterStrength(VP8Encoder* const enc) {
206 const int level0 = enc->config_->filter_strength;
209 const int level = level0 * 256 * enc->dqm_[i].quant_ / 128;
210 const int f = level / (256 + enc->dqm_[i].beta_);
211 enc->dqm_[i].fstrength_ = (f < FSTRENGTH_CUTOFF) ? 0 : (f > 63) ? 63 : f;
214 enc->filter_hdr_.level_ = enc->dqm_[0].fstrength_;
215 enc->filter_hdr_.simple_ = (enc->config_->filter_type == 0);
216 enc->filter_hdr_.sharpness_ = enc->config_->filter_sharpness;
265 static void SimplifySegments(VP8Encoder* const enc) {
267 const int num_segments = enc->segment_hdr_.num_segments_;
271 const VP8SegmentInfo* const S1 = &enc->dqm_[s1];
275 const VP8SegmentInfo* const S2 = &enc->dqm_[s2];
284 enc->dqm_[num_final_segments] = enc->dqm_[s1];
290 int i = enc->mb_w_ * enc->mb_h_;
291 while (i-- > 0) enc->mb_info_[i].segment_ = map[enc->mb_info_[i].segment_];
292 enc->segment_hdr_.num_segments_ = num_final_segments;
295 enc->dqm_[i] = enc->dqm_[num_final_segments - 1];
300 void VP8SetSegmentParams(VP8Encoder* const enc, float quality) {
303 const int num_segments = enc->segment_hdr_.num_segments_;
304 const double amp = SNS_TO_DQ * enc->config_->sns_strength / 100. / 128.;
306 const double c_base = enc->config_->emulate_jpeg_size ?
307 QualityToJPEGCompression(Q, enc->alpha_ / 255.) :
312 const double expn = 1. - amp * enc->dqm_[i].alpha_;
316 enc->dqm_[i].quant_ = clip(q, 0, 127);
320 enc->base_quant_ = enc->dqm_[0].quant_;
324 enc->dqm_[i].quant_ = enc->base_quant_;
330 dq_uv_ac = (enc->uv_alpha_ - MID_ALPHA) * (MAX_DQ_UV - MIN_DQ_UV)
333 dq_uv_ac = dq_uv_ac * enc->config_->sns_strength / 100;
339 dq_uv_dc = -4 * enc->config_->sns_strength / 100;
342 enc->dq_y1_dc_ = 0; // TODO(skal): dq-lum
343 enc->dq_y2_dc_ = 0;
344 enc->dq_y2_ac_ = 0;
345 enc->dq_uv_dc_ = dq_uv_dc;
346 enc->dq_uv_ac_ = dq_uv_ac;
348 SetupFilterStrength(enc); // initialize segments' filtering, eventually
350 if (num_segments > 1) SimplifySegments(enc);
352 SetupMatrices(enc); // finalize quantization matrices
368 const VP8Encoder* const enc = it->enc_;
369 const uint8_t* const left = it->x_ ? enc->y_left_ : NULL;
370 const uint8_t* const top = it->y_ ? enc->y_top_ + it->x_ * 16 : NULL;
375 const VP8Encoder* const enc = it->enc_;
376 const uint8_t* const left = it->x_ ? enc->u_left_ : NULL;
377 const uint8_t* const top = it->y_ ? enc->uv_top_ + it->x_ * 16 : NULL;
649 const VP8Encoder* const enc = it->enc_;
652 const VP8SegmentInfo* const dqm = &enc->dqm_[it->mb_->segment_];
696 const VP8Encoder* const enc = it->enc_;
698 const VP8SegmentInfo* const dqm = &enc->dqm_[it->mb_->segment_];
717 const VP8Encoder* const enc = it->enc_;
720 const VP8SegmentInfo* const dqm = &enc->dqm_[it->mb_->segment_];
769 const VP8Encoder* const enc = it->enc_;
770 const VP8SegmentInfo* const dqm = &enc->dqm_[it->mb_->segment_];
820 const VP8Encoder* const enc = it->enc_;
821 const VP8SegmentInfo* const dqm = &enc->dqm_[it->mb_->segment_];
829 if (enc->max_i4_header_bits_ == 0) {
875 total_header_bits > enc->max_i4_header_bits_) {
896 const VP8Encoder* const enc = it->enc_;
897 const VP8SegmentInfo* const dqm = &enc->dqm_[it->mb_->segment_];
935 const VP8Encoder* const enc = it->enc_;
945 enc->preds_w_];