diff --git a/vp9/encoder/vp9_ratectrl.c b/vp9/encoder/vp9_ratectrl.c index 4b05494717eb374bcb91b98c0bf1801a9897b665..fe43f3a07dde4dd6f16916a72f44c633255320b7 100644 --- a/vp9/encoder/vp9_ratectrl.c +++ b/vp9/encoder/vp9_ratectrl.c @@ -45,11 +45,9 @@ // Tables relating active max Q to active min Q static int kf_low_motion_minq[QINDEX_RANGE]; static int kf_high_motion_minq[QINDEX_RANGE]; -static int gf_low_motion_minq[QINDEX_RANGE]; -static int gf_high_motion_minq[QINDEX_RANGE]; +static int arfgf_low_motion_minq[QINDEX_RANGE]; +static int arfgf_high_motion_minq[QINDEX_RANGE]; static int inter_minq[QINDEX_RANGE]; -static int afq_low_motion_minq[QINDEX_RANGE]; -static int afq_high_motion_minq[QINDEX_RANGE]; static int gf_high = 2000; static int gf_low = 400; static int kf_high = 5000; @@ -83,10 +81,8 @@ void vp9_rc_init_minq_luts() { const double maxq = vp9_convert_qindex_to_q(i); kf_low_motion_minq[i] = get_minq_index(maxq, 0.000001, -0.0004, 0.125); kf_high_motion_minq[i] = get_minq_index(maxq, 0.000002, -0.0012, 0.50); - gf_low_motion_minq[i] = get_minq_index(maxq, 0.0000015, -0.0009, 0.30); - gf_high_motion_minq[i] = get_minq_index(maxq, 0.0000021, -0.00125, 0.50); - afq_low_motion_minq[i] = get_minq_index(maxq, 0.0000015, -0.0009, 0.30); - afq_high_motion_minq[i] = get_minq_index(maxq, 0.0000021, -0.00125, 0.55); + arfgf_low_motion_minq[i] = get_minq_index(maxq, 0.0000015, -0.0009, 0.30); + arfgf_high_motion_minq[i] = get_minq_index(maxq, 0.0000021, -0.00125, 0.50); inter_minq[i] = get_minq_index(maxq, 0.00000271, -0.00113, 0.90); } } @@ -548,7 +544,7 @@ static int rc_pick_q_and_bounds_one_pass_cbr(const VP9_COMP *cpi, } active_best_quality = get_active_quality( q, rc->gfu_boost, gf_low, gf_high, - gf_low_motion_minq, gf_high_motion_minq); + arfgf_low_motion_minq, arfgf_high_motion_minq); } else { // Use the lower of active_worst_quality and recent/average Q. if (cm->current_video_frame > 1) { @@ -676,17 +672,12 @@ static int rc_pick_q_and_bounds_one_pass_vbr(const VP9_COMP *cpi, if (oxcf->rc_mode == RC_MODE_CONSTRAINED_QUALITY) { if (q < cq_level) q = cq_level; - if (rc->frames_since_key > 1) { - active_best_quality = get_active_quality(q, rc->gfu_boost, - gf_low, gf_high, - afq_low_motion_minq, - afq_high_motion_minq); - } else { - active_best_quality = get_active_quality(q, rc->gfu_boost, - gf_low, gf_high, - gf_low_motion_minq, - gf_high_motion_minq); - } + + active_best_quality = get_active_quality(q, rc->gfu_boost, + gf_low, gf_high, + arfgf_low_motion_minq, + arfgf_high_motion_minq); + // Constrained quality use slightly lower active best. active_best_quality = active_best_quality * 15 / 16; @@ -694,20 +685,14 @@ static int rc_pick_q_and_bounds_one_pass_vbr(const VP9_COMP *cpi, if (!cpi->refresh_alt_ref_frame) { active_best_quality = cq_level; } else { - if (rc->frames_since_key > 1) { - active_best_quality = get_active_quality( - q, rc->gfu_boost, gf_low, gf_high, - afq_low_motion_minq, afq_high_motion_minq); - } else { - active_best_quality = get_active_quality( - q, rc->gfu_boost, gf_low, gf_high, - gf_low_motion_minq, gf_high_motion_minq); - } + active_best_quality = get_active_quality( + q, rc->gfu_boost, gf_low, gf_high, + arfgf_low_motion_minq, arfgf_high_motion_minq); } } else { active_best_quality = get_active_quality( q, rc->gfu_boost, gf_low, gf_high, - gf_low_motion_minq, gf_high_motion_minq); + arfgf_low_motion_minq, arfgf_high_motion_minq); } } else { if (oxcf->rc_mode == RC_MODE_CONSTANT_QUALITY) { @@ -867,17 +852,12 @@ static int rc_pick_q_and_bounds_two_pass(const VP9_COMP *cpi, if (oxcf->rc_mode == RC_MODE_CONSTRAINED_QUALITY) { if (q < cq_level) q = cq_level; - if (rc->frames_since_key > 1) { - active_best_quality = get_active_quality(q, rc->gfu_boost, - gf_low, gf_high, - afq_low_motion_minq, - afq_high_motion_minq); - } else { - active_best_quality = get_active_quality(q, rc->gfu_boost, - gf_low, gf_high, - gf_low_motion_minq, - gf_high_motion_minq); - } + + active_best_quality = get_active_quality(q, rc->gfu_boost, + gf_low, gf_high, + arfgf_low_motion_minq, + arfgf_high_motion_minq); + // Constrained quality use slightly lower active best. active_best_quality = active_best_quality * 15 / 16; @@ -885,20 +865,14 @@ static int rc_pick_q_and_bounds_two_pass(const VP9_COMP *cpi, if (!cpi->refresh_alt_ref_frame) { active_best_quality = cq_level; } else { - if (rc->frames_since_key > 1) { - active_best_quality = get_active_quality( - q, rc->gfu_boost, gf_low, gf_high, - afq_low_motion_minq, afq_high_motion_minq); - } else { - active_best_quality = get_active_quality( - q, rc->gfu_boost, gf_low, gf_high, - gf_low_motion_minq, gf_high_motion_minq); - } + active_best_quality = get_active_quality( + q, rc->gfu_boost, gf_low, gf_high, + arfgf_low_motion_minq, arfgf_high_motion_minq); } } else { active_best_quality = get_active_quality( q, rc->gfu_boost, gf_low, gf_high, - gf_low_motion_minq, gf_high_motion_minq); + arfgf_low_motion_minq, arfgf_high_motion_minq); } } else { if (oxcf->rc_mode == RC_MODE_CONSTANT_QUALITY) {