Tune vbr bit-allocation among various pyr levels
lowres (30 frames, vbr):
-0.253% Av PSNR, +0.017% Glb PSNR, -0.415% SSIM
Also does not seem to be slower.
STATS_CHANGED
Change-Id: I059b19c4afc09082e037870fb789427b6d57a26e
diff --git a/av1/encoder/firstpass.c b/av1/encoder/firstpass.c
index e8ef07e..e1ab9ff 100644
--- a/av1/encoder/firstpass.c
+++ b/av1/encoder/firstpass.c
@@ -2128,22 +2128,14 @@
}
#if USE_SYMM_MULTI_LAYER
-// TODO(debargha): Temporarily disable the allocation startegy that
-// uses the macros below, since it seems to cause a slowdown.
-// INvestigate and either re-enable or remove.
-#define NEW_MULTI_LVL_BOOST_VBR_ALLOC 0
+#define NEW_MULTI_LVL_BOOST_VBR_ALLOC 1
#if NEW_MULTI_LVL_BOOST_VBR_ALLOC
-#define LEAF_REDUCTION_FACTOR 0.75f
-#define LVL_3_BOOST_FACTOR 0.8f
-#define LVL_2_BOOST_FACTOR 0.3f
-
-static float_t lvl_budget_factor[MAX_PYRAMID_LVL][MAX_PYRAMID_LVL - 1] = {
- { 0, 0, 0 },
- { 1, 0, 0 },
- { LVL_3_BOOST_FACTOR, 0, 0 }, // Leaking budget works better
- { LVL_3_BOOST_FACTOR, (1 - LVL_3_BOOST_FACTOR) * LVL_2_BOOST_FACTOR,
- (1 - LVL_3_BOOST_FACTOR) * (1 - LVL_2_BOOST_FACTOR) }
+#define LEAF_REDUCTION_FACTOR 0.75
+static double lvl_budget_factor[MAX_PYRAMID_LVL - 1][MAX_PYRAMID_LVL - 1] = {
+ { 1.0, 0.0, 0.0 },
+ { 1.0, 0.5, 0.0 },
+ { 1.0, 0.5, 0.25 },
};
#endif // NEW_MULTI_LVL_BOOST_VBR_ALLOC
#endif // USE_SYMM_MULTI_LAYER
@@ -2247,11 +2239,12 @@
const int this_lvl = gf_group->pyramid_level[arf_pos];
const int dist2top = gf_group->pyramid_height - 1 - this_lvl;
#if NEW_MULTI_LVL_BOOST_VBR_ALLOC
- const float_t budget =
- LEAF_REDUCTION_FACTOR * gf_group->pyramid_lvl_nodes[0];
- const float_t lvl_boost =
- budget * lvl_budget_factor[gf_group->pyramid_height - 1][dist2top] /
- gf_group->pyramid_lvl_nodes[this_lvl];
+ const double lvl_ratio = LEAF_REDUCTION_FACTOR *
+ (double)gf_group->pyramid_lvl_nodes[0] /
+ (double)gf_group->pyramid_lvl_nodes[this_lvl];
+ const double lvl_boost =
+ AOMMIN(lvl_ratio, 3.0) *
+ lvl_budget_factor[gf_group->pyramid_height - 2][dist2top];
gf_group->bit_allocation[arf_pos] += (int)(target_frame_size * lvl_boost);
#else
gf_group->bit_allocation[arf_pos] += (target_frame_size >> dist2top);