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