From 253d6365e3f134f4aca6f5fc312336cb501a1c6f Mon Sep 17 00:00:00 2001 From: Marco Paniconi Date: Mon, 17 Jun 2024 11:21:19 -0700 Subject: [PATCH] rtc-vp9: Allow scene detection for all speeds Current code was disallowing scene detection for speeds >= 8, to avoid any encode_time increase (see comment in the code). But we can expect the cost to be small even at speed 8,9, and that concern on encode_time was from some time ago before 8 and 9 were further optimized. And this is needed for content with scene changes (see issue attached). So allow scene detection now for all RTC speed settings (speed >= 5). Bug: b/346846607 Change-Id: I678dbb88ff1399ed89b2bf9770ae9427e3044fc4 --- vp9/encoder/vp9_encoder.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 499adcb9f50..9ea1d2b5c9e 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -4098,16 +4098,14 @@ static int encode_without_recode_loop(VP9_COMP *cpi, size_t *size, #endif // Scene detection is always used for VBR mode or screen-content case. - // For other cases (e.g., CBR mode) use it for 5 <= speed < 8 for now - // (need to check encoding time cost for doing this for speed 8). + // For other cases (e.g., CBR mode) use it for 5 <= speed. cpi->rc.high_source_sad = 0; cpi->rc.hybrid_intra_scene_change = 0; cpi->rc.re_encode_maxq_scene_change = 0; if (cm->show_frame && cpi->oxcf.mode == REALTIME && !cpi->disable_scene_detection_rtc_ratectrl && (cpi->oxcf.rc_mode == VPX_VBR || - cpi->oxcf.content == VP9E_CONTENT_SCREEN || - (cpi->oxcf.speed >= 5 && cpi->oxcf.speed < 8))) + cpi->oxcf.content == VP9E_CONTENT_SCREEN || cpi->oxcf.speed >= 5)) vp9_scene_detection_onepass(cpi); if (svc->spatial_layer_id == svc->first_spatial_layer_to_encode) {