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_
Encode config sent to external rate control model.
Definition: vpx_ext_ratectrl.h:249
int frame_height
Definition: vpx_ext_ratectrl.h:251
int frame_width
Definition: vpx_ext_ratectrl.h:250
int show_frame_count
Definition: vpx_ext_ratectrl.h:252
int target_bitrate_kbps
Definition: vpx_ext_ratectrl.h:256
int frame_rate_num
Definition: vpx_ext_ratectrl.h:257
int frame_rate_den
Definition: vpx_ext_ratectrl.h:258
Encode frame decision made by the external rate control model.
Definition: vpx_ext_ratectrl.h:47
int q_index
Definition: vpx_ext_ratectrl.h:48
int max_frame_size
Definition: vpx_ext_ratectrl.h:49
Information for the frame to be encoded.
Definition: vpx_ext_ratectrl.h:58
int show_index
Definition: vpx_ext_ratectrl.h:67
int coding_index
Definition: vpx_ext_ratectrl.h:68
int ref_frame_coding_indexes[3]
Definition: vpx_ext_ratectrl.h:73
int ref_frame_valid_list[3]
Definition: vpx_ext_ratectrl.h:79
int gop_index
Definition: vpx_ext_ratectrl.h:72
int frame_type
Definition: vpx_ext_ratectrl.h:66
Frame coding result.
Definition: vpx_ext_ratectrl.h:87
int actual_encoding_qindex
Definition: vpx_ext_ratectrl.h:91
int64_t sse
Definition: vpx_ext_ratectrl.h:88
int64_t pixel_count
Definition: vpx_ext_ratectrl.h:90
int64_t bit_count
Definition: vpx_ext_ratectrl.h:89
Collection of first pass frame stats.
Definition: vpx_ext_ratectrl.h:234
vpx_rc_frame_stats_t * frame_stats
Definition: vpx_ext_ratectrl.h:240
int num_frames
Definition: vpx_ext_ratectrl.h:244
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
double mvr_abs
Definition: vpx_ext_ratectrl.h:198
double duration
Definition: vpx_ext_ratectrl.h:224
double pcnt_intra_low
Definition: vpx_ext_ratectrl.h:159
double inactive_zone_cols
Definition: vpx_ext_ratectrl.h:190
double weight
Definition: vpx_ext_ratectrl.h:116
double MVr
Definition: vpx_ext_ratectrl.h:194
double mv_in_out_count
Definition: vpx_ext_ratectrl.h:220
double inactive_zone_rows
Definition: vpx_ext_ratectrl.h:186
double frame
Definition: vpx_ext_ratectrl.h:110
double intra_error
Definition: vpx_ext_ratectrl.h:120
double frame_noise_energy
Definition: vpx_ext_ratectrl.h:132
double pcnt_neutral
Definition: vpx_ext_ratectrl.h:151
double MVc
Definition: vpx_ext_ratectrl.h:202
double mvc_abs
Definition: vpx_ext_ratectrl.h:206
double intra_smooth_pct
Definition: vpx_ext_ratectrl.h:182
double MVrv
Definition: vpx_ext_ratectrl.h:210
double pcnt_motion
Definition: vpx_ext_ratectrl.h:140
double MVcv
Definition: vpx_ext_ratectrl.h:214
double pcnt_intra_high
Definition: vpx_ext_ratectrl.h:167
double count
Definition: vpx_ext_ratectrl.h:229
double pcnt_inter
Definition: vpx_ext_ratectrl.h:136
double intra_skip_pct
Definition: vpx_ext_ratectrl.h:175
double sr_coded_error
Definition: vpx_ext_ratectrl.h:128
double pcnt_second_ref
Definition: vpx_ext_ratectrl.h:146
double coded_error
Definition: vpx_ext_ratectrl.h:124
Callback function set for external rate control.
Definition: vpx_ext_ratectrl.h:329
vpx_rc_send_firstpass_stats_cb_fn_t send_firstpass_stats
Definition: vpx_ext_ratectrl.h:337
vpx_rc_get_encodeframe_decision_cb_fn_t get_encodeframe_decision
Definition: vpx_ext_ratectrl.h:341
vpx_rc_create_model_cb_fn_t create_model
Definition: vpx_ext_ratectrl.h:333
void * priv
Definition: vpx_ext_ratectrl.h:353
vpx_rc_update_encodeframe_result_cb_fn_t update_encodeframe_result
Definition: vpx_ext_ratectrl.h:345
vpx_rc_delete_model_cb_fn_t delete_model
Definition: vpx_ext_ratectrl.h:349