From b9c9b61662698d48beba3af813512cb4aa208a11 Mon Sep 17 00:00:00 2001
From: Wan-Teh Chang <[EMAIL REDACTED]>
Date: Tue, 30 Jul 2024 12:10:27 -0700
Subject: [PATCH] Round framerate later in kf_boost adjustment
Match the VP8 and VP9 code.
The current code comes from the following change in commit 9e96d1b:
3) use int framerate (rounded) in setting target size in
calc_iframe_target_size_one_pass_cbr
It would be good if VP8, VP9, and AV1 calculate kf_boost in the same
way.
test_aom_rc still passes with this change. However, if I undo the change
to av1_calc_iframe_target_size_one_pass_cbr() in commit 9e96d1b,
test_aom_rc fails because rc_api_->GetQP() is less than qp by 1.
Change-Id: I06670ed28fcd225e413bc54e10f61cb7f39e3a00
---
av1/encoder/ratectrl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/av1/encoder/ratectrl.c b/av1/encoder/ratectrl.c
index 8135da8cd..b8c25387d 100644
--- a/av1/encoder/ratectrl.c
+++ b/av1/encoder/ratectrl.c
@@ -2821,9 +2821,9 @@ int av1_calc_iframe_target_size_one_pass_cbr(const AV1_COMP *cpi) {
}
} else {
int kf_boost = 32;
- int framerate = (int)round(cpi->framerate);
+ double framerate = cpi->framerate;
- kf_boost = AOMMAX(kf_boost, (int)(2 * framerate - 16));
+ kf_boost = AOMMAX(kf_boost, (int)round(2 * framerate - 16));
if (rc->frames_since_key < framerate / 2) {
kf_boost = (int)(kf_boost * rc->frames_since_key / (framerate / 2));
}