# aom: rtc: Avoid the qp adjustment on TL0 for key frames

**URL:** <https://discourse.libsdl.org/t/aom-rtc-avoid-the-qp-adjustment-on-tl0-for-key-frames/52752>\
**Category:** SDL Commits\
**Created:** [July 15, 2024, 2:06am UTC](https://discourse.libsdl.org/t/aom-rtc-avoid-the-qp-adjustment-on-tl0-for-key-frames/52752 "2024-07-15T02:06:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [July 15, 2024, 2:06am UTC](https://discourse.libsdl.org/t/aom-rtc-avoid-the-qp-adjustment-on-tl0-for-key-frames/52752/1 "2024-07-15T02:06:39Z")

</div>

> <https://github.com/libsdl-org/aom/commit/25f0d3d9f1289a04171d47bba48e6e2a72fc4183>
>
> The adjustment was meant for delta frames.
> 
> Change-Id: I3be09592535943e93cbb36db…17d92fe94299ee7d

```diff
From 25f0d3d9f1289a04171d47bba48e6e2a72fc4183 Mon Sep 17 00:00:00 2001
From: Marco Paniconi <[EMAIL REDACTED]>
Date: Thu, 11 Jul 2024 14:18:22 -0700
Subject: [PATCH] rtc: Avoid the qp adjustment on TL0 for key frames

The adjustment was meant for delta frames.

Change-Id: I3be09592535943e93cbb36db17d92fe94299ee7d
---
 av1/encoder/ratectrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/av1/encoder/ratectrl.c b/av1/encoder/ratectrl.c
index c5b67ba3b..4d9af471d 100644
--- a/av1/encoder/ratectrl.c
+++ b/av1/encoder/ratectrl.c
@@ -660,7 +660,7 @@ static int adjust_q_cbr(const AV1_COMP *cpi, int q, int active_worst_quality,
       if (rc->avg_frame_bandwidth < lc->rc.avg_frame_bandwidth &&
           q < last_qindex_tl0 - 4)
         q = last_qindex_tl0 - 4;
- } else if (cpi->svc.temporal_layer_id == 0 &&
+ } else if (cpi->svc.temporal_layer_id == 0 && !frame_is_intra_only(cm) &&
                p_rc->buffer_level > (p_rc->optimal_buffer_level >> 2) &&
                rc->frame_source_sad < 100000) {
       // Push base TL0 Q down if buffer is stable and frame_source_sad

```
