rtc: Disable aq-mode=3 at high QP
At very high QP, turn of the cyclic refresh (aq-mode=3),
this helps low bitrate and hard content.
On rtc_derf at low bitrates:
bdrate gain for avg_psnr is 1.6%, up to 7% for hard clip.
Neutral to small positive gain on higher/full bitrate range.
Change-Id: I5055925a2b2efd75d2d292e409d4746ecfc39f6d
diff --git a/av1/encoder/aq_cyclicrefresh.c b/av1/encoder/aq_cyclicrefresh.c
index cd68425..9b3b078 100644
--- a/av1/encoder/aq_cyclicrefresh.c
+++ b/av1/encoder/aq_cyclicrefresh.c
@@ -323,10 +323,13 @@
double weight_segment_target = 0;
double weight_segment = 0;
int qp_thresh = AOMMIN(20, rc->best_quality << 1);
+ int qp_max_thresh = 118 * MAXQ >> 7;
cr->apply_cyclic_refresh = 1;
if (frame_is_intra_only(cm) || is_lossless_requested(&cpi->oxcf) ||
cpi->svc.temporal_layer_id > 0 ||
- rc->avg_frame_qindex[INTER_FRAME] < qp_thresh) {
+ rc->avg_frame_qindex[INTER_FRAME] < qp_thresh ||
+ (rc->avg_frame_qindex[INTER_FRAME] > qp_max_thresh &&
+ rc->frames_since_key > 20)) {
cr->apply_cyclic_refresh = 0;
return;
}