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_motion.h"
30
31#ifdef __cplusplus
32extern "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
45
47#define MAX_TX_TYPE_PROB 1024
54typedef struct {
59
60
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];
79
82typedef struct {
86 RD_STATS rd_cost;
88 int64_t rd;
90 int rate_y;
94 uint8_t color_index_map[MAX_SB_SQUARE];
96 THR_MODES mode_index;
98
103typedef 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;
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;
142
147typedef 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];
170
173typedef struct {
175 int eob_cost[2][11];
177
180typedef struct {
182 tran_low_t *tcoeff[MAX_MB_PLANE];
184 uint16_t *eobs[MAX_MB_PLANE];
191 uint8_t *entropy_ctx[MAX_MB_PLANE];
193
196typedef 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];
209
216typedef struct {
218 CANDIDATE_MV ref_mv_stack[USABLE_REF_MV_STACK_SIZE];
220 uint16_t weight[USABLE_REF_MV_STACK_SIZE];
223 // TODO(Ravi/Remya): Reduce the buffer size of global_mvs
225 int_mv global_mvs[REF_FRAMES];
229 uint16_t cb_offset[PLANE_TYPES];
231
234typedef 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
255typedef struct {
263 int num;
267
269#define MAX_COMP_RD_STATS 64
272typedef struct {
274 int32_t rate[COMPOUND_TYPES];
276 int64_t dist[COMPOUND_TYPES];
278 int32_t model_rate[COMPOUND_TYPES];
280 int64_t model_dist[COMPOUND_TYPES];
282 int comp_rs2[COMPOUND_TYPES];
284 int_mv mv[2];
286 MV_REFERENCE_FRAME ref_frames[2];
288 PREDICTION_MODE mode;
290 int_interpfilters filter;
294 int is_global[2];
296 INTERINTER_COMPOUND_DATA interinter_comp;
298
303typedef struct {
308 int32_t *wsrc;
313 int32_t *mask;
318 uint8_t *above_pred;
323 uint8_t *left_pred;
324} OBMCBuffer;
325
328typedef struct {
330 uint8_t best_palette_color_map[MAX_PALETTE_SQUARE];
332 int kmeans_data_buf[2 * MAX_PALETTE_SQUARE];
334
340typedef struct {
342 uint8_t *pred0;
344 uint8_t *pred1;
346 int16_t *residual1;
348 int16_t *diff10;
352
355// TODO(chiyotsai@google.com): Consolidate this with SIMPLE_MOTION_DATA_TREE
356typedef struct {
357#if !CONFIG_REALTIME_ONLY
358 // The following 4 parameters are used for cnn-based partitioning on intra
359 // frame.
368 float cnn_buffer[CNN_OUT_BUF_SIZE];
370 float log_q;
371#endif
372
386 uint8_t variance_low[105];
388
393typedef struct {
400
403
406
411 unsigned int coeff_opt_thresholds[2];
415 TX_SIZE_SEARCH_METHOD tx_size_search_method;
419 unsigned int skip_txfm_level;
420
435
439 unsigned int predict_dc_level;
441
443#define MAX_NUM_8X8_TXBS ((MAX_MIB_SIZE >> 1) * (MAX_MIB_SIZE >> 1))
444#define MAX_NUM_16X16_TXBS ((MAX_MIB_SIZE >> 2) * (MAX_MIB_SIZE >> 2))
445#define MAX_NUM_32X32_TXBS ((MAX_MIB_SIZE >> 3) * (MAX_MIB_SIZE >> 3))
446#define MAX_NUM_64X64_TXBS ((MAX_MIB_SIZE >> 4) * (MAX_MIB_SIZE >> 4))
454typedef struct {
457
465 uint8_t blk_skip[MAX_MIB_SIZE * MAX_MIB_SIZE];
466
476 uint8_t tx_type_map_[MAX_MIB_SIZE * MAX_MIB_SIZE];
477
480
489 // TODO(chiyotsai@google.com): Move this to a more appropriate location such
490 // as ThreadData.
491 unsigned int txb_split_count;
492#if CONFIG_SPEED_STATS
494 unsigned int tx_search_count;
495#endif // CONFIG_SPEED_STATS
497#undef MAX_NUM_8X8_TXBS
498#undef MAX_NUM_16X16_TXBS
499#undef MAX_NUM_32X32_TXBS
500#undef MAX_NUM_64X64_TXBS
501
507typedef struct {
508
513 int partition_cost[PARTITION_CONTEXTS][EXT_PARTITION_TYPES];
516
521 int mbmode_cost[BLOCK_SIZE_GROUPS][INTRA_MODES];
523 int y_mode_costs[INTRA_MODES][INTRA_MODES][INTRA_MODES];
525 int intra_uv_mode_cost[CFL_ALLOWED_TYPES][INTRA_MODES][UV_INTRA_MODES];
527 int filter_intra_cost[BLOCK_SIZES_ALL][2];
529 int filter_intra_mode_cost[FILTER_INTRA_MODES];
531 int angle_delta_cost[DIRECTIONAL_MODES][2 * MAX_ANGLE_DELTA + 1];
532
534 int cfl_cost[CFL_JOINT_SIGNS][CFL_PRED_PLANES][CFL_ALPHABET_SIZE];
537
542 int intrabc_cost[2];
543
545 int palette_y_size_cost[PALATTE_BSIZE_CTXS][PALETTE_SIZES];
547 int palette_uv_size_cost[PALATTE_BSIZE_CTXS][PALETTE_SIZES];
549 int palette_y_color_cost[PALETTE_SIZES][PALETTE_COLOR_INDEX_CONTEXTS]
550 [PALETTE_COLORS];
552 int palette_uv_color_cost[PALETTE_SIZES][PALETTE_COLOR_INDEX_CONTEXTS]
553 [PALETTE_COLORS];
555 int palette_y_mode_cost[PALATTE_BSIZE_CTXS][PALETTE_Y_MODE_CONTEXTS][2];
557 int palette_uv_mode_cost[PALETTE_UV_MODE_CONTEXTS][2];
560
565 int skip_mode_cost[SKIP_MODE_CONTEXTS][2];
567 int newmv_mode_cost[NEWMV_MODE_CONTEXTS][2];
569 int zeromv_mode_cost[GLOBALMV_MODE_CONTEXTS][2];
571 int refmv_mode_cost[REFMV_MODE_CONTEXTS][2];
573 int drl_mode_cost0[DRL_MODE_CONTEXTS][2];
576
581 int single_ref_cost[REF_CONTEXTS][SINGLE_REFS - 1][2];
583 int comp_inter_cost[COMP_INTER_CONTEXTS][2];
585 int comp_ref_type_cost[COMP_REF_TYPE_CONTEXTS]
586 [CDF_SIZE(COMP_REFERENCE_TYPES)];
588 int uni_comp_ref_cost[UNI_COMP_REF_CONTEXTS][UNIDIR_COMP_REFS - 1]
589 [CDF_SIZE(2)];
594 int comp_ref_cost[REF_CONTEXTS][FWD_REFS - 1][2];
599 int comp_bwdref_cost[REF_CONTEXTS][BWD_REFS - 1][2];
602
607 int intra_inter_cost[INTRA_INTER_CONTEXTS][2];
609 int inter_compound_mode_cost[INTER_MODE_CONTEXTS][INTER_COMPOUND_MODES];
611 int compound_type_cost[BLOCK_SIZES_ALL][MASKED_COMPOUND_TYPES];
613 int wedge_idx_cost[BLOCK_SIZES_ALL][16];
615 int interintra_cost[BLOCK_SIZE_GROUPS][2];
617 int wedge_interintra_cost[BLOCK_SIZES_ALL][2];
619 int interintra_mode_cost[BLOCK_SIZE_GROUPS][INTERINTRA_MODES];
622
627 int comp_idx_cost[COMP_INDEX_CONTEXTS][2];
629 int comp_group_idx_cost[COMP_GROUP_IDX_CONTEXTS][2];
632
637 int motion_mode_cost[BLOCK_SIZES_ALL][MOTION_MODES];
639 int motion_mode_cost1[BLOCK_SIZES_ALL][2];
641 int switchable_interp_costs[SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS];
644
649 int skip_txfm_cost[SKIP_CONTEXTS][2];
651 int tx_size_cost[TX_SIZES - 1][TX_SIZE_CONTEXTS][TX_SIZES];
653 int txfm_partition_cost[TXFM_PARTITION_CONTEXTS][2];
655 int inter_tx_type_costs[EXT_TX_SETS_INTER][EXT_TX_SIZES][TX_TYPES];
657 int intra_tx_type_costs[EXT_TX_SETS_INTRA][EXT_TX_SIZES][INTRA_MODES]
658 [TX_TYPES];
661
666 int switchable_restore_cost[RESTORE_SWITCHABLE_TYPES];
668 int wiener_restore_cost[2];
670 int sgrproj_restore_cost[2];
672} ModeCosts;
673
676typedef struct {
677
690 int nmv_joint_cost[MV_JOINTS];
691
693 int nmv_cost_alloc[2][MV_VALS];
695 int nmv_cost_hp_alloc[2][MV_VALS];
697 int *nmv_cost[2];
699 int *nmv_cost_hp[2];
703} MvCosts;
704
707typedef struct {
709 int joint_mv[MV_JOINTS];
710
716 int dv_costs_alloc[2][MV_VALS];
717
719 int *dv_costs[2];
721
724typedef struct {
726 LV_MAP_COEFF_COST coeff_costs[TX_SIZES][PLANE_TYPES];
728 LV_MAP_EOB_COST eob_costs[7][2];
729} CoeffCosts;
730
732// 4: NEAREST, NEW, NEAR, GLOBAL
733#define SINGLE_REF_MODES ((REF_FRAMES - 1) * 4)
735struct inter_modes_info;
736
739typedef struct {
741 int num;
743 int pts[16];
745 int pts_inref[16];
747
749typedef enum {
750 kInvalid = 0,
751 kLowSad = 1,
752 kMedSad = 2,
753 kHighSad = 3
754} SOURCE_SAD;
755
756typedef struct {
757 SOURCE_SAD source_sad;
758 int lighting_change;
759 int low_sumdiff;
760} CONTENT_STATE_SB;
761
762// Structure to hold pixel level gradient info.
763typedef struct {
764 uint16_t abs_dx_abs_dy_sum;
765 int8_t hist_bin_idx;
766 bool is_dx_zero;
767} PixelLevelGradientInfo;
768
778typedef struct macroblock {
779
788 struct macroblock_plane plane[MAX_MB_PLANE];
789
797
804
811
813 FRAME_CONTEXT *row_ctx;
822 FRAME_CONTEXT *tile_pb_ctx;
823
834 uint16_t cb_offset[PLANE_TYPES];
835
843 CONV_BUF_TYPE *tmp_conv_dst;
844
854 uint8_t *tmp_pred_bufs[2];
857
867
874
884
889
892
896
901
906
916
926
932
938
944
949 // TODO(chiyotsai@google.com): Refactor this out of macroblock
951
957 CONTENT_STATE_SB content_state_sb;
960
968 int pred_mv_sad[REF_FRAMES];
972 int pred_mv0_sad[REF_FRAMES];
974 int pred_mv1_sad[REF_FRAMES];
975
982 uint8_t tpl_keep_ref_frame[REF_FRAMES];
983
989
996 int picked_ref_frames_mask[MAX_MIB_SIZE * MAX_MIB_SIZE];
997
1008
1014
1025
1036
1043 int thresh_freq_fact[BLOCK_SIZES_ALL][MAX_MODES];
1044
1056
1069 TXFM_RD_MODEL rd_model;
1070
1080 // TODO(any): try to consolidate this speed feature with winner mode
1081 // processing.
1083
1086
1091
1100
1105 IntraBCHashInfo intrabc_hash_info;
1106
1118 PixelLevelGradientInfo *pixel_gradient_info;
1120 bool is_sb_gradient_cached[PLANE_TYPES];
1123
1132 unsigned int max_mv_context[REF_FRAMES];
1133
1139 FullMvLimits mv_limits;
1142
1152
1159
1170
1175 unsigned int source_variance;
1177 unsigned int pred_sse[REF_FRAMES];
1179#if CONFIG_RT_ML_PARTITIONING
1180 DECLARE_ALIGNED(16, uint8_t, est_pred[128 * 128]);
1181#endif
1192#undef SINGLE_REF_MODES
1193
1195// Zeroes out 'n_stats' elements in the array x->winner_mode_stats.
1196// It only zeroes out what is necessary in 'color_index_map' (just the block
1197// size, not the whole array).
1198static INLINE void zero_winner_mode_stats(BLOCK_SIZE bsize, int n_stats,
1199 WinnerModeStats *stats) {
1200 const int block_height = block_size_high[bsize];
1201 const int block_width = block_size_wide[bsize];
1202 for (int i = 0; i < n_stats; ++i) {
1203 WinnerModeStats *const stat = &stats[i];
1204 memset(&stat->mbmi, 0, sizeof(stat->mbmi));
1205 memset(&stat->rd_cost, 0, sizeof(stat->rd_cost));
1206 memset(&stat->rd, 0, sizeof(stat->rd));
1207 memset(&stat->rate_y, 0, sizeof(stat->rate_y));
1208 memset(&stat->rate_uv, 0, sizeof(stat->rate_uv));
1209 // Do not reset the whole array as it is CPU intensive.
1210 memset(&stat->color_index_map, 0,
1211 block_width * block_height * sizeof(stat->color_index_map[0]));
1212 memset(&stat->mode_index, 0, sizeof(stat->mode_index));
1213 }
1214}
1215
1216static INLINE int is_rect_tx_allowed_bsize(BLOCK_SIZE bsize) {
1217 static const char LUT[BLOCK_SIZES_ALL] = {
1218 0, // BLOCK_4X4
1219 1, // BLOCK_4X8
1220 1, // BLOCK_8X4
1221 0, // BLOCK_8X8
1222 1, // BLOCK_8X16
1223 1, // BLOCK_16X8
1224 0, // BLOCK_16X16
1225 1, // BLOCK_16X32
1226 1, // BLOCK_32X16
1227 0, // BLOCK_32X32
1228 1, // BLOCK_32X64
1229 1, // BLOCK_64X32
1230 0, // BLOCK_64X64
1231 0, // BLOCK_64X128
1232 0, // BLOCK_128X64
1233 0, // BLOCK_128X128
1234 1, // BLOCK_4X16
1235 1, // BLOCK_16X4
1236 1, // BLOCK_8X32
1237 1, // BLOCK_32X8
1238 1, // BLOCK_16X64
1239 1, // BLOCK_64X16
1240 };
1241
1242 return LUT[bsize];
1243}
1244
1245static INLINE int is_rect_tx_allowed(const MACROBLOCKD *xd,
1246 const MB_MODE_INFO *mbmi) {
1247 return is_rect_tx_allowed_bsize(mbmi->bsize) &&
1248 !xd->lossless[mbmi->segment_id];
1249}
1250
1251static INLINE int tx_size_to_depth(TX_SIZE tx_size, BLOCK_SIZE bsize) {
1252 TX_SIZE ctx_size = max_txsize_rect_lookup[bsize];
1253 int depth = 0;
1254 while (tx_size != ctx_size) {
1255 depth++;
1256 ctx_size = sub_tx_size_map[ctx_size];
1257 assert(depth <= MAX_TX_DEPTH);
1258 }
1259 return depth;
1260}
1261
1262static INLINE void set_blk_skip(uint8_t txb_skip[], int plane, int blk_idx,
1263 int skip) {
1264 if (skip)
1265 txb_skip[blk_idx] |= 1UL << plane;
1266 else
1267 txb_skip[blk_idx] &= ~(1UL << plane);
1268#ifndef NDEBUG
1269 // Set chroma planes to uninitialized states when luma is set to check if
1270 // it will be set later
1271 if (plane == 0) {
1272 txb_skip[blk_idx] |= 1UL << (1 + 4);
1273 txb_skip[blk_idx] |= 1UL << (2 + 4);
1274 }
1275
1276 // Clear the initialization checking bit
1277 txb_skip[blk_idx] &= ~(1UL << (plane + 4));
1278#endif
1279}
1280
1281static INLINE int is_blk_skip(uint8_t *txb_skip, int plane, int blk_idx) {
1282#ifndef NDEBUG
1283 // Check if this is initialized
1284 assert(!(txb_skip[blk_idx] & (1UL << (plane + 4))));
1285
1286 // The magic number is 0x77, this is to test if there is garbage data
1287 assert((txb_skip[blk_idx] & 0x88) == 0);
1288#endif
1289 return (txb_skip[blk_idx] >> plane) & 1;
1290}
1291
1294#ifdef __cplusplus
1295} // extern "C"
1296#endif
1297
1298#endif // AOM_AV1_ENCODER_BLOCK_H_
#define MAX_COMP_RD_STATS
Number of compound rd stats.
Definition: block.h:269
#define MAX_TPL_BLK_IN_SB
Maximum number of tpl block in a super block.
Definition: block.h:38
#define RD_RECORD_BUFFER_LEN
Number of txfm hash records kept for the partition block.
Definition: block.h:44
struct macroblock_plane MACROBLOCK_PLANE
Each source plane of the current macroblock.
struct macroblock MACROBLOCK
Encoder's parameters related to the current coding block.
@ RESTORE_SWITCHABLE_TYPES
Definition: enums.h:602
Stores the transforms coefficients for the whole superblock.
Definition: block.h:180
Rdcost stats in compound mode.
Definition: block.h:272
int_interpfilters filter
Current interpolation filter.
Definition: block.h:290
INTERINTER_COMPOUND_DATA interinter_comp
Current parameters for interinter mode.
Definition: block.h:296
PREDICTION_MODE mode
Current prediction mode.
Definition: block.h:288
int ref_mv_idx
Refmv index in the drl.
Definition: block.h:292
Holds the costs needed to encode the coefficients.
Definition: block.h:724
Contains buffers used by av1_compound_type_rd()
Definition: block.h:340
int16_t * diff10
Second prediction - first prediction.
Definition: block.h:348
uint8_t * pred1
Second prediction.
Definition: block.h:344
int16_t * residual1
Source - first prediction.
Definition: block.h:346
uint8_t * pred0
First prediction.
Definition: block.h:342
uint8_t * tmp_best_mask_buf
Backup of the best segmentation mask.
Definition: block.h:350
Holds mv costs for intrabc.
Definition: block.h:707
Costs for encoding the coefficients within a level.
Definition: block.h:147
Costs for encoding the eob.
Definition: block.h:173
Stores best extended mode information at frame level.
Definition: block.h:216
uint8_t ref_mv_count
Number of ref mvs in the drl.
Definition: block.h:222
int16_t mode_context
Context used to encode the current mode.
Definition: block.h:227
Extended mode info derived from mbmi.
Definition: block.h:196
Stores the prediction/txfm mode of the current coding block.
Definition: blockd.h:222
uint8_t segment_id
The segment id.
Definition: blockd.h:310
BLOCK_SIZE bsize
The block size of the current coding block.
Definition: blockd.h:228
Inter-mode txfm results for a partition block.
Definition: block.h:234
TX_SIZE tx_size
Txfm size used if the current mode is intra mode.
Definition: block.h:236
uint32_t hash_value
Hash value of the current record.
Definition: block.h:246
RD_STATS rd_stats
Rd_stats for the whole partition block.
Definition: block.h:244
Hash records of the inter-mode transform results.
Definition: block.h:255
int index_start
Index to insert the newest rd record.
Definition: block.h:261
int num
Number of info stored in this record.
Definition: block.h:263
CRC32C crc_calculator
Hash function.
Definition: block.h:265
Holds the entropy costs for various modes sent to the bitstream.
Definition: block.h:507
Holds mv costs for encoding and motion search.
Definition: block.h:676
int ** mv_cost_stack
Points to the nmv_cost_hp in use.
Definition: block.h:701
Contains buffers used to speed up rdopt for obmc.
Definition: block.h:303
uint8_t * left_pred
Prediction from the up predictor.
Definition: block.h:323
int32_t * wsrc
A new source weighted with the above and left predictors.
Definition: block.h:308
int32_t * mask
A new mask constructed from the original horz/vert mask.
Definition: block.h:313
uint8_t * above_pred
Prediction from the up predictor.
Definition: block.h:318
Contains color maps used in palette mode.
Definition: block.h:328
Holds some parameters related to partitioning schemes in AV1.
Definition: block.h:356
int cnn_output_valid
Whether the CNN buffer contains valid output.
Definition: block.h:366
float log_q
log of the quantization parameter of the ancestor BLOCK_64X64.
Definition: block.h:370
int quad_tree_idx
Current index on the partition block quad tree.
Definition: block.h:364
Superblock level encoder info.
Definition: block.h:54
BLOCK_SIZE min_partition_size
Maximum partition size for the sb.
Definition: block.h:56
BLOCK_SIZE max_partition_size
Minimum partition size for the sb.
Definition: block.h:58
int tpl_stride
TPL's stride for the arrays in this struct.
Definition: block.h:76
int tpl_data_count
Number of TPL blocks in this superblock.
Definition: block.h:68
Stores various encoding/search decisions related to txfm search.
Definition: block.h:454
int skip_txfm
Whether to skip transform and quantization on a partition block level.
Definition: block.h:456
unsigned int txb_split_count
Number of txb splits.
Definition: block.h:491
MB_RD_RECORD * mb_rd_record
Txfm hash records of inter-modes.
Definition: block.h:479
Defines the parameters used to perform txfm search.
Definition: block.h:393
int use_default_intra_tx_type
Whether to limit the intra txfm search type to the default txfm.
Definition: block.h:399
int prune_2d_txfm_mode
Whether to prune 2d transforms based on 1d transform results.
Definition: block.h:405
TX_MODE tx_mode_search_type
How to search for the optimal tx_size.
Definition: block.h:434
TX_SIZE_SEARCH_METHOD tx_size_search_method
Variable from WinnerModeParams based on current eval mode.
Definition: block.h:415
int default_inter_tx_type_prob_thresh
Definition: block.h:402
unsigned int predict_dc_level
Definition: block.h:439
unsigned int tx_domain_dist_threshold
Variable from WinnerModeParams based on current eval mode.
Definition: block.h:413
unsigned int skip_txfm_level
Variable from WinnerModeParams based on current eval mode.
Definition: block.h:419
unsigned int use_transform_domain_distortion
Variable from WinnerModeParams based on current eval mode.
Definition: block.h:417
Holds the motion samples for warp motion model estimation.
Definition: block.h:739
int num
Number of samples.
Definition: block.h:741
Stores the best performing modes.
Definition: block.h:82
int rate_y
Luma rate of the winner mode.
Definition: block.h:90
uint8_t color_index_map[MAX_SB_SQUARE]
The color map needed to reconstruct palette mode.
Definition: block.h:94
RD_STATS rd_cost
Rdstats of the winner mode.
Definition: block.h:86
MB_MODE_INFO mbmi
The mbmi used to reconstruct the winner mode.
Definition: block.h:84
THR_MODES mode_index
The current winner mode.
Definition: block.h:96
int rate_uv
Chroma rate of the winner mode.
Definition: block.h:92
int64_t rd
Rdcost of the winner mode.
Definition: block.h:88
Each source plane of the current macroblock.
Definition: block.h:103
tran_low_t * qcoeff
Quantized coefficients.
Definition: block.h:109
const int16_t * quant_shift_QTX
Scale factor to shift coefficients toward zero. Only used by QUANT_B.
Definition: block.h:135
const int16_t * quant_fp_QTX
Quantization step size used by AV1_XFORM_QUANT_FP.
Definition: block.h:127
const int16_t * dequant_QTX
Dequantizer.
Definition: block.h:139
tran_low_t * dqcoeff
Dequantized coefficients.
Definition: block.h:107
const int16_t * zbin_QTX
Size of the quantization bin around 0. Only Used by QUANT_B.
Definition: block.h:137
const int16_t * quant_QTX
Quantization step size used by AV1_XFORM_QUANT_B.
Definition: block.h:131
struct buf_2d src
A buffer containing the source frame.
Definition: block.h:117
uint16_t * eobs
Location of the end of qcoeff (end of block).
Definition: block.h:113
tran_low_t * coeff
Transformed coefficients.
Definition: block.h:111
int16_t * src_diff
Stores source - pred so the txfm can be computed later.
Definition: block.h:105
uint8_t * txb_entropy_ctx
Contexts used to code the transform coefficients.
Definition: block.h:115
const int16_t * round_fp_QTX
Offset used for rounding in the quantizer process by AV1_XFORM_QUANT_FP.
Definition: block.h:129
const int16_t * round_QTX
Offset used for rounding in the quantizer process by AV1_XFORM_QUANT_B.
Definition: block.h:133
Encoder's parameters related to the current coding block.
Definition: block.h:778
int delta_qindex
Difference between frame-level qindex and current qindex.
Definition: block.h:873
WARP_SAMPLE_INFO warp_sample_info[REF_FRAMES]
Warp motion samples buffer.
Definition: block.h:988
MB_MODE_INFO_EXT_FRAME * mbmi_ext_frame
Finalized mbmi_ext for the whole frame.
Definition: block.h:810
int sb_energy_level
Energy in the current source superblock. Used to calculate rdmult.
Definition: block.h:888
uint8_t * tmp_pred_bufs[2]
Temporary buffer to hold prediction.
Definition: block.h:854
int mb_energy
Energy in the current source coding block. Used to calculate rdmult.
Definition: block.h:886
int skip_mode
Inter skip mode.
Definition: block.h:1035
FullMvLimits mv_limits
Limit for the range of motion vectors.
Definition: block.h:1139
CoeffCosts coeff_costs
The rate needed to signal the txfm coefficients to the bitstream.
Definition: block.h:903
PartitionSearchInfo part_search_info
Stores some partition-search related buffers.
Definition: block.h:1013
int rdmult
Rate-distortion multiplier.
Definition: block.h:883
MACROBLOCKD e_mbd
Decoder's view of current coding block.
Definition: block.h:796
int best_pred_mv_sad
The minimum of pred_mv_sad.
Definition: block.h:970
int actual_num_seg1_blocks
Number of segment 1 blocks Actual number of (4x4) blocks that were applied delta-q,...
Definition: block.h:931
unsigned int source_variance
Variance of the source frame.
Definition: block.h:1175
int seg_skip_block
Skip mode for the segment.
Definition: block.h:925
int pred_mv1_sad[REF_FRAMES]
The sad of the 2nd mv ref (near).
Definition: block.h:974
FRAME_CONTEXT * row_ctx
Entropy context for the current row.
Definition: block.h:813
uint8_t color_sensitivity_sb[2]
Whether there is a strong color activity.
Definition: block.h:1165
WinnerModeStats * winner_mode_stats
Tracks the winner modes in the current coding block.
Definition: block.h:1053
unsigned int pred_sse[REF_FRAMES]
SSE of the current predictor.
Definition: block.h:1177
CONV_BUF_TYPE * tmp_conv_dst
Buffer to store convolution during averaging process in compound mode.
Definition: block.h:843
ModeCosts mode_costs
The rate needed to signal a mode to the bitstream.
Definition: block.h:891
int pred_mv0_sad[REF_FRAMES]
The sad of the 1st mv ref (nearest).
Definition: block.h:972
int comp_rd_stats_idx
The idx for the latest compound mode in the cache comp_rd_stats.
Definition: block.h:1090
int nonrd_prune_ref_frame_search
Prune ref frames in real-time mode.
Definition: block.h:1005
int try_merge_partition
Prediction for ML based partition.
Definition: block.h:1190
PixelLevelGradientInfo * pixel_gradient_info
Pointer to the buffer which caches gradient information.
Definition: block.h:1118
unsigned int max_mv_context[REF_FRAMES]
Context used to determine the initial step size in motion search.
Definition: block.h:1132
int sadperbit
A multiplier that converts mv cost to l1 error.
Definition: block.h:913
uint8_t compound_idx
How to blend the compound predictions.
Definition: block.h:1085
CompoundTypeRdBuffers comp_rd_buffer
Buffer used for compound_type_rd().
Definition: block.h:841
int thresh_freq_fact[BLOCK_SIZES_ALL][MAX_MODES]
Factors used for rd-thresholding.
Definition: block.h:1043
IntraBCMVCosts * dv_costs
Definition: block.h:900
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:1111
PALETTE_BUFFER * palette_buffer
Buffer to store the best palette map.
Definition: block.h:839
CONTENT_STATE_SB content_state_sb
Characteristics of the current superblock.
Definition: block.h:957
struct macroblock_plane plane[3]
Each of the encoding plane.
Definition: block.h:788
int recalc_luma_mc_data
Whether to recompute the luma prediction.
Definition: block.h:1099
bool is_sb_gradient_cached[PLANE_TYPES]
Flags indicating the availability of cached gradient info.
Definition: block.h:1120
OBMCBuffer obmc_buffer
Modified source and masks used for fast OBMC search.
Definition: block.h:837
SuperBlockEnc sb_enc
Information on a whole superblock level.
Definition: block.h:950
COMP_RD_STATS comp_rd_stats[64]
A caches of results of compound type search so they can be reused later.
Definition: block.h:1088
int use_mb_mode_cache
Whether to reuse the mode stored in mb_mode_cache.
Definition: block.h:1108
CB_COEFF_BUFFER * cb_coef_buff
Buffer of transformed coefficients.
Definition: block.h:832
uint8_t color_sensitivity[2]
Color sensitivity flag for the coding block.
Definition: block.h:1167
int qindex
Quantization index for the current partition block.
Definition: block.h:866
int must_find_valid_partition
Whether to disable some features to force a mode in current block.
Definition: block.h:1022
int actual_num_seg2_blocks
Number of segment 2 blocks Actual number of (4x4) blocks that were applied delta-q,...
Definition: block.h:937
int picked_ref_frames_mask[MAX_MIB_SIZE *MAX_MIB_SIZE]
Reference frames picked by the square subblocks in a superblock.
Definition: block.h:996
MvCosts * mv_costs
Definition: block.h:895
TxfmSearchInfo txfm_search_info
Results of the txfm searches that have been done.
Definition: block.h:1158
int pred_mv_sad[REF_FRAMES]
Sum absolute distortion of the predicted mv for each ref frame.
Definition: block.h:968
IntraBCHashInfo intrabc_hash_info
Data structure to speed up intrabc search.
Definition: block.h:1105
int errorperbit
A multiplier that converts mv cost to l2 error.
Definition: block.h:911
FRAME_CONTEXT * tile_pb_ctx
Entropy context for the current tile.
Definition: block.h:822
struct inter_modes_info * inter_modes_info
Stores the inter mode information needed to build an rd model.
Definition: block.h:1082
uint16_t cb_offset[PLANE_TYPES]
Offset of current coding block's coeff buffer relative to the sb.
Definition: block.h:834
int winner_mode_count
Tracks how many winner modes there are.
Definition: block.h:1055
int cnt_zeromv
Number of zero motion vectors.
Definition: block.h:941
TXFM_RD_MODEL rd_model
The model used for rd-estimation to avoid txfm.
Definition: block.h:1069
TxfmSearchParams txfm_search_params
Parameters that control how motion search is done.
Definition: block.h:1151
uint8_t tpl_keep_ref_frame[REF_FRAMES]
Disables certain ref frame pruning based on tpl.
Definition: block.h:982
MB_MODE_INFO_EXT mbmi_ext
Derived coding information.
Definition: block.h:803
Variables related to current coding block.
Definition: blockd.h:577
int lossless[8]
Definition: blockd.h:824