/src/aom/av1/encoder/context_tree.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 | | #ifndef AOM_AV1_ENCODER_CONTEXT_TREE_H_ |
13 | | #define AOM_AV1_ENCODER_CONTEXT_TREE_H_ |
14 | | |
15 | | #include "config/aom_config.h" |
16 | | |
17 | | #include "av1/common/blockd.h" |
18 | | #include "av1/encoder/block.h" |
19 | | |
20 | | #ifdef __cplusplus |
21 | | extern "C" { |
22 | | #endif |
23 | | |
24 | | struct AV1_PRIMARY; |
25 | | struct AV1_COMP; |
26 | | struct AV1Common; |
27 | | struct ThreadData; |
28 | | |
29 | | typedef struct { |
30 | | tran_low_t *coeff_buf[MAX_MB_PLANE]; |
31 | | tran_low_t *qcoeff_buf[MAX_MB_PLANE]; |
32 | | tran_low_t *dqcoeff_buf[MAX_MB_PLANE]; |
33 | | } PC_TREE_SHARED_BUFFERS; |
34 | | |
35 | | // Structure to hold snapshot of coding context during the mode picking process |
36 | | typedef struct PICK_MODE_CONTEXT { |
37 | | MB_MODE_INFO mic; |
38 | | MB_MODE_INFO_EXT_FRAME mbmi_ext_best; |
39 | | uint8_t *color_index_map[2]; |
40 | | uint8_t *blk_skip; |
41 | | |
42 | | tran_low_t *coeff[MAX_MB_PLANE]; |
43 | | tran_low_t *qcoeff[MAX_MB_PLANE]; |
44 | | tran_low_t *dqcoeff[MAX_MB_PLANE]; |
45 | | uint16_t *eobs[MAX_MB_PLANE]; |
46 | | uint8_t *txb_entropy_ctx[MAX_MB_PLANE]; |
47 | | uint8_t *tx_type_map; |
48 | | |
49 | | int num_4x4_blk; |
50 | | // For current partition, only if all Y, U, and V transform blocks' |
51 | | // coefficients are quantized to 0, skippable is set to 1. |
52 | | int skippable; |
53 | | #if CONFIG_INTERNAL_STATS |
54 | | THR_MODES best_mode_index; |
55 | | #endif // CONFIG_INTERNAL_STATS |
56 | | RD_STATS rd_stats; |
57 | | |
58 | | int rd_mode_is_ready; // Flag to indicate whether rd pick mode decision has |
59 | | // been made. |
60 | | #if CONFIG_AV1_TEMPORAL_DENOISING |
61 | | int64_t newmv_sse; |
62 | | int64_t zeromv_sse; |
63 | | int64_t zeromv_lastref_sse; |
64 | | PREDICTION_MODE best_sse_inter_mode; |
65 | | int_mv best_sse_mv; |
66 | | MV_REFERENCE_FRAME best_reference_frame; |
67 | | MV_REFERENCE_FRAME best_zeromv_reference_frame; |
68 | | int sb_skip_denoising; |
69 | | #endif |
70 | | } PICK_MODE_CONTEXT; |
71 | | |
72 | | typedef struct PC_TREE { |
73 | | PARTITION_TYPE partitioning; |
74 | | BLOCK_SIZE block_size; |
75 | | PICK_MODE_CONTEXT *none; |
76 | | PICK_MODE_CONTEXT *horizontal[2]; |
77 | | PICK_MODE_CONTEXT *vertical[2]; |
78 | | PICK_MODE_CONTEXT *horizontala[3]; |
79 | | PICK_MODE_CONTEXT *horizontalb[3]; |
80 | | PICK_MODE_CONTEXT *verticala[3]; |
81 | | PICK_MODE_CONTEXT *verticalb[3]; |
82 | | PICK_MODE_CONTEXT *horizontal4[4]; |
83 | | PICK_MODE_CONTEXT *vertical4[4]; |
84 | | struct PC_TREE *split[4]; |
85 | | int index; |
86 | | } PC_TREE; |
87 | | |
88 | | typedef struct SIMPLE_MOTION_DATA_TREE { |
89 | | BLOCK_SIZE block_size; |
90 | | PARTITION_TYPE partitioning; |
91 | | struct SIMPLE_MOTION_DATA_TREE *split[4]; |
92 | | |
93 | | // Simple motion search_features |
94 | | FULLPEL_MV start_mvs[REF_FRAMES]; |
95 | | unsigned int sms_none_feat[2]; |
96 | | unsigned int sms_rect_feat[8]; |
97 | | int sms_none_valid; |
98 | | int sms_rect_valid; |
99 | | } SIMPLE_MOTION_DATA_TREE; |
100 | | |
101 | | void av1_setup_shared_coeff_buffer(const SequenceHeader *const seq_params, |
102 | | PC_TREE_SHARED_BUFFERS *shared_bufs, |
103 | | struct aom_internal_error_info *error); |
104 | | void av1_free_shared_coeff_buffer(PC_TREE_SHARED_BUFFERS *shared_bufs); |
105 | | |
106 | | PC_TREE *av1_alloc_pc_tree_node(BLOCK_SIZE bsize); |
107 | | void av1_free_pc_tree_recursive(PC_TREE *tree, int num_planes, int keep_best, |
108 | | int keep_none); |
109 | | |
110 | | PICK_MODE_CONTEXT *av1_alloc_pmc(const struct AV1_COMP *const cpi, |
111 | | BLOCK_SIZE bsize, |
112 | | PC_TREE_SHARED_BUFFERS *shared_bufs); |
113 | | void av1_free_pmc(PICK_MODE_CONTEXT *ctx, int num_planes); |
114 | | void av1_copy_tree_context(PICK_MODE_CONTEXT *dst_ctx, |
115 | | PICK_MODE_CONTEXT *src_ctx); |
116 | | |
117 | | static const BLOCK_SIZE square[MAX_SB_SIZE_LOG2 - 1] = { |
118 | | BLOCK_4X4, BLOCK_8X8, BLOCK_16X16, BLOCK_32X32, BLOCK_64X64, BLOCK_128X128, |
119 | | }; |
120 | | |
121 | | static AOM_INLINE int av1_get_pc_tree_nodes(const int is_sb_size_128, |
122 | 0 | int stat_generation_stage) { |
123 | 0 | const int tree_nodes_inc = is_sb_size_128 ? 1024 : 0; |
124 | 0 | const int tree_nodes = |
125 | 0 | stat_generation_stage ? 1 : (tree_nodes_inc + 256 + 64 + 16 + 4 + 1); |
126 | 0 | return tree_nodes; |
127 | 0 | } Unexecuted instantiation: av1_cx_iface.c:av1_get_pc_tree_nodes Unexecuted instantiation: av1_quantize.c:av1_get_pc_tree_nodes Unexecuted instantiation: bitstream.c:av1_get_pc_tree_nodes Unexecuted instantiation: encodemv.c:av1_get_pc_tree_nodes Unexecuted instantiation: encoder.c:av1_get_pc_tree_nodes Unexecuted instantiation: encoder_utils.c:av1_get_pc_tree_nodes Unexecuted instantiation: encodetxb.c:av1_get_pc_tree_nodes Unexecuted instantiation: ethread.c:av1_get_pc_tree_nodes Unexecuted instantiation: firstpass.c:av1_get_pc_tree_nodes Unexecuted instantiation: global_motion_facade.c:av1_get_pc_tree_nodes Unexecuted instantiation: level.c:av1_get_pc_tree_nodes Unexecuted instantiation: lookahead.c:av1_get_pc_tree_nodes Unexecuted instantiation: mcomp.c:av1_get_pc_tree_nodes Unexecuted instantiation: mv_prec.c:av1_get_pc_tree_nodes Unexecuted instantiation: palette.c:av1_get_pc_tree_nodes Unexecuted instantiation: pass2_strategy.c:av1_get_pc_tree_nodes Unexecuted instantiation: pickcdef.c:av1_get_pc_tree_nodes Unexecuted instantiation: picklpf.c:av1_get_pc_tree_nodes Unexecuted instantiation: pickrst.c:av1_get_pc_tree_nodes Unexecuted instantiation: ratectrl.c:av1_get_pc_tree_nodes Unexecuted instantiation: rd.c:av1_get_pc_tree_nodes Unexecuted instantiation: rdopt.c:av1_get_pc_tree_nodes Unexecuted instantiation: segmentation.c:av1_get_pc_tree_nodes Unexecuted instantiation: speed_features.c:av1_get_pc_tree_nodes Unexecuted instantiation: superres_scale.c:av1_get_pc_tree_nodes Unexecuted instantiation: svc_layercontext.c:av1_get_pc_tree_nodes Unexecuted instantiation: temporal_filter.c:av1_get_pc_tree_nodes Unexecuted instantiation: thirdpass.c:av1_get_pc_tree_nodes Unexecuted instantiation: tokenize.c:av1_get_pc_tree_nodes Unexecuted instantiation: tpl_model.c:av1_get_pc_tree_nodes Unexecuted instantiation: tx_search.c:av1_get_pc_tree_nodes Unexecuted instantiation: txb_rdopt.c:av1_get_pc_tree_nodes Unexecuted instantiation: intra_mode_search.c:av1_get_pc_tree_nodes Unexecuted instantiation: var_based_part.c:av1_get_pc_tree_nodes Unexecuted instantiation: av1_noise_estimate.c:av1_get_pc_tree_nodes Unexecuted instantiation: aq_complexity.c:av1_get_pc_tree_nodes Unexecuted instantiation: aq_cyclicrefresh.c:av1_get_pc_tree_nodes Unexecuted instantiation: aq_variance.c:av1_get_pc_tree_nodes Unexecuted instantiation: allintra_vis.c:av1_get_pc_tree_nodes Unexecuted instantiation: compound_type.c:av1_get_pc_tree_nodes Unexecuted instantiation: context_tree.c:av1_get_pc_tree_nodes Unexecuted instantiation: encodeframe.c:av1_get_pc_tree_nodes Unexecuted instantiation: encodeframe_utils.c:av1_get_pc_tree_nodes Unexecuted instantiation: encodemb.c:av1_get_pc_tree_nodes Unexecuted instantiation: encode_strategy.c:av1_get_pc_tree_nodes Unexecuted instantiation: global_motion.c:av1_get_pc_tree_nodes Unexecuted instantiation: gop_structure.c:av1_get_pc_tree_nodes Unexecuted instantiation: interp_search.c:av1_get_pc_tree_nodes Unexecuted instantiation: motion_search_facade.c:av1_get_pc_tree_nodes Unexecuted instantiation: partition_search.c:av1_get_pc_tree_nodes Unexecuted instantiation: partition_strategy.c:av1_get_pc_tree_nodes Unexecuted instantiation: nonrd_pickmode.c:av1_get_pc_tree_nodes |
128 | | |
129 | | void av1_setup_sms_tree(struct AV1_COMP *const cpi, struct ThreadData *td); |
130 | | void av1_free_sms_tree(struct ThreadData *td); |
131 | | |
132 | | #ifdef __cplusplus |
133 | | } // extern "C" |
134 | | #endif |
135 | | |
136 | | #endif // AOM_AV1_ENCODER_CONTEXT_TREE_H_ |