Commit 8ad2e72af7 for aom
commit 8ad2e72af7f81f6aba3f3bde60c5d1c27a23e80a
Author: Marco Paniconi <marpan@google.com>
Date: Tue Jun 16 20:27:43 2026 -0700
rtc: Allow for intrabc for realtime mode screen
Make changes to allow intrabc for realtime mode.
Add a speed feature, for now enabled for speed < 7,
screen content mode.
Change-Id: I1fdd8361ac31913ca9b7e9737d17e82eb4d07965
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index 9d2292c5e3..e3ef6eb198 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -2232,7 +2232,7 @@ static inline void encode_frame_internal(AV1_COMP *cpi) {
int hash_table_created = 0;
if (!is_stat_generation_stage(cpi) && av1_use_hash_me(cpi) &&
- !cpi->sf.rt_sf.use_nonrd_pick_mode) {
+ (!cpi->sf.rt_sf.use_nonrd_pick_mode || cpi->sf.rt_sf.rt_use_intrabc)) {
// TODO(any): move this outside of the recoding loop to avoid recalculating
// the hash table.
// add to hash table
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c
index 878075f820..766b689913 100644
--- a/av1/encoder/encoder.c
+++ b/av1/encoder/encoder.c
@@ -2448,14 +2448,16 @@ void av1_set_screen_content_options(AV1_COMP *cpi, FeatureFlags *features) {
if (cpi->oxcf.tune_cfg.content == AOM_CONTENT_SCREEN) {
features->allow_screen_content_tools = 1;
- features->allow_intrabc = cpi->oxcf.mode == REALTIME ? 0 : 1;
+ features->allow_intrabc =
+ (cpi->oxcf.mode == REALTIME && !cpi->sf.rt_sf.rt_use_intrabc) ? 0 : 1;
cpi->is_screen_content_type = 1;
cpi->use_screen_content_tools = 1;
return;
}
if (cpi->oxcf.mode == REALTIME) {
- features->allow_screen_content_tools = features->allow_intrabc = 0;
+ features->allow_screen_content_tools = features->allow_intrabc =
+ cpi->sf.rt_sf.rt_use_intrabc;
return;
}
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h
index 601a111d35..bf47b76170 100644
--- a/av1/encoder/encoder.h
+++ b/av1/encoder/encoder.h
@@ -4153,7 +4153,7 @@ static inline int is_stat_consumption_stage(const AV1_COMP *const cpi) {
// Decide whether 'dv_costs' need to be allocated/stored during the encoding.
static inline bool av1_need_dv_costs(const AV1_COMP *const cpi) {
- return !cpi->sf.rt_sf.use_nonrd_pick_mode &&
+ return (!cpi->sf.rt_sf.use_nonrd_pick_mode || cpi->sf.rt_sf.rt_use_intrabc) &&
av1_allow_intrabc(&cpi->common) && !is_stat_generation_stage(cpi);
}
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 0ee6f482ea..a71217b835 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -3430,7 +3430,8 @@ static int64_t rd_pick_intrabc_mode_sb(const AV1_COMP *cpi, MACROBLOCK *x,
int64_t best_rd) {
const AV1_COMMON *const cm = &cpi->common;
if (!av1_allow_intrabc(cm) || !cpi->oxcf.kf_cfg.enable_intrabc ||
- !cpi->sf.mv_sf.use_intrabc || cpi->sf.rt_sf.use_nonrd_pick_mode)
+ !cpi->sf.mv_sf.use_intrabc ||
+ (cpi->sf.rt_sf.use_nonrd_pick_mode && !cpi->sf.rt_sf.rt_use_intrabc))
return INT64_MAX;
if (cpi->sf.mv_sf.intrabc_search_level >= 1 && bsize != BLOCK_4X4 &&
bsize != BLOCK_8X8 && bsize != BLOCK_16X16) {
diff --git a/av1/encoder/speed_features.c b/av1/encoder/speed_features.c
index d4e1f011de..8d3fa12f29 100644
--- a/av1/encoder/speed_features.c
+++ b/av1/encoder/speed_features.c
@@ -1762,7 +1762,7 @@ static void set_rt_speed_feature_framesize_dependent(const AV1_COMP *const cpi,
}
// Screen settings.
if (cpi->oxcf.tune_cfg.content == AOM_CONTENT_SCREEN) {
- // TODO(marpan): Check settings for speed 7 and 8.
+ if (speed < 7) sf->rt_sf.rt_use_intrabc = 1;
if (speed >= 7) {
sf->rt_sf.reduce_mv_pel_precision_highmotion = 0;
sf->mv_sf.use_bsize_dependent_search_method = 0;
@@ -2620,6 +2620,7 @@ static inline void init_rt_sf(REAL_TIME_SPEED_FEATURES *rt_sf) {
rt_sf->check_globalmv_on_single_ref = true;
rt_sf->increase_color_thresh_palette = false;
rt_sf->selective_cdf_update = 0;
+ rt_sf->rt_use_intrabc = 0;
rt_sf->force_only_last_ref = 0;
rt_sf->higher_thresh_scene_detection = 1;
rt_sf->skip_newmv_flat_blocks_screen = 0;
diff --git a/av1/encoder/speed_features.h b/av1/encoder/speed_features.h
index da6f18b655..e884dade05 100644
--- a/av1/encoder/speed_features.h
+++ b/av1/encoder/speed_features.h
@@ -1842,6 +1842,8 @@ typedef struct REAL_TIME_SPEED_FEATURES {
// Force selective cdf update.
int selective_cdf_update;
+ // Use IntraBC for realtime mode.
+ int rt_use_intrabc;
// Force only single reference (LAST) for prediction.
int force_only_last_ref;