WebM Codec SDK
vpx_ext_ratectrl.h
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
11#ifndef VPX_VPX_VPX_EXT_RATECTRL_H_
12#define VPX_VPX_VPX_EXT_RATECTRL_H_
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18#include "./vpx_integer.h"
19
28#define VPX_EXT_RATECTRL_ABI_VERSION (6)
29
42typedef enum vpx_rc_type {
43 VPX_RC_QP = 1 << 0,
44 VPX_RC_GOP = 1 << 1,
45 VPX_RC_RDMULT = 1 << 2,
46 VPX_RC_GOP_QP = VPX_RC_QP | VPX_RC_GOP,
47 VPX_RC_GOP_QP_RDMULT = VPX_RC_QP | VPX_RC_GOP | VPX_RC_RDMULT
48} vpx_rc_type_t;
49
55typedef void *vpx_rc_model_t;
56
62#define VPX_DEFAULT_Q -1
63
69#define VPX_DEFAULT_RDMULT -1
70
84 int q_index;
87
125
132 int64_t sse;
133 int64_t bit_count;
134 int64_t pixel_count;
137
140typedef enum vpx_rc_status {
141 VPX_RC_OK = 0,
142 VPX_RC_ERROR = 1,
143} vpx_rc_status_t;
144
149typedef struct vpx_rc_frame_stats {
154 double frame;
160 double weight;
238 double MVr;
242 double mvr_abs;
246 double MVc;
250 double mvc_abs;
254 double MVrv;
258 double MVcv;
268 double duration;
273 double count;
275
290
293typedef struct vpx_rc_config {
304
308typedef struct vpx_rc_gop_info {
374
378typedef struct vpx_rc_gop_decision {
382
392typedef vpx_rc_status_t (*vpx_rc_create_model_cb_fn_t)(
393 void *priv, const vpx_rc_config_t *ratectrl_config,
394 vpx_rc_model_t *rate_ctrl_model_pt);
395
405typedef vpx_rc_status_t (*vpx_rc_send_firstpass_stats_cb_fn_t)(
406 vpx_rc_model_t rate_ctrl_model,
407 const vpx_rc_firstpass_stats_t *first_pass_stats);
408
418typedef vpx_rc_status_t (*vpx_rc_get_encodeframe_decision_cb_fn_t)(
419 vpx_rc_model_t rate_ctrl_model,
420 const vpx_rc_encodeframe_info_t *encode_frame_info,
421 vpx_rc_encodeframe_decision_t *frame_decision);
422
431typedef vpx_rc_status_t (*vpx_rc_update_encodeframe_result_cb_fn_t)(
432 vpx_rc_model_t rate_ctrl_model,
433 const vpx_rc_encodeframe_result_t *encode_frame_result);
434
444typedef vpx_rc_status_t (*vpx_rc_get_gop_decision_cb_fn_t)(
445 vpx_rc_model_t rate_ctrl_model, const vpx_rc_gop_info_t *gop_info,
446 vpx_rc_gop_decision_t *gop_decision);
447
457typedef vpx_rc_status_t (*vpx_rc_get_frame_rdmult_cb_fn_t)(
458 vpx_rc_model_t rate_ctrl_model, const vpx_rc_encodeframe_info_t *frame_info,
459 int *rdmult);
460
468typedef vpx_rc_status_t (*vpx_rc_delete_model_cb_fn_t)(
469 vpx_rc_model_t rate_ctrl_model);
470
477typedef struct vpx_rc_funcs {
481 vpx_rc_type_t rc_type;
485 vpx_rc_create_model_cb_fn_t create_model;
489 vpx_rc_send_firstpass_stats_cb_fn_t send_firstpass_stats;
493 vpx_rc_get_encodeframe_decision_cb_fn_t get_encodeframe_decision;
497 vpx_rc_update_encodeframe_result_cb_fn_t update_encodeframe_result;
501 vpx_rc_get_gop_decision_cb_fn_t get_gop_decision;
505 vpx_rc_get_frame_rdmult_cb_fn_t get_frame_rdmult;
509 vpx_rc_delete_model_cb_fn_t delete_model;
513 void *priv;
515
516#ifdef __cplusplus
517} // extern "C"
518#endif
519
520#endif // VPX_VPX_VPX_EXT_RATECTRL_H_
Encode config sent to external rate control model.
Definition: vpx_ext_ratectrl.h:293
int frame_height
Definition: vpx_ext_ratectrl.h:295
int frame_width
Definition: vpx_ext_ratectrl.h:294
int show_frame_count
Definition: vpx_ext_ratectrl.h:296
int target_bitrate_kbps
Definition: vpx_ext_ratectrl.h:300
int frame_rate_num
Definition: vpx_ext_ratectrl.h:301
int frame_rate_den
Definition: vpx_ext_ratectrl.h:302
Encode frame decision made by the external rate control model.
Definition: vpx_ext_ratectrl.h:83
int q_index
Definition: vpx_ext_ratectrl.h:84
int max_frame_size
Definition: vpx_ext_ratectrl.h:85
Information for the frame to be encoded.
Definition: vpx_ext_ratectrl.h:94
int show_index
Definition: vpx_ext_ratectrl.h:103
int coding_index
Definition: vpx_ext_ratectrl.h:104
int ref_frame_coding_indexes[3]
Definition: vpx_ext_ratectrl.h:109
int ref_frame_valid_list[3]
Definition: vpx_ext_ratectrl.h:115
int gop_index
Definition: vpx_ext_ratectrl.h:108
int frame_type
Definition: vpx_ext_ratectrl.h:102
int use_alt_ref
Definition: vpx_ext_ratectrl.h:123
int gop_size
Definition: vpx_ext_ratectrl.h:119
Frame coding result.
Definition: vpx_ext_ratectrl.h:131
int actual_encoding_qindex
Definition: vpx_ext_ratectrl.h:135
int64_t sse
Definition: vpx_ext_ratectrl.h:132
int64_t pixel_count
Definition: vpx_ext_ratectrl.h:134
int64_t bit_count
Definition: vpx_ext_ratectrl.h:133
Collection of first pass frame stats.
Definition: vpx_ext_ratectrl.h:278
vpx_rc_frame_stats_t * frame_stats
Definition: vpx_ext_ratectrl.h:284
int num_frames
Definition: vpx_ext_ratectrl.h:288
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:149
double mvr_abs
Definition: vpx_ext_ratectrl.h:242
double duration
Definition: vpx_ext_ratectrl.h:268
double pcnt_intra_low
Definition: vpx_ext_ratectrl.h:203
double inactive_zone_cols
Definition: vpx_ext_ratectrl.h:234
double weight
Definition: vpx_ext_ratectrl.h:160
double MVr
Definition: vpx_ext_ratectrl.h:238
double mv_in_out_count
Definition: vpx_ext_ratectrl.h:264
double inactive_zone_rows
Definition: vpx_ext_ratectrl.h:230
double frame
Definition: vpx_ext_ratectrl.h:154
double intra_error
Definition: vpx_ext_ratectrl.h:164
double frame_noise_energy
Definition: vpx_ext_ratectrl.h:176
double pcnt_neutral
Definition: vpx_ext_ratectrl.h:195
double MVc
Definition: vpx_ext_ratectrl.h:246
double mvc_abs
Definition: vpx_ext_ratectrl.h:250
double intra_smooth_pct
Definition: vpx_ext_ratectrl.h:226
double MVrv
Definition: vpx_ext_ratectrl.h:254
double pcnt_motion
Definition: vpx_ext_ratectrl.h:184
double MVcv
Definition: vpx_ext_ratectrl.h:258
double pcnt_intra_high
Definition: vpx_ext_ratectrl.h:211
double count
Definition: vpx_ext_ratectrl.h:273
double pcnt_inter
Definition: vpx_ext_ratectrl.h:180
double intra_skip_pct
Definition: vpx_ext_ratectrl.h:219
double sr_coded_error
Definition: vpx_ext_ratectrl.h:172
double pcnt_second_ref
Definition: vpx_ext_ratectrl.h:190
double coded_error
Definition: vpx_ext_ratectrl.h:168
Callback function set for external rate control.
Definition: vpx_ext_ratectrl.h:477
vpx_rc_send_firstpass_stats_cb_fn_t send_firstpass_stats
Definition: vpx_ext_ratectrl.h:489
vpx_rc_get_encodeframe_decision_cb_fn_t get_encodeframe_decision
Definition: vpx_ext_ratectrl.h:493
vpx_rc_create_model_cb_fn_t create_model
Definition: vpx_ext_ratectrl.h:485
vpx_rc_get_gop_decision_cb_fn_t get_gop_decision
Definition: vpx_ext_ratectrl.h:501
vpx_rc_type_t rc_type
Definition: vpx_ext_ratectrl.h:481
void * priv
Definition: vpx_ext_ratectrl.h:513
vpx_rc_update_encodeframe_result_cb_fn_t update_encodeframe_result
Definition: vpx_ext_ratectrl.h:497
vpx_rc_delete_model_cb_fn_t delete_model
Definition: vpx_ext_ratectrl.h:509
vpx_rc_get_frame_rdmult_cb_fn_t get_frame_rdmult
Definition: vpx_ext_ratectrl.h:505
The decision made by the external rate control model to set the group of picture.
Definition: vpx_ext_ratectrl.h:378
int use_alt_ref
Definition: vpx_ext_ratectrl.h:380
int gop_coding_frames
Definition: vpx_ext_ratectrl.h:379
Information passed to the external rate control model to help make GOP decisions.
Definition: vpx_ext_ratectrl.h:308
int active_min_gf_interval
Definition: vpx_ext_ratectrl.h:325
int show_index
Definition: vpx_ext_ratectrl.h:363
int frames_since_key
Definition: vpx_ext_ratectrl.h:349
int allow_alt_ref
Definition: vpx_ext_ratectrl.h:336
int is_key_frame
Definition: vpx_ext_ratectrl.h:340
int active_max_gf_interval
Definition: vpx_ext_ratectrl.h:330
int max_gf_interval
Definition: vpx_ext_ratectrl.h:320
int min_gf_interval
Definition: vpx_ext_ratectrl.h:316
int last_gop_use_alt_ref
Definition: vpx_ext_ratectrl.h:344
int frames_to_key
Definition: vpx_ext_ratectrl.h:354
int coding_index
Definition: vpx_ext_ratectrl.h:367
int lag_in_frames
Definition: vpx_ext_ratectrl.h:358
int gop_global_index
Definition: vpx_ext_ratectrl.h:372