vpx_ext_ratectrl.h
/*
* Copyright (c) 2020 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef VPX_VPX_VPX_EXT_RATECTRL_H_
#define VPX_VPX_VPX_EXT_RATECTRL_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "./vpx_integer.h"
#define VPX_EXT_RATECTRL_ABI_VERSION (1)
typedef void *vpx_rc_model_t;
typedef struct vpx_rc_encodeframe_decision {
int q_index;
int max_frame_size;
} vpx_rc_encodeframe_decision_t;
typedef struct vpx_rc_encodeframe_info {
int frame_type;
int show_index;
int coding_index;
int gop_index;
int ref_frame_coding_indexes[3];
int ref_frame_valid_list[3];
} vpx_rc_encodeframe_info_t;
typedef struct vpx_rc_encodeframe_result {
int64_t sse;
int64_t bit_count;
int64_t pixel_count;
int actual_encoding_qindex;
} vpx_rc_encodeframe_result_t;
typedef enum vpx_rc_status {
VPX_RC_OK = 0,
VPX_RC_ERROR = 1,
} vpx_rc_status_t;
typedef struct vpx_rc_frame_stats {
double frame;
double weight;
double intra_error;
double coded_error;
double sr_coded_error;
double frame_noise_energy;
double pcnt_inter;
double pcnt_motion;
double pcnt_second_ref;
double pcnt_neutral;
double pcnt_intra_low;
double pcnt_intra_high;
double intra_skip_pct;
double intra_smooth_pct;
double inactive_zone_rows;
double inactive_zone_cols;
double MVr;
double mvr_abs;
double MVc;
double mvc_abs;
double MVrv;
double MVcv;
double mv_in_out_count;
double duration;
double count;
} vpx_rc_frame_stats_t;
typedef struct vpx_rc_firstpass_stats {
vpx_rc_frame_stats_t *frame_stats;
int num_frames;
} vpx_rc_firstpass_stats_t;
typedef struct vpx_rc_config {
int frame_width;
int frame_height;
int show_frame_count;
int target_bitrate_kbps;
int frame_rate_num;
int frame_rate_den;
} vpx_rc_config_t;
typedef 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_pt);
typedef 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);
typedef vpx_rc_status_t (*vpx_rc_get_encodeframe_decision_cb_fn_t)(
vpx_rc_model_t rate_ctrl_model,
const vpx_rc_encodeframe_info_t *encode_frame_info,
vpx_rc_encodeframe_decision_t *frame_decision);
typedef 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);
typedef vpx_rc_status_t (*vpx_rc_delete_model_cb_fn_t)(
vpx_rc_model_t rate_ctrl_model);
typedef struct vpx_rc_funcs {
vpx_rc_create_model_cb_fn_t create_model;
vpx_rc_send_firstpass_stats_cb_fn_t send_firstpass_stats;
vpx_rc_get_encodeframe_decision_cb_fn_t get_encodeframe_decision;
vpx_rc_update_encodeframe_result_cb_fn_t update_encodeframe_result;
vpx_rc_delete_model_cb_fn_t delete_model;
void *priv;
} vpx_rc_funcs_t;
#ifdef __cplusplus
} // extern "C"
#endif
#endif // VPX_VPX_VPX_EXT_RATECTRL_H_
vpx_rc_config
Encode config sent to external rate control model.
Definition: vpx_ext_ratectrl.h:249
vpx_rc_config::frame_height
int frame_height
Definition: vpx_ext_ratectrl.h:251
vpx_rc_config::frame_width
int frame_width
Definition: vpx_ext_ratectrl.h:250
vpx_rc_config::show_frame_count
int show_frame_count
Definition: vpx_ext_ratectrl.h:252
vpx_rc_config::target_bitrate_kbps
int target_bitrate_kbps
Definition: vpx_ext_ratectrl.h:256
vpx_rc_config::frame_rate_num
int frame_rate_num
Definition: vpx_ext_ratectrl.h:257
vpx_rc_config::frame_rate_den
int frame_rate_den
Definition: vpx_ext_ratectrl.h:258
vpx_rc_encodeframe_decision
Encode frame decision made by the external rate control model.
Definition: vpx_ext_ratectrl.h:47
vpx_rc_encodeframe_decision::q_index
int q_index
Definition: vpx_ext_ratectrl.h:48
vpx_rc_encodeframe_decision::max_frame_size
int max_frame_size
Definition: vpx_ext_ratectrl.h:49
vpx_rc_encodeframe_info
Information for the frame to be encoded.
Definition: vpx_ext_ratectrl.h:58
vpx_rc_encodeframe_info::show_index
int show_index
Definition: vpx_ext_ratectrl.h:67
vpx_rc_encodeframe_info::coding_index
int coding_index
Definition: vpx_ext_ratectrl.h:68
vpx_rc_encodeframe_info::ref_frame_coding_indexes
int ref_frame_coding_indexes[3]
Definition: vpx_ext_ratectrl.h:73
vpx_rc_encodeframe_info::ref_frame_valid_list
int ref_frame_valid_list[3]
Definition: vpx_ext_ratectrl.h:79
vpx_rc_encodeframe_info::gop_index
int gop_index
Definition: vpx_ext_ratectrl.h:72
vpx_rc_encodeframe_info::frame_type
int frame_type
Definition: vpx_ext_ratectrl.h:66
vpx_rc_encodeframe_result
Frame coding result.
Definition: vpx_ext_ratectrl.h:87
vpx_rc_encodeframe_result::actual_encoding_qindex
int actual_encoding_qindex
Definition: vpx_ext_ratectrl.h:91
vpx_rc_encodeframe_result::sse
int64_t sse
Definition: vpx_ext_ratectrl.h:88
vpx_rc_encodeframe_result::pixel_count
int64_t pixel_count
Definition: vpx_ext_ratectrl.h:90
vpx_rc_encodeframe_result::bit_count
int64_t bit_count
Definition: vpx_ext_ratectrl.h:89
vpx_rc_firstpass_stats
Collection of first pass frame stats.
Definition: vpx_ext_ratectrl.h:234
vpx_rc_firstpass_stats::frame_stats
vpx_rc_frame_stats_t * frame_stats
Definition: vpx_ext_ratectrl.h:240
vpx_rc_firstpass_stats::num_frames
int num_frames
Definition: vpx_ext_ratectrl.h:244
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::mvr_abs
double mvr_abs
Definition: vpx_ext_ratectrl.h:198
vpx_rc_frame_stats::duration
double duration
Definition: vpx_ext_ratectrl.h:224
vpx_rc_frame_stats::pcnt_intra_low
double pcnt_intra_low
Definition: vpx_ext_ratectrl.h:159
vpx_rc_frame_stats::inactive_zone_cols
double inactive_zone_cols
Definition: vpx_ext_ratectrl.h:190
vpx_rc_frame_stats::weight
double weight
Definition: vpx_ext_ratectrl.h:116
vpx_rc_frame_stats::MVr
double MVr
Definition: vpx_ext_ratectrl.h:194
vpx_rc_frame_stats::mv_in_out_count
double mv_in_out_count
Definition: vpx_ext_ratectrl.h:220
vpx_rc_frame_stats::inactive_zone_rows
double inactive_zone_rows
Definition: vpx_ext_ratectrl.h:186
vpx_rc_frame_stats::frame
double frame
Definition: vpx_ext_ratectrl.h:110
vpx_rc_frame_stats::intra_error
double intra_error
Definition: vpx_ext_ratectrl.h:120
vpx_rc_frame_stats::frame_noise_energy
double frame_noise_energy
Definition: vpx_ext_ratectrl.h:132
vpx_rc_frame_stats::pcnt_neutral
double pcnt_neutral
Definition: vpx_ext_ratectrl.h:151
vpx_rc_frame_stats::MVc
double MVc
Definition: vpx_ext_ratectrl.h:202
vpx_rc_frame_stats::mvc_abs
double mvc_abs
Definition: vpx_ext_ratectrl.h:206
vpx_rc_frame_stats::intra_smooth_pct
double intra_smooth_pct
Definition: vpx_ext_ratectrl.h:182
vpx_rc_frame_stats::MVrv
double MVrv
Definition: vpx_ext_ratectrl.h:210
vpx_rc_frame_stats::pcnt_motion
double pcnt_motion
Definition: vpx_ext_ratectrl.h:140
vpx_rc_frame_stats::MVcv
double MVcv
Definition: vpx_ext_ratectrl.h:214
vpx_rc_frame_stats::pcnt_intra_high
double pcnt_intra_high
Definition: vpx_ext_ratectrl.h:167
vpx_rc_frame_stats::count
double count
Definition: vpx_ext_ratectrl.h:229
vpx_rc_frame_stats::pcnt_inter
double pcnt_inter
Definition: vpx_ext_ratectrl.h:136
vpx_rc_frame_stats::intra_skip_pct
double intra_skip_pct
Definition: vpx_ext_ratectrl.h:175
vpx_rc_frame_stats::sr_coded_error
double sr_coded_error
Definition: vpx_ext_ratectrl.h:128
vpx_rc_frame_stats::pcnt_second_ref
double pcnt_second_ref
Definition: vpx_ext_ratectrl.h:146
vpx_rc_frame_stats::coded_error
double coded_error
Definition: vpx_ext_ratectrl.h:124
vpx_rc_funcs
Callback function set for external rate control.
Definition: vpx_ext_ratectrl.h:329
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_funcs::get_encodeframe_decision
vpx_rc_get_encodeframe_decision_cb_fn_t get_encodeframe_decision
Definition: vpx_ext_ratectrl.h:341
vpx_rc_funcs::create_model
vpx_rc_create_model_cb_fn_t create_model
Definition: vpx_ext_ratectrl.h:333
vpx_rc_funcs::priv
void * priv
Definition: vpx_ext_ratectrl.h:353
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_funcs::delete_model
vpx_rc_delete_model_cb_fn_t delete_model
Definition: vpx_ext_ratectrl.h:349