Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(628)

Unified Diff: source/libvpx/vp9/encoder/vp9_ratectrl.c

Issue 478033002: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_quantize.c ('k') | source/libvpx/vp9/encoder/vp9_rd.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: source/libvpx/vp9/encoder/vp9_ratectrl.c
===================================================================
--- source/libvpx/vp9/encoder/vp9_ratectrl.c (revision 290053)
+++ source/libvpx/vp9/encoder/vp9_ratectrl.c (working copy)
@@ -104,7 +104,7 @@
// q based adjustment to baseline enumerator
enumerator += (int)(enumerator * q) >> 12;
- return (int)(0.5 + (enumerator * correction_factor / q));
+ return (int)(enumerator * correction_factor / q);
}
static int estimate_bits_at_q(FRAME_TYPE frame_type, int q, int mbs,
@@ -277,7 +277,7 @@
if (cpi->common.frame_type == KEY_FRAME) {
return rc->rate_correction_factors[KF_STD];
- } else if (cpi->pass == 2) {
+ } else if (cpi->oxcf.pass == 2) {
RATE_FACTOR_LEVEL rf_lvl =
cpi->twopass.gf_group.rf_level[cpi->twopass.gf_group.index];
return rc->rate_correction_factors[rf_lvl];
@@ -296,7 +296,7 @@
if (cpi->common.frame_type == KEY_FRAME) {
rc->rate_correction_factors[KF_STD] = factor;
- } else if (cpi->pass == 2) {
+ } else if (cpi->oxcf.pass == 2) {
RATE_FACTOR_LEVEL rf_lvl =
cpi->twopass.gf_group.rf_level[cpi->twopass.gf_group.index];
rc->rate_correction_factors[rf_lvl] = factor;
@@ -923,7 +923,7 @@
int vp9_rc_pick_q_and_bounds(const VP9_COMP *cpi,
int *bottom_index, int *top_index) {
int q;
- if (cpi->pass == 0) {
+ if (cpi->oxcf.pass == 0) {
if (cpi->oxcf.rc_mode == VPX_CBR)
q = rc_pick_q_and_bounds_one_pass_cbr(cpi, bottom_index, top_index);
else
@@ -991,7 +991,7 @@
// this frame refreshes means next frames don't unless specified by user
rc->frames_since_golden = 0;
- if (cpi->pass == 2) {
+ if (cpi->oxcf.pass == 2) {
if (!rc->source_alt_ref_pending &&
cpi->twopass.gf_group.rf_level[0] == GF_ARF_STD)
rc->source_alt_ref_active = 0;
@@ -1208,7 +1208,7 @@
? INT_MAX : (int)(rc->starting_buffer_level / 2);
} else {
int kf_boost = 32;
- double framerate = oxcf->framerate;
+ double framerate = cpi->framerate;
if (svc->number_temporal_layers > 1 &&
oxcf->rc_mode == VPX_CBR) {
// Use the layer framerate for temporal layers CBR mode.
@@ -1236,26 +1236,31 @@
cm->frame_type = KEY_FRAME;
rc->source_alt_ref_active = 0;
- if (cpi->use_svc && cpi->svc.number_temporal_layers == 1) {
+ if (is_spatial_svc(cpi)) {
cpi->svc.layer_context[cpi->svc.spatial_layer_id].is_key_frame = 1;
+ cpi->ref_frame_flags &=
+ (~VP9_LAST_FLAG & ~VP9_GOLD_FLAG & ~VP9_ALT_FLAG);
}
- if (cpi->pass == 0 && cpi->oxcf.rc_mode == VPX_CBR) {
+ if (cpi->oxcf.pass == 0 && cpi->oxcf.rc_mode == VPX_CBR) {
target = calc_iframe_target_size_one_pass_cbr(cpi);
}
} else {
cm->frame_type = INTER_FRAME;
- if (cpi->use_svc && cpi->svc.number_temporal_layers == 1) {
+ if (is_spatial_svc(cpi)) {
LAYER_CONTEXT *lc = &cpi->svc.layer_context[cpi->svc.spatial_layer_id];
if (cpi->svc.spatial_layer_id == 0) {
lc->is_key_frame = 0;
} else {
lc->is_key_frame = cpi->svc.layer_context[0].is_key_frame;
+ if (lc->is_key_frame)
+ cpi->ref_frame_flags &= (~VP9_LAST_FLAG);
}
+ cpi->ref_frame_flags &= (~VP9_ALT_FLAG);
}
- if (cpi->pass == 0 && cpi->oxcf.rc_mode == VPX_CBR) {
+ if (cpi->oxcf.pass == 0 && cpi->oxcf.rc_mode == VPX_CBR) {
target = calc_pframe_target_size_one_pass_cbr(cpi);
}
}
@@ -1359,7 +1364,7 @@
RATE_CONTROL *const rc = &cpi->rc;
int vbr_max_bits;
- rc->avg_frame_bandwidth = (int)(oxcf->target_bandwidth / oxcf->framerate);
+ rc->avg_frame_bandwidth = (int)(oxcf->target_bandwidth / cpi->framerate);
rc->min_frame_bandwidth = (int)(rc->avg_frame_bandwidth *
oxcf->two_pass_vbrmin_section / 100);
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_quantize.c ('k') | source/libvpx/vp9/encoder/vp9_rd.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698