Replace frame_params with more specific func param Some functions that take a frame_params output parameter set only one field in the frame_params struct. Replace frame_params with a more specific function parameter. Change-Id: I6fefc56fd0dd91c13f654a25e4432901a0e7afe4
diff --git a/av1/encoder/encode_strategy.c b/av1/encoder/encode_strategy.c index 0c71036..f3bbc71 100644 --- a/av1/encoder/encode_strategy.c +++ b/av1/encoder/encode_strategy.c
@@ -310,8 +310,7 @@ // Return the frame source, or NULL if we couldn't find one static struct lookahead_entry *choose_frame_source( AV1_COMP *const cpi, int *const flush, int *pop_lookahead, - struct lookahead_entry **last_source, - EncodeFrameParams *const frame_params) { + struct lookahead_entry **last_source, int *const show_frame) { AV1_COMMON *const cm = &cpi->common; const GF_GROUP *const gf_group = &cpi->ppi->gf_group; struct lookahead_entry *source = NULL; @@ -353,7 +352,7 @@ src_index = 0; } - frame_params->show_frame = *pop_lookahead; + *show_frame = *pop_lookahead; #if CONFIG_FPMT_TEST if (cpi->ppi->fpmt_unit_test_cfg == PARALLEL_ENCODE) { @@ -365,7 +364,7 @@ !is_stat_generation_stage(cpi)) src_index = gf_group->src_offset[cpi->gf_frame_index]; } - if (frame_params->show_frame) { + if (*show_frame) { // show frame, pop from buffer // Get last frame source. if (cm->current_frame.frame_number > 0) { @@ -1362,7 +1361,7 @@ frame_params.show_frame = 1; } else { source = choose_frame_source(cpi, &flush, pop_lookahead, &last_source, - &frame_params); + &frame_params.show_frame); } if (source == NULL) { // If no source was found, we can't encode a frame. @@ -1429,12 +1428,14 @@ start_timing(cpi, av1_get_one_pass_rt_params_time); #endif #if CONFIG_REALTIME_ONLY - av1_get_one_pass_rt_params(cpi, &frame_params, &frame_input, *frame_flags); + av1_get_one_pass_rt_params(cpi, &frame_params.frame_type, &frame_input, + *frame_flags); if (use_rtc_reference_structure_one_layer(cpi)) av1_set_rtc_reference_structure_one_layer(cpi, cpi->gf_frame_index == 0); #else if (use_one_pass_rt_params) { - av1_get_one_pass_rt_params(cpi, &frame_params, &frame_input, *frame_flags); + av1_get_one_pass_rt_params(cpi, &frame_params.frame_type, &frame_input, + *frame_flags); if (use_rtc_reference_structure_one_layer(cpi)) av1_set_rtc_reference_structure_one_layer(cpi, cpi->gf_frame_index == 0); }
diff --git a/av1/encoder/ratectrl.c b/av1/encoder/ratectrl.c index fed5916..9e2bfc1 100644 --- a/av1/encoder/ratectrl.c +++ b/av1/encoder/ratectrl.c
@@ -3058,8 +3058,7 @@ return 0; } -void av1_get_one_pass_rt_params(AV1_COMP *cpi, - EncodeFrameParams *const frame_params, +void av1_get_one_pass_rt_params(AV1_COMP *cpi, FRAME_TYPE *const frame_type, const EncodeFrameInput *frame_input, unsigned int frame_flags) { RATE_CONTROL *const rc = &cpi->rc; @@ -3081,7 +3080,7 @@ } // Set frame type. if (set_key_frame(cpi, frame_flags)) { - frame_params->frame_type = KEY_FRAME; + *frame_type = KEY_FRAME; p_rc->this_key_frame_forced = cm->current_frame.frame_number != 0 && rc->frames_to_key == 0; rc->frames_to_key = cpi->oxcf.kf_cfg.key_freq_max; @@ -3095,7 +3094,7 @@ svc->layer_context[layer].is_key_frame = 1; } } else { - frame_params->frame_type = INTER_FRAME; + *frame_type = INTER_FRAME; gf_group->update_type[cpi->gf_frame_index] = LF_UPDATE; gf_group->frame_type[cpi->gf_frame_index] = INTER_FRAME; gf_group->refbuf_state[cpi->gf_frame_index] = REFBUF_UPDATE; @@ -3120,7 +3119,7 @@ // The stream can start decoding on INTRA_ONLY_FRAME so long as the // layer with the intra_only_frame doesn't signal a reference to a slot // that hasn't been set yet. - if (no_references_set) frame_params->frame_type = INTRA_ONLY_FRAME; + if (no_references_set) *frame_type = INTRA_ONLY_FRAME; } } } @@ -3149,19 +3148,17 @@ } // Set the GF interval and update flag. if (!rc->rtc_external_ratectrl) - set_gf_interval_update_onepass_rt(cpi, frame_params->frame_type); + set_gf_interval_update_onepass_rt(cpi, *frame_type); // Set target size. if (cpi->oxcf.rc_cfg.mode == AOM_CBR) { - if (frame_params->frame_type == KEY_FRAME || - frame_params->frame_type == INTRA_ONLY_FRAME) { + if (*frame_type == KEY_FRAME || *frame_type == INTRA_ONLY_FRAME) { target = av1_calc_iframe_target_size_one_pass_cbr(cpi); } else { target = av1_calc_pframe_target_size_one_pass_cbr( cpi, gf_group->update_type[cpi->gf_frame_index]); } } else { - if (frame_params->frame_type == KEY_FRAME || - frame_params->frame_type == INTRA_ONLY_FRAME) { + if (*frame_type == KEY_FRAME || *frame_type == INTRA_ONLY_FRAME) { target = av1_calc_iframe_target_size_one_pass_vbr(cpi); } else { target = av1_calc_pframe_target_size_one_pass_vbr( @@ -3173,7 +3170,7 @@ av1_rc_set_frame_target(cpi, target, cm->width, cm->height); rc->base_frame_target = target; - cm->current_frame.frame_type = frame_params->frame_type; + cm->current_frame.frame_type = *frame_type; // For fixed mode SVC: if KSVC is enabled remove inter layer // prediction on spatial enhancement layer frames for frames // whose base is not KEY frame.
diff --git a/av1/encoder/ratectrl.h b/av1/encoder/ratectrl.h index e188e6e..6a678b7 100644 --- a/av1/encoder/ratectrl.h +++ b/av1/encoder/ratectrl.h
@@ -584,7 +584,6 @@ // Functions to set parameters for encoding before the actual // encode_frame_to_data_rate() function. -struct EncodeFrameParams; struct EncodeFrameInput; // Post encode update of the rate control parameters based @@ -768,16 +767,16 @@ * * \ingroup rate_control * \param[in] cpi Top level encoder structure - * \param[in] frame_params Encoder frame parameters + * \param[in] frame_type Encoder frame type * \param[in] frame_input Current and last input source frames - * \param[in] frame_flags Emcoder frame flags + * \param[in] frame_flags Encoder frame flags * * \remark Nothing is returned. Instead the settings computed in this * function are set in: \c frame_params, \c cpi->common, \c cpi->rc, * \c cpi->svc. */ void av1_get_one_pass_rt_params(struct AV1_COMP *cpi, - struct EncodeFrameParams *const frame_params, + FRAME_TYPE *const frame_type, const struct EncodeFrameInput *frame_input, unsigned int frame_flags);