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
15 extern "C" {
16 #endif
17 
18 #include "./vpx_integer.h"
19 
28 #define VPX_EXT_RATECTRL_ABI_VERSION (1)
29 
35 typedef void *vpx_rc_model_t;
36 
48  int q_index;
51 
58 typedef struct vpx_rc_encodeframe_info {
67  int show_index;
72  int gop_index;
81 
87 typedef struct vpx_rc_encodeframe_result {
88  int64_t sse;
89  int64_t bit_count;
90  int64_t pixel_count;
93 
96 typedef enum vpx_rc_status {
97  VPX_RC_OK = 0,
98  VPX_RC_ERROR = 1,
99 } vpx_rc_status_t;
100 
105 typedef struct vpx_rc_frame_stats {
110  double frame;
116  double weight;
120  double intra_error;
124  double coded_error;
136  double pcnt_inter;
140  double pcnt_motion;
151  double pcnt_neutral;
194  double MVr;
198  double mvr_abs;
202  double MVc;
206  double mvc_abs;
210  double MVrv;
214  double MVcv;
224  double duration;
229  double count;
231 
234 typedef struct vpx_rc_firstpass_stats {
246 
249 typedef struct vpx_rc_config {
260 
270 typedef vpx_rc_status_t (*vpx_rc_create_model_cb_fn_t)(
271  void *priv, const vpx_rc_config_t *ratectrl_config,
272  vpx_rc_model_t *rate_ctrl_model_pt);
273 
283 typedef vpx_rc_status_t (*vpx_rc_send_firstpass_stats_cb_fn_t)(
284  vpx_rc_model_t rate_ctrl_model,
285  const vpx_rc_firstpass_stats_t *first_pass_stats);
286 
296 typedef vpx_rc_status_t (*vpx_rc_get_encodeframe_decision_cb_fn_t)(
297  vpx_rc_model_t rate_ctrl_model,
298  const vpx_rc_encodeframe_info_t *encode_frame_info,
299  vpx_rc_encodeframe_decision_t *frame_decision);
300 
309 typedef vpx_rc_status_t (*vpx_rc_update_encodeframe_result_cb_fn_t)(
310  vpx_rc_model_t rate_ctrl_model,
311  const vpx_rc_encodeframe_result_t *encode_frame_result);
312 
320 typedef vpx_rc_status_t (*vpx_rc_delete_model_cb_fn_t)(
321  vpx_rc_model_t rate_ctrl_model);
322 
329 typedef struct vpx_rc_funcs {
333  vpx_rc_create_model_cb_fn_t create_model;
337  vpx_rc_send_firstpass_stats_cb_fn_t send_firstpass_stats;
341  vpx_rc_get_encodeframe_decision_cb_fn_t get_encodeframe_decision;
345  vpx_rc_update_encodeframe_result_cb_fn_t update_encodeframe_result;
349  vpx_rc_delete_model_cb_fn_t delete_model;
353  void *priv;
355 
356 #ifdef __cplusplus
357 } // extern "C"
358 #endif
359 
360 #endif // VPX_VPX_VPX_EXT_RATECTRL_H_
vpx_rc_frame_stats::weight
double weight
Definition: vpx_ext_ratectrl.h:116
vpx_rc_funcs::send_firstpass_stats
vpx_rc_send_firstpass_stats_cb_fn_t send_firstpass_stats
Definition: vpx_ext_ratectrl.h:337
vpx_rc_encodeframe_result
Frame coding result.
Definition: vpx_ext_ratectrl.h:87
vpx_rc_frame_stats::MVr
double MVr
Definition: vpx_ext_ratectrl.h:194
vpx_rc_config::show_frame_count
int show_frame_count
Definition: vpx_ext_ratectrl.h:252
vpx_rc_config::frame_rate_den
int frame_rate_den
Definition: vpx_ext_ratectrl.h:258
vpx_rc_frame_stats::pcnt_intra_low
double pcnt_intra_low
Definition: vpx_ext_ratectrl.h:159
vpx_rc_frame_stats::pcnt_second_ref
double pcnt_second_ref
Definition: vpx_ext_ratectrl.h:146
vpx_rc_frame_stats::frame
double frame
Definition: vpx_ext_ratectrl.h:110
vpx_rc_frame_stats::intra_smooth_pct
double intra_smooth_pct
Definition: vpx_ext_ratectrl.h:182
vpx_rc_firstpass_stats::frame_stats
vpx_rc_frame_stats_t * frame_stats
Definition: vpx_ext_ratectrl.h:240
vpx_rc_frame_stats::MVrv
double MVrv
Definition: vpx_ext_ratectrl.h:210
vpx_rc_encodeframe_result::actual_encoding_qindex
int actual_encoding_qindex
Definition: vpx_ext_ratectrl.h:91
vpx_rc_frame_stats::MVcv
double MVcv
Definition: vpx_ext_ratectrl.h:214
vpx_rc_frame_stats::mvr_abs
double mvr_abs
Definition: vpx_ext_ratectrl.h:198
vpx_rc_funcs::delete_model
vpx_rc_delete_model_cb_fn_t delete_model
Definition: vpx_ext_ratectrl.h:349
vpx_rc_encodeframe_info::ref_frame_valid_list
int ref_frame_valid_list[3]
Definition: vpx_ext_ratectrl.h:79
vpx_rc_config::frame_height
int frame_height
Definition: vpx_ext_ratectrl.h:251
vpx_rc_frame_stats::intra_error
double intra_error
Definition: vpx_ext_ratectrl.h:120
vpx_rc_config::frame_rate_num
int frame_rate_num
Definition: vpx_ext_ratectrl.h:257
vpx_rc_encodeframe_info::gop_index
int gop_index
Definition: vpx_ext_ratectrl.h:72
vpx_rc_encodeframe_info::coding_index
int coding_index
Definition: vpx_ext_ratectrl.h:68
vpx_rc_encodeframe_result::pixel_count
int64_t pixel_count
Definition: vpx_ext_ratectrl.h:90
vpx_rc_funcs
Callback function set for external rate control.
Definition: vpx_ext_ratectrl.h:329
vpx_rc_encodeframe_result::bit_count
int64_t bit_count
Definition: vpx_ext_ratectrl.h:89
vpx_rc_frame_stats::pcnt_inter
double pcnt_inter
Definition: vpx_ext_ratectrl.h:136
vpx_rc_funcs::create_model
vpx_rc_create_model_cb_fn_t create_model
Definition: vpx_ext_ratectrl.h:333
vpx_rc_encodeframe_decision
Encode frame decision made by the external rate control model.
Definition: vpx_ext_ratectrl.h:47
vpx_rc_frame_stats::pcnt_motion
double pcnt_motion
Definition: vpx_ext_ratectrl.h:140
vpx_rc_frame_stats::frame_noise_energy
double frame_noise_energy
Definition: vpx_ext_ratectrl.h:132
vpx_rc_encodeframe_decision::max_frame_size
int max_frame_size
Definition: vpx_ext_ratectrl.h:49
vpx_rc_frame_stats::mv_in_out_count
double mv_in_out_count
Definition: vpx_ext_ratectrl.h:220
vpx_rc_encodeframe_decision::q_index
int q_index
Definition: vpx_ext_ratectrl.h:48
vpx_rc_firstpass_stats::num_frames
int num_frames
Definition: vpx_ext_ratectrl.h:244
vpx_rc_encodeframe_info::frame_type
int frame_type
Definition: vpx_ext_ratectrl.h:66
vpx_rc_frame_stats::sr_coded_error
double sr_coded_error
Definition: vpx_ext_ratectrl.h:128
vpx_rc_frame_stats::pcnt_neutral
double pcnt_neutral
Definition: vpx_ext_ratectrl.h:151
vpx_rc_encodeframe_info
Information for the frame to be encoded.
Definition: vpx_ext_ratectrl.h:58
vpx_rc_firstpass_stats
Collection of first pass frame stats.
Definition: vpx_ext_ratectrl.h:234
vpx_rc_frame_stats::count
double count
Definition: vpx_ext_ratectrl.h:229
vpx_rc_frame_stats::intra_skip_pct
double intra_skip_pct
Definition: vpx_ext_ratectrl.h:175
vpx_rc_encodeframe_result::sse
int64_t sse
Definition: vpx_ext_ratectrl.h:88
vpx_rc_config
Encode config sent to external rate control model.
Definition: vpx_ext_ratectrl.h:249
vpx_rc_funcs::priv
void * priv
Definition: vpx_ext_ratectrl.h:353
vpx_rc_config::target_bitrate_kbps
int target_bitrate_kbps
Definition: vpx_ext_ratectrl.h:256
vpx_rc_frame_stats::duration
double duration
Definition: vpx_ext_ratectrl.h:224
vpx_rc_frame_stats::pcnt_intra_high
double pcnt_intra_high
Definition: vpx_ext_ratectrl.h:167
vpx_rc_config::frame_width
int frame_width
Definition: vpx_ext_ratectrl.h:250
vpx_rc_encodeframe_info::ref_frame_coding_indexes
int ref_frame_coding_indexes[3]
Definition: vpx_ext_ratectrl.h:73
vpx_rc_frame_stats::mvc_abs
double mvc_abs
Definition: vpx_ext_ratectrl.h:206
vpx_rc_frame_stats::MVc
double MVc
Definition: vpx_ext_ratectrl.h:202
vpx_rc_encodeframe_info::show_index
int show_index
Definition: vpx_ext_ratectrl.h:67
vpx_rc_frame_stats
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:105
vpx_rc_frame_stats::inactive_zone_rows
double inactive_zone_rows
Definition: vpx_ext_ratectrl.h:186
vpx_rc_funcs::update_encodeframe_result
vpx_rc_update_encodeframe_result_cb_fn_t update_encodeframe_result
Definition: vpx_ext_ratectrl.h:345
vpx_rc_frame_stats::coded_error
double coded_error
Definition: vpx_ext_ratectrl.h:124
vpx_rc_frame_stats::inactive_zone_cols
double inactive_zone_cols
Definition: vpx_ext_ratectrl.h:190
vpx_rc_funcs::get_encodeframe_decision
vpx_rc_get_encodeframe_decision_cb_fn_t get_encodeframe_decision
Definition: vpx_ext_ratectrl.h:341