chromium/third_party/libaom/source/libaom/av1/encoder/speed_features.c

/*
 * Copyright (c) 2016, Alliance for Open Media. All rights reserved.
 *
 * This source code is subject to the terms of the BSD 2 Clause License and
 * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
 * was not distributed with this source code in the LICENSE file, you can
 * obtain it at www.aomedia.org/license/software. If the Alliance for Open
 * Media Patent License 1.0 was not distributed with this source code in the
 * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
 */

#include <limits.h>

#include "av1/common/reconintra.h"

#include "av1/encoder/encoder.h"
#include "av1/encoder/speed_features.h"
#include "av1/encoder/rdopt.h"

#include "aom_dsp/aom_dsp_common.h"

#define MAX_MESH_SPEED
// Max speed setting for tx domain evaluation
#define MAX_TX_DOMAIN_EVAL_SPEED
static MESH_PATTERN
    good_quality_mesh_patterns[MAX_MESH_SPEED + 1][MAX_MESH_STEP] =;

// TODO([email protected]): These settings are pretty relaxed, tune them for
// each speed setting
static MESH_PATTERN intrabc_mesh_patterns[MAX_MESH_SPEED + 1][MAX_MESH_STEP] =;

// Threshold values to be used for pruning the txfm_domain_distortion
// based on block MSE
// Index 0: Default mode evaluation, Winner mode processing is not
// applicable (Eg : IntraBc). Index 1: Mode evaluation.
// Index 2: Winner mode evaluation. Index 1 and 2 are applicable when
// enable_winner_mode_for_use_tx_domain_dist speed feature is ON
// TODO(any): Experiment the threshold logic based on variance metric
static unsigned int tx_domain_dist_thresholds[4][MODE_EVAL_TYPES] =;

// Number of different levels of aggressiveness in using transform domain
// distortion during the R-D evaluation based on the speed feature
// tx_domain_dist_level.
#define TX_DOMAIN_DIST_LEVELS

// Transform domain distortion type to be used for default, mode and winner mode
// evaluation Index 0: Default mode evaluation, Winner mode processing is not
// applicable (Eg : IntraBc). Index 1: Mode evaluation. Index 2: Winner mode
// evaluation. Index 1 and 2 are applicable when
// enable_winner_mode_for_use_tx_domain_dist speed feature is ON
static unsigned int
    tx_domain_dist_types[TX_DOMAIN_DIST_LEVELS][MODE_EVAL_TYPES] =;

// Threshold values to be used for disabling coeff RD-optimization
// based on block MSE / qstep^2.
// TODO(any): Experiment the threshold logic based on variance metric.
// Table has satd and dist threshold value index 0 : dist,index 1: satd
// For each row, the indices are as follows.
// Index 0: Default mode evaluation, Winner mode processing is not applicable
// (Eg : IntraBc)
// Index 1: Mode evaluation.
// Index 2: Winner mode evaluation.
// Index 1 and 2 are applicable when enable_winner_mode_for_coeff_opt speed
// feature is ON
// There are 7 levels with increasing speed, mapping to vertical indices.
static unsigned int coeff_opt_thresholds[9][MODE_EVAL_TYPES][2] =;

// Transform size to be used for default, mode and winner mode evaluation
// Index 0: Default mode evaluation, Winner mode processing is not applicable
// (Eg : IntraBc) Index 1: Mode evaluation. Index 2: Winner mode evaluation.
// Index 1 and 2 are applicable when enable_winner_mode_for_tx_size_srch speed
// feature is ON
static TX_SIZE_SEARCH_METHOD tx_size_search_methods[4][MODE_EVAL_TYPES] =;

// Predict transform skip levels to be used for default, mode and winner mode
// evaluation. Index 0: Default mode evaluation, Winner mode processing is not
// applicable. Index 1: Mode evaluation, Index 2: Winner mode evaluation
// Values indicate the aggressiveness of skip flag prediction.
// 0 : no early skip prediction
// 1 : conservative early skip prediction using DCT_DCT
// 2 : early skip prediction based on SSE
static unsigned int predict_skip_levels[3][MODE_EVAL_TYPES] =;

// Predict skip or DC block level used during transform type search. It is
// indexed using the following:
// First index  : Speed feature 'dc_blk_pred_level' (0 to 3)
// Second index : Mode evaluation type (DEFAULT_EVAL, MODE_EVAL and
// WINNER_MODE_EVAL).
//
// The values of predict_dc_levels[][] indicate the aggressiveness of predicting
// a block as transform skip or DC only.
// Type 0 : No skip block or DC only block prediction
// Type 1 : Prediction of skip block based on residual mean and variance
// Type 2 : Prediction of skip block or DC only block based on residual mean and
// variance
static unsigned int predict_dc_levels[4][MODE_EVAL_TYPES] =;

