Respect --gf_max_pyr_height.
This patch had changed gf_group->max_layer_depth_allowed to a constant
to allow max depth of 5:
https://aomedia-review.googlesource.com/c/aom/+/104822
We instead:
- Allow value 5 for --gf_max_pyr_height and --gf_min_pyr_height options
- Change the default --gf_max_pyr_height to 5, and
- Use the user provided max for setting
gf_group->max_layer_depth_allowed
Change-Id: I83ab9a1674ee208082f34104e9da9a06dbeabf9f
diff --git a/apps/aomenc.c b/apps/aomenc.c
index cd67d6b..636816f 100644
--- a/apps/aomenc.c
+++ b/apps/aomenc.c
@@ -666,10 +666,10 @@
"max gf/arf frame interval (default 0, indicating in-built behavior)");
static const arg_def_t gf_min_pyr_height =
ARG_DEF(NULL, "gf-min-pyr-height", 1,
- "Min height for GF group pyramid structure (0 (default) to 4)");
+ "Min height for GF group pyramid structure (0 (default) to 5)");
static const arg_def_t gf_max_pyr_height =
ARG_DEF(NULL, "gf-max-pyr-height", 1,
- "maximum height for GF group pyramid structure (0 to 4 (default))");
+ "maximum height for GF group pyramid structure (0 to 5 (default))");
static const arg_def_t max_reference_frames = ARG_DEF(
NULL, "max-reference-frames", 1,
"maximum number of reference frames allowed per frame (3 to 7 (default))");
diff --git a/av1/av1_cx_iface.c b/av1/av1_cx_iface.c
index 75f002f..7938213 100644
--- a/av1/av1_cx_iface.c
+++ b/av1/av1_cx_iface.c
@@ -169,7 +169,7 @@
0, // min_gf_interval; 0 -> default decision
0, // max_gf_interval; 0 -> default decision
0, // gf_min_pyr_height
- 4, // gf_max_pyr_height
+ 5, // gf_max_pyr_height
AOM_TUNE_PSNR, // tuning
"/usr/local/share/model/vmaf_v0.6.1.pkl", // VMAF model path
10, // cq_level
@@ -395,8 +395,8 @@
RANGE_CHECK(extra_cfg, max_gf_interval,
AOMMAX(2, extra_cfg->min_gf_interval), (MAX_LAG_BUFFERS - 1));
}
- RANGE_CHECK_HI(extra_cfg, gf_min_pyr_height, 4);
- RANGE_CHECK_HI(extra_cfg, gf_max_pyr_height, 4);
+ RANGE_CHECK_HI(extra_cfg, gf_min_pyr_height, 5);
+ RANGE_CHECK_HI(extra_cfg, gf_max_pyr_height, 5);
if (extra_cfg->gf_min_pyr_height > extra_cfg->gf_max_pyr_height) {
ERROR(
"gf_min_pyr_height must be less than or equal to "
diff --git a/av1/encoder/pass2_strategy.c b/av1/encoder/pass2_strategy.c
index 6b0a828..2f20f45 100644
--- a/av1/encoder/pass2_strategy.c
+++ b/av1/encoder/pass2_strategy.c
@@ -1576,7 +1576,7 @@
rc->gfu_boost = av1_calc_arf_boost(twopass, rc, frame_info, alt_offset,
forward_frames, (i - 1));
rc->source_alt_ref_pending = 1;
- gf_group->max_layer_depth_allowed = MAX_ARF_LAYERS - 1;
+ gf_group->max_layer_depth_allowed = cpi->oxcf.gf_max_pyr_height;
} else {
reset_fpf_position(twopass, start_pos);
rc->gfu_boost = AOMMIN(
diff --git a/test/gf_pyr_height_test.cc b/test/gf_pyr_height_test.cc
index 7bea378..518b01e 100644
--- a/test/gf_pyr_height_test.cc
+++ b/test/gf_pyr_height_test.cc
@@ -30,20 +30,27 @@
{ 0, 2, 34.00 },
{ 0, 3, 34.20 },
{ 0, 4, 34.30 },
+ { 0, 5, 34.40 },
// gf_min_pyr_height = 1
{ 1, 1, 34.50 },
{ 1, 2, 34.00 },
{ 1, 3, 34.20 },
{ 1, 4, 34.30 },
+ { 1, 5, 34.40 },
// gf_min_pyr_height = 2
{ 2, 2, 34.00 },
{ 2, 3, 34.20 },
{ 2, 4, 34.30 },
+ { 2, 5, 34.40 },
// gf_min_pyr_height = 3
{ 3, 3, 34.20 },
{ 3, 4, 34.30 },
+ { 3, 5, 34.40 },
// gf_min_pyr_height = 4
{ 4, 4, 34.30 },
+ { 4, 5, 34.40 },
+ // gf_min_pyr_height = 5
+ { 5, 5, 34.40 },
};
// Compiler may decide to add some padding to the struct above for alignment,