Two control types are defined: QP and GOP control.
Now the API only supports the QP model.
Change-Id: Ib3a712964b9d2282c93993ee56e0558e4795fb46
::libvpx_test::Encoder *encoder) override {
if (video->frame() == 0) {
vpx_rc_funcs_t rc_funcs;
+ rc_funcs.rc_type = VPX_RC_QP;
rc_funcs.create_model = rc_create_model;
rc_funcs.send_firstpass_stats = rc_send_firstpass_stats;
rc_funcs.get_encodeframe_decision = rc_get_encodeframe_decision;
if (ext_ratectrl == NULL) {
return VPX_CODEC_INVALID_PARAM;
}
- if (ext_ratectrl->ready) {
+ if (ext_ratectrl->ready && ext_ratectrl->funcs.rc_type == VPX_RC_QP) {
vpx_rc_status_t rc_status;
vpx_rc_encodeframe_info_t encode_frame_info;
encode_frame_info.show_index = show_index;
if (ext_ratectrl == NULL) {
return VPX_CODEC_INVALID_PARAM;
}
- if (ext_ratectrl->ready) {
+ if (ext_ratectrl->ready && ext_ratectrl->funcs.rc_type == VPX_RC_QP) {
PSNR_STATS psnr;
vpx_rc_status_t rc_status;
vpx_rc_encodeframe_result_t encode_frame_result;
* types, removing or reassigning enums, adding/removing/rearranging
* fields to structures.
*/
-#define VPX_EXT_RATECTRL_ABI_VERSION (1)
+#define VPX_EXT_RATECTRL_ABI_VERSION (2)
+
+/*!\brief The control type of the inference API.
+ * In VPX_RC_QP mode, the external rate control model determines the
+ * quantization parameter (QP) for each frame.
+ * In VPX_RC_GOP mode, the external rate control model determines the
+ * group of picture (GOP) of the video sequence.
+ */
+typedef enum vpx_rc_type { VPX_RC_QP = 0, VPX_RC_GOP = 1 } vpx_rc_type_t;
/*!\brief Abstract rate control model handler
*
*/
typedef struct vpx_rc_funcs {
/*!
+ * The rate control type of this API.
+ */
+ vpx_rc_type_t rc_type;
+ /*!
* Create an external rate control model.
*/
vpx_rc_create_model_cb_fn_t create_model;