Adjustment to KF boost in STRICT_RC mode.
Imposes a maximum kf boost when STRICT_RC is selected.
For strict RC mode this gives substantial gains.
(a psnr, ov psnr, ssim, psnr hvs, vmaf)
If ALT_ARF_ALLOCATION is not enabled the gains are as follows:
Low Res -3.840 -5.318 -2.770 -4.692 -6.110
UGC 360 -1.116 -2.456 -0.306 -2.734 -3.439
Mid Res 0.049 0.018 0.618 -0.055 -0.571
Hd Res -1.251 -1.397 -0.973 -1.510 -1.911
If ALT_ARF_ALLOCATION is enabled the gains are:
Low Res -1.865 -3.369 -0.919 -2.813 -4.539
UGC 360 -0.641 -1.688 -0.438 -1.796 -2.635
Mid Res 0.042 0.216 0.838 -0.070 -0.599
Hd Res -0.585 -0.635 -0.327 -0.699 -1.104
Where Strict_RC is enabled and the new limit on KF boost is in force
the gain from selecting ALT_REF_ALLOCATION is now:
Low Res -24.355 -27.486 -18.352 -27.127 -29.144
UGC 360 -16.470 -20.157 -11.792 -19.504 -18.558
Mid Res -10.518 -11.066 -6.754 -11.317 -9.881
Hd Res -18.942 -23.513 -14.666 -20.392 -28.304
Change-Id: Ic8021317ba1c3096e0da59b5941cb19b9b20e210
diff --git a/av1/encoder/pass2_strategy.c b/av1/encoder/pass2_strategy.c
index 32b98df..2f4654b 100644
--- a/av1/encoder/pass2_strategy.c
+++ b/av1/encoder/pass2_strategy.c
@@ -940,7 +940,6 @@
calculate_boost_bits(rc->baseline_gf_interval - total_arfs -
total_overlays - arf_depth_count[idx],
arf_depth_boost[idx], total_group_bits);
-
total_group_bits -= arf_depth_bits[idx];
total_arfs += arf_depth_count[idx];
}
@@ -2023,7 +2022,8 @@
#define FRAMES_TO_CHECK_DECAY 8
#define KF_MIN_FRAME_BOOST 80.0
#define KF_MAX_FRAME_BOOST 128.0
-#define MIN_KF_BOOST 600 // Minimum boost for non-static KF interval
+#define MIN_KF_BOOST 600 // Minimum boost for non-static KF interval
+#define MAX_KF_BOOST 3200
#define MIN_STATIC_KF_BOOST 5400 // Minimum boost for static KF interval
static int detect_app_forced_key(AV1_COMP *cpi) {
@@ -2347,6 +2347,9 @@
// Apply various clamps for min and max boost
rc->kf_boost = AOMMAX(rc->kf_boost, (rc->frames_to_key * 3));
rc->kf_boost = AOMMAX(rc->kf_boost, MIN_KF_BOOST);
+#ifdef STRICT_RC
+ rc->kf_boost = AOMMIN(rc->kf_boost, MAX_KF_BOOST);
+#endif
}
// Work out how many bits to allocate for the key frame itself.
diff --git a/av1/encoder/ratectrl.c b/av1/encoder/ratectrl.c
index 992d1fb..3c8bb80 100644
--- a/av1/encoder/ratectrl.c
+++ b/av1/encoder/ratectrl.c
@@ -86,7 +86,11 @@
static int gf_high = 2400;
static int gf_low = 300;
+#ifdef STRICT_RC
+static int kf_high = 3200;
+#else
static int kf_high = 5000;
+#endif
static int kf_low = 400;
// How many times less pixels there are to encode given the current scaling.