Commit 0dfe179f80 for aom
commit 0dfe179f80da866a291728590fd1bbc3b5e6fe0a
Author: Anusuya <anusuya.k@ittiam.com>
Date: Tue Dec 16 22:03:12 2025 +0530
lc-dec: Bias against rd cost of obmc motion mode
This patch introduces a speed feature to increase the rd cost
of obmc motion mode so that encoder decisions are biased
against obmc motion mode.
Performance results of encoder and decoder for the streams
generated with low complexity decode enabled.
Decode Time BD-Rate Loss(%)
cpu Reduction(%) avg.psnr ssim vmaf vmaf_neg
1 0.890 -0.0328 -0.0451 -0.1258 -0.1067
2 1.260 -0.0114 -0.0289 -0.1701 -0.1384
3 1.416 -0.0151 -0.0317 -0.3050 -0.2401
STATS_CHANGED for low complexity decode
Change-Id: Ia98bafd3e38731b38fa8154718a720ed9725f1f0
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 91b5dea736..dcce6bbcf4 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -1401,29 +1401,34 @@ static inline void update_mode_start_end_index(
*mode_index_end = SIMPLE_TRANSLATION;
}
-// Increase rd cost of warp mode for low complexity decoding.
-static inline void increase_warp_mode_rd(const MB_MODE_INFO *const best_mbmi,
- const MB_MODE_INFO *const this_mbmi,
- int64_t *const best_scaled_rd,
- int64_t *const this_scaled_rd,
- int rd_bias_scale_pct) {
- // Check rd bias percentage is non-zero.
- if (!rd_bias_scale_pct) return;
+// Increase rd cost of warp and obmc motion modes for low complexity decoding.
+static inline void increase_motion_mode_rd(const MB_MODE_INFO *const best_mbmi,
+ const MB_MODE_INFO *const this_mbmi,
+ int64_t *const best_scaled_rd,
+ int64_t *const this_scaled_rd,
+ int rd_warp_bias_scale_pct,
+ float rd_obmc_bias_scale_pct) {
if (*best_scaled_rd == INT64_MAX || *this_scaled_rd == INT64_MAX) return;
- // Experiments have been performed with increasing the RD cost of warp mode at
- // the below locations of inter mode evaluation.
+ // Experiments have been performed with increasing the RD cost of warp and
+ // obmc motion modes at the below locations of inter mode evaluation.
// (1). Inter mode evaluation loop in av1_rd_pick_inter_mode().
// (2). Motion mode evaluation during handle_inter_mode() call.
// (3). Motion mode evaluation for winner motion modes.
// (4). Tx search for best inter candidates.
// Based on the speed quality trade-off results of this speed feature, the rd
// bias logic is enabled only at (2), (3) and (4).
- const double rd_bias_scale = rd_bias_scale_pct / 100.0;
+ const double rd_warp_bias_scale = rd_warp_bias_scale_pct / 100.0;
+ const double rd_obmc_bias_scale = rd_obmc_bias_scale_pct / 100.0;
if (best_mbmi->motion_mode == WARPED_CAUSAL)
- *best_scaled_rd += (int64_t)(rd_bias_scale * *best_scaled_rd);
+ *best_scaled_rd += (int64_t)(rd_warp_bias_scale * *best_scaled_rd);
+ else if (best_mbmi->motion_mode == OBMC_CAUSAL)
+ *best_scaled_rd += (int64_t)(rd_obmc_bias_scale * *best_scaled_rd);
+
if (this_mbmi->motion_mode == WARPED_CAUSAL)
- *this_scaled_rd += (int64_t)(rd_bias_scale * *this_scaled_rd);
+ *this_scaled_rd += (int64_t)(rd_warp_bias_scale * *this_scaled_rd);
+ else if (this_mbmi->motion_mode == OBMC_CAUSAL)
+ *this_scaled_rd += (int64_t)(rd_obmc_bias_scale * *this_scaled_rd);
}
/*!\brief AV1 motion mode search
@@ -1857,8 +1862,10 @@ static int64_t motion_mode_rd(
int64_t best_scaled_rd = best_rd;
int64_t this_scaled_rd = tmp_rd;
if (mode_index != 0)
- increase_warp_mode_rd(&best_mbmi, mbmi, &best_scaled_rd, &this_scaled_rd,
- cpi->sf.inter_sf.bias_warp_mode_rd_scale_pct);
+ increase_motion_mode_rd(&best_mbmi, mbmi, &best_scaled_rd,
+ &this_scaled_rd,
+ cpi->sf.inter_sf.bias_warp_mode_rd_scale_pct,
+ cpi->sf.inter_sf.bias_obmc_mode_rd_scale_pct);
if (mode_index == 0 || this_scaled_rd < best_scaled_rd) {
// Update best_rd data if this is the best motion mode so far
@@ -5213,9 +5220,10 @@ static inline void evaluate_motion_mode_for_winner_candidates(
int64_t best_scaled_rd = search_state->best_rd;
int64_t this_scaled_rd = rd_stats.rdcost;
if (search_state->best_mode_index != THR_INVALID)
- increase_warp_mode_rd(&search_state->best_mbmode, mbmi, &best_scaled_rd,
- &this_scaled_rd,
- cpi->sf.inter_sf.bias_warp_mode_rd_scale_pct);
+ increase_motion_mode_rd(&search_state->best_mbmode, mbmi,
+ &best_scaled_rd, &this_scaled_rd,
+ cpi->sf.inter_sf.bias_warp_mode_rd_scale_pct,
+ cpi->sf.inter_sf.bias_obmc_mode_rd_scale_pct);
if (this_scaled_rd < best_scaled_rd) {
*yrd = this_yrd;
@@ -5555,9 +5563,10 @@ static void tx_search_best_inter_candidates(
int64_t best_scaled_rd = search_state->best_rd;
int64_t this_scaled_rd = rd_stats.rdcost;
- increase_warp_mode_rd(&search_state->best_mbmode, mbmi, &best_scaled_rd,
- &this_scaled_rd,
- cpi->sf.inter_sf.bias_warp_mode_rd_scale_pct);
+ increase_motion_mode_rd(&search_state->best_mbmode, mbmi, &best_scaled_rd,
+ &this_scaled_rd,
+ cpi->sf.inter_sf.bias_warp_mode_rd_scale_pct,
+ cpi->sf.inter_sf.bias_obmc_mode_rd_scale_pct);
if (this_scaled_rd < best_rd_in_this_partition) {
best_rd_in_this_partition = rd_stats.rdcost;
*yrd = this_yrd;
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index bc0e1988c0..3d9833a647 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -659,6 +659,7 @@ static void set_good_speed_features_lc_dec_framesize_dependent(
sf->lpf_sf.switchable_lr_with_bias_level = 1;
sf->inter_sf.bias_warp_mode_rd_scale_pct = 4;
+ sf->inter_sf.bias_obmc_mode_rd_scale_pct = 1.5f;
sf->part_sf.split_partition_penalty_level = is_key_frame ? 0 : 2;
@@ -2331,6 +2332,7 @@ static inline void init_inter_sf(INTER_MODE_SPEED_FEATURES *inter_sf) {
inter_sf->limit_txfm_eval_per_mode = 0;
inter_sf->skip_arf_compound = 0;
inter_sf->bias_warp_mode_rd_scale_pct = 0;
+ inter_sf->bias_obmc_mode_rd_scale_pct = 0.0f;
set_txfm_rd_gate_level(inter_sf->txfm_rd_gate_level, 0);
}
diff --git a/av1/encoder/speed_features.h b/av1/encoder/speed_features.h
index 3bcffb4d91..b92cd19a9f 100644
--- a/av1/encoder/speed_features.h
+++ b/av1/encoder/speed_features.h
@@ -1222,6 +1222,11 @@ typedef struct INTER_MODE_SPEED_FEATURES {
// encoder decisions are biased against local warp, favoring low complexity
// modes.
int bias_warp_mode_rd_scale_pct;
+
+ // Percentage of scaling used to increase the rd cost of obmc motion mode so
+ // that encoder decisions are biased against local obmc, favoring low
+ // complexity modes.
+ float bias_obmc_mode_rd_scale_pct;
} INTER_MODE_SPEED_FEATURES;
typedef struct INTERP_FILTER_SPEED_FEATURES {