chromium/third_party/libaom/source/libaom/av1/encoder/rdopt_utils.h

/*
 * Copyright (c) 2019, 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.
 */

#ifndef AOM_AV1_ENCODER_RDOPT_UTILS_H_
#define AOM_AV1_ENCODER_RDOPT_UTILS_H_

#include "aom/aom_integer.h"
#include "av1/encoder/block.h"
#include "av1/common/cfl.h"
#include "av1/common/pred_common.h"
#include "av1/encoder/rdopt_data_defs.h"

#ifdef __cplusplus
extern "C" {
#endif

#define MAX_REF_MV_SEARCH
#define MAX_TX_RD_GATE_LEVEL
#define INTER_INTRA_RD_THRESH_SCALE
#define INTER_INTRA_RD_THRESH_SHIFT

MODE_DEFINITION;

// This array defines the mapping from the enums in THR_MODES to the actual
// prediction modes and refrence frames
static const MODE_DEFINITION av1_mode_defs[MAX_MODES] =;

// Number of winner modes allowed for different values of the speed feature
// multi_winner_mode_type.
static const int winner_mode_count_allowed[MULTI_WINNER_MODE_LEVELS] =;

static inline void restore_dst_buf(MACROBLOCKD *xd, const BUFFER_SET dst,
                                   const int num_planes) {}

static inline void swap_dst_buf(MACROBLOCKD *xd, const BUFFER_SET *dst_bufs[2],
                                int num_planes) {}

/* clang-format on */
// Calculate rd threshold based on ref best rd and relevant scaling factors
static inline int64_t get_rd_thresh_from_best_rd(int64_t ref_best_rd,
                                                 int mul_factor,
                                                 int div_factor) {}

static inline THR_MODES get_prediction_mode_idx(
    PREDICTION_MODE this_mode, MV_REFERENCE_FRAME ref_frame,
    MV_REFERENCE_FRAME second_ref_frame) {}

static inline int inter_mode_data_block_idx(BLOCK_SIZE bsize) {}

// Get transform block visible dimensions cropped to the MI units.
static inline void get_txb_dimensions(const MACROBLOCKD *xd, int plane,
                                      BLOCK_SIZE plane_bsize, int blk_row,
                                      int blk_col, BLOCK_SIZE tx_bsize,
                                      int *width, int *height,
                                      int *visible_width, int *visible_height) {}

static inline int bsize_to_num_blk(BLOCK_SIZE bsize) {}

static inline int check_txfm_eval(MACROBLOCK *const x, BLOCK_SIZE bsize,
                                  int64_t best_skip_rd, int64_t skip_rd,
                                  int level, int is_luma_only) {}

static TX_MODE select_tx_mode(
    const AV1_COMMON *cm, const TX_SIZE_SEARCH_METHOD tx_size_search_method) {}

// Checks the conditions to disable winner mode processing
static inline int bypass_winner_mode_processing(const MACROBLOCK *const x,
                                                const SPEED_FEATURES *sf,
                                                int use_txfm_skip,
                                                int actual_txfm_skip,
                                                PREDICTION_MODE best_mode) {}

// Checks the conditions to enable winner mode processing
static inline int is_winner_mode_processing_enabled(const struct AV1_COMP *cpi,
                                                    const MACROBLOCK *const x,
                                                    MB_MODE_INFO *const mbmi,
                                                    int actual_txfm_skip) {}

static inline void set_tx_size_search_method(
    const AV1_COMMON *cm, const WinnerModeParams *winner_mode_params,
    TxfmSearchParams *txfm_params, int enable_winner_mode_for_tx_size_srch,
    int is_winner_mode) {}

static inline void set_tx_type_prune(const SPEED_FEATURES *sf,
                                     TxfmSearchParams *txfm_params,
                                     int winner_mode_tx_type_pruning,
                                     int is_winner_mode) {}

static inline void set_tx_domain_dist_params(
    const WinnerModeParams *winner_mode_params, TxfmSearchParams *txfm_params,
    int enable_winner_mode_for_tx_domain_dist, int is_winner_mode) {}

// This function sets mode parameters for different mode evaluation stages
static inline void set_mode_eval_params(const struct AV1_COMP *cpi,
                                        MACROBLOCK *x,
                                        MODE_EVAL_TYPE mode_eval_type) {}

// Similar to store_cfl_required(), but for use during the RDO process,
// where we haven't yet determined whether this block uses CfL.
static inline CFL_ALLOWED_TYPE store_cfl_required_rdo(const AV1_COMMON *cm,
                                                      const MACROBLOCK *x) {}

static inline void init_sbuv_mode(MB_MODE_INFO *const mbmi) {}

// Store best mode stats for winner mode processing
static inline void store_winner_mode_stats(
    const AV1_COMMON *const cm, MACROBLOCK *x, const MB_MODE_INFO *mbmi,
    RD_STATS *rd_cost, RD_STATS *rd_cost_y, RD_STATS *rd_cost_uv,
    THR_MODES mode_index, uint8_t *color_map, BLOCK_SIZE bsize, int64_t this_rd,
    int multi_winner_mode_type, int txfm_search_done) {}

unsigned int av1_get_perpixel_variance(const AV1_COMP *cpi,
                                       const MACROBLOCKD *xd,
                                       const struct buf_2d *ref,
                                       BLOCK_SIZE bsize, int plane,
                                       int use_hbd);

unsigned int av1_get_perpixel_variance_facade(const struct AV1_COMP *cpi,
                                              const MACROBLOCKD *xd,
                                              const struct buf_2d *ref,
                                              BLOCK_SIZE bsize, int plane);

static inline int is_mode_intra(PREDICTION_MODE mode) {}

// This function will copy usable ref_mv_stack[ref_frame][4] and
// weight[ref_frame][4] information from ref_mv_stack[ref_frame][8] and
// weight[ref_frame][8].
static inline void av1_copy_usable_ref_mv_stack_and_weight(
    const MACROBLOCKD *xd, MB_MODE_INFO_EXT *const mbmi_ext,
    MV_REFERENCE_FRAME ref_frame) {}

// Get transform rd gate level for the given transform search case.
static inline int get_txfm_rd_gate_level(
    const int is_masked_compound_enabled,
    const int txfm_rd_gate_level[TX_SEARCH_CASES], BLOCK_SIZE bsize,
    TX_SEARCH_CASE tx_search_case, int eval_motion_mode) {}

#ifdef __cplusplus
}  // extern "C"
#endif

#endif  // AOM_AV1_ENCODER_RDOPT_UTILS_H_