Adjust parameters of the customized GF structure
Tweak the parameters for the customized GF structure (GF = 4)
so that the coding perfromance of the new structure can match
the performance of the old structure.
This patch is to identify the places we need to take extra
care of when building a longer GF structure.
Change-Id: I5412109db037655b7d692c7915580a28817b3ca0
diff --git a/av1/encoder/firstpass.c b/av1/encoder/firstpass.c
index 008906e..d4c54c7 100644
--- a/av1/encoder/firstpass.c
+++ b/av1/encoder/firstpass.c
@@ -2159,11 +2159,15 @@
0 // arf_update_idx
},
{
- // gf_group->index == 3 (Frame 1)
+// gf_group->index == 3 (Frame 1)
+#if MATCH_OLD_BITRATE
+ LAST_BIPRED_UPDATE, // update_type
+#else
LF_UPDATE, // update_type
- 0, // arf_src_offset
- 0, // brf_src_offset
- 0 // arf_update_idx
+#endif
+ 0, // arf_src_offset
+ 0, // brf_src_offset
+ 0 // arf_update_idx
},
{
@@ -2604,6 +2608,13 @@
// TODO(zoeliu): To investigate whether the allocated bits on
// BIPRED_UPDATE frames need to be further adjusted.
gf_group->bit_allocation[frame_index] = target_frame_size;
+#if MATCH_OLD_BITRATE
+ } else if (cpi->new_bwdref_update_rule == 1 &&
+ gf_group->update_type[frame_index] == INTNL_OVERLAY_UPDATE) {
+ // Boost up the allocated bits on backward reference frame
+ gf_group->bit_allocation[frame_index] =
+ target_frame_size + (target_frame_size >> 2);
+#endif
} else {
assert(gf_group->update_type[frame_index] == LF_UPDATE ||
gf_group->update_type[frame_index] == INTNL_OVERLAY_UPDATE);
diff --git a/av1/encoder/ratectrl.c b/av1/encoder/ratectrl.c
index 6aa3d76..5e6536f 100644
--- a/av1/encoder/ratectrl.c
+++ b/av1/encoder/ratectrl.c
@@ -930,11 +930,14 @@
ASSIGN_MINQ_TABLE(cm->bit_depth, inter_minq);
#if CUSTOMIZED_GF
- const int is_intrl_arf_boost =
+ int is_intrl_arf_boost =
gf_group->update_type[gf_group->index] == INTNL_ARF_UPDATE;
+#if MATCH_OLD_BITRATE
+ if (cpi->new_bwdref_update_rule == 1) is_intrl_arf_boost = 0;
+#endif
#else
const int is_intrl_arf_boost = cpi->refresh_alt2_ref_frame;
-#endif
+#endif // CUSTOMIZED_GF
if (frame_is_intra_only(cm)) {
// Handle the special case for key frames forced when we have reached
diff --git a/av1/encoder/ratectrl.h b/av1/encoder/ratectrl.h
index 604f5cb..ece73fd 100644
--- a/av1/encoder/ratectrl.h
+++ b/av1/encoder/ratectrl.h
@@ -34,6 +34,12 @@
#define USE_SYMM_MULTI_LAYER 0
#endif
+#if USE_SYMM_MULTI_LAYER
+#define MATCH_OLD_BITRATE 1
+#else
+#define MATCH_OLD_BITRATE 0
+#endif
+
#define MIN_GF_INTERVAL 4
#define MAX_GF_INTERVAL 16
#define FIXED_GF_INTERVAL 8 // Used in some testing modes only