RC: skip shortern GF when using ext RC Change-Id: Ife44d95b3cd5779be738930d213be6c3a9bf366e
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c index 5093bfd..a149da7 100644 --- a/av1/encoder/encoder.c +++ b/av1/encoder/encoder.c
@@ -3442,9 +3442,7 @@ } } - if (cpi->ext_ratectrl.ready && - (cpi->ext_ratectrl.funcs.rc_type & AOM_RC_QP) != 0 && - cpi->ext_ratectrl.funcs.get_encodeframe_decision != NULL) { + if (av1_encode_for_extrc(&cpi->ext_ratectrl)) { aom_codec_err_t codec_status; aom_rc_encodeframe_decision_t encode_frame_decision; const int sb_rows = CEIL_POWER_OF_TWO(cm->mi_params.mi_rows, @@ -3617,9 +3615,7 @@ } // Do not recode if external rate control is used. - if (cpi->ext_ratectrl.ready && - (cpi->ext_ratectrl.funcs.rc_type & AOM_RC_QP) != 0 && - cpi->ext_ratectrl.funcs.get_encodeframe_decision != NULL) { + if (av1_encode_for_extrc(&cpi->ext_ratectrl)) { loop = 0; } #if CONFIG_BITRATE_ACCURACY || CONFIG_RD_COMMAND
diff --git a/av1/encoder/encoder.h b/av1/encoder/encoder.h index 0bac370..b4e25d4 100644 --- a/av1/encoder/encoder.h +++ b/av1/encoder/encoder.h
@@ -4233,6 +4233,11 @@ return av1_superres_scaled(cm) || av1_resize_scaled(cm); } +static inline bool av1_encode_for_extrc(AOM_EXT_RATECTRL const *ext_rc) { + return ext_rc->ready && (ext_rc->funcs.rc_type & AOM_RC_QP) != 0 && + ext_rc->funcs.get_encodeframe_decision != NULL; +} + // Don't allow a show_existing_frame to coincide with an error resilient // frame. An exception can be made for a forward keyframe since it has no // previous dependencies.
diff --git a/av1/encoder/pass2_strategy.c b/av1/encoder/pass2_strategy.c index f489317..3c02b87 100644 --- a/av1/encoder/pass2_strategy.c +++ b/av1/encoder/pass2_strategy.c
@@ -1060,6 +1060,10 @@ static int is_shorter_gf_interval_better( AV1_COMP *cpi, const EncodeFrameParams *frame_params) { + if (av1_use_tpl_for_extrc(&cpi->ext_ratectrl) || + av1_encode_for_extrc(&cpi->ext_ratectrl)) { + return 0; + } const RATE_CONTROL *const rc = &cpi->rc; PRIMARY_RATE_CONTROL *const p_rc = &cpi->ppi->p_rc; int gop_length_decision_method = cpi->sf.tpl_sf.gop_length_decision_method;