chromium/third_party/libaom/source/libaom/av1/common/enums.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_ENUMS_H_
#define AOM_AV1_COMMON_ENUMS_H_

#include "config/aom_config.h"

#include "aom/aom_codec.h"
#include "aom/aom_integer.h"
#include "aom_dsp/txfm_common.h"
#include "aom_ports/mem.h"

#ifdef __cplusplus
extern "C" {
#endif

/*! @file */

/*!\cond */

// Max superblock size
#define MAX_SB_SIZE_LOG2
#define MAX_SB_SIZE
#define MAX_SB_SQUARE

// Min superblock size
#define MIN_SB_SIZE_LOG2

// Pixels per Mode Info (MI) unit
#define MI_SIZE_LOG2
#define MI_SIZE

// MI-units per max superblock (MI Block - MIB)
#define MAX_MIB_SIZE_LOG2
#define MAX_MIB_SIZE

// MI-units per min superblock
#define MIN_MIB_SIZE_LOG2

// Mask to extract MI offset within max MIB
#define MAX_MIB_MASK

// Maximum number of tile rows and tile columns
#define MAX_TILE_ROWS
#define MAX_TILE_COLS

#define MAX_VARTX_DEPTH

#define MI_SIZE_64X64
#define MI_SIZE_128X128

#define MAX_PALETTE_SQUARE
// Maximum number of colors in a palette.
#define PALETTE_MAX_SIZE
// Minimum number of colors in a palette.
#define PALETTE_MIN_SIZE

#define FRAME_OFFSET_BITS
#define MAX_FRAME_DISTANCE

// 4 frame filter levels: y plane vertical, y plane horizontal,
// u plane, and v plane
#define FRAME_LF_COUNT
#define DEFAULT_DELTA_LF_MULTI
#define MAX_MODE_LF_DELTAS

#define DIST_PRECISION_BITS
#define DIST_PRECISION

#define PROFILE_BITS
// The following three profiles are currently defined.
// Profile 0.  8-bit and 10-bit 4:2:0 and 4:0:0 only.
// Profile 1.  8-bit and 10-bit 4:4:4
// Profile 2.  8-bit and 10-bit 4:2:2
//            12-bit  4:0:0, 4:2:2 and 4:4:4
// Since we have three bits for the profiles, it can be extended later.
enum {} SENUM1BYTE();

#define OP_POINTS_CNT_MINUS_1_BITS
#define OP_POINTS_IDC_BITS

// Note: Some enums use the attribute 'packed' to use smallest possible integer
// type, so that we can save memory when they are used in structs/arrays.

BLOCK_SIZE;

// 4X4, 8X8, 16X16, 32X32, 64X64, 128X128
#define SQR_BLOCK_SIZES

//  Partition types.  R: Recursive
//
//  NONE          HORZ          VERT          SPLIT
//  +-------+     +-------+     +---+---+     +---+---+
//  |       |     |       |     |   |   |     | R | R |
//  |       |     +-------+     |   |   |     +---+---+
//  |       |     |       |     |   |   |     | R | R |
//  +-------+     +-------+     +---+---+     +---+---+
//
//  HORZ_A        HORZ_B        VERT_A        VERT_B
//  +---+---+     +-------+     +---+---+     +---+---+
//  |   |   |     |       |     |   |   |     |   |   |
//  +---+---+     +---+---+     +---+   |     |   +---+
//  |       |     |   |   |     |   |   |     |   |   |
//  +-------+     +---+---+     +---+---+     +---+---+
//
//  HORZ_4        VERT_4
//  +-----+       +-+-+-+
//  +-----+       | | | |
//  +-----+       | | | |
//  +-----+       +-+-+-+
enum {} UENUM1BYTE();

PARTITION_CONTEXT;
#define PARTITION_PLOFFSET
#define PARTITION_BLOCK_SIZES
#define PARTITION_CONTEXTS

#define TX_SIZE_LUMA_MIN
/* We don't need to code a transform size unless the allowed size is at least
   one more than the minimum. */
#define TX_SIZE_CTX_MIN

// Maximum tx_size categories
#define MAX_TX_CATS
#define MAX_TX_DEPTH

#define MAX_TX_SIZE_LOG2
#define MAX_TX_SIZE
#define MIN_TX_SIZE_LOG2
#define MIN_TX_SIZE
#define MAX_TX_SQUARE

// Pad 4 extra columns to remove horizontal availability check.
#define TX_PAD_HOR_LOG2
#define TX_PAD_HOR
// Pad 6 extra rows (2 on top and 4 on bottom) to remove vertical availability
// check.
#define TX_PAD_TOP
#define TX_PAD_BOTTOM
#define TX_PAD_VER
// Pad 16 extra bytes to avoid reading overflow in SIMD optimization.
#define TX_PAD_END
#define TX_PAD_2D

// Number of maximum size transform blocks in the maximum size superblock
#define MAX_TX_BLOCKS_IN_MAX_SB_LOG2
#define MAX_TX_BLOCKS_IN_MAX_SB

// frame transform mode
enum {} UENUM1BYTE();

// 1D tx types
enum {} UENUM1BYTE();

enum {} UENUM1BYTE();

#define EXT_TX_SIZES
#define EXT_TX_SETS_INTER
#define EXT_TX_SETS_INTRA

enum {} UENUM1BYTE();

enum {} UENUM1BYTE();

enum {} UENUM1BYTE();

#define CFL_ALPHABET_SIZE_LOG2
#define CFL_ALPHABET_SIZE
#define CFL_MAGS_SIZE
#define CFL_INDEX_ZERO
#define CFL_IDX_U(idx)
#define CFL_IDX_V(idx)

enum {} UENUM1BYTE();

enum {} UENUM1BYTE();

enum {} UENUM1BYTE();

// CFL_SIGN_ZERO,CFL_SIGN_ZERO is invalid
#define CFL_JOINT_SIGNS
// CFL_SIGN_U is equivalent to (js + 1) / 3 for js in 0 to 8
#define CFL_SIGN_U(js)
// CFL_SIGN_V is equivalent to (js + 1) % 3 for js in 0 to 8
#define CFL_SIGN_V(js)

// There is no context when the alpha for a given plane is zero.
// So there are 2 fewer contexts than joint signs.
#define CFL_ALPHA_CONTEXTS
#define CFL_CONTEXT_U(js)
// Also, the contexts are symmetric under swapping the planes.
#define CFL_CONTEXT_V(js)

enum {} UENUM1BYTE();

enum {} UENUM1BYTE();

enum {} UENUM1BYTE();

// Note: All directional predictors must be between V_PRED and D67_PRED (both
// inclusive).
enum {} UENUM1BYTE();

// TODO(ltrudeau) Do we really want to pack this?
// TODO(ltrudeau) Do we match with PREDICTION_MODE?
enum {} UENUM1BYTE();

// Number of top model rd to store for pruning y modes in intra mode decision
#define TOP_INTRA_MODEL_COUNT
// Total number of luma intra prediction modes (include both directional and
// non-directional modes)
// Because there are 8 directional modes, each has additional 6 delta angles.
#define LUMA_MODE_COUNT

enum {} UENUM1BYTE();

enum {} UENUM1BYTE();

enum {} UENUM1BYTE();

enum {} UENUM1BYTE();

enum {} UENUM1BYTE();

#define LEVEL_BITS

#define DIRECTIONAL_MODES
#define MAX_ANGLE_DELTA
#define ANGLE_STEP

#define INTER_MODES

#define INTER_COMPOUND_MODES

#define SKIP_CONTEXTS
#define SKIP_MODE_CONTEXTS

#define COMP_INDEX_CONTEXTS
#define COMP_GROUP_IDX_CONTEXTS

#define NMV_CONTEXTS

#define NEWMV_MODE_CONTEXTS
#define GLOBALMV_MODE_CONTEXTS
#define REFMV_MODE_CONTEXTS
#define DRL_MODE_CONTEXTS

#define GLOBALMV_OFFSET
#define REFMV_OFFSET

#define NEWMV_CTX_MASK
#define GLOBALMV_CTX_MASK
#define REFMV_CTX_MASK

#define COMP_NEWMV_CTXS
#define INTER_MODE_CONTEXTS

#define DELTA_Q_SMALL
#define DELTA_Q_PROBS
#define DEFAULT_DELTA_Q_RES_PERCEPTUAL
#define DEFAULT_DELTA_Q_RES_OBJECTIVE
#define DEFAULT_DELTA_Q_RES_DUCKY_ENCODE

#define DELTA_LF_SMALL
#define DELTA_LF_PROBS
#define DEFAULT_DELTA_LF_RES

/* Segment Feature Masks */
#define MAX_MV_REF_CANDIDATES

#define MAX_REF_MV_STACK_SIZE
#define USABLE_REF_MV_STACK_SIZE
#define REF_CAT_LEVEL

#define INTRA_INTER_CONTEXTS
#define COMP_INTER_CONTEXTS
#define REF_CONTEXTS

#define COMP_REF_TYPE_CONTEXTS
#define UNI_COMP_REF_CONTEXTS

#define TXFM_PARTITION_CONTEXTS
TXFM_CONTEXT;

// An enum for single reference types (and some derived values).
enum {};

#define REF_FRAMES_LOG2

// REF_FRAMES for the cm->ref_frame_map array, 1 scratch frame for the new
// frame in cm->cur_frame, INTER_REFS_PER_FRAME for scaled references on the
// encoder in the cpi->scaled_ref_buf array.
// The encoder uses FRAME_BUFFERS only in GOOD and REALTIME encoding modes.
// The decoder also uses FRAME_BUFFERS.
#define FRAME_BUFFERS

// During allintra encoding, one reference frame buffer is free to be used again
// only after another frame buffer is stored as the reference frame. Hence, it
// is necessary and sufficient to maintain only two reference frame buffers in
// this case.
#define FRAME_BUFFERS_ALLINTRA

#define FWD_RF_OFFSET(ref)
#define BWD_RF_OFFSET(ref)

// Select all the decoded frame buffer slots
#define SELECT_ALL_BUF_SLOTS

enum {} UENUM1BYTE();

#define TOTAL_COMP_REFS

#define COMP_REFS

// NOTE: A limited number of unidirectional reference pairs can be signalled for
//       compound prediction. The use of skip mode, on the other hand, makes it
//       possible to have a reference pair not listed for explicit signaling.
#define MODE_CTX_REF_FRAMES

// Note: It includes single and compound references. So, it can take values from
// NONE_FRAME to (MODE_CTX_REF_FRAMES - 1). Hence, it is not defined as an enum.
MV_REFERENCE_FRAME;

/*!\endcond */

/*!\enum RestorationType
 * \brief This enumeration defines various restoration types supported
 */
RestorationType;

/*!\cond */
// Picture prediction structures (0-13 are predefined) in scalability metadata.
enum {} UENUM1BYTE();

#define SUPERRES_SCALE_BITS
#define SUPERRES_SCALE_DENOMINATOR_MIN

// In large_scale_tile coding, external references are used.
#define MAX_EXTERNAL_REFERENCES
#define MAX_TILES

/*!\endcond */

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

#endif  // AOM_AV1_COMMON_ENUMS_H_