Use dummy first-pass frame in CTC Use a dummy first-pass frame in CTC settings. Avoid exercising first-pass stats in the encoding process therein. Change-Id: Ibc8498e826672444299a7b75d5e2f5d134c9af78 (cherry picked from commit cab784db520b8b6c5ab98cf066f9a772030f9dd0)
diff --git a/av1/encoder/encoder.c b/av1/encoder/encoder.c index a4fcba6..b5fa6a3 100644 --- a/av1/encoder/encoder.c +++ b/av1/encoder/encoder.c
@@ -3638,7 +3638,10 @@ if (is_stat_generation_stage(cpi)) { #if !CONFIG_REALTIME_ONLY - av1_first_pass(cpi, frame_input->ts_duration); + if (cpi->oxcf.q_cfg.use_fixed_qp_offsets) + av1_dummy_first_pass_frame(cpi, frame_input->ts_duration); + else + av1_first_pass(cpi, frame_input->ts_duration); #endif } else if (cpi->oxcf.pass == AOM_RC_ONE_PASS || cpi->oxcf.pass >= AOM_RC_SECOND_PASS) {
diff --git a/av1/encoder/firstpass.c b/av1/encoder/firstpass.c index af1e8c1..21fcd16 100644 --- a/av1/encoder/firstpass.c +++ b/av1/encoder/firstpass.c
@@ -1207,6 +1207,21 @@ } } +void av1_dummy_first_pass_frame(AV1_COMP *cpi, const int64_t ts_duration) { + AV1_COMMON *const cm = &cpi->common; + CurrentFrame *const current_frame = &cm->current_frame; + const CommonModeInfoParams *const mi_params = &cm->mi_params; + const int unit_rows = get_unit_rows(BLOCK_16X16, mi_params->mb_rows); + const int unit_cols = get_unit_cols(BLOCK_16X16, mi_params->mb_cols); + setup_firstpass_data(cm, &cpi->firstpass_data, unit_rows, unit_cols); + FRAME_STATS *mb_stats = cpi->firstpass_data.mb_stats; + FRAME_STATS stats = accumulate_frame_stats(mb_stats, unit_rows, unit_cols); + free_firstpass_data(&cpi->firstpass_data); + update_firstpass_stats(cpi, &stats, 1.0, current_frame->frame_number, + ts_duration, BLOCK_16X16); + return; +} + void av1_first_pass(AV1_COMP *cpi, const int64_t ts_duration) { MACROBLOCK *const x = &cpi->td.mb; AV1_COMMON *const cm = &cpi->common; @@ -1216,6 +1231,7 @@ const int num_planes = av1_num_planes(cm); MACROBLOCKD *const xd = &x->e_mbd; const int qindex = find_fp_qindex(seq_params->bit_depth); + // Detect if the key frame is screen content type. if (frame_is_intra_only(cm)) { FeatureFlags *const features = &cm->features;
diff --git a/av1/encoder/firstpass.h b/av1/encoder/firstpass.h index 88f9b27..078e0e5 100644 --- a/av1/encoder/firstpass.h +++ b/av1/encoder/firstpass.h
@@ -574,6 +574,8 @@ */ void av1_first_pass(struct AV1_COMP *cpi, const int64_t ts_duration); +void av1_dummy_first_pass_frame(struct AV1_COMP *cpi, + const int64_t ts_duration); #ifdef __cplusplus } // extern "C" #endif