Commit 3e3512e478 for aom
commit 3e3512e4781f2821bceec3ba26de7c02e5d4de41
Author: Bohan Li <bohanli@google.com>
Date: Fri Apr 17 11:08:15 2026 -0700
Add speed feature to selectively change trellis rd mult
STATS_CHANGED
Change-Id: I5cd1d63bb8406a2ca37efd778496497f5e60f4ca
diff --git a/av1/encoder/encodetxb.h b/av1/encoder/encodetxb.h
index 5e711e522c..45a7b635df 100644
--- a/av1/encoder/encodetxb.h
+++ b/av1/encoder/encodetxb.h
@@ -263,10 +263,14 @@ static inline int av1_cost_skip_txb(const CoeffCosts *coeff_costs,
/*!\cond */
// These numbers are empirically obtained.
-static const int plane_rd_mult[REF_TYPES][PLANE_TYPES] = {
+static const int plane_rd_mult_chroma[REF_TYPES][PLANE_TYPES] = {
{ 17, 13 },
{ 16, 10 },
};
+static const int plane_rd_mult[REF_TYPES][PLANE_TYPES] = {
+ { 17, 20 },
+ { 16, 20 },
+};
/*!\endcond */
#ifdef __cplusplus
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index 4f7d3087f5..abfa1a53f3 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -367,6 +367,7 @@ static void set_allintra_speed_features_framesize_independent(
sf->tx_sf.intra_tx_size_search_init_depth_sqr = 1;
sf->tx_sf.model_based_prune_tx_search_level = 1;
sf->tx_sf.tx_type_search.use_reduced_intra_txset = 1;
+ sf->tx_sf.use_chroma_trellis_rd_mult = 1;
sf->rt_sf.use_nonrd_pick_mode = 0;
sf->rt_sf.discount_color_cost = 0;
@@ -2016,6 +2017,7 @@ static void set_rt_speed_features_framesize_independent(AV1_COMP *cpi,
sf->tx_sf.tx_type_search.fast_intra_tx_type_search = 2;
sf->tx_sf.tx_type_search.use_skip_flag_prediction = 2;
sf->tx_sf.tx_type_search.winner_mode_tx_type_pruning = 4;
+ sf->tx_sf.use_chroma_trellis_rd_mult = 1;
sf->rd_sf.optimize_coefficients = NO_TRELLIS_OPT;
sf->rd_sf.simple_model_rd_from_var = 1;
@@ -2452,6 +2454,7 @@ static inline void init_tx_sf(TX_SPEED_FEATURES *tx_sf) {
tx_sf->prune_intra_tx_depths_using_nn = false;
tx_sf->use_rd_based_breakout_for_intra_tx_search = false;
tx_sf->prune_inter_tx_split_rd_eval_lvl = 0;
+ tx_sf->use_chroma_trellis_rd_mult = 0;
}
static inline void init_rd_sf(RD_CALC_SPEED_FEATURES *rd_sf,
diff --git a/av1/encoder/speed_features.h b/av1/encoder/speed_features.h
index 342049ecf3..5b1a2e8e1e 100644
--- a/av1/encoder/speed_features.h
+++ b/av1/encoder/speed_features.h
@@ -1482,6 +1482,9 @@ typedef struct TX_SPEED_FEATURES {
// Values are 0 (not used), 1 - 2 with progressively increasing
// aggressiveness, i.e., decreasing number of top candidates
int prune_inter_tx_split_rd_eval_lvl;
+
+ // If 1, use a trellis rd multiplier that favors chroma plane more.
+ int use_chroma_trellis_rd_mult;
} TX_SPEED_FEATURES;
typedef struct RD_CALC_SPEED_FEATURES {
diff --git a/av1/encoder/txb_rdopt.c b/av1/encoder/txb_rdopt.c
index a199941b41..bd16ddc323 100644
--- a/av1/encoder/txb_rdopt.c
+++ b/av1/encoder/txb_rdopt.c
@@ -384,9 +384,12 @@ int av1_optimize_txb(const struct AV1_COMP *cpi, MACROBLOCK *x, int plane,
? 7
: 5;
+ const int(*trellis_rd_mult)[2] = cpi->sf.tx_sf.use_chroma_trellis_rd_mult
+ ? plane_rd_mult_chroma
+ : plane_rd_mult;
const int64_t rdmult = ROUND_POWER_OF_TWO(
(int64_t)x->rdmult * (8 - sharpness) *
- (plane_rd_mult[is_inter][plane_type] << (2 * (xd->bd - 8))),
+ (trellis_rd_mult[is_inter][plane_type] << (2 * (xd->bd - 8))),
rshift);
uint8_t levels_buf[TX_PAD_2D];
diff --git a/test/horz_superres_test.cc b/test/horz_superres_test.cc
index 6d4ca8a614..28c33482ec 100644
--- a/test/horz_superres_test.cc
+++ b/test/horz_superres_test.cc
@@ -56,7 +56,7 @@ const TestVideoParam kTestVideoVectors[] = {
44.7 },
#if CONFIG_AV1_HIGHBITDEPTH
{ "park_joy_90p_10_444.y4m", AOM_IMG_FMT_I44416, AOM_BITS_10, 1, 5, 0, 27.0,
- 46.8 },
+ 46.7 },
#endif
{ "screendata.y4m", AOM_IMG_FMT_I420, AOM_BITS_8, 0, 4, 1, 23.0, 52.5 },
// Image coding (single frame).