Commit 431ff8b214 for aom
commit 431ff8b2141d1619ee966d7bca103f645f8e1819
Author: Deepa K G <deepa.kg@ittiam.com>
Date: Wed Jul 8 23:12:09 2026 +0530
Clip QP used in TPL stage in VBR mode
Limit the qindex used in TPL analysis stage to a
range between 120 and 220 in VBR mode.
Instruction Count BD-Rate Loss(%)
cpu Reduction(%) avg.psnr ovr.psnr ssim vmaf vmaf_neg
0 0.1 -0.2134 -0.1720 -0.2352 -0.0632 -0.0127
1 -0.7 -0.2149 -0.1852 -0.2946 -0.1564 -0.1138
2 -0.6 -0.2126 -0.1900 -0.2582 -0.1379 -0.0851
3 0.1 -0.2098 -0.1767 -0.2926 -0.1141 -0.0591
STATS_CHANGED
Change-Id: I7cb5f6b1eac7854fe978cc5f1cd939542154dc76
diff --git a/av1/encoder/tpl_model.c b/av1/encoder/tpl_model.c
index 9131c1624d..3f7fa88ca9 100644
--- a/av1/encoder/tpl_model.c
+++ b/av1/encoder/tpl_model.c
@@ -1654,12 +1654,16 @@ static void mc_flow_synthesizer(TplParams *tpl_data, int frame_idx, int mi_rows,
}
}
+#define MIN_TPL_Q_INDEX 120
+#define MAX_TPL_Q_INDEX 220
+
static inline int init_gop_frames_for_tpl(
AV1_COMP *cpi, const EncodeFrameParams *const init_frame_params,
GF_GROUP *gf_group, int *tpl_group_frames, int *pframe_qindex) {
AV1_COMMON *cm = &cpi->common;
assert(cpi->gf_frame_index == 0);
*pframe_qindex = 0;
+ int leaf_frame_qindex = *pframe_qindex;
RefFrameMapPair ref_frame_map_pairs[REF_FRAMES];
init_ref_map_pair(cpi, ref_frame_map_pairs);
@@ -1717,8 +1721,13 @@ static inline int init_gop_frames_for_tpl(
frame_update_type == OVERLAY_UPDATE;
frame_params.frame_type = gf_group->frame_type[gf_index];
- if (frame_update_type == LF_UPDATE)
+ if (frame_update_type == LF_UPDATE) {
*pframe_qindex = gf_group->q_val[gf_index];
+ leaf_frame_qindex = *pframe_qindex;
+ if (cpi->oxcf.rc_cfg.mode == AOM_VBR) {
+ *pframe_qindex = CLIP(*pframe_qindex, MIN_TPL_Q_INDEX, MAX_TPL_Q_INDEX);
+ }
+ }
const struct lookahead_entry *buf = av1_lookahead_peek(
cpi->ppi->lookahead, lookahead_index, cpi->compressor_stage);
@@ -1835,7 +1844,9 @@ static inline int init_gop_frames_for_tpl(
}
}
#endif // CONFIG_BITRATE_ACCURACY && CONFIG_THREE_PASS
- gf_group->q_val[gf_index] = *pframe_qindex;
+ // Store the unclipped qindex in gf_group->q_val[] which is used when
+ // ducky_encode is on.
+ gf_group->q_val[gf_index] = leaf_frame_qindex;
const int true_disp = (int)(tpl_frame->frame_display_index);
av1_get_ref_frames(ref_frame_map_pairs, true_disp, cpi, gf_index, 0,
remapped_ref_idx);