tables.h 4.55 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
/*
 * Copyright © 2018, VideoLAN and dav1d authors
 * Copyright © 2018, Two Orioles, LLC
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, this
 *    list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

28 29
#ifndef DAV1D_SRC_TABLES_H
#define DAV1D_SRC_TABLES_H
30 31 32 33 34 35 36

#include <stdint.h>

#include "common/intops.h"

#include "src/levels.h"

37
extern const uint8_t dav1d_al_part_ctx[2][N_BL_LEVELS][N_PARTITIONS];
38
extern const uint8_t /* enum BlockSize */
39
                     dav1d_block_sizes[N_BL_LEVELS][N_PARTITIONS][2];
40
// width, height (in 4px blocks), log2 versions of these two
41
extern const uint8_t dav1d_block_dimensions[N_BS_SIZES][4];
42 43 44 45
typedef struct TxfmInfo {
    // width, height (in 4px blocks), log2 of them, min/max of log2, sub, pad
    uint8_t w, h, lw, lh, min, max, sub, ctx;
} TxfmInfo;
46
extern const TxfmInfo dav1d_txfm_dimensions[N_RECT_TX_SIZES];
47
extern const uint8_t /* enum (Rect)TxfmSize */
48
                     dav1d_max_txfm_size_for_bs[N_BS_SIZES][4 /* y, 420, 422, 444 */];
49
extern const uint8_t /* enum TxfmType */
50
                     dav1d_txtp_from_uvmode[N_UV_INTRA_PRED_MODES];
51 52

extern const uint8_t /* enum InterPredMode */
53
                     dav1d_comp_inter_pred_modes[N_COMP_INTER_PRED_MODES][2];
54

55
extern const uint8_t dav1d_tx_type_count[N_TXTP_SETS];
56
extern const uint8_t /* enum TxfmType */
57 58
                     dav1d_tx_types_per_set[N_TXTP_SETS][N_TX_TYPES];
extern const uint8_t dav1d_tx_type_set_index[2][N_TXTP_SETS];
59

60 61 62
extern const uint8_t dav1d_filter_mode_to_y_mode[5];
extern const uint8_t dav1d_ymode_size_context[N_BS_SIZES];
extern const uint8_t dav1d_nz_map_ctx_offset[N_RECT_TX_SIZES][5][5];
63
extern const uint8_t /* enum TxClass */
64
                     dav1d_tx_type_class[N_TX_TYPES_PLUS_LL];
65
extern const uint8_t /* enum Filter2d */
66 67
                     dav1d_filter_2d[DAV1D_N_FILTERS /* h */][DAV1D_N_FILTERS /* v */];
extern const uint8_t /* enum Dav1dFilterMode */ dav1d_filter_dir[N_2D_FILTERS][2];
68 69
extern const uint8_t dav1d_intra_mode_context[N_INTRA_PRED_MODES];
extern const uint8_t dav1d_wedge_ctx_lut[N_BS_SIZES];
70

71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
static const unsigned cfl_allowed_mask =
    (1 << BS_32x32) |
    (1 << BS_32x16) |
    (1 << BS_32x8) |
    (1 << BS_16x32) |
    (1 << BS_16x16) |
    (1 << BS_16x8) |
    (1 << BS_16x4) |
    (1 << BS_8x32) |
    (1 << BS_8x16) |
    (1 << BS_8x8) |
    (1 << BS_8x4) |
    (1 << BS_4x16) |
    (1 << BS_4x8) |
    (1 << BS_4x4);
86

87 88 89 90 91 92 93 94 95 96
static const unsigned wedge_allowed_mask =
    (1 << BS_32x32) |
    (1 << BS_32x16) |
    (1 << BS_32x8) |
    (1 << BS_16x32) |
    (1 << BS_16x16) |
    (1 << BS_16x8) |
    (1 << BS_8x32) |
    (1 << BS_8x16) |
    (1 << BS_8x8);
97

98 99 100 101 102 103 104 105 106
static const unsigned interintra_allowed_mask =
    (1 << BS_32x32) |
    (1 << BS_32x16) |
    (1 << BS_16x32) |
    (1 << BS_16x16) |
    (1 << BS_16x8) |
    (1 << BS_8x16) |
    (1 << BS_8x8);

107
extern const Dav1dWarpedMotionParams dav1d_default_wm_params;
108 109

extern const int16_t dav1d_sgr_params[16][4];
Henrik Gramner's avatar
Henrik Gramner committed
110
extern const uint8_t dav1d_sgr_x_by_x[256];
111 112

extern const int8_t dav1d_mc_subpel_filters[5][15][8];
113
extern const int8_t dav1d_mc_warp_filter[193][8];
Ronald S. Bultje's avatar
Ronald S. Bultje committed
114
extern const int16_t dav1d_resize_filter[64][8];
115

116
extern const uint8_t dav1d_sm_weights[128];
117
extern const uint16_t dav1d_dr_intra_derivative[44];
118
extern const int8_t dav1d_filter_intra_taps[5][64];
119

Henrik Gramner's avatar
Henrik Gramner committed
120 121
extern const uint8_t dav1d_obmc_masks[64];

122 123
extern const int16_t dav1d_gaussian_sequence[2048]; // for fgs

124
#endif /* DAV1D_SRC_TABLES_H */