diff options
author | Marco <marpan@chromium.org> | 2015-06-10 16:25:22 -0700 |
---|---|---|
committer | Marco <marpan@chromium.org> | 2015-06-11 08:31:03 -0700 |
commit | 2aa67ce20fb11eb847b1ecfb4c4481c2e43fe61d (patch) | |
tree | b967d814c202879e192a164d27b7874fa1614477 /vp9/encoder/vp9_aq_cyclicrefresh.c | |
parent | a49c7015298911f903d740c09d34b609e2be1a9b (diff) | |
download | libvpx-2aa67ce20fb11eb847b1ecfb4c4481c2e43fe61d.tar libvpx-2aa67ce20fb11eb847b1ecfb4c4481c2e43fe61d.tar.gz libvpx-2aa67ce20fb11eb847b1ecfb4c4481c2e43fe61d.tar.bz2 libvpx-2aa67ce20fb11eb847b1ecfb4c4481c2e43fe61d.zip |
Move adjustment of some CR parameters to existing function.
Refactor/no change in behavior.
Change-Id: Idb3c55b1304feaf689b90403f79bc96dba26f060
Diffstat (limited to 'vp9/encoder/vp9_aq_cyclicrefresh.c')
-rw-r--r-- | vp9/encoder/vp9_aq_cyclicrefresh.c | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/vp9/encoder/vp9_aq_cyclicrefresh.c b/vp9/encoder/vp9_aq_cyclicrefresh.c index 71c1e0b53..df70d48f8 100644 --- a/vp9/encoder/vp9_aq_cyclicrefresh.c +++ b/vp9/encoder/vp9_aq_cyclicrefresh.c @@ -95,19 +95,6 @@ static int apply_cyclic_refresh_bitrate(const VP9_COMMON *cm, return 1; } -static void adjust_cyclic_refresh_parameters(VP9_COMP *const cpi) { - const VP9_COMMON *const cm = &cpi->common; - const RATE_CONTROL *const rc = &cpi->rc; - CYCLIC_REFRESH *const cr = cpi->cyclic_refresh; - // Adjust some parameters, currently only for low resolutions at low bitrates. - if (cm->width <= 352 && - cm->height <= 288 && - rc->avg_frame_bandwidth < 3400) { - cr->motion_thresh = 4; - cr->rate_boost_fac = 1.25; - } -} - // Check if this coding block, of size bsize, should be considered for refresh // (lower-qp coding). Decision can be based on various factors, such as // size of the coding block (i.e., below min_block size rejected), coding @@ -435,18 +422,30 @@ static void cyclic_refresh_update_map(VP9_COMP *const cpi) { cr->sb_index = i; } -// Set/update global/frame level cyclic refresh parameters. +// Set cyclic refresh parameters. void vp9_cyclic_refresh_update_parameters(VP9_COMP *const cpi) { const RATE_CONTROL *const rc = &cpi->rc; + const VP9_COMMON *const cm = &cpi->common; CYCLIC_REFRESH *const cr = cpi->cyclic_refresh; cr->percent_refresh = 10; + cr->max_qdelta_perc = 50; + cr->time_for_refresh = 0; // Use larger delta-qp (increase rate_ratio_qdelta) for first few (~4) - // periods of the refresh cycle, after a key frame. This corresponds to ~40 - // frames with cr->percent_refresh = 10. - if (rc->frames_since_key < 40) + // periods of the refresh cycle, after a key frame. + if (rc->frames_since_key < 4 * cr->percent_refresh) cr->rate_ratio_qdelta = 3.0; else cr->rate_ratio_qdelta = 2.0; + // Adjust some parameters for low resolutions at low bitrates. + if (cm->width <= 352 && + cm->height <= 288 && + rc->avg_frame_bandwidth < 3400) { + cr->motion_thresh = 4; + cr->rate_boost_fac = 1.25; + } else { + cr->motion_thresh = 32; + cr->rate_boost_fac = 1.7; + } } // Setup cyclic background refresh: set delta q and segmentation map. @@ -475,9 +474,6 @@ void vp9_cyclic_refresh_setup(VP9_COMP *const cpi) { int qindex2; const double q = vp9_convert_qindex_to_q(cm->base_qindex, cm->bit_depth); vp9_clear_system_state(); - cr->max_qdelta_perc = 50; - cr->time_for_refresh = 0; - cr->rate_boost_fac = 1.7; // Set rate threshold to some multiple (set to 2 for now) of the target // rate (target is given by sb64_target_rate and scaled by 256). cr->thresh_rate_sb = ((int64_t)(rc->sb64_target_rate) << 8) << 2; @@ -485,9 +481,6 @@ void vp9_cyclic_refresh_setup(VP9_COMP *const cpi) { // q will not exceed 457, so (q * q) is within 32bit; see: // vp9_convert_qindex_to_q(), vp9_ac_quant(), ac_qlookup*[]. cr->thresh_dist_sb = ((int64_t)(q * q)) << 2; - cr->motion_thresh = 32; - - adjust_cyclic_refresh_parameters(cpi); // Set up segmentation. // Clear down the segment map. |