From 557368a8fa9f839afd7a6ded6a95f18829ff3365 Mon Sep 17 00:00:00 2001 From: Cheng Chen Date: Mon, 1 Feb 2021 16:57:09 -0800 Subject: L2E: let external rate control pass in a max frame size And allow the frame to recode when the frame size is larger than the input max frame size. If the max frame size is not specified, let vp9 decide whether to recode. The recode follows the vp9's current recoding mechanism. The rate control api will return the new qindex back to the external model. Change-Id: I796fbf713ad50a5b413b0e2501583b565ed2343f --- vpx/vpx_ext_ratectrl.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'vpx') diff --git a/vpx/vpx_ext_ratectrl.h b/vpx/vpx_ext_ratectrl.h index dc4d856a8..a193e5595 100644 --- a/vpx/vpx_ext_ratectrl.h +++ b/vpx/vpx_ext_ratectrl.h @@ -38,9 +38,15 @@ typedef void *vpx_rc_model_t; * * The encoder will receive the decision from the external rate control model * through get_encodeframe_decision() defined in vpx_rc_funcs_t. + * + * If max_frame_size = 0, the encoding ignores max frame size limit. + * If max_frame_size = -1, the encoding uses VP9's max frame size as the limit. + * If the encoded frame size is larger than max_frame_size, the frame is + * recoded to meet the size limit, following VP9's recoding principles. */ typedef struct vpx_rc_encodeframe_decision { - int q_index; /**< Quantizer step index [0..255]*/ + int q_index; /**< Quantizer step index [0..255]*/ + int max_frame_size; /**< Maximal frame size allowed to encode a frame*/ } vpx_rc_encodeframe_decision_t; /*!\brief Information for the frame to be encoded. @@ -82,6 +88,7 @@ typedef struct vpx_rc_encodeframe_result { int64_t sse; /**< sum of squared error of the reconstructed frame */ int64_t bit_count; /**< number of bits spent on coding the frame*/ int64_t pixel_count; /**< number of pixels in YUV planes of the frame*/ + int actual_encoding_qindex; /**< the actual qindex used to encode the frame*/ } vpx_rc_encodeframe_result_t; /*!\brief Status returned by rate control callback functions. -- cgit v1.2.3