AOMedia AV1 Codec: av1/encoder/block.h Source File

| AOMedia AV1 Codec

block.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2016, Alliance for Open Media. All rights reserved
3 *
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.
10 */
11
15 #ifndef AOM_AV1_ENCODER_BLOCK_H_
16 #define AOM_AV1_ENCODER_BLOCK_H_
17
18 #include "av1/common/blockd.h"
19 #include "av1/common/entropymv.h"
20 #include "av1/common/entropy.h"
21 #include "av1/common/enums.h"
22 #include "av1/common/mvref_common.h"
23
24 #include "av1/encoder/enc_enums.h"
25 #if !CONFIG_REALTIME_ONLY
26 #include "av1/encoder/partition_cnn_weights.h"
27 #endif
28
29 #include "av1/encoder/hash.h"
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
36 #define MIN_TPL_BSIZE_1D 16
38 #define MAX_TPL_BLK_IN_SB (MAX_SB_SIZE / MIN_TPL_BSIZE_1D)
40 #define MAX_WINNER_MODE_COUNT_INTRA 3
42 #define MAX_WINNER_MODE_COUNT_INTER 1
44 #define RD_RECORD_BUFFER_LEN 8
46 #define TX_SIZE_RD_RECORD_BUFFER_LEN 256
47
54 typedef struct {
56 BLOCK_SIZE min_partition_size;
58 BLOCK_SIZE max_partition_size;
59
60
68 int tpl_data_count;
70 int64_t tpl_inter_cost[MAX_TPL_BLK_IN_SB * MAX_TPL_BLK_IN_SB];
72 int64_t tpl_intra_cost[MAX_TPL_BLK_IN_SB * MAX_TPL_BLK_IN_SB];
74 int_mv tpl_mv[MAX_TPL_BLK_IN_SB * MAX_TPL_BLK_IN_SB][INTER_REFS_PER_FRAME];
76 int tpl_stride;
78 } SuperBlockEnc;
79
82 typedef struct {
84 MB_MODE_INFO mbmi;
86 RD_STATS rd_cost;
88 int64_t rd;
90 int rate_y;
92 int rate_uv;
94 uint8_t color_index_map[MAX_SB_SQUARE];
96 THR_MODES mode_index;
97 } WinnerModeStats;
98
103 typedef struct macroblock_plane {
105 int16_t *src_diff;
107 tran_low_t *dqcoeff;
109 tran_low_t *qcoeff;
111 tran_low_t *coeff;
113 uint16_t *eobs;
115 uint8_t *txb_entropy_ctx;
117 struct buf_2d src;
118
127 const int16_t *quant_fp_QTX;
129 const int16_t *round_fp_QTX;
131 const int16_t *quant_QTX;
133 const int16_t *round_QTX;
135 const int16_t *quant_shift_QTX;
137 const int16_t *zbin_QTX;
139 const int16_t *dequant_QTX;
141 } MACROBLOCK_PLANE;
142
147 typedef struct {
149 int txb_skip_cost[TXB_SKIP_CONTEXTS][2];
154 int base_eob_cost[SIG_COEF_CONTEXTS_EOB][3];
159 int base_cost[SIG_COEF_CONTEXTS][8];
164 int eob_extra_cost[EOB_COEF_CONTEXTS][2];
166 int dc_sign_cost[DC_SIGN_CONTEXTS][2];
168 int lps_cost[LEVEL_CONTEXTS][COEFF_BASE_RANGE + 1 + COEFF_BASE_RANGE + 1];
169 } LV_MAP_COEFF_COST;
170
173 typedef struct {
175 int eob_cost[2][11];
176 } LV_MAP_EOB_COST;
177
180 typedef struct {
182 tran_low_t *tcoeff[MAX_MB_PLANE];
184 uint16_t *eobs[MAX_MB_PLANE];
191 uint8_t *entropy_ctx[MAX_MB_PLANE];
192 } CB_COEFF_BUFFER;
193
196 typedef struct {
197 // TODO(angiebird): Reduce the buffer size according to sb_type
199 CANDIDATE_MV ref_mv_stack[MODE_CTX_REF_FRAMES][USABLE_REF_MV_STACK_SIZE];
201 uint16_t weight[MODE_CTX_REF_FRAMES][USABLE_REF_MV_STACK_SIZE];
203 uint8_t ref_mv_count[MODE_CTX_REF_FRAMES];
205 int_mv global_mvs[REF_FRAMES];
207 int16_t mode_context[MODE_CTX_REF_FRAMES];
208 } MB_MODE_INFO_EXT;
209
216 typedef struct {
218 CANDIDATE_MV ref_mv_stack[USABLE_REF_MV_STACK_SIZE];
220 uint16_t weight[USABLE_REF_MV_STACK_SIZE];
222 uint8_t ref_mv_count;
223 // TODO(Ravi/Remya): Reduce the buffer size of global_mvs
225 int_mv global_mvs[REF_FRAMES];
227 int16_t mode_context;
229 uint16_t cb_offset[PLANE_TYPES];
230 } MB_MODE_INFO_EXT_FRAME;
231
234 typedef struct {
236 TX_SIZE tx_size;
238 TX_SIZE inter_tx_size[INTER_TX_SIZE_BUF_LEN];
240 uint8_t blk_skip[MAX_MIB_SIZE * MAX_MIB_SIZE];
242 uint8_t tx_type_map[MAX_MIB_SIZE * MAX_MIB_SIZE];
244 RD_STATS rd_stats;
246 uint32_t hash_value;
247 } MB_RD_INFO;
248
251 typedef struct {
253 MB_RD_INFO tx_rd_info[RD_RECORD_BUFFER_LEN]; // Circular buffer.
255 int index_start;
257 int num;
259 CRC32C crc_calculator;
260 } MB_RD_RECORD;
261
264 typedef struct {
266 int64_t dist;
268 int64_t sse;
270 int rate;
272 uint16_t eob;
274 TX_TYPE tx_type;
276 uint16_t entropy_context;
278 uint8_t txb_entropy_ctx;
280 uint8_t valid;
282 uint8_t fast;
284 uint8_t perform_block_coeff_opt;
285 } TXB_RD_INFO;
286
289 typedef struct {
291 uint32_t hash_vals[TX_SIZE_RD_RECORD_BUFFER_LEN];
293 TXB_RD_INFO tx_rd_info[TX_SIZE_RD_RECORD_BUFFER_LEN];
295 int index_start;
297 int num;
298 } TXB_RD_RECORD;
299
301 #define MAX_COMP_RD_STATS 64
304 typedef struct {
306 int32_t rate[COMPOUND_TYPES];
308 int64_t dist[COMPOUND_TYPES];
310 int32_t model_rate[COMPOUND_TYPES];
312 int64_t model_dist[COMPOUND_TYPES];
314 int comp_rs2[COMPOUND_TYPES];
316 int_mv mv[2];
318 MV_REFERENCE_FRAME ref_frames[2];
320 PREDICTION_MODE mode;
322 int_interpfilters filter;
324 int ref_mv_idx;
326 int is_global[2];
328 INTERINTER_COMPOUND_DATA interinter_comp;
329 } COMP_RD_STATS;
330
335 typedef struct {
340 int32_t *wsrc;
345 int32_t *mask;
350 uint8_t *above_pred;
355 uint8_t *left_pred;
356 } OBMCBuffer;
357
360 typedef struct {
362 uint8_t best_palette_color_map[MAX_PALETTE_SQUARE];
364 int kmeans_data_buf[2 * MAX_PALETTE_SQUARE];
365 } PALETTE_BUFFER;
366
372 typedef struct {
374 uint8_t *pred0;
376 uint8_t *pred1;
378 int16_t *residual1;
380 int16_t *diff10;
382 uint8_t *tmp_best_mask_buf;
383 } CompoundTypeRdBuffers;
384
387 // TODO(chiyotsai@google.com): Consolidate this with SIMPLE_MOTION_DATA_TREE
388 typedef struct {
389 #if !CONFIG_REALTIME_ONLY
390 // The following 4 parameters are used for cnn-based partitioning on intra
391 // frame.
396 int quad_tree_idx;
398 int cnn_output_valid;
400 float cnn_buffer[CNN_OUT_BUF_SIZE];
402 float log_q;
403 #endif
404
418 uint8_t variance_low[105];
419 } PartitionSearchInfo;
420
425 typedef struct {
431 int use_default_intra_tx_type;
436 int use_default_inter_tx_type;
437
439 int prune_2d_txfm_mode;
440
445 unsigned int coeff_opt_thresholds[2];
447 unsigned int tx_domain_dist_threshold;
449 TX_SIZE_SEARCH_METHOD tx_size_search_method;
451 unsigned int use_transform_domain_distortion;
453 unsigned int skip_txfm_level;
454
468 TX_MODE tx_mode_search_type;
469
473 unsigned int predict_dc_level;
474 } TxfmSearchParams;
475
477 #define MAX_NUM_8X8_TXBS ((MAX_MIB_SIZE >> 1) * (MAX_MIB_SIZE >> 1))
478 #define MAX_NUM_16X16_TXBS ((MAX_MIB_SIZE >> 2) * (MAX_MIB_SIZE >> 2))
479 #define MAX_NUM_32X32_TXBS ((MAX_MIB_SIZE >> 3) * (MAX_MIB_SIZE >> 3))
480 #define MAX_NUM_64X64_TXBS ((MAX_MIB_SIZE >> 4) * (MAX_MIB_SIZE >> 4))
494 typedef struct {
495
500 MB_RD_RECORD mb_rd_record;
501
503 TXB_RD_RECORD txb_rd_record_8X8[MAX_NUM_8X8_TXBS];
505 TXB_RD_RECORD txb_rd_record_16X16[MAX_NUM_16X16_TXBS];
507 TXB_RD_RECORD txb_rd_record_32X32[MAX_NUM_32X32_TXBS];
509 TXB_RD_RECORD txb_rd_record_64X64[MAX_NUM_64X64_TXBS];
511 TXB_RD_RECORD txb_rd_record_intra;
513 } TxbRdRecords;
514
520 typedef struct {
522 int skip_txfm;
523
531 uint8_t blk_skip[MAX_MIB_SIZE * MAX_MIB_SIZE];
532
542 uint8_t tx_type_map_[MAX_MIB_SIZE * MAX_MIB_SIZE];
543
555 TxbRdRecords *txb_rd_records;
556
565 // TODO(chiyotsai@google.com): Move this to a more appropriate location such
566 // as ThreadData.
567 unsigned int txb_split_count;
568 #if CONFIG_SPEED_STATS
570 unsigned int tx_search_count;
571 #endif // CONFIG_SPEED_STATS
572 } TxfmSearchInfo;
573 #undef MAX_NUM_8X8_TXBS
574 #undef MAX_NUM_16X16_TXBS
575 #undef MAX_NUM_32X32_TXBS
576 #undef MAX_NUM_64X64_TXBS
577
583 typedef struct {
584
589 int partition_cost[PARTITION_CONTEXTS][EXT_PARTITION_TYPES];
592
597 int mbmode_cost[BLOCK_SIZE_GROUPS][INTRA_MODES];
599 int y_mode_costs[INTRA_MODES][INTRA_MODES][INTRA_MODES];
601 int intra_uv_mode_cost[CFL_ALLOWED_TYPES][INTRA_MODES][UV_INTRA_MODES];
603 int filter_intra_cost[BLOCK_SIZES_ALL][2];
605 int filter_intra_mode_cost[FILTER_INTRA_MODES];
607 int angle_delta_cost[DIRECTIONAL_MODES][2 * MAX_ANGLE_DELTA + 1];
608
610 int cfl_cost[CFL_JOINT_SIGNS][CFL_PRED_PLANES][CFL_ALPHABET_SIZE];
613
618 int intrabc_cost[2];
619
621 int palette_y_size_cost[PALATTE_BSIZE_CTXS][PALETTE_SIZES];
623 int palette_uv_size_cost[PALATTE_BSIZE_CTXS][PALETTE_SIZES];
625 int palette_y_color_cost[PALETTE_SIZES][PALETTE_COLOR_INDEX_CONTEXTS]
626 [PALETTE_COLORS];
628 int palette_uv_color_cost[PALETTE_SIZES][PALETTE_COLOR_INDEX_CONTEXTS]
629 [PALETTE_COLORS];
631 int palette_y_mode_cost[PALATTE_BSIZE_CTXS][PALETTE_Y_MODE_CONTEXTS][2];
633 int palette_uv_mode_cost[PALETTE_UV_MODE_CONTEXTS][2];
636
641 int skip_mode_cost[SKIP_MODE_CONTEXTS][2];
643 int newmv_mode_cost[NEWMV_MODE_CONTEXTS][2];
645 int zeromv_mode_cost[GLOBALMV_MODE_CONTEXTS][2];
647 int refmv_mode_cost[REFMV_MODE_CONTEXTS][2];
649 int drl_mode_cost0[DRL_MODE_CONTEXTS][2];
652
657 int single_ref_cost[REF_CONTEXTS][SINGLE_REFS - 1][2];
659 int comp_inter_cost[COMP_INTER_CONTEXTS][2];
661 int comp_ref_type_cost[COMP_REF_TYPE_CONTEXTS]
662 [CDF_SIZE(COMP_REFERENCE_TYPES)];
664 int uni_comp_ref_cost[UNI_COMP_REF_CONTEXTS][UNIDIR_COMP_REFS - 1]
665 [CDF_SIZE(2)];
670 int comp_ref_cost[REF_CONTEXTS][FWD_REFS - 1][2];
675 int comp_bwdref_cost[REF_CONTEXTS][BWD_REFS - 1][2];
678
683 int intra_inter_cost[INTRA_INTER_CONTEXTS][2];
685 int inter_compound_mode_cost[INTER_MODE_CONTEXTS][INTER_COMPOUND_MODES];
687 int compound_type_cost[BLOCK_SIZES_ALL][MASKED_COMPOUND_TYPES];
689 int wedge_idx_cost[BLOCK_SIZES_ALL][16];
691 int interintra_cost[BLOCK_SIZE_GROUPS][2];
693 int wedge_interintra_cost[BLOCK_SIZES_ALL][2];
695 int interintra_mode_cost[BLOCK_SIZE_GROUPS][INTERINTRA_MODES];
698
703 int comp_idx_cost[COMP_INDEX_CONTEXTS][2];
705 int comp_group_idx_cost[COMP_GROUP_IDX_CONTEXTS][2];
708
713 int motion_mode_cost[BLOCK_SIZES_ALL][MOTION_MODES];
715 int motion_mode_cost1[BLOCK_SIZES_ALL][2];
717 int switchable_interp_costs[SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS];
720
725 int skip_txfm_cost[SKIP_CONTEXTS][2];
727 int tx_size_cost[TX_SIZES - 1][TX_SIZE_CONTEXTS][TX_SIZES];
729 int txfm_partition_cost[TXFM_PARTITION_CONTEXTS][2];
731 int inter_tx_type_costs[EXT_TX_SETS_INTER][EXT_TX_SIZES][TX_TYPES];
733 int intra_tx_type_costs[EXT_TX_SETS_INTRA][EXT_TX_SIZES][INTRA_MODES]
734 [TX_TYPES];
737
742 int switchable_restore_cost[RESTORE_SWITCHABLE_TYPES];
744 int wiener_restore_cost[2];
746 int sgrproj_restore_cost[2];
748 } ModeCosts;
749
752 typedef struct {
753
766 int nmv_joint_cost[MV_JOINTS];
767
769 int nmv_cost_alloc[2][MV_VALS];
771 int nmv_cost_hp_alloc[2][MV_VALS];
773 int *nmv_cost[2];
775 int *nmv_cost_hp[2];
777 int **mv_cost_stack;
779 } MvCosts;
780
783 typedef struct {
785 int joint_mv[MV_JOINTS];
786
792 int dv_costs_alloc[2][MV_VALS];
793
795 int *dv_costs[2];
796 } IntraBCMVCosts;
797
800 typedef struct {
802 LV_MAP_COEFF_COST coeff_costs[TX_SIZES][PLANE_TYPES];
804 LV_MAP_EOB_COST eob_costs[7][2];
805 } CoeffCosts;
806
808 // 4: NEAREST, NEW, NEAR, GLOBAL
809 #define SINGLE_REF_MODES ((REF_FRAMES - 1) * 4)
811 struct inter_modes_info;
812
815 typedef struct {
817 int num;
819 int pts[16];
821 int pts_inref[16];
822 } WARP_SAMPLE_INFO;
823
825 typedef enum {
826 kInvalid = 0,
827 kLowSad = 1,
828 kMedSad = 2,
829 kHighSad = 3
830 } SOURCE_SAD;
831
832 typedef struct {
833 SOURCE_SAD source_sad;
834 int lighting_change;
835 int low_sumdiff;
836 } CONTENT_STATE_SB;
846 typedef struct macroblock {
847
856 struct macroblock_plane plane[MAX_MB_PLANE];
857
864 MACROBLOCKD e_mbd;
865
871 MB_MODE_INFO_EXT mbmi_ext;
872
878 MB_MODE_INFO_EXT_FRAME *mbmi_ext_frame;
879
881 FRAME_CONTEXT *row_ctx;
890 FRAME_CONTEXT *tile_pb_ctx;
891
900 CB_COEFF_BUFFER *cb_coef_buff;
902 uint16_t cb_offset[PLANE_TYPES];
903
905 OBMCBuffer obmc_buffer;
907 PALETTE_BUFFER *palette_buffer;
909 CompoundTypeRdBuffers comp_rd_buffer;
911 CONV_BUF_TYPE *tmp_conv_dst;
912
922 uint8_t *tmp_pred_bufs[2];
925
934 int qindex;
935
941 int delta_qindex;
942
951 int rdmult;
952
954 int mb_energy;
956 int sb_energy_level;
957
959 ModeCosts mode_costs;
960
963 MvCosts *mv_costs;
964
968 IntraBCMVCosts *dv_costs;
969
971 CoeffCosts coeff_costs;
974
979 int errorperbit;
981 int sadperbit;
984
993 int seg_skip_block;
994
999 int actual_num_seg1_blocks;
1000
1005 int actual_num_seg2_blocks;
1006
1009 int cnt_zeromv;
1012
1017 // TODO(chiyotsai@google.com): Refactor this out of macroblock
1018 SuperBlockEnc sb_enc;
1019
1025 CONTENT_STATE_SB content_state_sb;
1028
1036 int pred_mv_sad[REF_FRAMES];
1038 int best_pred_mv_sad;
1039
1046 uint8_t tpl_keep_ref_frame[REF_FRAMES];
1047
1052 WARP_SAMPLE_INFO warp_sample_info[REF_FRAMES];
1053
1060 int picked_ref_frames_mask[MAX_MIB_SIZE * MAX_MIB_SIZE];
1061
1069 int nonrd_prune_ref_frame_search;
1072
1077 PartitionSearchInfo part_search_info;
1078
1086 int must_find_valid_partition;
1089
1099 int skip_mode;
1100
1107 int thresh_freq_fact[BLOCK_SIZES_ALL][MAX_MODES];
1108
1117 WinnerModeStats *winner_mode_stats;
1119 int winner_mode_count;
1120
1133 TXFM_RD_MODEL rd_model;
1134
1144 // TODO(any): try to consolidate this speed feature with winner mode
1145 // processing.
1146 struct inter_modes_info *inter_modes_info;
1147
1149 uint8_t compound_idx;
1150
1152 COMP_RD_STATS comp_rd_stats[MAX_COMP_RD_STATS];
1154 int comp_rd_stats_idx;
1155
1163 int recalc_luma_mc_data;
1164
1169 IntraBCHashInfo intrabc_hash_info;
1170
1172 int use_mb_mode_cache;
1175 const MB_MODE_INFO *mb_mode_cache;
1178
1187 unsigned int max_mv_context[REF_FRAMES];
1188
1194 FullMvLimits mv_limits;
1197
1206 TxfmSearchParams txfm_search_params;
1207
1213 TxfmSearchInfo txfm_search_info;
1214
1220 uint8_t color_sensitivity[2];
1223
1228 unsigned int source_variance;
1230 unsigned int pred_sse[REF_FRAMES];
1232 #if CONFIG_RT_ML_PARTITIONING
1233 DECLARE_ALIGNED(16, uint8_t, est_pred[128 * 128]);
1234 #endif
1236 } MACROBLOCK;
1237 #undef SINGLE_REF_MODES
1238
1240 static INLINE int is_rect_tx_allowed_bsize(BLOCK_SIZE bsize) {
1241 static const char LUT[BLOCK_SIZES_ALL] = {
1242 0, // BLOCK_4X4
1243 1, // BLOCK_4X8
1244 1, // BLOCK_8X4
1245 0, // BLOCK_8X8
1246 1, // BLOCK_8X16
1247 1, // BLOCK_16X8
1248 0, // BLOCK_16X16
1249 1, // BLOCK_16X32
1250 1, // BLOCK_32X16
1251 0, // BLOCK_32X32
1252 1, // BLOCK_32X64
1253 1, // BLOCK_64X32
1254 0, // BLOCK_64X64
1255 0, // BLOCK_64X128
1256 0, // BLOCK_128X64
1257 0, // BLOCK_128X128
1258 1, // BLOCK_4X16
1259 1, // BLOCK_16X4
1260 1, // BLOCK_8X32
1261 1, // BLOCK_32X8
1262 1, // BLOCK_16X64
1263 1, // BLOCK_64X16
1264 };
1265
1266 return LUT[bsize];
1267 }
1268
1269 static INLINE int is_rect_tx_allowed(const MACROBLOCKD *xd,
1270 const MB_MODE_INFO *mbmi) {
1271 return is_rect_tx_allowed_bsize(mbmi->bsize) &&
1272 !xd->lossless[mbmi->segment_id];
1273 }
1274
1275 static INLINE int tx_size_to_depth(TX_SIZE tx_size, BLOCK_SIZE bsize) {
1276 TX_SIZE ctx_size = max_txsize_rect_lookup[bsize];
1277 int depth = 0;
1278 while (tx_size != ctx_size) {
1279 depth++;
1280 ctx_size = sub_tx_size_map[ctx_size];
1281 assert(depth <= MAX_TX_DEPTH);
1282 }
1283 return depth;
1284 }
1285
1286 static INLINE void set_blk_skip(uint8_t txb_skip[], int plane, int blk_idx,
1287 int skip) {
1288 if (skip)
1289 txb_skip[blk_idx] |= 1UL << plane;
1290 else
1291 txb_skip[blk_idx] &= ~(1UL << plane);
1292 #ifndef NDEBUG
1293 // Set chroma planes to uninitialized states when luma is set to check if
1294 // it will be set later
1295 if (plane == 0) {
1296 txb_skip[blk_idx] |= 1UL << (1 + 4);
1297 txb_skip[blk_idx] |= 1UL << (2 + 4);
1298 }
1299
1300 // Clear the initialization checking bit
1301 txb_skip[blk_idx] &= ~(1UL << (plane + 4));
1302 #endif
1303 }
1304
1305 static INLINE int is_blk_skip(uint8_t *txb_skip, int plane, int blk_idx) {
1306 #ifndef NDEBUG
1307 // Check if this is initialized
1308 assert(!(txb_skip[blk_idx] & (1UL << (plane + 4))));
1309
1310 // The magic number is 0x77, this is to test if there is garbage data
1311 assert((txb_skip[blk_idx] & 0x88) == 0);
1312 #endif
1313 return (txb_skip[blk_idx] >> plane) & 1;
1314 }
1315
1318 #ifdef __cplusplus
1319 } // extern "C"
1320 #endif
1321
1322 #endif // AOM_AV1_ENCODER_BLOCK_H_
MAX_COMP_RD_STATS
#define MAX_COMP_RD_STATS
Number of compound rd stats.
Definition: block.h:301
MAX_TPL_BLK_IN_SB
#define MAX_TPL_BLK_IN_SB
Maximum number of tpl block in a super block.
Definition: block.h:38
RD_RECORD_BUFFER_LEN
#define RD_RECORD_BUFFER_LEN
Number of txfm hash records kept for the partition block.
Definition: block.h:44
MACROBLOCK_PLANE
struct macroblock_plane MACROBLOCK_PLANE
Each source plane of the current macroblock.
MACROBLOCK
struct macroblock MACROBLOCK
Encoder's parameters related to the current coding block.
TX_SIZE_RD_RECORD_BUFFER_LEN
#define TX_SIZE_RD_RECORD_BUFFER_LEN
Number of txfm hash records kept for the txfm block.
Definition: block.h:46
enums.h
RESTORE_SWITCHABLE_TYPES
@ RESTORE_SWITCHABLE_TYPES
Definition: enums.h:655
CB_COEFF_BUFFER
Stores the transforms coefficients for the whole superblock.
Definition: block.h:180
COMP_RD_STATS
Rdcost stats in compound mode.
Definition: block.h:304
COMP_RD_STATS::filter
int_interpfilters filter
Current interpolation filter.
Definition: block.h:322
COMP_RD_STATS::interinter_comp
INTERINTER_COMPOUND_DATA interinter_comp
Current parameters for interinter mode.
Definition: block.h:328
COMP_RD_STATS::mode
PREDICTION_MODE mode
Current prediction mode.
Definition: block.h:320
COMP_RD_STATS::ref_mv_idx
int ref_mv_idx
Refmv index in the drl.
Definition: block.h:324
CoeffCosts
Holds the costs needed to encode the coefficients.
Definition: block.h:800
CompoundTypeRdBuffers
Contains buffers used by av1_compound_type_rd()
Definition: block.h:372
CompoundTypeRdBuffers::diff10
int16_t * diff10
Second prediction - first prediction.
Definition: block.h:380
CompoundTypeRdBuffers::pred1
uint8_t * pred1
Second prediction.
Definition: block.h:376
CompoundTypeRdBuffers::residual1
int16_t * residual1
Source - first prediction.
Definition: block.h:378
CompoundTypeRdBuffers::pred0
uint8_t * pred0
First prediction.
Definition: block.h:374
CompoundTypeRdBuffers::tmp_best_mask_buf
uint8_t * tmp_best_mask_buf
Backup of the best segmentation mask.
Definition: block.h:382
IntraBCMVCosts
Holds mv costs for intrabc.
Definition: block.h:783
LV_MAP_COEFF_COST
Costs for encoding the coefficients within a level.
Definition: block.h:147
LV_MAP_EOB_COST
Costs for encoding the eob.
Definition: block.h:173
MB_MODE_INFO_EXT_FRAME
Stores best extended mode information at frame level.
Definition: block.h:216
MB_MODE_INFO_EXT_FRAME::ref_mv_count
uint8_t ref_mv_count
Number of ref mvs in the drl.
Definition: block.h:222
MB_MODE_INFO_EXT_FRAME::mode_context
int16_t mode_context
Context used to encode the current mode.
Definition: block.h:227
MB_MODE_INFO_EXT
Extended mode info derived from mbmi.
Definition: block.h:196
MB_MODE_INFO
Stores the prediction/txfm mode of the current coding block.
Definition: blockd.h:216
MB_MODE_INFO::segment_id
uint8_t segment_id
The segment id.
Definition: blockd.h:304
MB_MODE_INFO::bsize
BLOCK_SIZE bsize
The block size of the current coding block.
Definition: blockd.h:222
MB_RD_INFO
Txfm search results for a partition.
Definition: block.h:234
MB_RD_INFO::tx_size
TX_SIZE tx_size
Txfm size used if the current mode is intra mode.
Definition: block.h:236
MB_RD_INFO::hash_value
uint32_t hash_value
Hash value of the current record.
Definition: block.h:246
MB_RD_INFO::rd_stats
RD_STATS rd_stats
Rd_stats for the whole partition block.
Definition: block.h:244
MB_RD_RECORD
Hash records of txfm search results for the partition block.
Definition: block.h:251
MB_RD_RECORD::index_start
int index_start
Index to insert the newest TXB_RD_INFO.
Definition: block.h:255
MB_RD_RECORD::num
int num
Number of info stored in this record.
Definition: block.h:257
MB_RD_RECORD::crc_calculator
CRC32C crc_calculator
Hash function.
Definition: block.h:259
ModeCosts
Holds the entropy costs for various modes sent to the bitstream.
Definition: block.h:583
MvCosts
Holds mv costs for encoding and motion search.
Definition: block.h:752
MvCosts::mv_cost_stack
int ** mv_cost_stack
Points to the nmv_cost_hp in use.
Definition: block.h:777
OBMCBuffer
Contains buffers used to speed up rdopt for obmc.
Definition: block.h:335
OBMCBuffer::left_pred
uint8_t * left_pred
Prediction from the up predictor.
Definition: block.h:355
OBMCBuffer::wsrc
int32_t * wsrc
A new source weighted with the above and left predictors.
Definition: block.h:340
OBMCBuffer::mask
int32_t * mask
A new mask constructed from the original horz/vert mask.
Definition: block.h:345
OBMCBuffer::above_pred
uint8_t * above_pred
Prediction from the up predictor.
Definition: block.h:350
PALETTE_BUFFER
Contains color maps used in palette mode.
Definition: block.h:360
PartitionSearchInfo
Holds some parameters related to partitioning schemes in AV1.
Definition: block.h:388
PartitionSearchInfo::cnn_output_valid
int cnn_output_valid
Whether the CNN buffer contains valid output.
Definition: block.h:398
PartitionSearchInfo::log_q
float log_q
log of the quantization parameter of the ancestor BLOCK_64X64.
Definition: block.h:402
PartitionSearchInfo::quad_tree_idx
int quad_tree_idx
Current index on the partition block quad tree.
Definition: block.h:396
SuperBlockEnc
Superblock level encoder info.
Definition: block.h:54
SuperBlockEnc::min_partition_size
BLOCK_SIZE min_partition_size
Maximum partition size for the sb.
Definition: block.h:56
SuperBlockEnc::max_partition_size
BLOCK_SIZE max_partition_size
Minimum partition size for the sb.
Definition: block.h:58
SuperBlockEnc::tpl_stride
int tpl_stride
TPL's stride for the arrays in this struct.
Definition: block.h:76
SuperBlockEnc::tpl_data_count
int tpl_data_count
Number of TPL blocks in this superblock.
Definition: block.h:68
TXB_RD_INFO
Txfm search results for a tx block.
Definition: block.h:264
TXB_RD_INFO::entropy_context
uint16_t entropy_context
Unknown usage.
Definition: block.h:276
TXB_RD_INFO::sse
int64_t sse
SSE of the prediction before the txfm process.
Definition: block.h:268
TXB_RD_INFO::dist
int64_t dist
Distortion after the txfm process.
Definition: block.h:266
TXB_RD_INFO::eob
uint16_t eob
Location of the end of non-zero entries.
Definition: block.h:272
TXB_RD_INFO::valid
uint8_t valid
Whether the current info block contains valid info.
Definition: block.h:280
TXB_RD_INFO::fast
uint8_t fast
Unused.
Definition: block.h:282
TXB_RD_INFO::tx_type
TX_TYPE tx_type
Transform type used on the current block.
Definition: block.h:274
TXB_RD_INFO::txb_entropy_ctx
uint8_t txb_entropy_ctx
Context used to code the coefficients.
Definition: block.h:278
TXB_RD_INFO::rate
int rate
Rate used to encode the txfm.
Definition: block.h:270
TXB_RD_INFO::perform_block_coeff_opt
uint8_t perform_block_coeff_opt
Whether trellis optimization is done.
Definition: block.h:284
TXB_RD_RECORD
Hash records of txfm search result for each tx block.
Definition: block.h:289
TXB_RD_RECORD::num
int num
Number of info stored in this record.
Definition: block.h:297
TXB_RD_RECORD::index_start
int index_start
Index to insert the newest TXB_RD_INFO.
Definition: block.h:295
TxbRdRecords
Txfm hash records.
Definition: block.h:494
TxbRdRecords::mb_rd_record
MB_RD_RECORD mb_rd_record
Txfm hash record for the whole coding block.
Definition: block.h:500
TxbRdRecords::txb_rd_record_intra
TXB_RD_RECORD txb_rd_record_intra
Intra mode txfm hash record for square tx blocks.
Definition: block.h:511
TxfmSearchInfo
Stores various encoding/search decisions related to txfm search.
Definition: block.h:520
TxfmSearchInfo::skip_txfm
int skip_txfm
Whether to skip transform and quantization on a partition block level.
Definition: block.h:522
TxfmSearchInfo::txb_split_count
unsigned int txb_split_count
Number of txb splits.
Definition: block.h:567
TxfmSearchInfo::txb_rd_records
TxbRdRecords * txb_rd_records
Txfm hash records.
Definition: block.h:555
TxfmSearchParams
Defines the parameters used to perform txfm search.
Definition: block.h:425
TxfmSearchParams::use_default_intra_tx_type
int use_default_intra_tx_type
Whether to limit the intra txfm search type to the default txfm.
Definition: block.h:431
TxfmSearchParams::prune_2d_txfm_mode
int prune_2d_txfm_mode
Whether to prune 2d transforms based on 1d transform results.
Definition: block.h:439
TxfmSearchParams::tx_mode_search_type
TX_MODE tx_mode_search_type
How to search for the optimal tx_size.
Definition: block.h:468
TxfmSearchParams::use_default_inter_tx_type
int use_default_inter_tx_type
Whether to limit the inter txfm search type to the default txfm.
Definition: block.h:436
TxfmSearchParams::tx_size_search_method
TX_SIZE_SEARCH_METHOD tx_size_search_method
Variable from WinnerModeParams based on current eval mode.
Definition: block.h:449
TxfmSearchParams::predict_dc_level
unsigned int predict_dc_level
Definition: block.h:473
TxfmSearchParams::tx_domain_dist_threshold
unsigned int tx_domain_dist_threshold
Variable from WinnerModeParams based on current eval mode.
Definition: block.h:447
TxfmSearchParams::skip_txfm_level
unsigned int skip_txfm_level
Variable from WinnerModeParams based on current eval mode.
Definition: block.h:453
TxfmSearchParams::use_transform_domain_distortion
unsigned int use_transform_domain_distortion
Variable from WinnerModeParams based on current eval mode.
Definition: block.h:451
WARP_SAMPLE_INFO
Holds the motion samples for warp motion model estimation.
Definition: block.h:815
WARP_SAMPLE_INFO::num
int num
Number of samples.
Definition: block.h:817
WinnerModeStats
Stores the best performing modes.
Definition: block.h:82
WinnerModeStats::rate_y
int rate_y
Luma rate of the winner mode.
Definition: block.h:90
WinnerModeStats::rd_cost
RD_STATS rd_cost
Rdstats of the winner mode.
Definition: block.h:86
WinnerModeStats::mbmi
MB_MODE_INFO mbmi
The mbmi used to reconstruct the winner mode.
Definition: block.h:84
WinnerModeStats::mode_index
THR_MODES mode_index
The current winner mode.
Definition: block.h:96
WinnerModeStats::rate_uv
int rate_uv
Chroma rate of the winner mode.
Definition: block.h:92
WinnerModeStats::rd
int64_t rd
Rdcost of the winner mode.
Definition: block.h:88
inter_modes_info
Struct used to hold inter mode data for fast tx search.
Definition: encoder.h:1116
macroblock_plane
Each source plane of the current macroblock.
Definition: block.h:103
macroblock_plane::qcoeff
tran_low_t * qcoeff
Quantized coefficients.
Definition: block.h:109
macroblock_plane::quant_shift_QTX
const int16_t * quant_shift_QTX
Scale factor to shift coefficients toward zero. Only used by QUANT_B.
Definition: block.h:135
macroblock_plane::quant_fp_QTX
const int16_t * quant_fp_QTX
Quantization step size used by AV1_XFORM_QUANT_FP.
Definition: block.h:127
macroblock_plane::dequant_QTX
const int16_t * dequant_QTX
Dequantizer.
Definition: block.h:139
macroblock_plane::dqcoeff
tran_low_t * dqcoeff
Dequantized coefficients.
Definition: block.h:107
macroblock_plane::zbin_QTX
const int16_t * zbin_QTX
Size of the quantization bin around 0. Only Used by QUANT_B.
Definition: block.h:137
macroblock_plane::quant_QTX
const int16_t * quant_QTX
Quantization step size used by AV1_XFORM_QUANT_B.
Definition: block.h:131
macroblock_plane::src
struct buf_2d src
A buffer containing the source frame.
Definition: block.h:117
macroblock_plane::eobs
uint16_t * eobs
Location of the end of qcoeff (end of block).
Definition: block.h:113
macroblock_plane::coeff
tran_low_t * coeff
Transformed coefficients.
Definition: block.h:111
macroblock_plane::src_diff
int16_t * src_diff
Stores source - pred so the txfm can be computed later.
Definition: block.h:105
macroblock_plane::txb_entropy_ctx
uint8_t * txb_entropy_ctx
Contexts used to code the transform coefficients.
Definition: block.h:115
macroblock_plane::round_fp_QTX
const int16_t * round_fp_QTX
Offset used for rounding in the quantizer process by AV1_XFORM_QUANT_FP.
Definition: block.h:129
macroblock_plane::round_QTX
const int16_t * round_QTX
Offset used for rounding in the quantizer process by AV1_XFORM_QUANT_B.
Definition: block.h:133
macroblock
Encoder's parameters related to the current coding block.
Definition: block.h:846
macroblock::delta_qindex
int delta_qindex
Difference between frame-level qindex and current qindex.
Definition: block.h:941
macroblock::warp_sample_info
WARP_SAMPLE_INFO warp_sample_info[REF_FRAMES]
Warp motion samples buffer.
Definition: block.h:1052
macroblock::mbmi_ext_frame
MB_MODE_INFO_EXT_FRAME * mbmi_ext_frame
Finalized mbmi_ext for the whole frame.
Definition: block.h:878
macroblock::sb_energy_level
int sb_energy_level
Energy in the current source superblock. Used to calculate rdmult.
Definition: block.h:956
macroblock::tmp_pred_bufs
uint8_t * tmp_pred_bufs[2]
Temporary buffer to hold prediction.
Definition: block.h:922
macroblock::mb_energy
int mb_energy
Energy in the current source coding block. Used to calculate rdmult.
Definition: block.h:954
macroblock::skip_mode
int skip_mode
Inter skip mode.
Definition: block.h:1099
macroblock::mv_limits
FullMvLimits mv_limits
Limit for the range of motion vectors.
Definition: block.h:1194
macroblock::coeff_costs
CoeffCosts coeff_costs
The rate needed to signal the txfm coefficients to the bitstream.
Definition: block.h:971
macroblock::part_search_info
PartitionSearchInfo part_search_info
Stores some partition-search related buffers.
Definition: block.h:1077
macroblock::rdmult
int rdmult
Rate-distortion multiplier.
Definition: block.h:951
macroblock::e_mbd
MACROBLOCKD e_mbd
Decoder's view of current coding block.
Definition: block.h:864
macroblock::best_pred_mv_sad
int best_pred_mv_sad
The minimum of pred_mv_sad.
Definition: block.h:1038
macroblock::actual_num_seg1_blocks
int actual_num_seg1_blocks
Number of segment 1 blocks Actual number of (4x4) blocks that were applied delta-q,...
Definition: block.h:999
macroblock::source_variance
unsigned int source_variance
Variance of the source frame.
Definition: block.h:1228
macroblock::seg_skip_block
int seg_skip_block
Skip mode for the segment.
Definition: block.h:993
macroblock::row_ctx
FRAME_CONTEXT * row_ctx
Entropy context for the current row.
Definition: block.h:881
macroblock::winner_mode_stats
WinnerModeStats * winner_mode_stats
Tracks the winner modes in the current coding block.
Definition: block.h:1117
macroblock::pred_sse
unsigned int pred_sse[REF_FRAMES]
SSE of the current predictor.
Definition: block.h:1230
macroblock::tmp_conv_dst
CONV_BUF_TYPE * tmp_conv_dst
Buffer to store convolution during averaging process in compound mode.
Definition: block.h:911
macroblock::mode_costs
ModeCosts mode_costs
The rate needed to signal a mode to the bitstream.
Definition: block.h:959
macroblock::comp_rd_stats_idx
int comp_rd_stats_idx
The idx for the latest compound mode in the cache comp_rd_stats.
Definition: block.h:1154
macroblock::nonrd_prune_ref_frame_search
int nonrd_prune_ref_frame_search
Prune ref frames in real-time mode.
Definition: block.h:1069
macroblock::max_mv_context
unsigned int max_mv_context[REF_FRAMES]
Context used to determine the initial step size in motion search.
Definition: block.h:1187
macroblock::sadperbit
int sadperbit
A multiplier that converts mv cost to l1 error.
Definition: block.h:981
macroblock::compound_idx
uint8_t compound_idx
How to blend the compound predictions.
Definition: block.h:1149
macroblock::comp_rd_buffer
CompoundTypeRdBuffers comp_rd_buffer
Buffer used for compound_type_rd().
Definition: block.h:909
macroblock::thresh_freq_fact
int thresh_freq_fact[BLOCK_SIZES_ALL][MAX_MODES]
Factors used for rd-thresholding.
Definition: block.h:1107
macroblock::dv_costs
IntraBCMVCosts * dv_costs
Definition: block.h:968
macroblock::mb_mode_cache
const MB_MODE_INFO * mb_mode_cache
The mode to reuse during av1_rd_pick_intra_mode_sb and av1_rd_pick_inter_mode.
Definition: block.h:1175
macroblock::palette_buffer
PALETTE_BUFFER * palette_buffer
Buffer to store the best palette map.
Definition: block.h:907
macroblock::content_state_sb
CONTENT_STATE_SB content_state_sb
Characteristics of the current superblock.
Definition: block.h:1025
macroblock::plane
struct macroblock_plane plane[3]
Each of the encoding plane.
Definition: block.h:856
macroblock::recalc_luma_mc_data
int recalc_luma_mc_data
Whether to recompute the luma prediction.
Definition: block.h:1163
macroblock::obmc_buffer
OBMCBuffer obmc_buffer
Modified source and masks used for fast OBMC search.
Definition: block.h:905
macroblock::sb_enc
SuperBlockEnc sb_enc
Information on a whole superblock level.
Definition: block.h:1018
macroblock::comp_rd_stats
COMP_RD_STATS comp_rd_stats[64]
A caches of results of compound type search so they can be reused later.
Definition: block.h:1152
macroblock::use_mb_mode_cache
int use_mb_mode_cache
Whether to reuse the mode stored in mb_mode_cache.
Definition: block.h:1172
macroblock::cb_coef_buff
CB_COEFF_BUFFER * cb_coef_buff
Buffer of transformed coefficients.
Definition: block.h:900
macroblock::color_sensitivity
uint8_t color_sensitivity[2]
Whether there is a strong color activity.
Definition: block.h:1220
macroblock::qindex
int qindex
Quantization index for the current partition block.
Definition: block.h:934
macroblock::must_find_valid_partition
int must_find_valid_partition
Whether to disable some features to force a mode in current block.
Definition: block.h:1086
macroblock::actual_num_seg2_blocks
int actual_num_seg2_blocks
Number of segment 2 blocks Actual number of (4x4) blocks that were applied delta-q,...
Definition: block.h:1005
macroblock::picked_ref_frames_mask
int picked_ref_frames_mask[MAX_MIB_SIZE *MAX_MIB_SIZE]
Reference frames picked by the square subblocks in a superblock.
Definition: block.h:1060
macroblock::mv_costs
MvCosts * mv_costs
Definition: block.h:963
macroblock::txfm_search_info
TxfmSearchInfo txfm_search_info
Results of the txfm searches that have been done.
Definition: block.h:1213
macroblock::pred_mv_sad
int pred_mv_sad[REF_FRAMES]
Sum absolute distortion of the predicted mv for each ref frame.
Definition: block.h:1036
macroblock::intrabc_hash_info
IntraBCHashInfo intrabc_hash_info
Data structure to speed up intrabc search.
Definition: block.h:1169
macroblock::errorperbit
int errorperbit
A multiplier that converts mv cost to l2 error.
Definition: block.h:979
macroblock::tile_pb_ctx
FRAME_CONTEXT * tile_pb_ctx
Entropy context for the current tile.
Definition: block.h:890
macroblock::inter_modes_info
struct inter_modes_info * inter_modes_info
Stores the inter mode information needed to build an rd model.
Definition: block.h:1146
macroblock::cb_offset
uint16_t cb_offset[PLANE_TYPES]
Offset of current coding block's coeff buffer relative to the sb.
Definition: block.h:902
macroblock::winner_mode_count
int winner_mode_count
Tracks how many winner modes there are.
Definition: block.h:1119
macroblock::cnt_zeromv
int cnt_zeromv
Number of zero motion vectors.
Definition: block.h:1009
macroblock::rd_model
TXFM_RD_MODEL rd_model
The model used for rd-estimation to avoid txfm.
Definition: block.h:1133
macroblock::txfm_search_params
TxfmSearchParams txfm_search_params
Parameters that control how motion search is done.
Definition: block.h:1206
macroblock::tpl_keep_ref_frame
uint8_t tpl_keep_ref_frame[REF_FRAMES]
Disables certain ref frame pruning based on tpl.
Definition: block.h:1046
macroblock::mbmi_ext
MB_MODE_INFO_EXT mbmi_ext
Derived coding information.
Definition: block.h:871
macroblockd
Variables related to current coding block.
Definition: blockd.h:568
macroblockd::lossless
int lossless[8]
Definition: blockd.h:815