/src/aom/av1/encoder/block.h
Line | Count | Source (jump to first uncovered line) |
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 | | |
12 | | /*! \file |
13 | | * Declares various structs used to encode the current partition block. |
14 | | */ |
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 |
32 | | extern "C" { |
33 | | #endif |
34 | | |
35 | | //! Minimum linear dimension of a tpl block |
36 | | #define MIN_TPL_BSIZE_1D 16 |
37 | | //! Maximum number of tpl block in a super block |
38 | | #define MAX_TPL_BLK_IN_SB (MAX_SB_SIZE / MIN_TPL_BSIZE_1D) |
39 | | //! Number of intra winner modes kept |
40 | 0 | #define MAX_WINNER_MODE_COUNT_INTRA 3 |
41 | | //! Number of inter winner modes kept |
42 | 0 | #define MAX_WINNER_MODE_COUNT_INTER 1 |
43 | | //! Number of txfm hash records kept for the partition block. |
44 | 0 | #define RD_RECORD_BUFFER_LEN 8 |
45 | | |
46 | | /*! Maximum value taken by transform type probabilities */ |
47 | 0 | #define MAX_TX_TYPE_PROB 1024 |
48 | | /*! \brief Superblock level encoder info |
49 | | * |
50 | | * SuperblockEnc stores superblock level information used by the encoder for |
51 | | * more efficient encoding. Currently this is mostly used to store TPL data |
52 | | * for the current superblock. |
53 | | */ |
54 | | typedef struct { |
55 | | //! Maximum partition size for the sb. |
56 | | BLOCK_SIZE min_partition_size; |
57 | | //! Minimum partition size for the sb. |
58 | | BLOCK_SIZE max_partition_size; |
59 | | |
60 | | /***************************************************************************** |
61 | | * \name TPL Info |
62 | | * |
63 | | * Information gathered from tpl_model at tpl block precision for the |
64 | | * superblock to speed up the encoding process.. |
65 | | ****************************************************************************/ |
66 | | /**@{*/ |
67 | | //! Number of TPL blocks in this superblock. |
68 | | int tpl_data_count; |
69 | | //! TPL's estimate of inter cost for each tpl block. |
70 | | int64_t tpl_inter_cost[MAX_TPL_BLK_IN_SB * MAX_TPL_BLK_IN_SB]; |
71 | | //! TPL's estimate of tpl cost for each tpl block. |
72 | | int64_t tpl_intra_cost[MAX_TPL_BLK_IN_SB * MAX_TPL_BLK_IN_SB]; |
73 | | //! Motion vectors found by TPL model for each tpl block. |
74 | | int_mv tpl_mv[MAX_TPL_BLK_IN_SB * MAX_TPL_BLK_IN_SB][INTER_REFS_PER_FRAME]; |
75 | | //! TPL's stride for the arrays in this struct. |
76 | | int tpl_stride; |
77 | | /**@}*/ |
78 | | } SuperBlockEnc; |
79 | | |
80 | | /*! \brief Stores the best performing modes. |
81 | | */ |
82 | | typedef struct { |
83 | | //! The mbmi used to reconstruct the winner mode. |
84 | | MB_MODE_INFO mbmi; |
85 | | //! Rdstats of the winner mode. |
86 | | RD_STATS rd_cost; |
87 | | //! Rdcost of the winner mode |
88 | | int64_t rd; |
89 | | //! Luma rate of the winner mode. |
90 | | int rate_y; |
91 | | //! Chroma rate of the winner mode. |
92 | | int rate_uv; |
93 | | //! The color map needed to reconstruct palette mode. |
94 | | uint8_t color_index_map[MAX_SB_SQUARE]; |
95 | | //! The current winner mode. |
96 | | THR_MODES mode_index; |
97 | | } WinnerModeStats; |
98 | | |
99 | | /*! \brief Each source plane of the current macroblock |
100 | | * |
101 | | * This struct also stores the txfm buffers and quantizer settings. |
102 | | */ |
103 | | typedef struct macroblock_plane { |
104 | | //! Stores source - pred so the txfm can be computed later |
105 | | int16_t *src_diff; |
106 | | //! Dequantized coefficients |
107 | | tran_low_t *dqcoeff; |
108 | | //! Quantized coefficients |
109 | | tran_low_t *qcoeff; |
110 | | //! Transformed coefficients |
111 | | tran_low_t *coeff; |
112 | | //! Location of the end of qcoeff (end of block). |
113 | | uint16_t *eobs; |
114 | | //! Contexts used to code the transform coefficients. |
115 | | uint8_t *txb_entropy_ctx; |
116 | | //! A buffer containing the source frame. |
117 | | struct buf_2d src; |
118 | | |
119 | | /*! \name Quantizer Settings |
120 | | * |
121 | | * \attention These are used/accessed only in the quantization process. |
122 | | * RDO does not and *must not* depend on any of these values. |
123 | | * All values below share the coefficient scale/shift used in TX. |
124 | | */ |
125 | | /**@{*/ |
126 | | //! Quantization step size used by AV1_XFORM_QUANT_FP. |
127 | | const int16_t *quant_fp_QTX; |
128 | | //! Offset used for rounding in the quantizer process by AV1_XFORM_QUANT_FP. |
129 | | const int16_t *round_fp_QTX; |
130 | | //! Quantization step size used by AV1_XFORM_QUANT_B. |
131 | | const int16_t *quant_QTX; |
132 | | //! Offset used for rounding in the quantizer process by AV1_XFORM_QUANT_B. |
133 | | const int16_t *round_QTX; |
134 | | //! Scale factor to shift coefficients toward zero. Only used by QUANT_B. |
135 | | const int16_t *quant_shift_QTX; |
136 | | //! Size of the quantization bin around 0. Only Used by QUANT_B |
137 | | const int16_t *zbin_QTX; |
138 | | //! Dequantizer |
139 | | const int16_t *dequant_QTX; |
140 | | /**@}*/ |
141 | | } MACROBLOCK_PLANE; |
142 | | |
143 | | /*! \brief Costs for encoding the coefficients within a level. |
144 | | * |
145 | | * Covers everything including txb_skip, eob, dc_sign, |
146 | | */ |
147 | | typedef struct { |
148 | | //! Cost to skip txfm for the current txfm block. |
149 | | int txb_skip_cost[TXB_SKIP_CONTEXTS][2]; |
150 | | /*! \brief Cost for encoding the base_eob of a level. |
151 | | * |
152 | | * Decoder uses base_eob to derive the base_level as base_eob := base_eob+1. |
153 | | */ |
154 | | int base_eob_cost[SIG_COEF_CONTEXTS_EOB][3]; |
155 | | /*! \brief Cost for encoding the base level of a coefficient. |
156 | | * |
157 | | * Decoder derives coeff_base as coeff_base := base_eob + 1. |
158 | | */ |
159 | | int base_cost[SIG_COEF_CONTEXTS][8]; |
160 | | /*! \brief Cost for encoding the last non-zero coefficient. |
161 | | * |
162 | | * Eob is derived from eob_extra at the decoder as eob := eob_extra + 1 |
163 | | */ |
164 | | int eob_extra_cost[EOB_COEF_CONTEXTS][2]; |
165 | | //! Cost for encoding the dc_sign |
166 | | int dc_sign_cost[DC_SIGN_CONTEXTS][2]; |
167 | | //! Cost for encoding an increment to the coefficient |
168 | | int lps_cost[LEVEL_CONTEXTS][COEFF_BASE_RANGE + 1 + COEFF_BASE_RANGE + 1]; |
169 | | } LV_MAP_COEFF_COST; |
170 | | |
171 | | /*! \brief Costs for encoding the eob. |
172 | | */ |
173 | | typedef struct { |
174 | | //! eob_cost. |
175 | | int eob_cost[2][11]; |
176 | | } LV_MAP_EOB_COST; |
177 | | |
178 | | /*! \brief Stores the transforms coefficients for the whole superblock. |
179 | | */ |
180 | | typedef struct { |
181 | | //! The transformed coefficients. |
182 | | tran_low_t *tcoeff[MAX_MB_PLANE]; |
183 | | //! Where the transformed coefficients end. |
184 | | uint16_t *eobs[MAX_MB_PLANE]; |
185 | | /*! \brief Transform block entropy contexts. |
186 | | * |
187 | | * Each element is used as a bit field. |
188 | | * - Bits 0~3: txb_skip_ctx |
189 | | * - Bits 4~5: dc_sign_ctx. |
190 | | */ |
191 | | uint8_t *entropy_ctx[MAX_MB_PLANE]; |
192 | | } CB_COEFF_BUFFER; |
193 | | |
194 | | /*! \brief Extended mode info derived from mbmi. |
195 | | */ |
196 | | typedef struct { |
197 | | // TODO(angiebird): Reduce the buffer size according to sb_type |
198 | | //! The reference mv list for the current block. |
199 | | CANDIDATE_MV ref_mv_stack[MODE_CTX_REF_FRAMES][USABLE_REF_MV_STACK_SIZE]; |
200 | | //! The weights used to compute the ref mvs. |
201 | | uint16_t weight[MODE_CTX_REF_FRAMES][USABLE_REF_MV_STACK_SIZE]; |
202 | | //! Number of ref mvs in the drl. |
203 | | uint8_t ref_mv_count[MODE_CTX_REF_FRAMES]; |
204 | | //! Global mvs |
205 | | int_mv global_mvs[REF_FRAMES]; |
206 | | //! Context used to encode the current mode. |
207 | | int16_t mode_context[MODE_CTX_REF_FRAMES]; |
208 | | } MB_MODE_INFO_EXT; |
209 | | |
210 | | /*! \brief Stores best extended mode information at frame level. |
211 | | * |
212 | | * The frame level in here is used in bitstream preparation stage. The |
213 | | * information in \ref MB_MODE_INFO_EXT are copied to this struct to save |
214 | | * memory. |
215 | | */ |
216 | | typedef struct { |
217 | | //! \copydoc MB_MODE_INFO_EXT::ref_mv_stack |
218 | | CANDIDATE_MV ref_mv_stack[USABLE_REF_MV_STACK_SIZE]; |
219 | | //! \copydoc MB_MODE_INFO_EXT::weight |
220 | | uint16_t weight[USABLE_REF_MV_STACK_SIZE]; |
221 | | //! \copydoc MB_MODE_INFO_EXT::ref_mv_count |
222 | | uint8_t ref_mv_count; |
223 | | // TODO(Ravi/Remya): Reduce the buffer size of global_mvs |
224 | | //! \copydoc MB_MODE_INFO_EXT::global_mvs |
225 | | int_mv global_mvs[REF_FRAMES]; |
226 | | //! \copydoc MB_MODE_INFO_EXT::mode_context |
227 | | int16_t mode_context; |
228 | | //! Offset of current coding block's coeff buffer relative to the sb. |
229 | | uint16_t cb_offset[PLANE_TYPES]; |
230 | | } MB_MODE_INFO_EXT_FRAME; |
231 | | |
232 | | /*! \brief Inter-mode txfm results for a partition block. |
233 | | */ |
234 | | typedef struct { |
235 | | //! Txfm size used if the current mode is intra mode. |
236 | | TX_SIZE tx_size; |
237 | | //! Txfm sizes used if the current mode is inter mode. |
238 | | TX_SIZE inter_tx_size[INTER_TX_SIZE_BUF_LEN]; |
239 | | //! Map showing which txfm block skips the txfm process. |
240 | | uint8_t blk_skip[MAX_MIB_SIZE * MAX_MIB_SIZE]; |
241 | | //! Map showing the txfm types for each block. |
242 | | uint8_t tx_type_map[MAX_MIB_SIZE * MAX_MIB_SIZE]; |
243 | | //! Rd_stats for the whole partition block. |
244 | | RD_STATS rd_stats; |
245 | | //! Hash value of the current record. |
246 | | uint32_t hash_value; |
247 | | } MB_RD_INFO; |
248 | | |
249 | | /*! \brief Hash records of the inter-mode transform results |
250 | | * |
251 | | * Hash records of the inter-mode transform results for a whole partition block |
252 | | * based on the residue. Since this operates on the partition block level, this |
253 | | * can give us a whole txfm partition tree. |
254 | | */ |
255 | | typedef struct { |
256 | | /*! Circular buffer that stores the inter-mode txfm results of a partition |
257 | | * block. |
258 | | */ |
259 | | MB_RD_INFO mb_rd_info[RD_RECORD_BUFFER_LEN]; |
260 | | //! Index to insert the newest rd record. |
261 | | int index_start; |
262 | | //! Number of info stored in this record. |
263 | | int num; |
264 | | //! Hash function |
265 | | CRC32C crc_calculator; |
266 | | } MB_RD_RECORD; |
267 | | |
268 | | //! Number of compound rd stats |
269 | 0 | #define MAX_COMP_RD_STATS 64 |
270 | | /*! \brief Rdcost stats in compound mode. |
271 | | */ |
272 | | typedef struct { |
273 | | //! Rate of the compound modes. |
274 | | int32_t rate[COMPOUND_TYPES]; |
275 | | //! Distortion of the compound modes. |
276 | | int64_t dist[COMPOUND_TYPES]; |
277 | | //! Estimated rate of the compound modes. |
278 | | int32_t model_rate[COMPOUND_TYPES]; |
279 | | //! Estimated distortion of the compound modes. |
280 | | int64_t model_dist[COMPOUND_TYPES]; |
281 | | //! Rate need to send the mask type. |
282 | | int comp_rs2[COMPOUND_TYPES]; |
283 | | //! Motion vector for each predictor. |
284 | | int_mv mv[2]; |
285 | | //! Ref frame for each predictor. |
286 | | MV_REFERENCE_FRAME ref_frames[2]; |
287 | | //! Current prediction mode. |
288 | | PREDICTION_MODE mode; |
289 | | //! Current interpolation filter. |
290 | | int_interpfilters filter; |
291 | | //! Refmv index in the drl. |
292 | | int ref_mv_idx; |
293 | | //! Whether the predictors are GLOBALMV. |
294 | | int is_global[2]; |
295 | | //! Current parameters for interinter mode. |
296 | | INTERINTER_COMPOUND_DATA interinter_comp; |
297 | | } COMP_RD_STATS; |
298 | | |
299 | | /*! \brief Contains buffers used to speed up rdopt for obmc. |
300 | | * |
301 | | * See the comments for calc_target_weighted_pred for details. |
302 | | */ |
303 | | typedef struct { |
304 | | /*! \brief A new source weighted with the above and left predictors. |
305 | | * |
306 | | * Used to efficiently construct multiple obmc predictors during rdopt. |
307 | | */ |
308 | | int32_t *wsrc; |
309 | | /*! \brief A new mask constructed from the original horz/vert mask. |
310 | | * |
311 | | * \copydetails wsrc |
312 | | */ |
313 | | int32_t *mask; |
314 | | /*! \brief Prediction from the up predictor. |
315 | | * |
316 | | * Used to build the obmc predictor. |
317 | | */ |
318 | | uint8_t *above_pred; |
319 | | /*! \brief Prediction from the up predictor. |
320 | | * |
321 | | * \copydetails above_pred |
322 | | */ |
323 | | uint8_t *left_pred; |
324 | | } OBMCBuffer; |
325 | | |
326 | | /*! \brief Contains color maps used in palette mode. |
327 | | */ |
328 | | typedef struct { |
329 | | //! The best color map found. |
330 | | uint8_t best_palette_color_map[MAX_PALETTE_SQUARE]; |
331 | | //! A temporary buffer used for k-means clustering. |
332 | | int kmeans_data_buf[2 * MAX_PALETTE_SQUARE]; |
333 | | } PALETTE_BUFFER; |
334 | | |
335 | | /*! \brief Contains buffers used by av1_compound_type_rd() |
336 | | * |
337 | | * For sizes and alignment of these arrays, refer to |
338 | | * alloc_compound_type_rd_buffers() function. |
339 | | */ |
340 | | typedef struct { |
341 | | //! First prediction. |
342 | | uint8_t *pred0; |
343 | | //! Second prediction. |
344 | | uint8_t *pred1; |
345 | | //! Source - first prediction. |
346 | | int16_t *residual1; |
347 | | //! Second prediction - first prediction. |
348 | | int16_t *diff10; |
349 | | //! Backup of the best segmentation mask. |
350 | | uint8_t *tmp_best_mask_buf; |
351 | | } CompoundTypeRdBuffers; |
352 | | |
353 | | /*! \brief Holds some parameters related to partitioning schemes in AV1. |
354 | | */ |
355 | | // TODO(chiyotsai@google.com): Consolidate this with SIMPLE_MOTION_DATA_TREE |
356 | | typedef struct { |
357 | | #if !CONFIG_REALTIME_ONLY |
358 | | // The following 4 parameters are used for cnn-based partitioning on intra |
359 | | // frame. |
360 | | /*! \brief Current index on the partition block quad tree. |
361 | | * |
362 | | * Used to index into the cnn buffer for partition decision. |
363 | | */ |
364 | | int quad_tree_idx; |
365 | | //! Whether the CNN buffer contains valid output. |
366 | | int cnn_output_valid; |
367 | | //! A buffer used by our segmentation CNN for intra-frame partitioning. |
368 | | float cnn_buffer[CNN_OUT_BUF_SIZE]; |
369 | | //! log of the quantization parameter of the ancestor BLOCK_64X64. |
370 | | float log_q; |
371 | | #endif |
372 | | |
373 | | /*! \brief Variance of the subblocks in the superblock. |
374 | | * |
375 | | * This is used by rt mode for variance based partitioning. |
376 | | * The indices corresponds to the following block sizes: |
377 | | * - 0 - 128x128 |
378 | | * - 1-2 - 128x64 |
379 | | * - 3-4 - 64x128 |
380 | | * - 5-8 - 64x64 |
381 | | * - 9-16 - 64x32 |
382 | | * - 17-24 - 32x64 |
383 | | * - 25-40 - 32x32 |
384 | | * - 41-104 - 16x16 |
385 | | */ |
386 | | uint8_t variance_low[105]; |
387 | | } PartitionSearchInfo; |
388 | | |
389 | | /*! \brief Defines the parameters used to perform txfm search. |
390 | | * |
391 | | * For the most part, this determines how various speed features are used. |
392 | | */ |
393 | | typedef struct { |
394 | | /*! \brief Whether to limit the intra txfm search type to the default txfm. |
395 | | * |
396 | | * This could either be a result of either sequence parameter or speed |
397 | | * features. |
398 | | */ |
399 | | int use_default_intra_tx_type; |
400 | | |
401 | | /*! Probability threshold used for conditionally forcing tx type*/ |
402 | | int default_inter_tx_type_prob_thresh; |
403 | | |
404 | | //! Whether to prune 2d transforms based on 1d transform results. |
405 | | int prune_2d_txfm_mode; |
406 | | |
407 | | /*! \brief Variable from \ref WinnerModeParams based on current eval mode. |
408 | | * |
409 | | * See the documentation for \ref WinnerModeParams for more detail. |
410 | | */ |
411 | | unsigned int coeff_opt_thresholds[2]; |
412 | | /*! \copydoc coeff_opt_thresholds */ |
413 | | unsigned int tx_domain_dist_threshold; |
414 | | /*! \copydoc coeff_opt_thresholds */ |
415 | | TX_SIZE_SEARCH_METHOD tx_size_search_method; |
416 | | /*! \copydoc coeff_opt_thresholds */ |
417 | | unsigned int use_transform_domain_distortion; |
418 | | /*! \copydoc coeff_opt_thresholds */ |
419 | | unsigned int skip_txfm_level; |
420 | | |
421 | | /*! \brief How to search for the optimal tx_size |
422 | | * |
423 | | * If ONLY_4X4, use TX_4X4; if TX_MODE_LARGEST, use the largest tx_size for |
424 | | * the current partition block; if TX_MODE_SELECT, search through the whole |
425 | | * tree. |
426 | | * |
427 | | * \attention |
428 | | * Although this looks suspicious similar to a bitstream element, this |
429 | | * tx_mode_search_type is only used internally by the encoder, and is *not* |
430 | | * written to the bitstream. It determines what kind of tx_mode would be |
431 | | * searched. For example, we might set it to TX_MODE_LARGEST to find a good |
432 | | * candidate, then code it as TX_MODE_SELECT. |
433 | | */ |
434 | | TX_MODE tx_mode_search_type; |
435 | | |
436 | | /*! |
437 | | * Flag to enable/disable DC block prediction. |
438 | | */ |
439 | | unsigned int predict_dc_level; |
440 | | } TxfmSearchParams; |
441 | | |
442 | | /*!\cond */ |
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)) |
447 | | /*!\endcond */ |
448 | | |
449 | | /*! \brief Stores various encoding/search decisions related to txfm search. |
450 | | * |
451 | | * This struct contains a cache of previous txfm results, and some buffers for |
452 | | * the current txfm decision. |
453 | | */ |
454 | | typedef struct { |
455 | | //! Whether to skip transform and quantization on a partition block level. |
456 | | int skip_txfm; |
457 | | |
458 | | /*! \brief Whether to skip transform and quantization on a txfm block level. |
459 | | * |
460 | | * Skips transform and quantization on a transform block level inside the |
461 | | * current partition block. Each element of this array is used as a bit-field. |
462 | | * So for example, the we are skipping on the luma plane, then the last bit |
463 | | * would be set to 1. |
464 | | */ |
465 | | uint8_t blk_skip[MAX_MIB_SIZE * MAX_MIB_SIZE]; |
466 | | |
467 | | /*! \brief Transform types inside the partition block |
468 | | * |
469 | | * Keeps a record of what kind of transform to use for each of the transform |
470 | | * block inside the partition block. |
471 | | * \attention The buffer here is *never* directly used. Instead, this just |
472 | | * allocates the memory for MACROBLOCKD::tx_type_map during rdopt on the |
473 | | * partition block. So if we need to save memory, we could move the allocation |
474 | | * to pick_sb_mode instead. |
475 | | */ |
476 | | uint8_t tx_type_map_[MAX_MIB_SIZE * MAX_MIB_SIZE]; |
477 | | |
478 | | //! Txfm hash records of inter-modes. |
479 | | MB_RD_RECORD *mb_rd_record; |
480 | | |
481 | | /*! \brief Number of txb splits. |
482 | | * |
483 | | * Keep track of how many times we've used split tx partition for transform |
484 | | * blocks. Somewhat misleadingly, this parameter doesn't actually keep track |
485 | | * of the count of the current block. Instead, it's a cumulative count across |
486 | | * of the whole frame. The main usage is that if txb_split_count is zero, then |
487 | | * we can signal TX_MODE_LARGEST at frame level. |
488 | | */ |
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 |
493 | | //! For debugging. Used to check how many txfm searches we are doing. |
494 | | unsigned int tx_search_count; |
495 | | #endif // CONFIG_SPEED_STATS |
496 | | } TxfmSearchInfo; |
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 | | |
502 | | /*! \brief Holds the entropy costs for various modes sent to the bitstream. |
503 | | * |
504 | | * \attention This does not include the costs for mv and transformed |
505 | | * coefficients. |
506 | | */ |
507 | | typedef struct { |
508 | | /***************************************************************************** |
509 | | * \name Partition Costs |
510 | | ****************************************************************************/ |
511 | | /**@{*/ |
512 | | //! Cost for coding the partition. |
513 | | int partition_cost[PARTITION_CONTEXTS][EXT_PARTITION_TYPES]; |
514 | | /**@}*/ |
515 | | |
516 | | /***************************************************************************** |
517 | | * \name Intra Costs: General |
518 | | ****************************************************************************/ |
519 | | /**@{*/ |
520 | | //! Luma mode cost for inter frame. |
521 | | int mbmode_cost[BLOCK_SIZE_GROUPS][INTRA_MODES]; |
522 | | //! Luma mode cost for intra frame. |
523 | | int y_mode_costs[INTRA_MODES][INTRA_MODES][INTRA_MODES]; |
524 | | //! Chroma mode cost |
525 | | int intra_uv_mode_cost[CFL_ALLOWED_TYPES][INTRA_MODES][UV_INTRA_MODES]; |
526 | | //! filter_intra_cost |
527 | | int filter_intra_cost[BLOCK_SIZES_ALL][2]; |
528 | | //! filter_intra_mode_cost |
529 | | int filter_intra_mode_cost[FILTER_INTRA_MODES]; |
530 | | //! angle_delta_cost |
531 | | int angle_delta_cost[DIRECTIONAL_MODES][2 * MAX_ANGLE_DELTA + 1]; |
532 | | |
533 | | //! Rate rate associated with each alpha codeword |
534 | | int cfl_cost[CFL_JOINT_SIGNS][CFL_PRED_PLANES][CFL_ALPHABET_SIZE]; |
535 | | /**@}*/ |
536 | | |
537 | | /***************************************************************************** |
538 | | * \name Intra Costs: Screen Contents |
539 | | ****************************************************************************/ |
540 | | /**@{*/ |
541 | | //! intrabc_cost |
542 | | int intrabc_cost[2]; |
543 | | |
544 | | //! palette_y_size_cost |
545 | | int palette_y_size_cost[PALATTE_BSIZE_CTXS][PALETTE_SIZES]; |
546 | | //! palette_uv_size_cost |
547 | | int palette_uv_size_cost[PALATTE_BSIZE_CTXS][PALETTE_SIZES]; |
548 | | //! palette_y_color_cost |
549 | | int palette_y_color_cost[PALETTE_SIZES][PALETTE_COLOR_INDEX_CONTEXTS] |
550 | | [PALETTE_COLORS]; |
551 | | //! palette_uv_color_cost |
552 | | int palette_uv_color_cost[PALETTE_SIZES][PALETTE_COLOR_INDEX_CONTEXTS] |
553 | | [PALETTE_COLORS]; |
554 | | //! palette_y_mode_cost |
555 | | int palette_y_mode_cost[PALATTE_BSIZE_CTXS][PALETTE_Y_MODE_CONTEXTS][2]; |
556 | | //! palette_uv_mode_cost |
557 | | int palette_uv_mode_cost[PALETTE_UV_MODE_CONTEXTS][2]; |
558 | | /**@}*/ |
559 | | |
560 | | /***************************************************************************** |
561 | | * \name Inter Costs: MV Modes |
562 | | ****************************************************************************/ |
563 | | /**@{*/ |
564 | | //! skip_mode_cost |
565 | | int skip_mode_cost[SKIP_MODE_CONTEXTS][2]; |
566 | | //! newmv_mode_cost |
567 | | int newmv_mode_cost[NEWMV_MODE_CONTEXTS][2]; |
568 | | //! zeromv_mode_cost |
569 | | int zeromv_mode_cost[GLOBALMV_MODE_CONTEXTS][2]; |
570 | | //! refmv_mode_cost |
571 | | int refmv_mode_cost[REFMV_MODE_CONTEXTS][2]; |
572 | | //! drl_mode_cost0 |
573 | | int drl_mode_cost0[DRL_MODE_CONTEXTS][2]; |
574 | | /**@}*/ |
575 | | |
576 | | /***************************************************************************** |
577 | | * \name Inter Costs: Ref Frame Types |
578 | | ****************************************************************************/ |
579 | | /**@{*/ |
580 | | //! single_ref_cost |
581 | | int single_ref_cost[REF_CONTEXTS][SINGLE_REFS - 1][2]; |
582 | | //! comp_inter_cost |
583 | | int comp_inter_cost[COMP_INTER_CONTEXTS][2]; |
584 | | //! comp_ref_type_cost |
585 | | int comp_ref_type_cost[COMP_REF_TYPE_CONTEXTS] |
586 | | [CDF_SIZE(COMP_REFERENCE_TYPES)]; |
587 | | //! uni_comp_ref_cost |
588 | | int uni_comp_ref_cost[UNI_COMP_REF_CONTEXTS][UNIDIR_COMP_REFS - 1] |
589 | | [CDF_SIZE(2)]; |
590 | | /*! \brief Cost for signaling ref_frame[0] in bidir-comp mode |
591 | | * |
592 | | * Includes LAST_FRAME, LAST2_FRAME, LAST3_FRAME, and GOLDEN_FRAME. |
593 | | */ |
594 | | int comp_ref_cost[REF_CONTEXTS][FWD_REFS - 1][2]; |
595 | | /*! \brief Cost for signaling ref_frame[1] in bidir-comp mode |
596 | | * |
597 | | * Includes ALTREF_FRAME, ALTREF2_FRAME, and BWDREF_FRAME. |
598 | | */ |
599 | | int comp_bwdref_cost[REF_CONTEXTS][BWD_REFS - 1][2]; |
600 | | /**@}*/ |
601 | | |
602 | | /***************************************************************************** |
603 | | * \name Inter Costs: Compound Types |
604 | | ****************************************************************************/ |
605 | | /**@{*/ |
606 | | //! intra_inter_cost |
607 | | int intra_inter_cost[INTRA_INTER_CONTEXTS][2]; |
608 | | //! inter_compound_mode_cost |
609 | | int inter_compound_mode_cost[INTER_MODE_CONTEXTS][INTER_COMPOUND_MODES]; |
610 | | //! compound_type_cost |
611 | | int compound_type_cost[BLOCK_SIZES_ALL][MASKED_COMPOUND_TYPES]; |
612 | | //! wedge_idx_cost |
613 | | int wedge_idx_cost[BLOCK_SIZES_ALL][16]; |
614 | | //! interintra_cost |
615 | | int interintra_cost[BLOCK_SIZE_GROUPS][2]; |
616 | | //! wedge_interintra_cost |
617 | | int wedge_interintra_cost[BLOCK_SIZES_ALL][2]; |
618 | | //! interintra_mode_cost |
619 | | int interintra_mode_cost[BLOCK_SIZE_GROUPS][INTERINTRA_MODES]; |
620 | | /**@}*/ |
621 | | |
622 | | /***************************************************************************** |
623 | | * \name Inter Costs: Compound Masks |
624 | | ****************************************************************************/ |
625 | | /**@{*/ |
626 | | //! comp_idx_cost |
627 | | int comp_idx_cost[COMP_INDEX_CONTEXTS][2]; |
628 | | //! comp_group_idx_cost |
629 | | int comp_group_idx_cost[COMP_GROUP_IDX_CONTEXTS][2]; |
630 | | /**@}*/ |
631 | | |
632 | | /***************************************************************************** |
633 | | * \name Inter Costs: Motion Modes/Filters |
634 | | ****************************************************************************/ |
635 | | /**@{*/ |
636 | | //! motion_mode_cost |
637 | | int motion_mode_cost[BLOCK_SIZES_ALL][MOTION_MODES]; |
638 | | //! motion_mode_cost1 |
639 | | int motion_mode_cost1[BLOCK_SIZES_ALL][2]; |
640 | | //! switchable_interp_costs |
641 | | int switchable_interp_costs[SWITCHABLE_FILTER_CONTEXTS][SWITCHABLE_FILTERS]; |
642 | | /**@}*/ |
643 | | |
644 | | /***************************************************************************** |
645 | | * \name Txfm Mode Costs |
646 | | ****************************************************************************/ |
647 | | /**@{*/ |
648 | | //! skip_txfm_cost |
649 | | int skip_txfm_cost[SKIP_CONTEXTS][2]; |
650 | | //! tx_size_cost |
651 | | int tx_size_cost[TX_SIZES - 1][TX_SIZE_CONTEXTS][TX_SIZES]; |
652 | | //! txfm_partition_cost |
653 | | int txfm_partition_cost[TXFM_PARTITION_CONTEXTS][2]; |
654 | | //! inter_tx_type_costs |
655 | | int inter_tx_type_costs[EXT_TX_SETS_INTER][EXT_TX_SIZES][TX_TYPES]; |
656 | | //! intra_tx_type_costs |
657 | | int intra_tx_type_costs[EXT_TX_SETS_INTRA][EXT_TX_SIZES][INTRA_MODES] |
658 | | [TX_TYPES]; |
659 | | /**@}*/ |
660 | | |
661 | | /***************************************************************************** |
662 | | * \name Restoration Mode Costs |
663 | | ****************************************************************************/ |
664 | | /**@{*/ |
665 | | //! switchable_restore_cost |
666 | | int switchable_restore_cost[RESTORE_SWITCHABLE_TYPES]; |
667 | | //! wiener_restore_cost |
668 | | int wiener_restore_cost[2]; |
669 | | //! sgrproj_restore_cost |
670 | | int sgrproj_restore_cost[2]; |
671 | | /**@}*/ |
672 | | } ModeCosts; |
673 | | |
674 | | /*! \brief Holds mv costs for encoding and motion search. |
675 | | */ |
676 | | typedef struct { |
677 | | /***************************************************************************** |
678 | | * \name Encoding Costs |
679 | | * Here are the entropy costs needed to encode a given mv. |
680 | | * \ref nmv_cost_alloc and \ref nmv_cost_hp_alloc are two arrays that holds |
681 | | * the memory for holding the mv cost. But since the motion vectors can be |
682 | | * negative, we shift them to the middle and store the resulting pointer in |
683 | | * \ref nmv_cost and \ref nmv_cost_hp for easier referencing. Finally, \ref |
684 | | * mv_cost_stack points to the \ref nmv_cost with the mv precision we are |
685 | | * currently working with. In essence, only \ref mv_cost_stack is needed for |
686 | | * motion search, the other can be considered private. |
687 | | ****************************************************************************/ |
688 | | /**@{*/ |
689 | | //! Costs for coding the zero components. |
690 | | int nmv_joint_cost[MV_JOINTS]; |
691 | | |
692 | | //! Allocates memory for 1/4-pel motion vector costs. |
693 | | int nmv_cost_alloc[2][MV_VALS]; |
694 | | //! Allocates memory for 1/8-pel motion vector costs. |
695 | | int nmv_cost_hp_alloc[2][MV_VALS]; |
696 | | //! Points to the middle of \ref nmv_cost_alloc |
697 | | int *nmv_cost[2]; |
698 | | //! Points to the middle of \ref nmv_cost_hp_alloc |
699 | | int *nmv_cost_hp[2]; |
700 | | //! Points to the nmv_cost_hp in use. |
701 | | int **mv_cost_stack; |
702 | | /**@}*/ |
703 | | } MvCosts; |
704 | | |
705 | | /*! \brief Holds mv costs for intrabc. |
706 | | */ |
707 | | typedef struct { |
708 | | /*! Costs for coding the joint mv. */ |
709 | | int joint_mv[MV_JOINTS]; |
710 | | |
711 | | /*! \brief Cost of transmitting the actual motion vector. |
712 | | * dv_costs_alloc[0][i] is the cost of motion vector with horizontal |
713 | | * component (mv_row) equal to i - MV_MAX. dv_costs_alloc[1][i] is the cost of |
714 | | * motion vector with vertical component (mv_col) equal to i - MV_MAX. |
715 | | */ |
716 | | int dv_costs_alloc[2][MV_VALS]; |
717 | | |
718 | | /*! Points to the middle of \ref dv_costs_alloc. */ |
719 | | int *dv_costs[2]; |
720 | | } IntraBCMVCosts; |
721 | | |
722 | | /*! \brief Holds the costs needed to encode the coefficients |
723 | | */ |
724 | | typedef struct { |
725 | | //! Costs for coding the coefficients. |
726 | | LV_MAP_COEFF_COST coeff_costs[TX_SIZES][PLANE_TYPES]; |
727 | | //! Costs for coding the eobs. |
728 | | LV_MAP_EOB_COST eob_costs[7][2]; |
729 | | } CoeffCosts; |
730 | | |
731 | | /*!\cond */ |
732 | | // 4: NEAREST, NEW, NEAR, GLOBAL |
733 | | #define SINGLE_REF_MODES ((REF_FRAMES - 1) * 4) |
734 | | /*!\endcond */ |
735 | | struct inter_modes_info; |
736 | | |
737 | | /*! \brief Holds the motion samples for warp motion model estimation |
738 | | */ |
739 | | typedef struct { |
740 | | //! Number of samples. |
741 | | int num; |
742 | | //! Sample locations in current frame. |
743 | | int pts[16]; |
744 | | //! Sample location in the reference frame. |
745 | | int pts_inref[16]; |
746 | | } WARP_SAMPLE_INFO; |
747 | | |
748 | | /*!\cond */ |
749 | | typedef enum { |
750 | | kZeroSad = 0, |
751 | | kLowSad = 1, |
752 | | kMedSad = 2, |
753 | | kHighSad = 3 |
754 | | } SOURCE_SAD; |
755 | | |
756 | | typedef 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. |
763 | | typedef struct { |
764 | | uint16_t abs_dx_abs_dy_sum; |
765 | | int8_t hist_bin_idx; |
766 | | bool is_dx_zero; |
767 | | } PixelLevelGradientInfo; |
768 | | |
769 | | /*!\endcond */ |
770 | | |
771 | | /*! \brief Encoder's parameters related to the current coding block. |
772 | | * |
773 | | * This struct contains most of the information the encoder needs to encode the |
774 | | * current coding block. This includes the src and pred buffer, a copy of the |
775 | | * decoder's view of the current block, the txfm coefficients. This struct also |
776 | | * contains various buffers and data used to speed up the encoding process. |
777 | | */ |
778 | | typedef struct macroblock { |
779 | | /***************************************************************************** |
780 | | * \name Source, Buffers and Decoder |
781 | | ****************************************************************************/ |
782 | | /**@{*/ |
783 | | /*! \brief Each of the encoding plane. |
784 | | * |
785 | | * An array holding the src buffer for each of plane of the current block. It |
786 | | * also contains the txfm and quantized txfm coefficients. |
787 | | */ |
788 | | struct macroblock_plane plane[MAX_MB_PLANE]; |
789 | | |
790 | | /*! \brief Decoder's view of current coding block. |
791 | | * |
792 | | * Contains the encoder's copy of what the decoder sees in the current block. |
793 | | * Most importantly, this struct contains pointers to mbmi that is used in |
794 | | * final bitstream packing. |
795 | | */ |
796 | | MACROBLOCKD e_mbd; |
797 | | |
798 | | /*! \brief Derived coding information. |
799 | | * |
800 | | * Contains extra information not transmitted in the bitstream but are |
801 | | * derived. For example, this contains the stack of ref_mvs. |
802 | | */ |
803 | | MB_MODE_INFO_EXT mbmi_ext; |
804 | | |
805 | | /*! \brief Finalized mbmi_ext for the whole frame. |
806 | | * |
807 | | * Contains the finalized info in mbmi_ext that gets used at the frame level |
808 | | * for bitstream packing. |
809 | | */ |
810 | | MB_MODE_INFO_EXT_FRAME *mbmi_ext_frame; |
811 | | |
812 | | //! Entropy context for the current row. |
813 | | FRAME_CONTEXT *row_ctx; |
814 | | /*! \brief Entropy context for the current tile. |
815 | | * |
816 | | * This context will be used to update color_map_cdf pointer which would be |
817 | | * used during pack bitstream. For single thread and tile-multithreading case |
818 | | * this pointer will be same as xd->tile_ctx, but for the case of row-mt: |
819 | | * xd->tile_ctx will point to a temporary context while tile_pb_ctx will point |
820 | | * to the accurate tile context. |
821 | | */ |
822 | | FRAME_CONTEXT *tile_pb_ctx; |
823 | | |
824 | | /*! \brief Buffer of transformed coefficients |
825 | | * |
826 | | * Points to cb_coef_buff in the AV1_COMP struct, which contains the finalized |
827 | | * coefficients. This is here to conveniently copy the best coefficients to |
828 | | * frame level for bitstream packing. Since CB_COEFF_BUFFER is allocated on a |
829 | | * superblock level, we need to combine it with cb_offset to get the proper |
830 | | * position for the current coding block. |
831 | | */ |
832 | | CB_COEFF_BUFFER *cb_coef_buff; |
833 | | //! Offset of current coding block's coeff buffer relative to the sb. |
834 | | uint16_t cb_offset[PLANE_TYPES]; |
835 | | |
836 | | //! Modified source and masks used for fast OBMC search. |
837 | | OBMCBuffer obmc_buffer; |
838 | | //! Buffer to store the best palette map. |
839 | | PALETTE_BUFFER *palette_buffer; |
840 | | //! Buffer used for compound_type_rd(). |
841 | | CompoundTypeRdBuffers comp_rd_buffer; |
842 | | //! Buffer to store convolution during averaging process in compound mode. |
843 | | CONV_BUF_TYPE *tmp_conv_dst; |
844 | | |
845 | | /*! \brief Temporary buffer to hold prediction. |
846 | | * |
847 | | * Points to a buffer that is used to hold temporary prediction results. This |
848 | | * is used in two ways: |
849 | | * - This is a temporary buffer used to ping-pong the prediction in |
850 | | * handle_inter_mode. |
851 | | * - xd->tmp_obmc_bufs also points to this buffer, and is used in ombc |
852 | | * prediction. |
853 | | */ |
854 | | uint8_t *tmp_pred_bufs[2]; |
855 | | /**@}*/ |
856 | | |
857 | | /***************************************************************************** |
858 | | * \name Rdopt Costs |
859 | | ****************************************************************************/ |
860 | | /**@{*/ |
861 | | /*! \brief Quantization index for the current partition block. |
862 | | * |
863 | | * This is used to as the index to find quantization parameter for luma and |
864 | | * chroma transformed coefficients. |
865 | | */ |
866 | | int qindex; |
867 | | |
868 | | /*! \brief Difference between frame-level qindex and current qindex. |
869 | | * |
870 | | * This is used to track whether a non-zero delta for qindex is used at least |
871 | | * once in the current frame. |
872 | | */ |
873 | | int delta_qindex; |
874 | | |
875 | | /*! \brief Rate-distortion multiplier. |
876 | | * |
877 | | * The rd multiplier used to determine the rate-distortion trade-off. This is |
878 | | * roughly proportional to the inverse of q-index for a given frame, but this |
879 | | * can be manipulated for better rate-control. For example, in tune_ssim |
880 | | * mode, this is scaled by a factor related to the variance of the current |
881 | | * block. |
882 | | */ |
883 | | int rdmult; |
884 | | |
885 | | //! Superblock level distortion propagation factor. |
886 | | double rb; |
887 | | |
888 | | //! Energy in the current source coding block. Used to calculate \ref rdmult |
889 | | int mb_energy; |
890 | | //! Energy in the current source superblock. Used to calculate \ref rdmult |
891 | | int sb_energy_level; |
892 | | |
893 | | //! The rate needed to signal a mode to the bitstream. |
894 | | ModeCosts mode_costs; |
895 | | |
896 | | //! The rate needed to encode a new motion vector to the bitstream and some |
897 | | //! multipliers for motion search. |
898 | | MvCosts *mv_costs; |
899 | | |
900 | | /*! The rate needed to encode a new motion vector to the bitstream in intrabc |
901 | | * mode. |
902 | | */ |
903 | | IntraBCMVCosts *dv_costs; |
904 | | |
905 | | //! The rate needed to signal the txfm coefficients to the bitstream. |
906 | | CoeffCosts coeff_costs; |
907 | | /**@}*/ |
908 | | |
909 | | /***************************************************************************** |
910 | | * \name Rate to Distortion Multipliers |
911 | | ****************************************************************************/ |
912 | | /**@{*/ |
913 | | //! A multiplier that converts mv cost to l2 error. |
914 | | int errorperbit; |
915 | | //! A multiplier that converts mv cost to l1 error. |
916 | | int sadperbit; |
917 | | /**@}*/ |
918 | | |
919 | | /****************************************************************************** |
920 | | * \name Segmentation |
921 | | *****************************************************************************/ |
922 | | /**@{*/ |
923 | | /*! \brief Skip mode for the segment |
924 | | * |
925 | | * A syntax element of the segmentation mode. In skip_block mode, all mvs are |
926 | | * set 0 and all txfms are skipped. |
927 | | */ |
928 | | int seg_skip_block; |
929 | | |
930 | | /*! \brief Number of segment 1 blocks |
931 | | * Actual number of (4x4) blocks that were applied delta-q, |
932 | | * for segment 1. |
933 | | */ |
934 | | int actual_num_seg1_blocks; |
935 | | |
936 | | /*!\brief Number of segment 2 blocks |
937 | | * Actual number of (4x4) blocks that were applied delta-q, |
938 | | * for segment 2. |
939 | | */ |
940 | | int actual_num_seg2_blocks; |
941 | | |
942 | | /*!\brief Number of zero motion vectors |
943 | | */ |
944 | | int cnt_zeromv; |
945 | | /**@}*/ |
946 | | |
947 | | /***************************************************************************** |
948 | | * \name Superblock |
949 | | ****************************************************************************/ |
950 | | /**@{*/ |
951 | | //! Information on a whole superblock level. |
952 | | // TODO(chiyotsai@google.com): Refactor this out of macroblock |
953 | | SuperBlockEnc sb_enc; |
954 | | |
955 | | /*! \brief Characteristics of the current superblock. |
956 | | * |
957 | | * Characteristics like whether the block has high sad, low sad, etc. This is |
958 | | * only used by av1 realtime mode. |
959 | | */ |
960 | | CONTENT_STATE_SB content_state_sb; |
961 | | /**@}*/ |
962 | | |
963 | | /***************************************************************************** |
964 | | * \name Reference Frame Search |
965 | | ****************************************************************************/ |
966 | | /**@{*/ |
967 | | /*! \brief Sum absolute distortion of the predicted mv for each ref frame. |
968 | | * |
969 | | * This is used to measure how viable a reference frame is. |
970 | | */ |
971 | | int pred_mv_sad[REF_FRAMES]; |
972 | | //! The minimum of \ref pred_mv_sad. |
973 | | int best_pred_mv_sad; |
974 | | //! The sad of the 1st mv ref (nearest). |
975 | | int pred_mv0_sad[REF_FRAMES]; |
976 | | //! The sad of the 2nd mv ref (near). |
977 | | int pred_mv1_sad[REF_FRAMES]; |
978 | | |
979 | | /*! \brief Disables certain ref frame pruning based on tpl. |
980 | | * |
981 | | * Determines whether a given ref frame is "good" based on data from the TPL |
982 | | * model. If so, this stops selective_ref frame from pruning the given ref |
983 | | * frame at block level. |
984 | | */ |
985 | | uint8_t tpl_keep_ref_frame[REF_FRAMES]; |
986 | | |
987 | | /*! \brief Warp motion samples buffer. |
988 | | * |
989 | | * Store the motion samples used for warp motion. |
990 | | */ |
991 | | WARP_SAMPLE_INFO warp_sample_info[REF_FRAMES]; |
992 | | |
993 | | /*! \brief Reference frames picked by the square subblocks in a superblock. |
994 | | * |
995 | | * Keeps track of ref frames that are selected by square partition blocks |
996 | | * within a superblock, in MI resolution. They can be used to prune ref frames |
997 | | * for rectangular blocks. |
998 | | */ |
999 | | int picked_ref_frames_mask[MAX_MIB_SIZE * MAX_MIB_SIZE]; |
1000 | | |
1001 | | /*! \brief Prune ref frames in real-time mode. |
1002 | | * |
1003 | | * Determines whether to prune reference frames in real-time mode. For the |
1004 | | * most part, this is the same as nonrd_prune_ref_frame_search in |
1005 | | * cpi->sf.rt_sf.nonrd_prune_ref_frame_search, but this can be selectively |
1006 | | * turned off if the only frame available is GOLDEN_FRAME. |
1007 | | */ |
1008 | | int nonrd_prune_ref_frame_search; |
1009 | | /**@}*/ |
1010 | | |
1011 | | /***************************************************************************** |
1012 | | * \name Partition Search |
1013 | | ****************************************************************************/ |
1014 | | /**@{*/ |
1015 | | //! Stores some partition-search related buffers. |
1016 | | PartitionSearchInfo part_search_info; |
1017 | | |
1018 | | /*! \brief Whether to disable some features to force a mode in current block. |
1019 | | * |
1020 | | * In some cases, our speed features can be overly aggressive and remove all |
1021 | | * modes search in the superblock. When this happens, we set |
1022 | | * must_find_valid_partition to 1 to reduce the number of speed features, and |
1023 | | * recode the superblock again. |
1024 | | */ |
1025 | | int must_find_valid_partition; |
1026 | | /**@}*/ |
1027 | | |
1028 | | /***************************************************************************** |
1029 | | * \name Prediction Mode Search |
1030 | | ****************************************************************************/ |
1031 | | /**@{*/ |
1032 | | /*! \brief Inter skip mode. |
1033 | | * |
1034 | | * Skip mode tries to use the closest forward and backward references for |
1035 | | * inter prediction. Skip here means to skip transmitting the reference |
1036 | | * frames, not to be confused with skip_txfm. |
1037 | | */ |
1038 | | int skip_mode; |
1039 | | |
1040 | | /*! \brief Factors used for rd-thresholding. |
1041 | | * |
1042 | | * Determines a rd threshold to determine whether to continue searching the |
1043 | | * current mode. If the current best rd is already <= threshold, then we skip |
1044 | | * the current mode. |
1045 | | */ |
1046 | | int thresh_freq_fact[BLOCK_SIZES_ALL][MAX_MODES]; |
1047 | | |
1048 | | /*! \brief Tracks the winner modes in the current coding block. |
1049 | | * |
1050 | | * Winner mode is a two-pass strategy to find the best prediction mode. In the |
1051 | | * first pass, we search the prediction modes with a limited set of txfm |
1052 | | * options, and keep the top modes. These modes are called the winner modes. |
1053 | | * In the second pass, we retry the winner modes with more thorough txfm |
1054 | | * options. |
1055 | | */ |
1056 | | WinnerModeStats *winner_mode_stats; |
1057 | | //! Tracks how many winner modes there are. |
1058 | | int winner_mode_count; |
1059 | | |
1060 | | /*! \brief The model used for rd-estimation to avoid txfm |
1061 | | * |
1062 | | * These are for inter_mode_rd_model_estimation, which is another two pass |
1063 | | * approach. In this speed feature, we collect data in the first couple frames |
1064 | | * to build an rd model to estimate the rdcost of a prediction model based on |
1065 | | * the residue error. Once enough data is collected, this speed feature uses |
1066 | | * the estimated rdcost to find the most performant prediction mode. Then we |
1067 | | * follow up with a second pass find the best transform for the mode. |
1068 | | * Determines if one would go with reduced complexity transform block |
1069 | | * search model to select prediction modes, or full complexity model |
1070 | | * to select transform kernel. |
1071 | | */ |
1072 | | TXFM_RD_MODEL rd_model; |
1073 | | |
1074 | | /*! \brief Stores the inter mode information needed to build an rd model. |
1075 | | * |
1076 | | * These are for inter_mode_rd_model_estimation, which is another two pass |
1077 | | * approach. In this speed feature, we collect data in the first couple frames |
1078 | | * to build an rd model to estimate the rdcost of a prediction model based on |
1079 | | * the residue error. Once enough data is collected, this speed feature uses |
1080 | | * the estimated rdcost to find the most performant prediction mode. Then we |
1081 | | * follow up with a second pass find the best transform for the mode. |
1082 | | */ |
1083 | | // TODO(any): try to consolidate this speed feature with winner mode |
1084 | | // processing. |
1085 | | struct inter_modes_info *inter_modes_info; |
1086 | | |
1087 | | //! How to blend the compound predictions. |
1088 | | uint8_t compound_idx; |
1089 | | |
1090 | | //! A caches of results of compound type search so they can be reused later. |
1091 | | COMP_RD_STATS comp_rd_stats[MAX_COMP_RD_STATS]; |
1092 | | //! The idx for the latest compound mode in the cache \ref comp_rd_stats. |
1093 | | int comp_rd_stats_idx; |
1094 | | |
1095 | | /*! \brief Whether to recompute the luma prediction. |
1096 | | * |
1097 | | * In interpolation search, we can usually skip recalculating the luma |
1098 | | * prediction because it is already calculated by a previous predictor. This |
1099 | | * flag signifies that some modes might have been skipped, so we need to |
1100 | | * rebuild the prediction. |
1101 | | */ |
1102 | | int recalc_luma_mc_data; |
1103 | | |
1104 | | /*! \brief Data structure to speed up intrabc search. |
1105 | | * |
1106 | | * Contains the hash table, hash function, and buffer used for intrabc. |
1107 | | */ |
1108 | | IntraBCHashInfo intrabc_hash_info; |
1109 | | |
1110 | | /*! \brief Whether to reuse the mode stored in mb_mode_cache. */ |
1111 | | int use_mb_mode_cache; |
1112 | | /*! \brief The mode to reuse during \ref av1_rd_pick_intra_mode_sb and |
1113 | | * \ref av1_rd_pick_inter_mode. */ |
1114 | | const MB_MODE_INFO *mb_mode_cache; |
1115 | | /*! \brief Pointer to the buffer which caches gradient information. |
1116 | | * |
1117 | | * Pointer to the array of structures to store gradient information of each |
1118 | | * pixel in a superblock. The buffer constitutes of MAX_SB_SQUARE pixel level |
1119 | | * structures for each of the plane types (PLANE_TYPE_Y and PLANE_TYPE_UV). |
1120 | | */ |
1121 | | PixelLevelGradientInfo *pixel_gradient_info; |
1122 | | /*! \brief Flags indicating the availability of cached gradient info. */ |
1123 | | bool is_sb_gradient_cached[PLANE_TYPES]; |
1124 | | /**@}*/ |
1125 | | |
1126 | | /***************************************************************************** |
1127 | | * \name MV Search |
1128 | | ****************************************************************************/ |
1129 | | /**@{*/ |
1130 | | /*! \brief Context used to determine the initial step size in motion search. |
1131 | | * |
1132 | | * This context is defined as the \f$l_\inf\f$ norm of the best ref_mvs for |
1133 | | * each frame. |
1134 | | */ |
1135 | | unsigned int max_mv_context[REF_FRAMES]; |
1136 | | |
1137 | | /*! \brief Limit for the range of motion vectors. |
1138 | | * |
1139 | | * These define limits to motion vector components to prevent them from |
1140 | | * extending outside the UMV borders |
1141 | | */ |
1142 | | FullMvLimits mv_limits; |
1143 | | /**@}*/ |
1144 | | |
1145 | | /***************************************************************************** |
1146 | | * \name Txfm Search |
1147 | | ****************************************************************************/ |
1148 | | /**@{*/ |
1149 | | /*! \brief Parameters that control how motion search is done. |
1150 | | * |
1151 | | * Stores various txfm search related parameters such as txfm_type, txfm_size, |
1152 | | * trellis eob search, etc. |
1153 | | */ |
1154 | | TxfmSearchParams txfm_search_params; |
1155 | | |
1156 | | /*! \brief Results of the txfm searches that have been done. |
1157 | | * |
1158 | | * Caches old txfm search results and keeps the current txfm decisions to |
1159 | | * facilitate rdopt. |
1160 | | */ |
1161 | | TxfmSearchInfo txfm_search_info; |
1162 | | |
1163 | | /*! \brief Whether there is a strong color activity. |
1164 | | * |
1165 | | * Used in REALTIME coding mode to enhance the visual quality at the boundary |
1166 | | * of moving color objects. |
1167 | | */ |
1168 | | uint8_t color_sensitivity_sb[2]; |
1169 | | //! Color sensitivity flag for the coding block. |
1170 | | uint8_t color_sensitivity[2]; |
1171 | | /**@}*/ |
1172 | | |
1173 | | /***************************************************************************** |
1174 | | * \name Misc |
1175 | | ****************************************************************************/ |
1176 | | /**@{*/ |
1177 | | //! Variance of the source frame. |
1178 | | unsigned int source_variance; |
1179 | | //! SSE of the current predictor. |
1180 | | unsigned int pred_sse[REF_FRAMES]; |
1181 | | //! Prediction for ML based partition. |
1182 | | #if CONFIG_RT_ML_PARTITIONING |
1183 | | DECLARE_ALIGNED(16, uint8_t, est_pred[128 * 128]); |
1184 | | #endif |
1185 | | /**@}*/ |
1186 | | |
1187 | | /*! \brief NONE partition evaluated for merge. |
1188 | | * |
1189 | | * In variance based partitioning scheme, NONE & SPLIT partitions are |
1190 | | * evaluated to check the SPLIT can be merged as NONE. This flag signifies the |
1191 | | * partition is evaluated in the scheme. |
1192 | | */ |
1193 | | int try_merge_partition; |
1194 | | } MACROBLOCK; |
1195 | | #undef SINGLE_REF_MODES |
1196 | | |
1197 | | /*!\cond */ |
1198 | | // Zeroes out 'n_stats' elements in the array x->winner_mode_stats. |
1199 | | // It only zeroes out what is necessary in 'color_index_map' (just the block |
1200 | | // size, not the whole array). |
1201 | | static INLINE void zero_winner_mode_stats(BLOCK_SIZE bsize, int n_stats, |
1202 | 0 | WinnerModeStats *stats) { |
1203 | 0 | const int block_height = block_size_high[bsize]; |
1204 | 0 | const int block_width = block_size_wide[bsize]; |
1205 | 0 | for (int i = 0; i < n_stats; ++i) { |
1206 | 0 | WinnerModeStats *const stat = &stats[i]; |
1207 | 0 | memset(&stat->mbmi, 0, sizeof(stat->mbmi)); |
1208 | 0 | memset(&stat->rd_cost, 0, sizeof(stat->rd_cost)); |
1209 | 0 | memset(&stat->rd, 0, sizeof(stat->rd)); |
1210 | 0 | memset(&stat->rate_y, 0, sizeof(stat->rate_y)); |
1211 | 0 | memset(&stat->rate_uv, 0, sizeof(stat->rate_uv)); |
1212 | | // Do not reset the whole array as it is CPU intensive. |
1213 | 0 | memset(&stat->color_index_map, 0, |
1214 | 0 | block_width * block_height * sizeof(stat->color_index_map[0])); |
1215 | 0 | memset(&stat->mode_index, 0, sizeof(stat->mode_index)); |
1216 | 0 | } |
1217 | 0 | } Unexecuted instantiation: av1_cx_iface.c:zero_winner_mode_stats Unexecuted instantiation: av1_quantize.c:zero_winner_mode_stats Unexecuted instantiation: bitstream.c:zero_winner_mode_stats Unexecuted instantiation: encodemv.c:zero_winner_mode_stats Unexecuted instantiation: encoder.c:zero_winner_mode_stats Unexecuted instantiation: encoder_utils.c:zero_winner_mode_stats Unexecuted instantiation: encodetxb.c:zero_winner_mode_stats Unexecuted instantiation: ethread.c:zero_winner_mode_stats Unexecuted instantiation: firstpass.c:zero_winner_mode_stats Unexecuted instantiation: global_motion_facade.c:zero_winner_mode_stats Unexecuted instantiation: hash_motion.c:zero_winner_mode_stats Unexecuted instantiation: level.c:zero_winner_mode_stats Unexecuted instantiation: lookahead.c:zero_winner_mode_stats Unexecuted instantiation: mcomp.c:zero_winner_mode_stats Unexecuted instantiation: mv_prec.c:zero_winner_mode_stats Unexecuted instantiation: palette.c:zero_winner_mode_stats Unexecuted instantiation: pass2_strategy.c:zero_winner_mode_stats Unexecuted instantiation: pickcdef.c:zero_winner_mode_stats Unexecuted instantiation: picklpf.c:zero_winner_mode_stats Unexecuted instantiation: pickrst.c:zero_winner_mode_stats Unexecuted instantiation: ratectrl.c:zero_winner_mode_stats Unexecuted instantiation: rd.c:zero_winner_mode_stats Unexecuted instantiation: rdopt.c:zero_winner_mode_stats Unexecuted instantiation: segmentation.c:zero_winner_mode_stats Unexecuted instantiation: speed_features.c:zero_winner_mode_stats Unexecuted instantiation: superres_scale.c:zero_winner_mode_stats Unexecuted instantiation: svc_layercontext.c:zero_winner_mode_stats Unexecuted instantiation: temporal_filter.c:zero_winner_mode_stats Unexecuted instantiation: thirdpass.c:zero_winner_mode_stats Unexecuted instantiation: tokenize.c:zero_winner_mode_stats Unexecuted instantiation: tpl_model.c:zero_winner_mode_stats Unexecuted instantiation: tx_search.c:zero_winner_mode_stats Unexecuted instantiation: txb_rdopt.c:zero_winner_mode_stats Unexecuted instantiation: intra_mode_search.c:zero_winner_mode_stats Unexecuted instantiation: var_based_part.c:zero_winner_mode_stats Unexecuted instantiation: av1_noise_estimate.c:zero_winner_mode_stats Unexecuted instantiation: aq_complexity.c:zero_winner_mode_stats Unexecuted instantiation: aq_cyclicrefresh.c:zero_winner_mode_stats Unexecuted instantiation: aq_variance.c:zero_winner_mode_stats Unexecuted instantiation: allintra_vis.c:zero_winner_mode_stats Unexecuted instantiation: compound_type.c:zero_winner_mode_stats Unexecuted instantiation: context_tree.c:zero_winner_mode_stats Unexecuted instantiation: encodeframe.c:zero_winner_mode_stats Unexecuted instantiation: encodeframe_utils.c:zero_winner_mode_stats Unexecuted instantiation: encodemb.c:zero_winner_mode_stats Unexecuted instantiation: encode_strategy.c:zero_winner_mode_stats Unexecuted instantiation: global_motion.c:zero_winner_mode_stats Unexecuted instantiation: gop_structure.c:zero_winner_mode_stats Unexecuted instantiation: interp_search.c:zero_winner_mode_stats Unexecuted instantiation: motion_search_facade.c:zero_winner_mode_stats Unexecuted instantiation: partition_search.c:zero_winner_mode_stats Unexecuted instantiation: partition_strategy.c:zero_winner_mode_stats Unexecuted instantiation: nonrd_pickmode.c:zero_winner_mode_stats |
1218 | | |
1219 | 0 | static INLINE int is_rect_tx_allowed_bsize(BLOCK_SIZE bsize) { |
1220 | 0 | static const char LUT[BLOCK_SIZES_ALL] = { |
1221 | 0 | 0, // BLOCK_4X4 |
1222 | 0 | 1, // BLOCK_4X8 |
1223 | 0 | 1, // BLOCK_8X4 |
1224 | 0 | 0, // BLOCK_8X8 |
1225 | 0 | 1, // BLOCK_8X16 |
1226 | 0 | 1, // BLOCK_16X8 |
1227 | 0 | 0, // BLOCK_16X16 |
1228 | 0 | 1, // BLOCK_16X32 |
1229 | 0 | 1, // BLOCK_32X16 |
1230 | 0 | 0, // BLOCK_32X32 |
1231 | 0 | 1, // BLOCK_32X64 |
1232 | 0 | 1, // BLOCK_64X32 |
1233 | 0 | 0, // BLOCK_64X64 |
1234 | 0 | 0, // BLOCK_64X128 |
1235 | 0 | 0, // BLOCK_128X64 |
1236 | 0 | 0, // BLOCK_128X128 |
1237 | 0 | 1, // BLOCK_4X16 |
1238 | 0 | 1, // BLOCK_16X4 |
1239 | 0 | 1, // BLOCK_8X32 |
1240 | 0 | 1, // BLOCK_32X8 |
1241 | 0 | 1, // BLOCK_16X64 |
1242 | 0 | 1, // BLOCK_64X16 |
1243 | 0 | }; |
1244 | 0 |
|
1245 | 0 | return LUT[bsize]; |
1246 | 0 | } Unexecuted instantiation: av1_cx_iface.c:is_rect_tx_allowed_bsize Unexecuted instantiation: av1_quantize.c:is_rect_tx_allowed_bsize Unexecuted instantiation: bitstream.c:is_rect_tx_allowed_bsize Unexecuted instantiation: encodemv.c:is_rect_tx_allowed_bsize Unexecuted instantiation: encoder.c:is_rect_tx_allowed_bsize Unexecuted instantiation: encoder_utils.c:is_rect_tx_allowed_bsize Unexecuted instantiation: encodetxb.c:is_rect_tx_allowed_bsize Unexecuted instantiation: ethread.c:is_rect_tx_allowed_bsize Unexecuted instantiation: firstpass.c:is_rect_tx_allowed_bsize Unexecuted instantiation: global_motion_facade.c:is_rect_tx_allowed_bsize Unexecuted instantiation: hash_motion.c:is_rect_tx_allowed_bsize Unexecuted instantiation: level.c:is_rect_tx_allowed_bsize Unexecuted instantiation: lookahead.c:is_rect_tx_allowed_bsize Unexecuted instantiation: mcomp.c:is_rect_tx_allowed_bsize Unexecuted instantiation: mv_prec.c:is_rect_tx_allowed_bsize Unexecuted instantiation: palette.c:is_rect_tx_allowed_bsize Unexecuted instantiation: pass2_strategy.c:is_rect_tx_allowed_bsize Unexecuted instantiation: pickcdef.c:is_rect_tx_allowed_bsize Unexecuted instantiation: picklpf.c:is_rect_tx_allowed_bsize Unexecuted instantiation: pickrst.c:is_rect_tx_allowed_bsize Unexecuted instantiation: ratectrl.c:is_rect_tx_allowed_bsize Unexecuted instantiation: rd.c:is_rect_tx_allowed_bsize Unexecuted instantiation: rdopt.c:is_rect_tx_allowed_bsize Unexecuted instantiation: segmentation.c:is_rect_tx_allowed_bsize Unexecuted instantiation: speed_features.c:is_rect_tx_allowed_bsize Unexecuted instantiation: superres_scale.c:is_rect_tx_allowed_bsize Unexecuted instantiation: svc_layercontext.c:is_rect_tx_allowed_bsize Unexecuted instantiation: temporal_filter.c:is_rect_tx_allowed_bsize Unexecuted instantiation: thirdpass.c:is_rect_tx_allowed_bsize Unexecuted instantiation: tokenize.c:is_rect_tx_allowed_bsize Unexecuted instantiation: tpl_model.c:is_rect_tx_allowed_bsize Unexecuted instantiation: tx_search.c:is_rect_tx_allowed_bsize Unexecuted instantiation: txb_rdopt.c:is_rect_tx_allowed_bsize Unexecuted instantiation: intra_mode_search.c:is_rect_tx_allowed_bsize Unexecuted instantiation: var_based_part.c:is_rect_tx_allowed_bsize Unexecuted instantiation: av1_noise_estimate.c:is_rect_tx_allowed_bsize Unexecuted instantiation: aq_complexity.c:is_rect_tx_allowed_bsize Unexecuted instantiation: aq_cyclicrefresh.c:is_rect_tx_allowed_bsize Unexecuted instantiation: aq_variance.c:is_rect_tx_allowed_bsize Unexecuted instantiation: allintra_vis.c:is_rect_tx_allowed_bsize Unexecuted instantiation: compound_type.c:is_rect_tx_allowed_bsize Unexecuted instantiation: context_tree.c:is_rect_tx_allowed_bsize Unexecuted instantiation: encodeframe.c:is_rect_tx_allowed_bsize Unexecuted instantiation: encodeframe_utils.c:is_rect_tx_allowed_bsize Unexecuted instantiation: encodemb.c:is_rect_tx_allowed_bsize Unexecuted instantiation: encode_strategy.c:is_rect_tx_allowed_bsize Unexecuted instantiation: global_motion.c:is_rect_tx_allowed_bsize Unexecuted instantiation: gop_structure.c:is_rect_tx_allowed_bsize Unexecuted instantiation: interp_search.c:is_rect_tx_allowed_bsize Unexecuted instantiation: motion_search_facade.c:is_rect_tx_allowed_bsize Unexecuted instantiation: partition_search.c:is_rect_tx_allowed_bsize Unexecuted instantiation: partition_strategy.c:is_rect_tx_allowed_bsize Unexecuted instantiation: nonrd_pickmode.c:is_rect_tx_allowed_bsize |
1247 | | |
1248 | | static INLINE int is_rect_tx_allowed(const MACROBLOCKD *xd, |
1249 | 0 | const MB_MODE_INFO *mbmi) { |
1250 | 0 | return is_rect_tx_allowed_bsize(mbmi->bsize) && |
1251 | 0 | !xd->lossless[mbmi->segment_id]; |
1252 | 0 | } Unexecuted instantiation: av1_cx_iface.c:is_rect_tx_allowed Unexecuted instantiation: av1_quantize.c:is_rect_tx_allowed Unexecuted instantiation: bitstream.c:is_rect_tx_allowed Unexecuted instantiation: encodemv.c:is_rect_tx_allowed Unexecuted instantiation: encoder.c:is_rect_tx_allowed Unexecuted instantiation: encoder_utils.c:is_rect_tx_allowed Unexecuted instantiation: encodetxb.c:is_rect_tx_allowed Unexecuted instantiation: ethread.c:is_rect_tx_allowed Unexecuted instantiation: firstpass.c:is_rect_tx_allowed Unexecuted instantiation: global_motion_facade.c:is_rect_tx_allowed Unexecuted instantiation: hash_motion.c:is_rect_tx_allowed Unexecuted instantiation: level.c:is_rect_tx_allowed Unexecuted instantiation: lookahead.c:is_rect_tx_allowed Unexecuted instantiation: mcomp.c:is_rect_tx_allowed Unexecuted instantiation: mv_prec.c:is_rect_tx_allowed Unexecuted instantiation: palette.c:is_rect_tx_allowed Unexecuted instantiation: pass2_strategy.c:is_rect_tx_allowed Unexecuted instantiation: pickcdef.c:is_rect_tx_allowed Unexecuted instantiation: picklpf.c:is_rect_tx_allowed Unexecuted instantiation: pickrst.c:is_rect_tx_allowed Unexecuted instantiation: ratectrl.c:is_rect_tx_allowed Unexecuted instantiation: rd.c:is_rect_tx_allowed Unexecuted instantiation: rdopt.c:is_rect_tx_allowed Unexecuted instantiation: segmentation.c:is_rect_tx_allowed Unexecuted instantiation: speed_features.c:is_rect_tx_allowed Unexecuted instantiation: superres_scale.c:is_rect_tx_allowed Unexecuted instantiation: svc_layercontext.c:is_rect_tx_allowed Unexecuted instantiation: temporal_filter.c:is_rect_tx_allowed Unexecuted instantiation: thirdpass.c:is_rect_tx_allowed Unexecuted instantiation: tokenize.c:is_rect_tx_allowed Unexecuted instantiation: tpl_model.c:is_rect_tx_allowed Unexecuted instantiation: tx_search.c:is_rect_tx_allowed Unexecuted instantiation: txb_rdopt.c:is_rect_tx_allowed Unexecuted instantiation: intra_mode_search.c:is_rect_tx_allowed Unexecuted instantiation: var_based_part.c:is_rect_tx_allowed Unexecuted instantiation: av1_noise_estimate.c:is_rect_tx_allowed Unexecuted instantiation: aq_complexity.c:is_rect_tx_allowed Unexecuted instantiation: aq_cyclicrefresh.c:is_rect_tx_allowed Unexecuted instantiation: aq_variance.c:is_rect_tx_allowed Unexecuted instantiation: allintra_vis.c:is_rect_tx_allowed Unexecuted instantiation: compound_type.c:is_rect_tx_allowed Unexecuted instantiation: context_tree.c:is_rect_tx_allowed Unexecuted instantiation: encodeframe.c:is_rect_tx_allowed Unexecuted instantiation: encodeframe_utils.c:is_rect_tx_allowed Unexecuted instantiation: encodemb.c:is_rect_tx_allowed Unexecuted instantiation: encode_strategy.c:is_rect_tx_allowed Unexecuted instantiation: global_motion.c:is_rect_tx_allowed Unexecuted instantiation: gop_structure.c:is_rect_tx_allowed Unexecuted instantiation: interp_search.c:is_rect_tx_allowed Unexecuted instantiation: motion_search_facade.c:is_rect_tx_allowed Unexecuted instantiation: partition_search.c:is_rect_tx_allowed Unexecuted instantiation: partition_strategy.c:is_rect_tx_allowed Unexecuted instantiation: nonrd_pickmode.c:is_rect_tx_allowed |
1253 | | |
1254 | 0 | static INLINE int tx_size_to_depth(TX_SIZE tx_size, BLOCK_SIZE bsize) { |
1255 | 0 | TX_SIZE ctx_size = max_txsize_rect_lookup[bsize]; |
1256 | 0 | int depth = 0; |
1257 | 0 | while (tx_size != ctx_size) { |
1258 | 0 | depth++; |
1259 | 0 | ctx_size = sub_tx_size_map[ctx_size]; |
1260 | 0 | assert(depth <= MAX_TX_DEPTH); |
1261 | 0 | } |
1262 | 0 | return depth; |
1263 | 0 | } Unexecuted instantiation: av1_cx_iface.c:tx_size_to_depth Unexecuted instantiation: av1_quantize.c:tx_size_to_depth Unexecuted instantiation: bitstream.c:tx_size_to_depth Unexecuted instantiation: encodemv.c:tx_size_to_depth Unexecuted instantiation: encoder.c:tx_size_to_depth Unexecuted instantiation: encoder_utils.c:tx_size_to_depth Unexecuted instantiation: encodetxb.c:tx_size_to_depth Unexecuted instantiation: ethread.c:tx_size_to_depth Unexecuted instantiation: firstpass.c:tx_size_to_depth Unexecuted instantiation: global_motion_facade.c:tx_size_to_depth Unexecuted instantiation: hash_motion.c:tx_size_to_depth Unexecuted instantiation: level.c:tx_size_to_depth Unexecuted instantiation: lookahead.c:tx_size_to_depth Unexecuted instantiation: mcomp.c:tx_size_to_depth Unexecuted instantiation: mv_prec.c:tx_size_to_depth Unexecuted instantiation: palette.c:tx_size_to_depth Unexecuted instantiation: pass2_strategy.c:tx_size_to_depth Unexecuted instantiation: pickcdef.c:tx_size_to_depth Unexecuted instantiation: picklpf.c:tx_size_to_depth Unexecuted instantiation: pickrst.c:tx_size_to_depth Unexecuted instantiation: ratectrl.c:tx_size_to_depth Unexecuted instantiation: rd.c:tx_size_to_depth Unexecuted instantiation: rdopt.c:tx_size_to_depth Unexecuted instantiation: segmentation.c:tx_size_to_depth Unexecuted instantiation: speed_features.c:tx_size_to_depth Unexecuted instantiation: superres_scale.c:tx_size_to_depth Unexecuted instantiation: svc_layercontext.c:tx_size_to_depth Unexecuted instantiation: temporal_filter.c:tx_size_to_depth Unexecuted instantiation: thirdpass.c:tx_size_to_depth Unexecuted instantiation: tokenize.c:tx_size_to_depth Unexecuted instantiation: tpl_model.c:tx_size_to_depth Unexecuted instantiation: tx_search.c:tx_size_to_depth Unexecuted instantiation: txb_rdopt.c:tx_size_to_depth Unexecuted instantiation: intra_mode_search.c:tx_size_to_depth Unexecuted instantiation: var_based_part.c:tx_size_to_depth Unexecuted instantiation: av1_noise_estimate.c:tx_size_to_depth Unexecuted instantiation: aq_complexity.c:tx_size_to_depth Unexecuted instantiation: aq_cyclicrefresh.c:tx_size_to_depth Unexecuted instantiation: aq_variance.c:tx_size_to_depth Unexecuted instantiation: allintra_vis.c:tx_size_to_depth Unexecuted instantiation: compound_type.c:tx_size_to_depth Unexecuted instantiation: context_tree.c:tx_size_to_depth Unexecuted instantiation: encodeframe.c:tx_size_to_depth Unexecuted instantiation: encodeframe_utils.c:tx_size_to_depth Unexecuted instantiation: encodemb.c:tx_size_to_depth Unexecuted instantiation: encode_strategy.c:tx_size_to_depth Unexecuted instantiation: global_motion.c:tx_size_to_depth Unexecuted instantiation: gop_structure.c:tx_size_to_depth Unexecuted instantiation: interp_search.c:tx_size_to_depth Unexecuted instantiation: motion_search_facade.c:tx_size_to_depth Unexecuted instantiation: partition_search.c:tx_size_to_depth Unexecuted instantiation: partition_strategy.c:tx_size_to_depth Unexecuted instantiation: nonrd_pickmode.c:tx_size_to_depth |
1264 | | |
1265 | | static INLINE void set_blk_skip(uint8_t txb_skip[], int plane, int blk_idx, |
1266 | 0 | int skip) { |
1267 | 0 | if (skip) |
1268 | 0 | txb_skip[blk_idx] |= 1UL << plane; |
1269 | 0 | else |
1270 | 0 | txb_skip[blk_idx] &= ~(1UL << plane); |
1271 | | #ifndef NDEBUG |
1272 | | // Set chroma planes to uninitialized states when luma is set to check if |
1273 | | // it will be set later |
1274 | | if (plane == 0) { |
1275 | | txb_skip[blk_idx] |= 1UL << (1 + 4); |
1276 | | txb_skip[blk_idx] |= 1UL << (2 + 4); |
1277 | | } |
1278 | | |
1279 | | // Clear the initialization checking bit |
1280 | | txb_skip[blk_idx] &= ~(1UL << (plane + 4)); |
1281 | | #endif |
1282 | 0 | } Unexecuted instantiation: av1_cx_iface.c:set_blk_skip Unexecuted instantiation: av1_quantize.c:set_blk_skip Unexecuted instantiation: bitstream.c:set_blk_skip Unexecuted instantiation: encodemv.c:set_blk_skip Unexecuted instantiation: encoder.c:set_blk_skip Unexecuted instantiation: encoder_utils.c:set_blk_skip Unexecuted instantiation: encodetxb.c:set_blk_skip Unexecuted instantiation: ethread.c:set_blk_skip Unexecuted instantiation: firstpass.c:set_blk_skip Unexecuted instantiation: global_motion_facade.c:set_blk_skip Unexecuted instantiation: hash_motion.c:set_blk_skip Unexecuted instantiation: level.c:set_blk_skip Unexecuted instantiation: lookahead.c:set_blk_skip Unexecuted instantiation: mcomp.c:set_blk_skip Unexecuted instantiation: mv_prec.c:set_blk_skip Unexecuted instantiation: palette.c:set_blk_skip Unexecuted instantiation: pass2_strategy.c:set_blk_skip Unexecuted instantiation: pickcdef.c:set_blk_skip Unexecuted instantiation: picklpf.c:set_blk_skip Unexecuted instantiation: pickrst.c:set_blk_skip Unexecuted instantiation: ratectrl.c:set_blk_skip Unexecuted instantiation: rd.c:set_blk_skip Unexecuted instantiation: rdopt.c:set_blk_skip Unexecuted instantiation: segmentation.c:set_blk_skip Unexecuted instantiation: speed_features.c:set_blk_skip Unexecuted instantiation: superres_scale.c:set_blk_skip Unexecuted instantiation: svc_layercontext.c:set_blk_skip Unexecuted instantiation: temporal_filter.c:set_blk_skip Unexecuted instantiation: thirdpass.c:set_blk_skip Unexecuted instantiation: tokenize.c:set_blk_skip Unexecuted instantiation: tpl_model.c:set_blk_skip Unexecuted instantiation: tx_search.c:set_blk_skip Unexecuted instantiation: txb_rdopt.c:set_blk_skip Unexecuted instantiation: intra_mode_search.c:set_blk_skip Unexecuted instantiation: var_based_part.c:set_blk_skip Unexecuted instantiation: av1_noise_estimate.c:set_blk_skip Unexecuted instantiation: aq_complexity.c:set_blk_skip Unexecuted instantiation: aq_cyclicrefresh.c:set_blk_skip Unexecuted instantiation: aq_variance.c:set_blk_skip Unexecuted instantiation: allintra_vis.c:set_blk_skip Unexecuted instantiation: compound_type.c:set_blk_skip Unexecuted instantiation: context_tree.c:set_blk_skip Unexecuted instantiation: encodeframe.c:set_blk_skip Unexecuted instantiation: encodeframe_utils.c:set_blk_skip Unexecuted instantiation: encodemb.c:set_blk_skip Unexecuted instantiation: encode_strategy.c:set_blk_skip Unexecuted instantiation: global_motion.c:set_blk_skip Unexecuted instantiation: gop_structure.c:set_blk_skip Unexecuted instantiation: interp_search.c:set_blk_skip Unexecuted instantiation: motion_search_facade.c:set_blk_skip Unexecuted instantiation: partition_search.c:set_blk_skip Unexecuted instantiation: partition_strategy.c:set_blk_skip Unexecuted instantiation: nonrd_pickmode.c:set_blk_skip |
1283 | | |
1284 | 0 | static INLINE int is_blk_skip(uint8_t *txb_skip, int plane, int blk_idx) { |
1285 | | #ifndef NDEBUG |
1286 | | // Check if this is initialized |
1287 | | assert(!(txb_skip[blk_idx] & (1UL << (plane + 4)))); |
1288 | | |
1289 | | // The magic number is 0x77, this is to test if there is garbage data |
1290 | | assert((txb_skip[blk_idx] & 0x88) == 0); |
1291 | | #endif |
1292 | 0 | return (txb_skip[blk_idx] >> plane) & 1; |
1293 | 0 | } Unexecuted instantiation: av1_cx_iface.c:is_blk_skip Unexecuted instantiation: av1_quantize.c:is_blk_skip Unexecuted instantiation: bitstream.c:is_blk_skip Unexecuted instantiation: encodemv.c:is_blk_skip Unexecuted instantiation: encoder.c:is_blk_skip Unexecuted instantiation: encoder_utils.c:is_blk_skip Unexecuted instantiation: encodetxb.c:is_blk_skip Unexecuted instantiation: ethread.c:is_blk_skip Unexecuted instantiation: firstpass.c:is_blk_skip Unexecuted instantiation: global_motion_facade.c:is_blk_skip Unexecuted instantiation: hash_motion.c:is_blk_skip Unexecuted instantiation: level.c:is_blk_skip Unexecuted instantiation: lookahead.c:is_blk_skip Unexecuted instantiation: mcomp.c:is_blk_skip Unexecuted instantiation: mv_prec.c:is_blk_skip Unexecuted instantiation: palette.c:is_blk_skip Unexecuted instantiation: pass2_strategy.c:is_blk_skip Unexecuted instantiation: pickcdef.c:is_blk_skip Unexecuted instantiation: picklpf.c:is_blk_skip Unexecuted instantiation: pickrst.c:is_blk_skip Unexecuted instantiation: ratectrl.c:is_blk_skip Unexecuted instantiation: rd.c:is_blk_skip Unexecuted instantiation: rdopt.c:is_blk_skip Unexecuted instantiation: segmentation.c:is_blk_skip Unexecuted instantiation: speed_features.c:is_blk_skip Unexecuted instantiation: superres_scale.c:is_blk_skip Unexecuted instantiation: svc_layercontext.c:is_blk_skip Unexecuted instantiation: temporal_filter.c:is_blk_skip Unexecuted instantiation: thirdpass.c:is_blk_skip Unexecuted instantiation: tokenize.c:is_blk_skip Unexecuted instantiation: tpl_model.c:is_blk_skip Unexecuted instantiation: tx_search.c:is_blk_skip Unexecuted instantiation: txb_rdopt.c:is_blk_skip Unexecuted instantiation: intra_mode_search.c:is_blk_skip Unexecuted instantiation: var_based_part.c:is_blk_skip Unexecuted instantiation: av1_noise_estimate.c:is_blk_skip Unexecuted instantiation: aq_complexity.c:is_blk_skip Unexecuted instantiation: aq_cyclicrefresh.c:is_blk_skip Unexecuted instantiation: aq_variance.c:is_blk_skip Unexecuted instantiation: allintra_vis.c:is_blk_skip Unexecuted instantiation: compound_type.c:is_blk_skip Unexecuted instantiation: context_tree.c:is_blk_skip Unexecuted instantiation: encodeframe.c:is_blk_skip Unexecuted instantiation: encodeframe_utils.c:is_blk_skip Unexecuted instantiation: encodemb.c:is_blk_skip Unexecuted instantiation: encode_strategy.c:is_blk_skip Unexecuted instantiation: global_motion.c:is_blk_skip Unexecuted instantiation: gop_structure.c:is_blk_skip Unexecuted instantiation: interp_search.c:is_blk_skip Unexecuted instantiation: motion_search_facade.c:is_blk_skip Unexecuted instantiation: partition_search.c:is_blk_skip Unexecuted instantiation: partition_strategy.c:is_blk_skip Unexecuted instantiation: nonrd_pickmode.c:is_blk_skip |
1294 | | |
1295 | | /*!\endcond */ |
1296 | | |
1297 | | #ifdef __cplusplus |
1298 | | } // extern "C" |
1299 | | #endif |
1300 | | |
1301 | | #endif // AOM_AV1_ENCODER_BLOCK_H_ |