| Index: source/libvpx/vp9/encoder/vp9_encoder.h
|
| ===================================================================
|
| --- source/libvpx/vp9/encoder/vp9_encoder.h (revision 278778)
|
| +++ source/libvpx/vp9/encoder/vp9_encoder.h (working copy)
|
| @@ -24,6 +24,7 @@
|
| #include "vp9/common/vp9_onyxc_int.h"
|
|
|
| #include "vp9/encoder/vp9_aq_cyclicrefresh.h"
|
| +#include "vp9/encoder/vp9_context_tree.h"
|
| #include "vp9/encoder/vp9_encodemb.h"
|
| #include "vp9/encoder/vp9_firstpass.h"
|
| #include "vp9/encoder/vp9_lookahead.h"
|
| @@ -31,10 +32,14 @@
|
| #include "vp9/encoder/vp9_mcomp.h"
|
| #include "vp9/encoder/vp9_quantize.h"
|
| #include "vp9/encoder/vp9_ratectrl.h"
|
| +#include "vp9/encoder/vp9_rdopt.h"
|
| #include "vp9/encoder/vp9_speed_features.h"
|
| #include "vp9/encoder/vp9_svc_layercontext.h"
|
| #include "vp9/encoder/vp9_tokenize.h"
|
| #include "vp9/encoder/vp9_variance.h"
|
| +#if CONFIG_DENOISING
|
| +#include "vp9/encoder/vp9_denoiser.h"
|
| +#endif
|
|
|
| #ifdef __cplusplus
|
| extern "C" {
|
| @@ -42,9 +47,6 @@
|
|
|
| #define DEFAULT_GF_INTERVAL 10
|
|
|
| -#define MAX_MODES 30
|
| -#define MAX_REFS 6
|
| -
|
| typedef struct {
|
| int nmvjointcost[MV_JOINTS];
|
| int nmvcosts[2][MV_VALS];
|
| @@ -62,58 +64,8 @@
|
| FRAME_CONTEXT fc;
|
| } CODING_CONTEXT;
|
|
|
| -// This enumerator type needs to be kept aligned with the mode order in
|
| -// const MODE_DEFINITION vp9_mode_order[MAX_MODES] used in the rd code.
|
| -typedef enum {
|
| - THR_NEARESTMV,
|
| - THR_NEARESTA,
|
| - THR_NEARESTG,
|
|
|
| - THR_DC,
|
| -
|
| - THR_NEWMV,
|
| - THR_NEWA,
|
| - THR_NEWG,
|
| -
|
| - THR_NEARMV,
|
| - THR_NEARA,
|
| - THR_COMP_NEARESTLA,
|
| - THR_COMP_NEARESTGA,
|
| -
|
| - THR_TM,
|
| -
|
| - THR_COMP_NEARLA,
|
| - THR_COMP_NEWLA,
|
| - THR_NEARG,
|
| - THR_COMP_NEARGA,
|
| - THR_COMP_NEWGA,
|
| -
|
| - THR_ZEROMV,
|
| - THR_ZEROG,
|
| - THR_ZEROA,
|
| - THR_COMP_ZEROLA,
|
| - THR_COMP_ZEROGA,
|
| -
|
| - THR_H_PRED,
|
| - THR_V_PRED,
|
| - THR_D135_PRED,
|
| - THR_D207_PRED,
|
| - THR_D153_PRED,
|
| - THR_D63_PRED,
|
| - THR_D117_PRED,
|
| - THR_D45_PRED,
|
| -} THR_MODES;
|
| -
|
| typedef enum {
|
| - THR_LAST,
|
| - THR_GOLD,
|
| - THR_ALTR,
|
| - THR_COMP_LA,
|
| - THR_COMP_GA,
|
| - THR_INTRA,
|
| -} THR_MODES_SUB8X8;
|
| -
|
| -typedef enum {
|
| // encode_breakout is disabled.
|
| ENCODE_BREAKOUT_DISABLED = 0,
|
| // encode_breakout is enabled.
|
| @@ -130,13 +82,6 @@
|
| } VPX_SCALING;
|
|
|
| typedef enum {
|
| - RC_MODE_VBR = 0,
|
| - RC_MODE_CBR = 1,
|
| - RC_MODE_CONSTRAINED_QUALITY = 2,
|
| - RC_MODE_CONSTANT_QUALITY = 3,
|
| -} RC_MODE;
|
| -
|
| -typedef enum {
|
| // Good Quality Fast Encoding. The encoder balances quality with the
|
| // amount of time it takes to encode the output. (speed setting
|
| // controls how fast)
|
| @@ -208,16 +153,17 @@
|
| // ----------------------------------------------------------------
|
| // DATARATE CONTROL OPTIONS
|
|
|
| - RC_MODE rc_mode; // vbr, cbr, constrained quality or constant quality
|
| + // vbr, cbr, constrained quality or constant quality
|
| + enum vpx_rc_mode rc_mode;
|
|
|
| // buffer targeting aggressiveness
|
| int under_shoot_pct;
|
| int over_shoot_pct;
|
|
|
| // buffering parameters
|
| - int64_t starting_buffer_level; // in seconds
|
| - int64_t optimal_buffer_level;
|
| - int64_t maximum_buffer_size;
|
| + int64_t starting_buffer_level_ms;
|
| + int64_t optimal_buffer_level_ms;
|
| + int64_t maximum_buffer_size_ms;
|
|
|
| // Frame drop threshold.
|
| int drop_frames_water_mark;
|
| @@ -227,7 +173,6 @@
|
| int worst_allowed_q;
|
| int best_allowed_q;
|
| int cq_level;
|
| - int lossless;
|
| AQ_MODE aq_mode; // Adaptive Quantization mode
|
|
|
| // Internal frame size scaling.
|
| @@ -256,7 +201,6 @@
|
|
|
| // these parameters aren't to be used in final build don't use!!!
|
| int play_alternate;
|
| - int alt_freq;
|
|
|
| int encode_breakout; // early breakout : for video conf recommend 800
|
|
|
| @@ -285,36 +229,18 @@
|
| vp8e_tuning tuning;
|
| } VP9EncoderConfig;
|
|
|
| +static INLINE int is_altref_enabled(const VP9EncoderConfig *cfg) {
|
| + return cfg->mode != REALTIME && cfg->play_alternate && cfg->lag_in_frames > 0;
|
| +}
|
| +
|
| +static INLINE int is_lossless_requested(const VP9EncoderConfig *cfg) {
|
| + return cfg->best_allowed_q == 0 && cfg->worst_allowed_q == 0;
|
| +}
|
| +
|
| static INLINE int is_best_mode(MODE mode) {
|
| return mode == ONE_PASS_BEST || mode == TWO_PASS_SECOND_BEST;
|
| }
|
|
|
| -typedef struct RD_OPT {
|
| - // Thresh_mult is used to set a threshold for the rd score. A higher value
|
| - // means that we will accept the best mode so far more often. This number
|
| - // is used in combination with the current block size, and thresh_freq_fact
|
| - // to pick a threshold.
|
| - int thresh_mult[MAX_MODES];
|
| - int thresh_mult_sub8x8[MAX_REFS];
|
| -
|
| - int threshes[MAX_SEGMENTS][BLOCK_SIZES][MAX_MODES];
|
| - int thresh_freq_fact[BLOCK_SIZES][MAX_MODES];
|
| -
|
| - int64_t comp_pred_diff[REFERENCE_MODES];
|
| - int64_t prediction_type_threshes[MAX_REF_FRAMES][REFERENCE_MODES];
|
| - int64_t tx_select_diff[TX_MODES];
|
| - // FIXME(rbultje) can this overflow?
|
| - int tx_select_threshes[MAX_REF_FRAMES][TX_MODES];
|
| -
|
| - int64_t filter_diff[SWITCHABLE_FILTER_CONTEXTS];
|
| - int64_t filter_threshes[MAX_REF_FRAMES][SWITCHABLE_FILTER_CONTEXTS];
|
| - int64_t filter_cache[SWITCHABLE_FILTER_CONTEXTS];
|
| - int64_t mask_filter;
|
| -
|
| - int RDMULT;
|
| - int RDDIV;
|
| -} RD_OPT;
|
| -
|
| typedef struct VP9_COMP {
|
| QUANTS quants;
|
| MACROBLOCK mb;
|
| @@ -410,8 +336,8 @@
|
| // Default value is 1. From first pass stats, encode_breakout may be disabled.
|
| ENCODE_BREAKOUT_TYPE allow_encode_breakout;
|
|
|
| - // Get threshold from external input. In real time mode, it can be
|
| - // overwritten according to encoding speed.
|
| + // Get threshold from external input. A suggested threshold is 800 for HD
|
| + // clips, and 300 for < HD clips.
|
| int encode_breakout;
|
|
|
| unsigned char *segmentation_map;
|
| @@ -437,7 +363,7 @@
|
| uint64_t time_pick_lpf;
|
| uint64_t time_encode_sb_row;
|
|
|
| - struct twopass_rc twopass;
|
| + TWO_PASS twopass;
|
|
|
| YV12_BUFFER_CONFIG alt_ref_buffer;
|
| YV12_BUFFER_CONFIG *frames[MAX_LAG_BUFFERS];
|
| @@ -502,6 +428,11 @@
|
| int y_mode_costs[INTRA_MODES][INTRA_MODES][INTRA_MODES];
|
| int switchable_interp_costs[SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS];
|
|
|
| + PICK_MODE_CONTEXT *leaf_tree;
|
| + PC_TREE *pc_tree;
|
| + PC_TREE *pc_root;
|
| + int partition_cost[PARTITION_CONTEXTS][PARTITION_TYPES];
|
| +
|
| #if CONFIG_MULTIPLE_ARF
|
| // ARF tracking variables.
|
| int multi_arf_enabled;
|
| @@ -514,6 +445,10 @@
|
| int this_frame_weight;
|
| int max_arf_level;
|
| #endif
|
| +
|
| +#if CONFIG_DENOISING
|
| + VP9_DENOISER denoiser;
|
| +#endif
|
| } VP9_COMP;
|
|
|
| void vp9_initialize_enc();
|
| @@ -622,6 +557,10 @@
|
| : 0];
|
| }
|
|
|
| +static INLINE int get_chessboard_index(const VP9_COMMON *cm) {
|
| + return cm->current_video_frame % 2;
|
| +}
|
| +
|
| #ifdef __cplusplus
|
| } // extern "C"
|
| #endif
|
|
|