Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 1 | /* |
Yaowu Xu | 2ab7ff0 | 2016-09-02 12:04:54 -0700 | [diff] [blame] | 2 | * Copyright (c) 2016, Alliance for Open Media. All rights reserved |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 3 | * |
Yaowu Xu | 2ab7ff0 | 2016-09-02 12:04:54 -0700 | [diff] [blame] | 4 | * This source code is subject to the terms of the BSD 2 Clause License and |
| 5 | * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License |
| 6 | * was not distributed with this source code in the LICENSE file, you can |
| 7 | * obtain it at www.aomedia.org/license/software. If the Alliance for Open |
| 8 | * Media Patent License 1.0 was not distributed with this source code in the |
| 9 | * PATENTS file, you can obtain it at www.aomedia.org/license/patent. |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 10 | */ |
| 11 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 12 | #ifndef AV1_ENCODER_BLOCK_H_ |
| 13 | #define AV1_ENCODER_BLOCK_H_ |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 14 | |
| 15 | #include "av1/common/entropymv.h" |
| 16 | #include "av1/common/entropy.h" |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 17 | #include "av1/common/mvref_common.h" |
Hui Su | 1ddf231 | 2017-08-19 15:21:34 -0700 | [diff] [blame] | 18 | #include "av1/encoder/hash.h" |
Yushin Cho | 5510433 | 2017-08-14 16:15:43 -0700 | [diff] [blame] | 19 | #if CONFIG_DIST_8X8 |
| 20 | #include "aom/aomcx.h" |
| 21 | #endif |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 22 | |
| 23 | #ifdef __cplusplus |
| 24 | extern "C" { |
| 25 | #endif |
| 26 | |
| 27 | typedef struct { |
| 28 | unsigned int sse; |
| 29 | int sum; |
| 30 | unsigned int var; |
Urvang Joshi | 454280d | 2016-10-14 16:51:44 -0700 | [diff] [blame] | 31 | } DIFF; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 32 | |
| 33 | typedef struct macroblock_plane { |
| 34 | DECLARE_ALIGNED(16, int16_t, src_diff[MAX_SB_SQUARE]); |
| 35 | tran_low_t *qcoeff; |
| 36 | tran_low_t *coeff; |
| 37 | uint16_t *eobs; |
Angie Chiang | 74e2307 | 2017-03-24 14:54:23 -0700 | [diff] [blame] | 38 | #if CONFIG_LV_MAP |
| 39 | uint8_t *txb_entropy_ctx; |
| 40 | #endif |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 41 | struct buf_2d src; |
| 42 | |
| 43 | // Quantizer setings |
Monty Montgomery | 125c0fc | 2017-10-26 00:44:35 -0400 | [diff] [blame] | 44 | // These are used/accessed only in the quantization process |
| 45 | // RDO does not / must not depend on any of these values |
| 46 | // All values below share the coefficient scale/shift used in TX |
| 47 | const int16_t *quant_fp_QTX; |
| 48 | const int16_t *round_fp_QTX; |
| 49 | const int16_t *quant_QTX; |
| 50 | const int16_t *quant_shift_QTX; |
| 51 | const int16_t *zbin_QTX; |
| 52 | const int16_t *round_QTX; |
| 53 | const int16_t *dequant_QTX; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 54 | #if CONFIG_NEW_QUANT |
| 55 | const cuml_bins_type_nuq *cuml_bins_nuq[QUANT_PROFILES]; |
Monty Montgomery | 125c0fc | 2017-10-26 00:44:35 -0400 | [diff] [blame] | 56 | const dequant_val_type_nuq *dequant_val_nuq_QTX[QUANT_PROFILES]; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 57 | #endif // CONFIG_NEW_QUANT |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 58 | } MACROBLOCK_PLANE; |
| 59 | |
hui su | c0cf71d | 2017-07-20 16:38:50 -0700 | [diff] [blame] | 60 | typedef int av1_coeff_cost[PLANE_TYPES][REF_TYPES][COEF_BANDS][COEFF_CONTEXTS] |
| 61 | [TAIL_TOKENS]; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 62 | |
Jingning Han | dfd7232 | 2017-08-09 14:04:12 -0700 | [diff] [blame] | 63 | #if CONFIG_LV_MAP |
| 64 | typedef struct { |
| 65 | int txb_skip_cost[TXB_SKIP_CONTEXTS][2]; |
| 66 | int nz_map_cost[SIG_COEF_CONTEXTS][2]; |
| 67 | int eob_cost[EOB_COEF_CONTEXTS][2]; |
Angie Chiang | 7ab884e | 2017-10-18 15:57:12 -0700 | [diff] [blame] | 68 | int eob_extra_cost[EOB_COEF_CONTEXTS][2]; |
Jingning Han | dfd7232 | 2017-08-09 14:04:12 -0700 | [diff] [blame] | 69 | int dc_sign_cost[DC_SIGN_CONTEXTS][2]; |
| 70 | int base_cost[NUM_BASE_LEVELS][COEFF_BASE_CONTEXTS][2]; |
Angie Chiang | 26d3e45 | 2017-09-29 17:40:02 -0700 | [diff] [blame] | 71 | int lps_cost[LEVEL_CONTEXTS][COEFF_BASE_RANGE + 1]; |
Jingning Han | 87b01b5 | 2017-08-31 12:07:20 -0700 | [diff] [blame] | 72 | int br_cost[BASE_RANGE_SETS][LEVEL_CONTEXTS][2]; |
Angie Chiang | f12cc4a | 2017-08-28 15:42:33 -0700 | [diff] [blame] | 73 | #if CONFIG_CTX1D |
| 74 | int eob_mode_cost[TX_CLASSES][2]; |
| 75 | int empty_line_cost[TX_CLASSES][EMPTY_LINE_CONTEXTS][2]; |
| 76 | int hv_eob_cost[TX_CLASSES][HV_EOB_CONTEXTS][2]; |
| 77 | #endif |
Jingning Han | dfd7232 | 2017-08-09 14:04:12 -0700 | [diff] [blame] | 78 | } LV_MAP_COEFF_COST; |
Jingning Han | f5a4d3b | 2017-08-27 23:01:19 -0700 | [diff] [blame] | 79 | |
| 80 | typedef struct { |
| 81 | tran_low_t tcoeff[MAX_MB_PLANE][MAX_SB_SQUARE]; |
| 82 | uint16_t eobs[MAX_MB_PLANE][MAX_SB_SQUARE / (TX_SIZE_W_MIN * TX_SIZE_H_MIN)]; |
| 83 | uint8_t txb_skip_ctx[MAX_MB_PLANE] |
| 84 | [MAX_SB_SQUARE / (TX_SIZE_W_MIN * TX_SIZE_H_MIN)]; |
| 85 | int dc_sign_ctx[MAX_MB_PLANE] |
| 86 | [MAX_SB_SQUARE / (TX_SIZE_W_MIN * TX_SIZE_H_MIN)]; |
| 87 | } CB_COEFF_BUFFER; |
Jingning Han | dfd7232 | 2017-08-09 14:04:12 -0700 | [diff] [blame] | 88 | #endif |
| 89 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 90 | typedef struct { |
| 91 | int_mv ref_mvs[MODE_CTX_REF_FRAMES][MAX_MV_REF_CANDIDATES]; |
| 92 | int16_t mode_context[MODE_CTX_REF_FRAMES]; |
Angie Chiang | f0fbf9d | 2017-03-15 15:01:22 -0700 | [diff] [blame] | 93 | #if CONFIG_LV_MAP |
Angie Chiang | c484abe | 2017-03-20 15:43:11 -0700 | [diff] [blame] | 94 | // TODO(angiebird): Reduce the buffer size according to sb_type |
Jingning Han | f5a4d3b | 2017-08-27 23:01:19 -0700 | [diff] [blame] | 95 | tran_low_t *tcoeff[MAX_MB_PLANE]; |
| 96 | uint16_t *eobs[MAX_MB_PLANE]; |
| 97 | uint8_t *txb_skip_ctx[MAX_MB_PLANE]; |
| 98 | int *dc_sign_ctx[MAX_MB_PLANE]; |
Angie Chiang | f0fbf9d | 2017-03-15 15:01:22 -0700 | [diff] [blame] | 99 | #endif |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 100 | uint8_t ref_mv_count[MODE_CTX_REF_FRAMES]; |
| 101 | CANDIDATE_MV ref_mv_stack[MODE_CTX_REF_FRAMES][MAX_REF_MV_STACK_SIZE]; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 102 | int16_t compound_mode_context[MODE_CTX_REF_FRAMES]; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 103 | } MB_MODE_INFO_EXT; |
| 104 | |
Alex Converse | 0fa0f42 | 2017-04-24 12:51:14 -0700 | [diff] [blame] | 105 | typedef struct { |
| 106 | int col_min; |
| 107 | int col_max; |
| 108 | int row_min; |
| 109 | int row_max; |
| 110 | } MvLimits; |
| 111 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 112 | typedef struct { |
Hui Su | 473cf89 | 2017-11-08 18:14:31 -0800 | [diff] [blame^] | 113 | uint8_t best_palette_color_map[MAX_PALETTE_SQUARE]; |
| 114 | float kmeans_data_buf[2 * MAX_PALETTE_SQUARE]; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 115 | } PALETTE_BUFFER; |
| 116 | |
Hui Su | 1ddf231 | 2017-08-19 15:21:34 -0700 | [diff] [blame] | 117 | typedef struct { |
| 118 | TX_TYPE tx_type; |
| 119 | TX_SIZE tx_size; |
Hui Su | 1ddf231 | 2017-08-19 15:21:34 -0700 | [diff] [blame] | 120 | TX_SIZE min_tx_size; |
| 121 | TX_SIZE inter_tx_size[MAX_MIB_SIZE][MAX_MIB_SIZE]; |
| 122 | uint8_t blk_skip[MAX_MIB_SIZE * MAX_MIB_SIZE * 8]; |
Hui Su | 1ddf231 | 2017-08-19 15:21:34 -0700 | [diff] [blame] | 123 | #if CONFIG_TXK_SEL |
| 124 | TX_TYPE txk_type[MAX_SB_SQUARE / (TX_SIZE_W_MIN * TX_SIZE_H_MIN)]; |
| 125 | #endif // CONFIG_TXK_SEL |
| 126 | RD_STATS rd_stats; |
| 127 | uint32_t hash_value; |
| 128 | } TX_RD_INFO; |
| 129 | |
| 130 | #define RD_RECORD_BUFFER_LEN 8 |
| 131 | typedef struct { |
| 132 | TX_RD_INFO tx_rd_info[RD_RECORD_BUFFER_LEN]; // Circular buffer. |
| 133 | int index_start; |
| 134 | int num; |
| 135 | CRC_CALCULATOR crc_calculator; // Hash function. |
| 136 | } TX_RD_RECORD; |
| 137 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 138 | typedef struct macroblock MACROBLOCK; |
| 139 | struct macroblock { |
| 140 | struct macroblock_plane plane[MAX_MB_PLANE]; |
| 141 | |
Hui Su | 1ddf231 | 2017-08-19 15:21:34 -0700 | [diff] [blame] | 142 | // Save the transform RD search info. |
| 143 | TX_RD_RECORD tx_rd_record; |
| 144 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 145 | MACROBLOCKD e_mbd; |
| 146 | MB_MODE_INFO_EXT *mbmi_ext; |
| 147 | int skip_block; |
David Barker | d7d78c8 | 2016-10-24 10:55:35 +0100 | [diff] [blame] | 148 | int qindex; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 149 | |
| 150 | // The equivalent error at the current rdmult of one whole bit (not one |
| 151 | // bitcost unit). |
| 152 | int errorperbit; |
| 153 | // The equivalend SAD error of one (whole) bit at the current quantizer |
| 154 | // for large blocks. |
| 155 | int sadperbit16; |
| 156 | // The equivalend SAD error of one (whole) bit at the current quantizer |
| 157 | // for sub-8x8 blocks. |
| 158 | int sadperbit4; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 159 | int rdmult; |
| 160 | int mb_energy; |
| 161 | int *m_search_count_ptr; |
| 162 | int *ex_search_count_ptr; |
| 163 | |
Jingning Han | 9777afc | 2016-10-20 15:17:43 -0700 | [diff] [blame] | 164 | unsigned int txb_split_count; |
Jingning Han | 9777afc | 2016-10-20 15:17:43 -0700 | [diff] [blame] | 165 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 166 | // These are set to their default values at the beginning, and then adjusted |
| 167 | // further in the encoding process. |
| 168 | BLOCK_SIZE min_partition_size; |
| 169 | BLOCK_SIZE max_partition_size; |
| 170 | |
| 171 | int mv_best_ref_index[TOTAL_REFS_PER_FRAME]; |
| 172 | unsigned int max_mv_context[TOTAL_REFS_PER_FRAME]; |
| 173 | unsigned int source_variance; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 174 | unsigned int pred_sse[TOTAL_REFS_PER_FRAME]; |
| 175 | int pred_mv_sad[TOTAL_REFS_PER_FRAME]; |
| 176 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 177 | int *nmvjointcost; |
| 178 | int nmv_vec_cost[NMV_CONTEXTS][MV_JOINTS]; |
| 179 | int *nmvcost[NMV_CONTEXTS][2]; |
| 180 | int *nmvcost_hp[NMV_CONTEXTS][2]; |
| 181 | int **mv_cost_stack[NMV_CONTEXTS]; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 182 | int **mvcost; |
Alex Converse | a127a79 | 2017-05-23 15:27:21 -0700 | [diff] [blame] | 183 | |
Yue Chen | e9638cc | 2016-10-10 12:37:54 -0700 | [diff] [blame] | 184 | int32_t *wsrc_buf; |
| 185 | int32_t *mask_buf; |
Jingning Han | d064cf0 | 2017-06-01 10:00:39 -0700 | [diff] [blame] | 186 | uint8_t *above_pred_buf; |
| 187 | uint8_t *left_pred_buf; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 188 | |
| 189 | PALETTE_BUFFER *palette_buffer; |
| 190 | |
| 191 | // These define limits to motion vector components to prevent them |
| 192 | // from extending outside the UMV borders |
Alex Converse | 0fa0f42 | 2017-04-24 12:51:14 -0700 | [diff] [blame] | 193 | MvLimits mv_limits; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 194 | |
Jingning Han | 9ca05b7 | 2017-01-03 14:41:36 -0800 | [diff] [blame] | 195 | uint8_t blk_skip[MAX_MB_PLANE][MAX_MIB_SIZE * MAX_MIB_SIZE * 8]; |
Jingning Han | 9ca05b7 | 2017-01-03 14:41:36 -0800 | [diff] [blame] | 196 | uint8_t blk_skip_drl[MAX_MB_PLANE][MAX_MIB_SIZE * MAX_MIB_SIZE * 8]; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 197 | |
| 198 | int skip; |
Jingning Han | 8efdbc8 | 2017-02-19 14:40:03 -0800 | [diff] [blame] | 199 | int skip_chroma_rd; |
Zoe Liu | 1eed2df | 2017-10-16 17:13:15 -0700 | [diff] [blame] | 200 | int skip_cost[SKIP_CONTEXTS][2]; |
| 201 | |
Jingning Han | dfd7232 | 2017-08-09 14:04:12 -0700 | [diff] [blame] | 202 | #if CONFIG_LV_MAP |
| 203 | LV_MAP_COEFF_COST coeff_costs[TX_SIZES][PLANE_TYPES]; |
Jingning Han | f5a4d3b | 2017-08-27 23:01:19 -0700 | [diff] [blame] | 204 | uint16_t cb_offset; |
Jingning Han | dfd7232 | 2017-08-09 14:04:12 -0700 | [diff] [blame] | 205 | #endif |
| 206 | |
hui su | c0cf71d | 2017-07-20 16:38:50 -0700 | [diff] [blame] | 207 | av1_coeff_cost token_head_costs[TX_SIZES]; |
| 208 | av1_coeff_cost token_tail_costs[TX_SIZES]; |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 209 | |
Yue Chen | b23d00a | 2017-07-28 17:01:21 -0700 | [diff] [blame] | 210 | // mode costs |
Yue Chen | 170678a | 2017-10-17 13:43:10 -0700 | [diff] [blame] | 211 | int intra_inter_cost[INTRA_INTER_CONTEXTS][2]; |
| 212 | |
Yue Chen | b23d00a | 2017-07-28 17:01:21 -0700 | [diff] [blame] | 213 | int mbmode_cost[BLOCK_SIZE_GROUPS][INTRA_MODES]; |
| 214 | int newmv_mode_cost[NEWMV_MODE_CONTEXTS][2]; |
Sarah Parker | 2b9ec2e | 2017-10-30 17:34:08 -0700 | [diff] [blame] | 215 | int zeromv_mode_cost[GLOBALMV_MODE_CONTEXTS][2]; |
Yue Chen | b23d00a | 2017-07-28 17:01:21 -0700 | [diff] [blame] | 216 | int refmv_mode_cost[REFMV_MODE_CONTEXTS][2]; |
| 217 | int drl_mode_cost0[DRL_MODE_CONTEXTS][2]; |
| 218 | |
Yue Chen | b23d00a | 2017-07-28 17:01:21 -0700 | [diff] [blame] | 219 | int inter_compound_mode_cost[INTER_MODE_CONTEXTS][INTER_COMPOUND_MODES]; |
Yue Chen | a424551 | 2017-08-31 11:58:08 -0700 | [diff] [blame] | 220 | int compound_type_cost[BLOCK_SIZES_ALL][COMPOUND_TYPES]; |
Yue Chen | b23d00a | 2017-07-28 17:01:21 -0700 | [diff] [blame] | 221 | #if CONFIG_COMPOUND_SINGLEREF |
| 222 | int inter_singleref_comp_mode_cost[INTER_MODE_CONTEXTS] |
| 223 | [INTER_SINGLEREF_COMP_MODES]; |
| 224 | #endif // CONFIG_COMPOUND_SINGLEREF |
Yue Chen | eaf128a | 2017-10-16 17:01:36 -0700 | [diff] [blame] | 225 | int interintra_cost[BLOCK_SIZE_GROUPS][2]; |
| 226 | int wedge_interintra_cost[BLOCK_SIZES_ALL][2]; |
Yue Chen | b23d00a | 2017-07-28 17:01:21 -0700 | [diff] [blame] | 227 | int interintra_mode_cost[BLOCK_SIZE_GROUPS][INTERINTRA_MODES]; |
Yue Chen | b23d00a | 2017-07-28 17:01:21 -0700 | [diff] [blame] | 228 | int motion_mode_cost[BLOCK_SIZES_ALL][MOTION_MODES]; |
Yue Chen | b23d00a | 2017-07-28 17:01:21 -0700 | [diff] [blame] | 229 | int motion_mode_cost1[BLOCK_SIZES_ALL][2]; |
Yue Chen | b23d00a | 2017-07-28 17:01:21 -0700 | [diff] [blame] | 230 | int intra_uv_mode_cost[INTRA_MODES][UV_INTRA_MODES]; |
| 231 | int y_mode_costs[INTRA_MODES][INTRA_MODES][INTRA_MODES]; |
Yue Chen | 63ce36f | 2017-10-10 23:37:31 -0700 | [diff] [blame] | 232 | #if CONFIG_FILTER_INTRA |
| 233 | int filter_intra_mode_cost[PLANE_TYPES][FILTER_INTRA_MODES]; |
| 234 | #endif |
Yue Chen | b23d00a | 2017-07-28 17:01:21 -0700 | [diff] [blame] | 235 | int switchable_interp_costs[SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS]; |
| 236 | #if CONFIG_EXT_PARTITION_TYPES |
| 237 | int partition_cost[PARTITION_CONTEXTS + CONFIG_UNPOISON_PARTITION_CTX] |
| 238 | [EXT_PARTITION_TYPES]; |
| 239 | #else |
| 240 | int partition_cost[PARTITION_CONTEXTS + CONFIG_UNPOISON_PARTITION_CTX] |
| 241 | [PARTITION_TYPES]; |
| 242 | #endif // CONFIG_EXT_PARTITION_TYPES |
Sarah Parker | 5c6744b | 2017-08-25 17:27:45 -0700 | [diff] [blame] | 243 | #if CONFIG_MRC_TX |
| 244 | int mrc_mask_inter_cost[PALETTE_SIZES][PALETTE_COLOR_INDEX_CONTEXTS] |
| 245 | [PALETTE_COLORS]; |
| 246 | int mrc_mask_intra_cost[PALETTE_SIZES][PALETTE_COLOR_INDEX_CONTEXTS] |
| 247 | [PALETTE_COLORS]; |
| 248 | #endif // CONFIG_MRC_TX |
Yue Chen | b23d00a | 2017-07-28 17:01:21 -0700 | [diff] [blame] | 249 | int palette_y_size_cost[PALETTE_BLOCK_SIZES][PALETTE_SIZES]; |
| 250 | int palette_uv_size_cost[PALETTE_BLOCK_SIZES][PALETTE_SIZES]; |
| 251 | int palette_y_color_cost[PALETTE_SIZES][PALETTE_COLOR_INDEX_CONTEXTS] |
| 252 | [PALETTE_COLORS]; |
| 253 | int palette_uv_color_cost[PALETTE_SIZES][PALETTE_COLOR_INDEX_CONTEXTS] |
| 254 | [PALETTE_COLORS]; |
Yue Chen | dab2ca9 | 2017-10-16 17:48:48 -0700 | [diff] [blame] | 255 | int palette_y_mode_cost[PALETTE_BLOCK_SIZES][PALETTE_Y_MODE_CONTEXTS][2]; |
| 256 | int palette_uv_mode_cost[PALETTE_UV_MODE_CONTEXTS][2]; |
David Michael Barr | 38e560c | 2017-08-16 21:46:37 +0900 | [diff] [blame] | 257 | #if CONFIG_CFL |
| 258 | // The rate associated with each alpha codeword |
| 259 | int cfl_cost[CFL_JOINT_SIGNS][CFL_PRED_PLANES][CFL_ALPHABET_SIZE]; |
| 260 | #endif // CONFIG_CFL |
Yue Chen | b23d00a | 2017-07-28 17:01:21 -0700 | [diff] [blame] | 261 | int tx_size_cost[TX_SIZES - 1][TX_SIZE_CONTEXTS][TX_SIZES]; |
Sebastien Alaiwan | fb83877 | 2017-10-24 12:02:54 +0200 | [diff] [blame] | 262 | #if CONFIG_RECT_TX_EXT |
Yue Chen | 3dd03e3 | 2017-10-17 15:39:52 -0700 | [diff] [blame] | 263 | int quarter_tx_size_cost[2]; |
| 264 | #endif |
Yue Chen | 171c17d | 2017-10-16 18:08:22 -0700 | [diff] [blame] | 265 | int txfm_partition_cost[TXFM_PARTITION_CONTEXTS][2]; |
Yue Chen | b23d00a | 2017-07-28 17:01:21 -0700 | [diff] [blame] | 266 | int inter_tx_type_costs[EXT_TX_SETS_INTER][EXT_TX_SIZES][TX_TYPES]; |
| 267 | int intra_tx_type_costs[EXT_TX_SETS_INTRA][EXT_TX_SIZES][INTRA_MODES] |
| 268 | [TX_TYPES]; |
Joe Young | 3ca43bf | 2017-10-06 15:12:46 -0700 | [diff] [blame] | 269 | #if CONFIG_EXT_INTRA && CONFIG_EXT_INTRA_MOD |
| 270 | int angle_delta_cost[DIRECTIONAL_MODES][2 * MAX_ANGLE_DELTA + 1]; |
| 271 | #endif // CONFIG_EXT_INTRA && CONFIG_EXT_INTRA_MOD |
Yue Chen | b23d00a | 2017-07-28 17:01:21 -0700 | [diff] [blame] | 272 | #if CONFIG_LOOP_RESTORATION |
| 273 | int switchable_restore_cost[RESTORE_SWITCHABLE_TYPES]; |
Debargha Mukherjee | bc732ef | 2017-10-12 12:40:25 -0700 | [diff] [blame] | 274 | int wiener_restore_cost[2]; |
| 275 | int sgrproj_restore_cost[2]; |
Yue Chen | b23d00a | 2017-07-28 17:01:21 -0700 | [diff] [blame] | 276 | #endif // CONFIG_LOOP_RESTORATION |
Hui Su | 6c8584f | 2017-09-14 15:37:02 -0700 | [diff] [blame] | 277 | #if CONFIG_INTRABC |
| 278 | int intrabc_cost[2]; |
| 279 | #endif // CONFIG_INTRABC |
Yue Chen | b23d00a | 2017-07-28 17:01:21 -0700 | [diff] [blame] | 280 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 281 | int optimize; |
| 282 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 283 | // Used to store sub partition's choices. |
| 284 | MV pred_mv[TOTAL_REFS_PER_FRAME]; |
| 285 | |
| 286 | // Store the best motion vector during motion search |
| 287 | int_mv best_mv; |
| 288 | // Store the second best motion vector during full-pixel motion search |
| 289 | int_mv second_best_mv; |
| 290 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 291 | // use default transform and skip transform type search for intra modes |
| 292 | int use_default_intra_tx_type; |
| 293 | // use default transform and skip transform type search for inter modes |
| 294 | int use_default_inter_tx_type; |
Yushin Cho | b7b60c5 | 2017-07-14 16:18:52 -0700 | [diff] [blame] | 295 | #if CONFIG_DIST_8X8 |
Yushin Cho | 5510433 | 2017-08-14 16:15:43 -0700 | [diff] [blame] | 296 | int using_dist_8x8; |
| 297 | aom_tune_metric tune_metric; |
Yushin Cho | 8ab875d | 2017-06-23 14:47:21 -0700 | [diff] [blame] | 298 | #if CONFIG_HIGHBITDEPTH |
| 299 | DECLARE_ALIGNED(16, uint16_t, decoded_8x8[8 * 8]); |
| 300 | #else |
Yushin Cho | 63927c4 | 2017-05-23 15:41:05 -0700 | [diff] [blame] | 301 | DECLARE_ALIGNED(16, uint8_t, decoded_8x8[8 * 8]); |
Yushin Cho | 8ab875d | 2017-06-23 14:47:21 -0700 | [diff] [blame] | 302 | #endif |
Yushin Cho | b7b60c5 | 2017-07-14 16:18:52 -0700 | [diff] [blame] | 303 | #endif // CONFIG_DIST_8X8 |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 304 | }; |
| 305 | |
| 306 | #ifdef __cplusplus |
| 307 | } // extern "C" |
| 308 | #endif |
| 309 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 310 | #endif // AV1_ENCODER_BLOCK_H_ |