aom: rtc: Allow QP to react faster for larger overshoot

From 9a2f746aef90b2899f09a87b3dc12adcecda8f86 Mon Sep 17 00:00:00 2001
From: Marco Paniconi <[EMAIL REDACTED]>
Date: Mon, 1 Jul 2024 14:53:13 -0700
Subject: [PATCH] rtc: Allow QP to react faster for larger overshoot

Increase the max_delta_up when overshoot is detected.
This reduces overshoot in static clips with scene change
fading in/out.

Neutral/negligible stats change on rtc_derf/rtc/rtc_screen.

Change-Id: I86bf7c67e6438e60bd828775c60248abd571579f
---
 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 744f5f5cd..9793a3f84 100644
--- a/av1/encoder/ratectrl.c
+++ b/av1/encoder/ratectrl.c
@@ -551,7 +551,7 @@ static int adjust_q_cbr(const AV1_COMP *cpi, int q, int active_worst_quality,
       p_rc->buffer_level < (p_rc->optimal_buffer_level >> 1) &&
       rc->frames_since_key > 4;
   int max_delta_down;
-  int max_delta_up = overshoot_buffer_low ? 60 : 20;
+  int max_delta_up = overshoot_buffer_low ? 120 : 20;
   const int change_avg_frame_bandwidth =
       abs(rc->avg_frame_bandwidth - rc->prev_avg_frame_bandwidth) >
       0.1 * (rc->avg_frame_bandwidth);
@@ -571,7 +571,7 @@ static int adjust_q_cbr(const AV1_COMP *cpi, int q, int active_worst_quality,
       // Link max_delta_up to max_delta_down and buffer status.
       if (p_rc->buffer_level > p_rc->optimal_buffer_level) {
         max_delta_up = AOMMAX(4, max_delta_down);
-      } else {
+      } else if (!overshoot_buffer_low) {
         max_delta_up = AOMMAX(8, max_delta_down);
       }
     }