chromium/third_party/libaom/source/libaom/av1/common/av1_common_int.h

/*
 * 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.
 */

#ifndef AOM_AV1_COMMON_AV1_COMMON_INT_H_
#define AOM_AV1_COMMON_AV1_COMMON_INT_H_

#include <stdbool.h>

#include "config/aom_config.h"
#include "config/av1_rtcd.h"

#include "aom/internal/aom_codec_internal.h"
#include "aom_dsp/flow_estimation/corner_detect.h"
#include "aom_util/aom_pthread.h"
#include "av1/common/alloccommon.h"
#include "av1/common/av1_loopfilter.h"
#include "av1/common/entropy.h"
#include "av1/common/entropymode.h"
#include "av1/common/entropymv.h"
#include "av1/common/enums.h"
#include "av1/common/frame_buffers.h"
#include "av1/common/mv.h"
#include "av1/common/quant_common.h"
#include "av1/common/restoration.h"
#include "av1/common/tile_common.h"
#include "av1/common/timing.h"
#include "aom_dsp/grain_params.h"
#include "aom_dsp/grain_table.h"
#include "aom_dsp/odintrin.h"
#ifdef __cplusplus
extern "C" {
#endif

#if defined(__clang__) && defined(__has_warning)
#if __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough")
#define AOM_FALLTHROUGH_INTENDED
#endif
#elif defined(__GNUC__) && __GNUC__ >= 7
#define AOM_FALLTHROUGH_INTENDED
#endif

#ifndef AOM_FALLTHROUGH_INTENDED
#define AOM_FALLTHROUGH_INTENDED
#endif

#define CDEF_MAX_STRENGTHS

/* Constant values while waiting for the sequence header */
#define FRAME_ID_LENGTH
#define DELTA_FRAME_ID_LENGTH

#define FRAME_CONTEXTS
// Extra frame context which is always kept at default values
#define FRAME_CONTEXT_DEFAULTS
#define PRIMARY_REF_BITS
#define PRIMARY_REF_NONE

#define NUM_PING_PONG_BUFFERS

#define MAX_NUM_TEMPORAL_LAYERS
#define MAX_NUM_SPATIAL_LAYERS
/* clang-format off */
// clang-format seems to think this is a pointer dereference and not a
// multiplication.
#define MAX_NUM_OPERATING_POINTS
/* clang-format on */

// TODO(jingning): Turning this on to set up transform coefficient
// processing timer.
#define TXCOEFF_TIMER
#define TXCOEFF_COST_TIMER

/*!\cond */

enum {} UENUM1BYTE();

enum {} UENUM1BYTE();

#define MFMV_STACK_SIZE
TPL_MV_REF;

MV_REF;

RefCntBuffer;

BufferPool;

/*!\endcond */

/*!\brief Parameters related to CDEF */
CdefInfo;

/*!\cond */

DeltaQInfo;

OrderHintInfo;

// Sequence header structure.
// Note: All syntax elements of sequence_header_obu that need to be
// bit-identical across multiple sequence headers must be part of this struct,
// so that consistency is checked by are_seq_headers_consistent() function.
// One exception is the last member 'op_params' that is ignored by
// are_seq_headers_consistent() function.
SequenceHeader;

SkipModeInfo;

CurrentFrame;

/*!\endcond */

/*!
 * \brief Frame level features.
 */
FeatureFlags;

/*!
 * \brief Params related to tiles.
 */
CommonTileParams;

CommonModeInfoParams;
/*!
 * \brief Params related to MB_MODE_INFO arrays and related info.
 */
struct CommonModeInfoParams {};

CommonQuantParams;
/*!
 * \brief Parameters related to quantization at the frame level.
 */
struct CommonQuantParams {};

CommonContexts;
/*!
 * \brief Contexts used for transmitting various symbols in the bitstream.
 */
struct CommonContexts {};

/*!
 * \brief Top level common structure used by both encoder and decoder.
 */
AV1_COMMON;

/*!\cond */

// TODO(hkuang): Don't need to lock the whole pool after implementing atomic
// frame reference count.
static void lock_buffer_pool(BufferPool *const pool) {}

static void unlock_buffer_pool(BufferPool *const pool) {}

static inline YV12_BUFFER_CONFIG *get_ref_frame(AV1_COMMON *cm, int index) {}

static inline int get_free_fb(AV1_COMMON *cm) {}

static inline RefCntBuffer *assign_cur_frame_new_fb(AV1_COMMON *const cm) {}

// Modify 'lhs_ptr' to reference the buffer at 'rhs_ptr', and update the ref
// counts accordingly.
static inline void assign_frame_buffer_p(RefCntBuffer **lhs_ptr,
                                         RefCntBuffer *rhs_ptr) {}

static inline int frame_is_intra_only(const AV1_COMMON *const cm) {}

static inline int frame_is_sframe(const AV1_COMMON *cm) {}

// These functions take a reference frame label between LAST_FRAME and
// EXTREF_FRAME inclusive.  Note that this is different to the indexing
// previously used by the frame_refs[] array.
static inline int get_ref_frame_map_idx(const AV1_COMMON *const cm,
                                        const MV_REFERENCE_FRAME ref_frame) {}

static inline RefCntBuffer *get_ref_frame_buf(
    const AV1_COMMON *const cm, const MV_REFERENCE_FRAME ref_frame) {}

// Both const and non-const versions of this function are provided so that it
// can be used with a const AV1_COMMON if needed.
static inline const struct scale_factors *get_ref_scale_factors_const(
    const AV1_COMMON *const cm, const MV_REFERENCE_FRAME ref_frame) {}

static inline struct scale_factors *get_ref_scale_factors(
    AV1_COMMON *const cm, const MV_REFERENCE_FRAME ref_frame) {}

static inline RefCntBuffer *get_primary_ref_frame_buf(
    const AV1_COMMON *const cm) {}

// Returns 1 if this frame might allow mvs from some reference frame.
static inline int frame_might_allow_ref_frame_mvs(const AV1_COMMON *cm) {}

// Returns 1 if this frame might use warped_motion
static inline int frame_might_allow_warped_motion(const AV1_COMMON *cm) {}

static inline void ensure_mv_buffer(RefCntBuffer *buf, AV1_COMMON *cm) {}

void cfl_init(CFL_CTX *cfl, const SequenceHeader *seq_params);

static inline int av1_num_planes(const AV1_COMMON *cm) {}

static inline void av1_init_above_context(CommonContexts *above_contexts,
                                          int num_planes, int tile_row,
                                          MACROBLOCKD *xd) {}

static inline void av1_init_macroblockd(AV1_COMMON *cm, MACROBLOCKD *xd) {}

static inline void set_entropy_context(MACROBLOCKD *xd, int mi_row, int mi_col,
                                       const int num_planes) {}

static inline int calc_mi_size(int len) {}

static inline void set_plane_n4(MACROBLOCKD *const xd, int bw, int bh,
                                const int num_planes) {}

static inline void set_mi_row_col(MACROBLOCKD *xd, const TileInfo *const tile,
                                  int mi_row, int bh, int mi_col, int bw,
                                  int mi_rows, int mi_cols) {}

static inline aom_cdf_prob *get_y_mode_cdf(FRAME_CONTEXT *tile_ctx,
                                           const MB_MODE_INFO *above_mi,
                                           const MB_MODE_INFO *left_mi) {}

static inline void update_partition_context(MACROBLOCKD *xd, int mi_row,
                                            int mi_col, BLOCK_SIZE subsize,
                                            BLOCK_SIZE bsize) {}

static inline int is_chroma_reference(int mi_row, int mi_col, BLOCK_SIZE bsize,
                                      int subsampling_x, int subsampling_y) {}

static inline aom_cdf_prob cdf_element_prob(const aom_cdf_prob *cdf,
                                            size_t element) {}

static inline void partition_gather_horz_alike(aom_cdf_prob *out,
                                               const aom_cdf_prob *const in,
                                               BLOCK_SIZE bsize) {}

static inline void partition_gather_vert_alike(aom_cdf_prob *out,
                                               const aom_cdf_prob *const in,
                                               BLOCK_SIZE bsize) {}

static inline void update_ext_partition_context(MACROBLOCKD *xd, int mi_row,
                                                int mi_col, BLOCK_SIZE subsize,
                                                BLOCK_SIZE bsize,
                                                PARTITION_TYPE partition) {}

static inline int partition_plane_context(const MACROBLOCKD *xd, int mi_row,
                                          int mi_col, BLOCK_SIZE bsize) {}

// Return the number of elements in the partition CDF when
// partitioning the (square) block with luma block size of bsize.
static inline int partition_cdf_length(BLOCK_SIZE bsize) {}

static inline int max_block_wide(const MACROBLOCKD *xd, BLOCK_SIZE bsize,
                                 int plane) {}

static inline int max_block_high(const MACROBLOCKD *xd, BLOCK_SIZE bsize,
                                 int plane) {}

static inline void av1_zero_above_context(AV1_COMMON *const cm,
                                          const MACROBLOCKD *xd,
                                          int mi_col_start, int mi_col_end,
                                          const int tile_row) {}

static inline void av1_zero_left_context(MACROBLOCKD *const xd) {}

static inline void set_txfm_ctx(TXFM_CONTEXT *txfm_ctx, uint8_t txs, int len) {}

static inline void set_txfm_ctxs(TX_SIZE tx_size, int n4_w, int n4_h, int skip,
                                 const MACROBLOCKD *xd) {}

static inline int get_mi_grid_idx(const CommonModeInfoParams *const mi_params,
                                  int mi_row, int mi_col) {}

static inline int get_alloc_mi_idx(const CommonModeInfoParams *const mi_params,
                                   int mi_row, int mi_col) {}

// For this partition block, set pointers in mi_params->mi_grid_base and xd->mi.
static inline void set_mi_offsets(const CommonModeInfoParams *const mi_params,
                                  MACROBLOCKD *const xd, int mi_row,
                                  int mi_col) {}

static inline void txfm_partition_update(TXFM_CONTEXT *above_ctx,
                                         TXFM_CONTEXT *left_ctx,
                                         TX_SIZE tx_size, TX_SIZE txb_size) {}

static inline TX_SIZE get_sqr_tx_size(int tx_dim) {}

static inline TX_SIZE get_tx_size(int width, int height) {}

static inline int txfm_partition_context(const TXFM_CONTEXT *const above_ctx,
                                         const TXFM_CONTEXT *const left_ctx,
                                         BLOCK_SIZE bsize, TX_SIZE tx_size) {}

// Compute the next partition in the direction of the sb_type stored in the mi
// array, starting with bsize.
static inline PARTITION_TYPE get_partition(const AV1_COMMON *const cm,
                                           int mi_row, int mi_col,
                                           BLOCK_SIZE bsize) {}

static inline void set_sb_size(SequenceHeader *const seq_params,
                               BLOCK_SIZE sb_size) {}

// Returns true if the frame is fully lossless at the coded resolution.
// Note: If super-resolution is used, such a frame will still NOT be lossless at
// the upscaled resolution.
static inline int is_coded_lossless(const AV1_COMMON *cm,
                                    const MACROBLOCKD *xd) {}

static inline int is_valid_seq_level_idx(AV1_LEVEL seq_level_idx) {}

/*!\endcond */

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

#endif  // AOM_AV1_COMMON_AV1_COMMON_INT_H_