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

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

Issue 394353005: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 5 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_ratectrl.h ('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 284462)
+++ source/libvpx/vp9/encoder/vp9_ratectrl.c (working copy)
@@ -424,6 +424,16 @@
}
}
+static int get_kf_active_quality(const RATE_CONTROL *const rc, int q) {
+ return get_active_quality(q, rc->kf_boost, kf_low, kf_high,
+ kf_low_motion_minq, kf_high_motion_minq);
+}
+
+static int get_gf_active_quality(const RATE_CONTROL *const rc, int q) {
+ return get_active_quality(q, rc->gfu_boost, gf_low, gf_high,
+ arfgf_low_motion_minq, arfgf_high_motion_minq);
+}
+
static int calc_active_worst_quality_one_pass_vbr(const VP9_COMP *cpi) {
const RATE_CONTROL *const rc = &cpi->rc;
const unsigned int curr_frame = cpi->common.current_video_frame;
@@ -523,11 +533,8 @@
double q_adj_factor = 1.0;
double q_val;
- active_best_quality = get_active_quality(rc->avg_frame_qindex[KEY_FRAME],
- rc->kf_boost,
- kf_low, kf_high,
- kf_low_motion_minq,
- kf_high_motion_minq);
+ active_best_quality =
+ get_kf_active_quality(rc, rc->avg_frame_qindex[KEY_FRAME]);
// Allow somewhat lower kf minq with small image formats.
if ((cm->width * cm->height) <= (352 * 288)) {
@@ -552,9 +559,7 @@
} else {
q = active_worst_quality;
}
- active_best_quality = get_active_quality(
- q, rc->gfu_boost, gf_low, gf_high,
- arfgf_low_motion_minq, arfgf_high_motion_minq);
+ active_best_quality = get_gf_active_quality(rc, q);
} else {
// Use the lower of active_worst_quality and recent/average Q.
if (cm->current_video_frame > 1) {
@@ -657,11 +662,8 @@
double q_adj_factor = 1.0;
double q_val;
- active_best_quality = get_active_quality(rc->avg_frame_qindex[KEY_FRAME],
- rc->kf_boost,
- kf_low, kf_high,
- kf_low_motion_minq,
- kf_high_motion_minq);
+ active_best_quality =
+ get_kf_active_quality(rc, rc->avg_frame_qindex[KEY_FRAME]);
// Allow somewhat lower kf minq with small image formats.
if ((cm->width * cm->height) <= (352 * 288)) {
@@ -690,10 +692,7 @@
if (q < cq_level)
q = cq_level;
- active_best_quality = get_active_quality(q, rc->gfu_boost,
- gf_low, gf_high,
- arfgf_low_motion_minq,
- arfgf_high_motion_minq);
+ active_best_quality = get_gf_active_quality(rc, q);
// Constrained quality use slightly lower active best.
active_best_quality = active_best_quality * 15 / 16;
@@ -702,14 +701,10 @@
if (!cpi->refresh_alt_ref_frame) {
active_best_quality = cq_level;
} else {
- active_best_quality = get_active_quality(
- q, rc->gfu_boost, gf_low, gf_high,
- arfgf_low_motion_minq, arfgf_high_motion_minq);
+ active_best_quality = get_gf_active_quality(rc, q);
}
} else {
- active_best_quality = get_active_quality(
- q, rc->gfu_boost, gf_low, gf_high,
- arfgf_low_motion_minq, arfgf_high_motion_minq);
+ active_best_quality = get_gf_active_quality(rc, q);
}
} else {
if (oxcf->rc_mode == VPX_Q) {
@@ -810,11 +805,7 @@
double q_adj_factor = 1.0;
double q_val;
// Baseline value derived from cpi->active_worst_quality and kf boost.
- active_best_quality = get_active_quality(active_worst_quality,
- rc->kf_boost,
- kf_low, kf_high,
- kf_low_motion_minq,
- kf_high_motion_minq);
+ active_best_quality = get_kf_active_quality(rc, active_worst_quality);
// Allow somewhat lower kf minq with small image formats.
if ((cm->width * cm->height) <= (352 * 288)) {
@@ -846,10 +837,7 @@
if (q < cq_level)
q = cq_level;
- active_best_quality = get_active_quality(q, rc->gfu_boost,
- gf_low, gf_high,
- arfgf_low_motion_minq,
- arfgf_high_motion_minq);
+ active_best_quality = get_gf_active_quality(rc, q);
// Constrained quality use slightly lower active best.
active_best_quality = active_best_quality * 15 / 16;
@@ -858,14 +846,10 @@
if (!cpi->refresh_alt_ref_frame) {
active_best_quality = cq_level;
} else {
- active_best_quality = get_active_quality(
- q, rc->gfu_boost, gf_low, gf_high,
- arfgf_low_motion_minq, arfgf_high_motion_minq);
+ active_best_quality = get_gf_active_quality(rc, q);
}
} else {
- active_best_quality = get_active_quality(
- q, rc->gfu_boost, gf_low, gf_high,
- arfgf_low_motion_minq, arfgf_high_motion_minq);
+ active_best_quality = get_gf_active_quality(rc, q);
}
} else {
if (oxcf->rc_mode == VPX_Q) {
@@ -1097,7 +1081,7 @@
rc->total_target_vs_actual = rc->total_actual_bits - rc->total_target_bits;
- if (is_altref_enabled(oxcf) && cpi->refresh_alt_ref_frame &&
+ if (is_altref_enabled(cpi) && cpi->refresh_alt_ref_frame &&
(cm->frame_type != KEY_FRAME))
// Update the alternate reference frame stats as appropriate.
update_alt_ref_frame_stats(cpi);
@@ -1349,8 +1333,9 @@
return target_index - qindex;
}
-void vp9_rc_set_gf_max_interval(const VP9EncoderConfig *const oxcf,
+void vp9_rc_set_gf_max_interval(const VP9_COMP *const cpi,
RATE_CONTROL *const rc) {
+ const VP9EncoderConfig *const oxcf = &cpi->oxcf;
// Set Maximum gf/arf interval
rc->max_gf_interval = 16;
@@ -1359,7 +1344,7 @@
if (rc->static_scene_max_gf_interval > (MAX_LAG_BUFFERS * 2))
rc->static_scene_max_gf_interval = MAX_LAG_BUFFERS * 2;
- if (is_altref_enabled(oxcf)) {
+ if (is_altref_enabled(cpi)) {
if (rc->static_scene_max_gf_interval > oxcf->lag_in_frames - 1)
rc->static_scene_max_gf_interval = oxcf->lag_in_frames - 1;
}
@@ -1392,5 +1377,5 @@
rc->max_frame_bandwidth = MAX(MAX((cm->MBs * MAX_MB_RATE), MAXRATE_1080P),
vbr_max_bits);
- vp9_rc_set_gf_max_interval(oxcf, rc);
+ vp9_rc_set_gf_max_interval(cpi, rc);
}
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_ratectrl.h ('k') | source/libvpx/vp9/encoder/vp9_rd.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698