#if !CONFIG_FPMT_TEST
// This table holds the maximum number of reference frames for global motion.
// The table is indexed as per the speed feature 'gm_search_type'.
// 0 : All reference frames are allowed.
// 1 : All reference frames except L2 and L3 are allowed.
// 2 : All reference frames except L2, L3 and ARF2 are allowed.
// 3 : No reference frame is allowed.
static int gm_available_reference_frames[GM_DISABLE_SEARCH + 1] =;
#endif

// Qindex threshold levels used for selecting full-pel motion search.
// ms_qthresh[i][j][k] indicates the qindex boundary value for 'k'th qindex band
// for resolution index 'j' for aggressiveness level 'i'.
// Aggressiveness increases from i = 0 to 2.
// j = 0: lower than 720p resolution, j = 1: 720p or larger resolution.
// Currently invoked only for speed 0, 1 and 2.
static int ms_qindex_thresh[3][2][2] =;

// Full-pel search methods for aggressive search based on qindex.
// Index 0 is for resolutions lower than 720p, index 1 for 720p or larger
// resolutions. Currently invoked only for speed 1 and 2.
static SEARCH_METHODS motion_search_method[2] =;

// Intra only frames, golden frames (except alt ref overlays) and
// alt ref frames tend to be coded at a higher than ambient quality
static int frame_is_boosted(const AV1_COMP *cpi) {}

// Set transform rd gate level for all transform search cases.
static inline void set_txfm_rd_gate_level(
    int txfm_rd_gate_level[TX_SEARCH_CASES], int level) {}

static void set_allintra_speed_feature_framesize_dependent(
    const AV1_COMP *const cpi, SPEED_FEATURES *const sf, int speed) {}

static void set_allintra_speed_features_framesize_independent(
    const AV1_COMP *const cpi, SPEED_FEATURES *const sf, int speed) {}

static void set_good_speed_feature_framesize_dependent(
    const AV1_COMP *const cpi, SPEED_FEATURES *const sf, int speed) {}

static void set_good_speed_features_framesize_independent(
    const AV1_COMP *const cpi, SPEED_FEATURES *const sf, int speed) {}

static void set_rt_speed_feature_framesize_dependent(const AV1_COMP *const cpi,
                                                     SPEED_FEATURES *const sf,
                                                     int speed) {}

// TODO(kyslov): now this is very similar to
// set_good_speed_features_framesize_independent
// except it sets non-rd flag on speed 8. This function will likely
// be modified in the future with RT-specific speed features.
static void set_rt_speed_features_framesize_independent(AV1_COMP *cpi,
                                                        SPEED_FEATURES *sf,
                                                        int speed) {}

static inline void init_hl_sf(HIGH_LEVEL_SPEED_FEATURES *hl_sf) {}

static inline void init_fp_sf(FIRST_PASS_SPEED_FEATURES *fp_sf) {}

static inline void init_tpl_sf(TPL_SPEED_FEATURES *tpl_sf) {}

static inline void init_gm_sf(GLOBAL_MOTION_SPEED_FEATURES *gm_sf) {}

static inline void init_part_sf(PARTITION_SPEED_FEATURES *part_sf) {}

static inline void init_mv_sf(MV_SPEED_FEATURES *mv_sf) {}

static inline void init_inter_sf(INTER_MODE_SPEED_FEATURES *inter_sf) {}

static inline void init_interp_sf(INTERP_FILTER_SPEED_FEATURES *interp_sf) {}

static inline void init_intra_sf(INTRA_MODE_SPEED_FEATURES *intra_sf) {}

static inline void init_tx_sf(TX_SPEED_FEATURES *tx_sf) {}

static inline void init_rd_sf(RD_CALC_SPEED_FEATURES *rd_sf,
                              const AV1EncoderConfig *oxcf) {}

static inline void init_winner_mode_sf(
    WINNER_MODE_SPEED_FEATURES *winner_mode_sf) {}

static inline void init_lpf_sf(LOOP_FILTER_SPEED_FEATURES *lpf_sf) {}

static inline void init_rt_sf(REAL_TIME_SPEED_FEATURES *rt_sf) {}

static fractional_mv_step_fp
    *const fractional_mv_search[SUBPEL_SEARCH_METHODS] =;

// Populate appropriate sub-pel search method based on speed feature and user
// specified settings
static void set_subpel_search_method(
    MotionVectorSearchParams *mv_search_params,
    unsigned int motion_vector_unit_test,
    SUBPEL_SEARCH_METHOD subpel_search_method) {}

void av1_set_speed_features_framesize_dependent(AV1_COMP *cpi, int speed) {}

void av1_set_speed_features_framesize_independent(AV1_COMP *cpi, int speed) {}

// Override some speed features based on qindex
void av1_set_speed_features_qindex_dependent(AV1_COMP *cpi, int speed) {}