WebM Codec SDK
vpx_ext_ratectrl.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 The WebM project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
15#ifndef VPX_VPX_VPX_EXT_RATECTRL_H_
16#define VPX_VPX_VPX_EXT_RATECTRL_H_
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22#include "./vpx_integer.h"
23#include "./vpx_tpl.h"
24
33#define VPX_EXT_RATECTRL_ABI_VERSION (5 + VPX_TPL_ABI_VERSION)
34
37#define VPX_RC_MAX_STATIC_GF_GROUP_LENGTH 250
38
43#define VPX_RC_MAX_REF_FRAMES 4
44
80
83typedef enum vpx_ext_rc_mode {
84 VPX_RC_QMODE = 0,
85 VPX_RC_VBR = 1,
86 VPX_RC_CQ = 2,
88
92 VPX_RC_INVALID_UPDATE_TYPE = -1,
93 VPX_RC_KF_UPDATE = 0,
94 VPX_RC_LF_UPDATE = 1,
95 VPX_RC_GF_UPDATE = 2,
96 VPX_RC_ARF_UPDATE = 3,
97 VPX_RC_OVERLAY_UPDATE = 4,
98 VPX_RC_MID_OVERLAY_UPDATE = 5,
99 VPX_RC_USE_BUF_FRAME = 6,
101
106typedef enum vpx_rc_ref_name {
107 VPX_RC_INVALID_REF_FRAME = -1,
108 VPX_RC_INTRA_FRAME = 0,
109 VPX_RC_LAST_FRAME = 1,
110 VPX_RC_GOLDEN_FRAME = 2,
111 VPX_RC_ALTREF_FRAME = 3,
113
119typedef void *vpx_rc_model_t;
120
126#define VPX_DEFAULT_Q -1
127
133#define VPX_DEFAULT_RDMULT -1
134
144
182
192
195typedef enum vpx_rc_status {
196 VPX_RC_OK = 0,
197 VPX_RC_ERROR = 1,
199
334
349
375
391
410
418
429 void *priv, const vpx_rc_config_t *ratectrl_config,
430 vpx_rc_model_t *rate_ctrl_model_ptr);
431
442 vpx_rc_model_t rate_ctrl_model,
443 const vpx_rc_firstpass_stats_t *first_pass_stats);
444
455 vpx_rc_model_t rate_ctrl_model, const VpxTplGopStats *tpl_gop_stats);
456
467 vpx_rc_model_t rate_ctrl_model, const int frame_gop_index,
468 vpx_rc_encodeframe_decision_t *frame_decision);
469
479 vpx_rc_model_t rate_ctrl_model,
480 const vpx_rc_encodeframe_result_t *encode_frame_result);
481
491 vpx_rc_model_t rate_ctrl_model,
492 vpx_rc_key_frame_decision_t *key_frame_decision);
493
503 vpx_rc_model_t rate_ctrl_model, vpx_rc_gop_decision_t *gop_decision);
504
515 vpx_rc_model_t rate_ctrl_model, const vpx_rc_encodeframe_info_t *frame_info,
516 int *rdmult);
517
526 vpx_rc_model_t rate_ctrl_model);
527
585
586#ifdef __cplusplus
587} // extern "C"
588#endif
589
590#endif // VPX_VPX_VPX_EXT_RATECTRL_H_
Temporal dependency model stats for each GOP before propagation.
Definition vpx_tpl.h:59
Encode config sent to external rate control model.
Definition vpx_ext_ratectrl.h:352
int min_base_q_index
Definition vpx_ext_ratectrl.h:371
int frame_height
Definition vpx_ext_ratectrl.h:354
int max_base_q_index
Definition vpx_ext_ratectrl.h:372
int frame_width
Definition vpx_ext_ratectrl.h:353
int show_frame_count
Definition vpx_ext_ratectrl.h:355
int overshoot_percent
Definition vpx_ext_ratectrl.h:369
int base_qp
Definition vpx_ext_ratectrl.h:373
int max_gf_interval
Definition vpx_ext_ratectrl.h:356
int undershoot_percent
Definition vpx_ext_ratectrl.h:370
int target_bitrate_kbps
Definition vpx_ext_ratectrl.h:361
vpx_ext_rc_mode_t rc_mode
Definition vpx_ext_ratectrl.h:368
int frame_rate_num
Definition vpx_ext_ratectrl.h:362
int min_gf_interval
Definition vpx_ext_ratectrl.h:357
int frame_rate_den
Definition vpx_ext_ratectrl.h:363
Encode frame decision made by the external rate control model.
Definition vpx_ext_ratectrl.h:140
int rdmult
Definition vpx_ext_ratectrl.h:142
int q_index
Definition vpx_ext_ratectrl.h:141
Information for the frame to be encoded.
Definition vpx_ext_ratectrl.h:151
int show_index
Definition vpx_ext_ratectrl.h:160
int coding_index
Definition vpx_ext_ratectrl.h:161
int ref_frame_coding_indexes[3]
Definition vpx_ext_ratectrl.h:166
int ref_frame_valid_list[3]
Definition vpx_ext_ratectrl.h:172
int gop_index
Definition vpx_ext_ratectrl.h:165
int frame_type
Definition vpx_ext_ratectrl.h:159
int use_alt_ref
Definition vpx_ext_ratectrl.h:180
int gop_size
Definition vpx_ext_ratectrl.h:176
Frame coding result.
Definition vpx_ext_ratectrl.h:188
int actual_encoding_qindex
Definition vpx_ext_ratectrl.h:190
int64_t bit_count
Definition vpx_ext_ratectrl.h:189
Collection of first pass frame stats.
Definition vpx_ext_ratectrl.h:337
vpx_rc_frame_stats_t * frame_stats
Definition vpx_ext_ratectrl.h:343
int num_frames
Definition vpx_ext_ratectrl.h:347
First pass frame stats This is a mirror of vp9's FIRSTPASS_STATS except that spatial_layer_id is omit...
Definition vpx_ext_ratectrl.h:204
double mvr_abs
Definition vpx_ext_ratectrl.h:297
double duration
Definition vpx_ext_ratectrl.h:323
double pcnt_intra_low
Definition vpx_ext_ratectrl.h:258
double inactive_zone_cols
Definition vpx_ext_ratectrl.h:289
double weight
Definition vpx_ext_ratectrl.h:215
double MVr
Definition vpx_ext_ratectrl.h:293
double mv_in_out_count
Definition vpx_ext_ratectrl.h:319
double inactive_zone_rows
Definition vpx_ext_ratectrl.h:285
double frame
Definition vpx_ext_ratectrl.h:209
double new_mv_count
Definition vpx_ext_ratectrl.h:332
double intra_error
Definition vpx_ext_ratectrl.h:219
double frame_noise_energy
Definition vpx_ext_ratectrl.h:231
double pcnt_neutral
Definition vpx_ext_ratectrl.h:250
double MVc
Definition vpx_ext_ratectrl.h:301
double mvc_abs
Definition vpx_ext_ratectrl.h:305
double intra_smooth_pct
Definition vpx_ext_ratectrl.h:281
double MVrv
Definition vpx_ext_ratectrl.h:309
double pcnt_motion
Definition vpx_ext_ratectrl.h:239
double MVcv
Definition vpx_ext_ratectrl.h:313
double pcnt_intra_high
Definition vpx_ext_ratectrl.h:266
double count
Definition vpx_ext_ratectrl.h:328
double pcnt_inter
Definition vpx_ext_ratectrl.h:235
double intra_skip_pct
Definition vpx_ext_ratectrl.h:274
double sr_coded_error
Definition vpx_ext_ratectrl.h:227
double pcnt_second_ref
Definition vpx_ext_ratectrl.h:245
double coded_error
Definition vpx_ext_ratectrl.h:223
Callback function set for external rate control.
Definition vpx_ext_ratectrl.h:534
vpx_rc_send_firstpass_stats_cb_fn_t send_firstpass_stats
Definition vpx_ext_ratectrl.h:546
vpx_rc_get_encodeframe_decision_cb_fn_t get_encodeframe_decision
Definition vpx_ext_ratectrl.h:554
vpx_rc_create_model_cb_fn_t create_model
Definition vpx_ext_ratectrl.h:542
vpx_rc_send_tpl_gop_stats_cb_fn_t send_tpl_gop_stats
Definition vpx_ext_ratectrl.h:550
vpx_rc_get_gop_decision_cb_fn_t get_gop_decision
Definition vpx_ext_ratectrl.h:566
vpx_rc_type_t rc_type
Definition vpx_ext_ratectrl.h:538
void * priv
Definition vpx_ext_ratectrl.h:583
vpx_rc_update_encodeframe_result_cb_fn_t update_encodeframe_result
Definition vpx_ext_ratectrl.h:558
const char * rate_ctrl_log_path
Definition vpx_ext_ratectrl.h:579
vpx_rc_get_key_frame_decision_cb_fn_t get_key_frame_decision
Definition vpx_ext_ratectrl.h:562
vpx_rc_delete_model_cb_fn_t delete_model
Definition vpx_ext_ratectrl.h:574
vpx_rc_get_frame_rdmult_cb_fn_t get_frame_rdmult
Definition vpx_ext_ratectrl.h:570
The decision made by the external rate control model to set the group of picture.
Definition vpx_ext_ratectrl.h:395
int use_key_frame
Definition vpx_ext_ratectrl.h:398
int use_alt_ref
Definition vpx_ext_ratectrl.h:397
int gop_coding_frames
Definition vpx_ext_ratectrl.h:396
vpx_rc_ref_frame_t ref_frame_list[250+2]
Definition vpx_ext_ratectrl.h:408
vpx_rc_frame_update_type_t update_type[250+2]
Definition vpx_ext_ratectrl.h:404
int update_ref_index[250+2]
Definition vpx_ext_ratectrl.h:406
The decision made by the external rate control model to set the key frame location and the show frame...
Definition vpx_ext_ratectrl.h:414
int key_frame_group_size
Definition vpx_ext_ratectrl.h:416
int key_frame_show_index
Definition vpx_ext_ratectrl.h:415
Control what ref frame to use and its index.
Definition vpx_ext_ratectrl.h:378
vpx_rc_ref_name_t name[4]
Definition vpx_ext_ratectrl.h:389
int index[4]
Definition vpx_ext_ratectrl.h:383
enum vpx_rc_type vpx_rc_type_t
The type of the external rate control.
vpx_rc_frame_update_type
Corresponds to FRAME_UPDATE_TYPE defined in vp9_firstpass.h.
Definition vpx_ext_ratectrl.h:91
#define VPX_RC_MAX_REF_FRAMES
Max number of ref frames returned by the external RC.
Definition vpx_ext_ratectrl.h:43
vpx_rc_status_t(* vpx_rc_update_encodeframe_result_cb_fn_t)(vpx_rc_model_t rate_ctrl_model, const vpx_rc_encodeframe_result_t *encode_frame_result)
Update encode frame result callback prototype.
Definition vpx_ext_ratectrl.h:478
struct vpx_rc_encodeframe_info vpx_rc_encodeframe_info_t
Information for the frame to be encoded.
vpx_rc_status_t(* vpx_rc_send_firstpass_stats_cb_fn_t)(vpx_rc_model_t rate_ctrl_model, const vpx_rc_firstpass_stats_t *first_pass_stats)
Send first pass stats to the external rate control model callback prototype.
Definition vpx_ext_ratectrl.h:441
struct vpx_rc_ref_frame vpx_rc_ref_frame_t
Control what ref frame to use and its index.
enum vpx_rc_frame_update_type vpx_rc_frame_update_type_t
Corresponds to FRAME_UPDATE_TYPE defined in vp9_firstpass.h.
vpx_rc_status_t(* vpx_rc_get_gop_decision_cb_fn_t)(vpx_rc_model_t rate_ctrl_model, vpx_rc_gop_decision_t *gop_decision)
Get the GOP structure from the external rate control model.
Definition vpx_ext_ratectrl.h:502
vpx_rc_status_t(* vpx_rc_get_frame_rdmult_cb_fn_t)(vpx_rc_model_t rate_ctrl_model, const vpx_rc_encodeframe_info_t *frame_info, int *rdmult)
Get the frame rdmult from the external rate control model.
Definition vpx_ext_ratectrl.h:514
vpx_rc_status
Status returned by rate control callback functions.
Definition vpx_ext_ratectrl.h:195
struct vpx_rc_firstpass_stats vpx_rc_firstpass_stats_t
Collection of first pass frame stats.
struct vpx_rc_key_frame_decision vpx_rc_key_frame_decision_t
The decision made by the external rate control model to set the key frame location and the show frame...
struct vpx_rc_gop_decision vpx_rc_gop_decision_t
The decision made by the external rate control model to set the group of picture.
vpx_rc_type
The type of the external rate control.
Definition vpx_ext_ratectrl.h:50
@ VPX_RC_RDMULT
Definition vpx_ext_ratectrl.h:70
@ VPX_RC_GOP
Definition vpx_ext_ratectrl.h:65
@ VPX_RC_QP
Definition vpx_ext_ratectrl.h:60
@ VPX_RC_GOP_QP
Definition vpx_ext_ratectrl.h:74
@ VPX_RC_NONE
Definition vpx_ext_ratectrl.h:55
@ VPX_RC_GOP_QP_RDMULT
Definition vpx_ext_ratectrl.h:78
#define VPX_RC_MAX_STATIC_GF_GROUP_LENGTH
Corresponds to MAX_STATIC_GF_GROUP_LENGTH defined in vp9_ratectrl.h.
Definition vpx_ext_ratectrl.h:37
struct vpx_rc_frame_stats vpx_rc_frame_stats_t
First pass frame stats This is a mirror of vp9's FIRSTPASS_STATS except that spatial_layer_id is omit...
struct vpx_rc_encodeframe_decision vpx_rc_encodeframe_decision_t
Encode frame decision made by the external rate control model.
vpx_rc_status_t(* vpx_rc_get_encodeframe_decision_cb_fn_t)(vpx_rc_model_t rate_ctrl_model, const int frame_gop_index, vpx_rc_encodeframe_decision_t *frame_decision)
Receive encode frame decision callback prototype.
Definition vpx_ext_ratectrl.h:466
enum vpx_rc_status vpx_rc_status_t
Status returned by rate control callback functions.
vpx_ext_rc_mode
The rate control mode for the external rate control model.
Definition vpx_ext_ratectrl.h:83
vpx_rc_status_t(* vpx_rc_get_key_frame_decision_cb_fn_t)(vpx_rc_model_t rate_ctrl_model, vpx_rc_key_frame_decision_t *key_frame_decision)
Get the key frame decision from the external rate control model.
Definition vpx_ext_ratectrl.h:490
struct vpx_rc_encodeframe_result vpx_rc_encodeframe_result_t
Frame coding result.
void * vpx_rc_model_t
Abstract rate control model handler.
Definition vpx_ext_ratectrl.h:119
vpx_rc_ref_name
Name for the ref frames returned by the external RC.
Definition vpx_ext_ratectrl.h:106
vpx_rc_status_t(* vpx_rc_send_tpl_gop_stats_cb_fn_t)(vpx_rc_model_t rate_ctrl_model, const VpxTplGopStats *tpl_gop_stats)
Send TPL stats for the current GOP to the external rate control model callback prototype.
Definition vpx_ext_ratectrl.h:454
struct vpx_rc_config vpx_rc_config_t
Encode config sent to external rate control model.
vpx_rc_status_t(* vpx_rc_delete_model_cb_fn_t)(vpx_rc_model_t rate_ctrl_model)
Delete the external rate control model callback prototype.
Definition vpx_ext_ratectrl.h:525
enum vpx_rc_ref_name vpx_rc_ref_name_t
Name for the ref frames returned by the external RC.
enum vpx_ext_rc_mode vpx_ext_rc_mode_t
The rate control mode for the external rate control model.
vpx_rc_status_t(* vpx_rc_create_model_cb_fn_t)(void *priv, const vpx_rc_config_t *ratectrl_config, vpx_rc_model_t *rate_ctrl_model_ptr)
Create an external rate control model callback prototype.
Definition vpx_ext_ratectrl.h:428
struct vpx_rc_funcs vpx_rc_funcs_t
Callback function set for external rate control.
Describes the TPL stats descriptor and associated operations.