/src/aom/av1/encoder/rd.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_RD_H_ |
13 | | #define AOM_AV1_ENCODER_RD_H_ |
14 | | |
15 | | #include <limits.h> |
16 | | |
17 | | #include "aom/aomcx.h" |
18 | | #include "av1/common/blockd.h" |
19 | | #include "av1/encoder/block.h" |
20 | | #include "av1/encoder/context_tree.h" |
21 | | #include "av1/encoder/cost.h" |
22 | | #include "av1/encoder/ratectrl.h" |
23 | | #include "config/aom_config.h" |
24 | | |
25 | | #ifdef __cplusplus |
26 | | extern "C" { |
27 | | #endif |
28 | | |
29 | 0 | #define RDDIV_BITS 7 |
30 | | #define RD_EPB_SHIFT 6 |
31 | | |
32 | | #define RDCOST(RM, R, D) \ |
33 | 0 | (ROUND_POWER_OF_TWO(((int64_t)(R)) * (RM), AV1_PROB_COST_SHIFT) + \ |
34 | 0 | ((D) * (1 << RDDIV_BITS))) |
35 | | |
36 | | #define RDCOST_NEG_R(RM, R, D) \ |
37 | 0 | (((D) * (1 << RDDIV_BITS)) - \ |
38 | 0 | ROUND_POWER_OF_TWO(((int64_t)(R)) * (RM), AV1_PROB_COST_SHIFT)) |
39 | | |
40 | | #define RDCOST_DBL_WITH_NATIVE_BD_DIST(RM, R, D, BD) \ |
41 | 0 | (((((double)(R)) * (RM)) / (double)(1 << AV1_PROB_COST_SHIFT)) + \ |
42 | 0 | ((double)((D) >> (2 * (BD - 8))) * (1 << RDDIV_BITS))) |
43 | | |
44 | | #define QIDX_SKIP_THRESH 115 |
45 | | |
46 | 0 | #define MV_COST_WEIGHT 108 |
47 | 0 | #define MV_COST_WEIGHT_SUB 120 |
48 | | |
49 | | // The fractional part of rd_thresh factor is stored with 5 bits. The maximum |
50 | | // factor that we allow is two, which is stored as 2 ** (5+1) = 64 |
51 | 0 | #define RD_THRESH_FAC_FRAC_BITS (5) |
52 | 0 | #define RD_THRESH_FAC_FRAC_VAL (1 << (RD_THRESH_FAC_FRAC_BITS)) |
53 | 0 | #define RD_THRESH_MAX_FACT ((RD_THRESH_FAC_FRAC_VAL) << 1) |
54 | 0 | #define RD_THRESH_LOG_DEC_FACTOR (4) |
55 | | #define RD_THRESH_INC (1) |
56 | | |
57 | | // Factor to weigh the rate for switchable interp filters. |
58 | 0 | #define SWITCHABLE_INTERP_RATE_FACTOR 1 |
59 | | |
60 | | // Macros for common video resolutions: width x height |
61 | | // For example, 720p represents video resolution of 1280x720 pixels. |
62 | 0 | #define RESOLUTION_288P 352 * 288 |
63 | 0 | #define RESOLUTION_360P 640 * 360 |
64 | 0 | #define RESOLUTION_480P 640 * 480 |
65 | 0 | #define RESOLUTION_720P 1280 * 720 |
66 | 0 | #define RESOLUTION_1080P 1920 * 1080 |
67 | 0 | #define RESOLUTION_1440P 2560 * 1440 |
68 | | #define RESOLUTION_4K 3840 * 2160 |
69 | | |
70 | 0 | #define RTC_REFS 4 |
71 | | static const MV_REFERENCE_FRAME real_time_ref_combos[RTC_REFS][2] = { |
72 | | { LAST_FRAME, NONE_FRAME }, |
73 | | { ALTREF_FRAME, NONE_FRAME }, |
74 | | { GOLDEN_FRAME, NONE_FRAME }, |
75 | | { INTRA_FRAME, NONE_FRAME } |
76 | | }; |
77 | | |
78 | 0 | static inline int mode_offset(const PREDICTION_MODE mode) { |
79 | 0 | if (mode >= NEARESTMV) { |
80 | 0 | return INTER_OFFSET(mode); |
81 | 0 | } else { |
82 | 0 | switch (mode) { |
83 | 0 | case DC_PRED: return 0; |
84 | 0 | case V_PRED: return 1; |
85 | 0 | case H_PRED: return 2; |
86 | 0 | case SMOOTH_PRED: return 3; |
87 | 0 | default: assert(0); return -1; |
88 | 0 | } |
89 | 0 | } |
90 | 0 | } Unexecuted instantiation: av1_cx_iface.c:mode_offset Unexecuted instantiation: allintra_vis.c:mode_offset Unexecuted instantiation: av1_quantize.c:mode_offset Unexecuted instantiation: bitstream.c:mode_offset Unexecuted instantiation: context_tree.c:mode_offset Unexecuted instantiation: encodeframe.c:mode_offset Unexecuted instantiation: encodeframe_utils.c:mode_offset Unexecuted instantiation: encodemb.c:mode_offset Unexecuted instantiation: encodemv.c:mode_offset Unexecuted instantiation: encoder.c:mode_offset Unexecuted instantiation: encoder_utils.c:mode_offset Unexecuted instantiation: encodetxb.c:mode_offset Unexecuted instantiation: ethread.c:mode_offset Unexecuted instantiation: firstpass.c:mode_offset Unexecuted instantiation: global_motion_facade.c:mode_offset Unexecuted instantiation: level.c:mode_offset Unexecuted instantiation: lookahead.c:mode_offset Unexecuted instantiation: mcomp.c:mode_offset Unexecuted instantiation: mv_prec.c:mode_offset Unexecuted instantiation: palette.c:mode_offset Unexecuted instantiation: partition_search.c:mode_offset Unexecuted instantiation: partition_strategy.c:mode_offset Unexecuted instantiation: pass2_strategy.c:mode_offset Unexecuted instantiation: pickcdef.c:mode_offset Unexecuted instantiation: picklpf.c:mode_offset Unexecuted instantiation: pickrst.c:mode_offset Unexecuted instantiation: ratectrl.c:mode_offset Unexecuted instantiation: rd.c:mode_offset Unexecuted instantiation: rdopt.c:mode_offset Unexecuted instantiation: nonrd_pickmode.c:mode_offset Unexecuted instantiation: nonrd_opt.c:mode_offset Unexecuted instantiation: segmentation.c:mode_offset Unexecuted instantiation: speed_features.c:mode_offset Unexecuted instantiation: superres_scale.c:mode_offset Unexecuted instantiation: svc_layercontext.c:mode_offset Unexecuted instantiation: temporal_filter.c:mode_offset Unexecuted instantiation: tokenize.c:mode_offset Unexecuted instantiation: tpl_model.c:mode_offset Unexecuted instantiation: tx_search.c:mode_offset Unexecuted instantiation: txb_rdopt.c:mode_offset Unexecuted instantiation: intra_mode_search.c:mode_offset Unexecuted instantiation: var_based_part.c:mode_offset Unexecuted instantiation: av1_noise_estimate.c:mode_offset Unexecuted instantiation: aq_complexity.c:mode_offset Unexecuted instantiation: aq_cyclicrefresh.c:mode_offset Unexecuted instantiation: aq_variance.c:mode_offset Unexecuted instantiation: compound_type.c:mode_offset Unexecuted instantiation: encode_strategy.c:mode_offset Unexecuted instantiation: global_motion.c:mode_offset Unexecuted instantiation: gop_structure.c:mode_offset Unexecuted instantiation: interp_search.c:mode_offset Unexecuted instantiation: motion_search_facade.c:mode_offset |
91 | | |
92 | | enum { |
93 | | // Default initialization when we are not using winner mode framework. e.g. |
94 | | // intrabc |
95 | | DEFAULT_EVAL = 0, |
96 | | // Initialization for selecting winner mode |
97 | | MODE_EVAL, |
98 | | // Initialization for winner mode evaluation |
99 | | WINNER_MODE_EVAL, |
100 | | // All mode evaluation types |
101 | | MODE_EVAL_TYPES, |
102 | | } UENUM1BYTE(MODE_EVAL_TYPE); |
103 | | |
104 | | typedef struct RD_OPT { |
105 | | // Thresh_mult is used to set a threshold for the rd score. A higher value |
106 | | // means that we will accept the best mode so far more often. This number |
107 | | // is used in combination with the current block size, and thresh_freq_fact |
108 | | // to pick a threshold. |
109 | | int thresh_mult[MAX_MODES]; |
110 | | |
111 | | int threshes[MAX_SEGMENTS][BLOCK_SIZES_ALL][MAX_MODES]; |
112 | | |
113 | | int RDMULT; |
114 | | |
115 | | double r0; |
116 | | } RD_OPT; |
117 | | |
118 | 0 | static inline void av1_init_rd_stats(RD_STATS *rd_stats) { |
119 | | #if CONFIG_RD_DEBUG |
120 | | int plane; |
121 | | #endif |
122 | 0 | rd_stats->rate = 0; |
123 | 0 | rd_stats->dist = 0; |
124 | 0 | rd_stats->rdcost = 0; |
125 | 0 | rd_stats->sse = 0; |
126 | 0 | rd_stats->skip_txfm = 1; |
127 | 0 | rd_stats->zero_rate = 0; |
128 | | #if CONFIG_RD_DEBUG |
129 | | // This may run into problems when monochrome video is |
130 | | // encoded, as there will only be 1 plane |
131 | | for (plane = 0; plane < MAX_MB_PLANE; ++plane) { |
132 | | rd_stats->txb_coeff_cost[plane] = 0; |
133 | | } |
134 | | #endif |
135 | 0 | } Unexecuted instantiation: av1_cx_iface.c:av1_init_rd_stats Unexecuted instantiation: allintra_vis.c:av1_init_rd_stats Unexecuted instantiation: av1_quantize.c:av1_init_rd_stats Unexecuted instantiation: bitstream.c:av1_init_rd_stats Unexecuted instantiation: context_tree.c:av1_init_rd_stats Unexecuted instantiation: encodeframe.c:av1_init_rd_stats Unexecuted instantiation: encodeframe_utils.c:av1_init_rd_stats Unexecuted instantiation: encodemb.c:av1_init_rd_stats Unexecuted instantiation: encodemv.c:av1_init_rd_stats Unexecuted instantiation: encoder.c:av1_init_rd_stats Unexecuted instantiation: encoder_utils.c:av1_init_rd_stats Unexecuted instantiation: encodetxb.c:av1_init_rd_stats Unexecuted instantiation: ethread.c:av1_init_rd_stats Unexecuted instantiation: firstpass.c:av1_init_rd_stats Unexecuted instantiation: global_motion_facade.c:av1_init_rd_stats Unexecuted instantiation: level.c:av1_init_rd_stats Unexecuted instantiation: lookahead.c:av1_init_rd_stats Unexecuted instantiation: mcomp.c:av1_init_rd_stats Unexecuted instantiation: mv_prec.c:av1_init_rd_stats Unexecuted instantiation: palette.c:av1_init_rd_stats Unexecuted instantiation: partition_search.c:av1_init_rd_stats Unexecuted instantiation: partition_strategy.c:av1_init_rd_stats Unexecuted instantiation: pass2_strategy.c:av1_init_rd_stats Unexecuted instantiation: pickcdef.c:av1_init_rd_stats Unexecuted instantiation: picklpf.c:av1_init_rd_stats Unexecuted instantiation: pickrst.c:av1_init_rd_stats Unexecuted instantiation: ratectrl.c:av1_init_rd_stats Unexecuted instantiation: rd.c:av1_init_rd_stats Unexecuted instantiation: rdopt.c:av1_init_rd_stats Unexecuted instantiation: nonrd_pickmode.c:av1_init_rd_stats Unexecuted instantiation: nonrd_opt.c:av1_init_rd_stats Unexecuted instantiation: segmentation.c:av1_init_rd_stats Unexecuted instantiation: speed_features.c:av1_init_rd_stats Unexecuted instantiation: superres_scale.c:av1_init_rd_stats Unexecuted instantiation: svc_layercontext.c:av1_init_rd_stats Unexecuted instantiation: temporal_filter.c:av1_init_rd_stats Unexecuted instantiation: tokenize.c:av1_init_rd_stats Unexecuted instantiation: tpl_model.c:av1_init_rd_stats Unexecuted instantiation: tx_search.c:av1_init_rd_stats Unexecuted instantiation: txb_rdopt.c:av1_init_rd_stats Unexecuted instantiation: intra_mode_search.c:av1_init_rd_stats Unexecuted instantiation: var_based_part.c:av1_init_rd_stats Unexecuted instantiation: av1_noise_estimate.c:av1_init_rd_stats Unexecuted instantiation: aq_complexity.c:av1_init_rd_stats Unexecuted instantiation: aq_cyclicrefresh.c:av1_init_rd_stats Unexecuted instantiation: aq_variance.c:av1_init_rd_stats Unexecuted instantiation: compound_type.c:av1_init_rd_stats Unexecuted instantiation: encode_strategy.c:av1_init_rd_stats Unexecuted instantiation: global_motion.c:av1_init_rd_stats Unexecuted instantiation: gop_structure.c:av1_init_rd_stats Unexecuted instantiation: interp_search.c:av1_init_rd_stats Unexecuted instantiation: motion_search_facade.c:av1_init_rd_stats |
136 | | |
137 | 0 | static inline void av1_invalid_rd_stats(RD_STATS *rd_stats) { |
138 | | #if CONFIG_RD_DEBUG |
139 | | int plane; |
140 | | #endif |
141 | 0 | rd_stats->rate = INT_MAX; |
142 | 0 | rd_stats->dist = INT64_MAX; |
143 | 0 | rd_stats->rdcost = INT64_MAX; |
144 | 0 | rd_stats->sse = INT64_MAX; |
145 | 0 | rd_stats->skip_txfm = 0; |
146 | 0 | rd_stats->zero_rate = 0; |
147 | | #if CONFIG_RD_DEBUG |
148 | | // This may run into problems when monochrome video is |
149 | | // encoded, as there will only be 1 plane |
150 | | for (plane = 0; plane < MAX_MB_PLANE; ++plane) { |
151 | | rd_stats->txb_coeff_cost[plane] = INT_MAX; |
152 | | } |
153 | | #endif |
154 | 0 | } Unexecuted instantiation: av1_cx_iface.c:av1_invalid_rd_stats Unexecuted instantiation: allintra_vis.c:av1_invalid_rd_stats Unexecuted instantiation: av1_quantize.c:av1_invalid_rd_stats Unexecuted instantiation: bitstream.c:av1_invalid_rd_stats Unexecuted instantiation: context_tree.c:av1_invalid_rd_stats Unexecuted instantiation: encodeframe.c:av1_invalid_rd_stats Unexecuted instantiation: encodeframe_utils.c:av1_invalid_rd_stats Unexecuted instantiation: encodemb.c:av1_invalid_rd_stats Unexecuted instantiation: encodemv.c:av1_invalid_rd_stats Unexecuted instantiation: encoder.c:av1_invalid_rd_stats Unexecuted instantiation: encoder_utils.c:av1_invalid_rd_stats Unexecuted instantiation: encodetxb.c:av1_invalid_rd_stats Unexecuted instantiation: ethread.c:av1_invalid_rd_stats Unexecuted instantiation: firstpass.c:av1_invalid_rd_stats Unexecuted instantiation: global_motion_facade.c:av1_invalid_rd_stats Unexecuted instantiation: level.c:av1_invalid_rd_stats Unexecuted instantiation: lookahead.c:av1_invalid_rd_stats Unexecuted instantiation: mcomp.c:av1_invalid_rd_stats Unexecuted instantiation: mv_prec.c:av1_invalid_rd_stats Unexecuted instantiation: palette.c:av1_invalid_rd_stats Unexecuted instantiation: partition_search.c:av1_invalid_rd_stats Unexecuted instantiation: partition_strategy.c:av1_invalid_rd_stats Unexecuted instantiation: pass2_strategy.c:av1_invalid_rd_stats Unexecuted instantiation: pickcdef.c:av1_invalid_rd_stats Unexecuted instantiation: picklpf.c:av1_invalid_rd_stats Unexecuted instantiation: pickrst.c:av1_invalid_rd_stats Unexecuted instantiation: ratectrl.c:av1_invalid_rd_stats Unexecuted instantiation: rd.c:av1_invalid_rd_stats Unexecuted instantiation: rdopt.c:av1_invalid_rd_stats Unexecuted instantiation: nonrd_pickmode.c:av1_invalid_rd_stats Unexecuted instantiation: nonrd_opt.c:av1_invalid_rd_stats Unexecuted instantiation: segmentation.c:av1_invalid_rd_stats Unexecuted instantiation: speed_features.c:av1_invalid_rd_stats Unexecuted instantiation: superres_scale.c:av1_invalid_rd_stats Unexecuted instantiation: svc_layercontext.c:av1_invalid_rd_stats Unexecuted instantiation: temporal_filter.c:av1_invalid_rd_stats Unexecuted instantiation: tokenize.c:av1_invalid_rd_stats Unexecuted instantiation: tpl_model.c:av1_invalid_rd_stats Unexecuted instantiation: tx_search.c:av1_invalid_rd_stats Unexecuted instantiation: txb_rdopt.c:av1_invalid_rd_stats Unexecuted instantiation: intra_mode_search.c:av1_invalid_rd_stats Unexecuted instantiation: var_based_part.c:av1_invalid_rd_stats Unexecuted instantiation: av1_noise_estimate.c:av1_invalid_rd_stats Unexecuted instantiation: aq_complexity.c:av1_invalid_rd_stats Unexecuted instantiation: aq_cyclicrefresh.c:av1_invalid_rd_stats Unexecuted instantiation: aq_variance.c:av1_invalid_rd_stats Unexecuted instantiation: compound_type.c:av1_invalid_rd_stats Unexecuted instantiation: encode_strategy.c:av1_invalid_rd_stats Unexecuted instantiation: global_motion.c:av1_invalid_rd_stats Unexecuted instantiation: gop_structure.c:av1_invalid_rd_stats Unexecuted instantiation: interp_search.c:av1_invalid_rd_stats Unexecuted instantiation: motion_search_facade.c:av1_invalid_rd_stats |
155 | | |
156 | | static inline void av1_merge_rd_stats(RD_STATS *rd_stats_dst, |
157 | 0 | const RD_STATS *rd_stats_src) { |
158 | 0 | if (rd_stats_dst->rate == INT_MAX || rd_stats_src->rate == INT_MAX) { |
159 | | // If rd_stats_dst or rd_stats_src has invalid rate, we will make |
160 | | // rd_stats_dst invalid. |
161 | 0 | av1_invalid_rd_stats(rd_stats_dst); |
162 | 0 | return; |
163 | 0 | } |
164 | 0 | rd_stats_dst->rate = (int)AOMMIN( |
165 | 0 | ((int64_t)rd_stats_dst->rate + (int64_t)rd_stats_src->rate), INT_MAX); |
166 | 0 | if (!rd_stats_dst->zero_rate) |
167 | 0 | rd_stats_dst->zero_rate = rd_stats_src->zero_rate; |
168 | 0 | rd_stats_dst->dist += rd_stats_src->dist; |
169 | 0 | if (rd_stats_dst->sse < INT64_MAX && rd_stats_src->sse < INT64_MAX) { |
170 | 0 | rd_stats_dst->sse += rd_stats_src->sse; |
171 | 0 | } |
172 | 0 | rd_stats_dst->skip_txfm &= rd_stats_src->skip_txfm; |
173 | | #if CONFIG_RD_DEBUG |
174 | | // This may run into problems when monochrome video is |
175 | | // encoded, as there will only be 1 plane |
176 | | for (int plane = 0; plane < MAX_MB_PLANE; ++plane) { |
177 | | rd_stats_dst->txb_coeff_cost[plane] += rd_stats_src->txb_coeff_cost[plane]; |
178 | | } |
179 | | #endif |
180 | 0 | } Unexecuted instantiation: av1_cx_iface.c:av1_merge_rd_stats Unexecuted instantiation: allintra_vis.c:av1_merge_rd_stats Unexecuted instantiation: av1_quantize.c:av1_merge_rd_stats Unexecuted instantiation: bitstream.c:av1_merge_rd_stats Unexecuted instantiation: context_tree.c:av1_merge_rd_stats Unexecuted instantiation: encodeframe.c:av1_merge_rd_stats Unexecuted instantiation: encodeframe_utils.c:av1_merge_rd_stats Unexecuted instantiation: encodemb.c:av1_merge_rd_stats Unexecuted instantiation: encodemv.c:av1_merge_rd_stats Unexecuted instantiation: encoder.c:av1_merge_rd_stats Unexecuted instantiation: encoder_utils.c:av1_merge_rd_stats Unexecuted instantiation: encodetxb.c:av1_merge_rd_stats Unexecuted instantiation: ethread.c:av1_merge_rd_stats Unexecuted instantiation: firstpass.c:av1_merge_rd_stats Unexecuted instantiation: global_motion_facade.c:av1_merge_rd_stats Unexecuted instantiation: level.c:av1_merge_rd_stats Unexecuted instantiation: lookahead.c:av1_merge_rd_stats Unexecuted instantiation: mcomp.c:av1_merge_rd_stats Unexecuted instantiation: mv_prec.c:av1_merge_rd_stats Unexecuted instantiation: palette.c:av1_merge_rd_stats Unexecuted instantiation: partition_search.c:av1_merge_rd_stats Unexecuted instantiation: partition_strategy.c:av1_merge_rd_stats Unexecuted instantiation: pass2_strategy.c:av1_merge_rd_stats Unexecuted instantiation: pickcdef.c:av1_merge_rd_stats Unexecuted instantiation: picklpf.c:av1_merge_rd_stats Unexecuted instantiation: pickrst.c:av1_merge_rd_stats Unexecuted instantiation: ratectrl.c:av1_merge_rd_stats Unexecuted instantiation: rd.c:av1_merge_rd_stats Unexecuted instantiation: rdopt.c:av1_merge_rd_stats Unexecuted instantiation: nonrd_pickmode.c:av1_merge_rd_stats Unexecuted instantiation: nonrd_opt.c:av1_merge_rd_stats Unexecuted instantiation: segmentation.c:av1_merge_rd_stats Unexecuted instantiation: speed_features.c:av1_merge_rd_stats Unexecuted instantiation: superres_scale.c:av1_merge_rd_stats Unexecuted instantiation: svc_layercontext.c:av1_merge_rd_stats Unexecuted instantiation: temporal_filter.c:av1_merge_rd_stats Unexecuted instantiation: tokenize.c:av1_merge_rd_stats Unexecuted instantiation: tpl_model.c:av1_merge_rd_stats Unexecuted instantiation: tx_search.c:av1_merge_rd_stats Unexecuted instantiation: txb_rdopt.c:av1_merge_rd_stats Unexecuted instantiation: intra_mode_search.c:av1_merge_rd_stats Unexecuted instantiation: var_based_part.c:av1_merge_rd_stats Unexecuted instantiation: av1_noise_estimate.c:av1_merge_rd_stats Unexecuted instantiation: aq_complexity.c:av1_merge_rd_stats Unexecuted instantiation: aq_cyclicrefresh.c:av1_merge_rd_stats Unexecuted instantiation: aq_variance.c:av1_merge_rd_stats Unexecuted instantiation: compound_type.c:av1_merge_rd_stats Unexecuted instantiation: encode_strategy.c:av1_merge_rd_stats Unexecuted instantiation: global_motion.c:av1_merge_rd_stats Unexecuted instantiation: gop_structure.c:av1_merge_rd_stats Unexecuted instantiation: interp_search.c:av1_merge_rd_stats Unexecuted instantiation: motion_search_facade.c:av1_merge_rd_stats |
181 | | |
182 | | static inline void av1_accumulate_rd_stats(RD_STATS *rd_stats, int64_t dist, |
183 | | int rate, int skip_txfm, int64_t sse, |
184 | 0 | int zero_rate) { |
185 | 0 | assert(rd_stats->rate != INT_MAX && rate != INT_MAX); |
186 | 0 | rd_stats->rate += rate; |
187 | 0 | if (!rd_stats->zero_rate) rd_stats->zero_rate = zero_rate; |
188 | 0 | rd_stats->dist += dist; |
189 | 0 | rd_stats->skip_txfm &= skip_txfm; |
190 | 0 | rd_stats->sse += sse; |
191 | 0 | } Unexecuted instantiation: av1_cx_iface.c:av1_accumulate_rd_stats Unexecuted instantiation: allintra_vis.c:av1_accumulate_rd_stats Unexecuted instantiation: av1_quantize.c:av1_accumulate_rd_stats Unexecuted instantiation: bitstream.c:av1_accumulate_rd_stats Unexecuted instantiation: context_tree.c:av1_accumulate_rd_stats Unexecuted instantiation: encodeframe.c:av1_accumulate_rd_stats Unexecuted instantiation: encodeframe_utils.c:av1_accumulate_rd_stats Unexecuted instantiation: encodemb.c:av1_accumulate_rd_stats Unexecuted instantiation: encodemv.c:av1_accumulate_rd_stats Unexecuted instantiation: encoder.c:av1_accumulate_rd_stats Unexecuted instantiation: encoder_utils.c:av1_accumulate_rd_stats Unexecuted instantiation: encodetxb.c:av1_accumulate_rd_stats Unexecuted instantiation: ethread.c:av1_accumulate_rd_stats Unexecuted instantiation: firstpass.c:av1_accumulate_rd_stats Unexecuted instantiation: global_motion_facade.c:av1_accumulate_rd_stats Unexecuted instantiation: level.c:av1_accumulate_rd_stats Unexecuted instantiation: lookahead.c:av1_accumulate_rd_stats Unexecuted instantiation: mcomp.c:av1_accumulate_rd_stats Unexecuted instantiation: mv_prec.c:av1_accumulate_rd_stats Unexecuted instantiation: palette.c:av1_accumulate_rd_stats Unexecuted instantiation: partition_search.c:av1_accumulate_rd_stats Unexecuted instantiation: partition_strategy.c:av1_accumulate_rd_stats Unexecuted instantiation: pass2_strategy.c:av1_accumulate_rd_stats Unexecuted instantiation: pickcdef.c:av1_accumulate_rd_stats Unexecuted instantiation: picklpf.c:av1_accumulate_rd_stats Unexecuted instantiation: pickrst.c:av1_accumulate_rd_stats Unexecuted instantiation: ratectrl.c:av1_accumulate_rd_stats Unexecuted instantiation: rd.c:av1_accumulate_rd_stats Unexecuted instantiation: rdopt.c:av1_accumulate_rd_stats Unexecuted instantiation: nonrd_pickmode.c:av1_accumulate_rd_stats Unexecuted instantiation: nonrd_opt.c:av1_accumulate_rd_stats Unexecuted instantiation: segmentation.c:av1_accumulate_rd_stats Unexecuted instantiation: speed_features.c:av1_accumulate_rd_stats Unexecuted instantiation: superres_scale.c:av1_accumulate_rd_stats Unexecuted instantiation: svc_layercontext.c:av1_accumulate_rd_stats Unexecuted instantiation: temporal_filter.c:av1_accumulate_rd_stats Unexecuted instantiation: tokenize.c:av1_accumulate_rd_stats Unexecuted instantiation: tpl_model.c:av1_accumulate_rd_stats Unexecuted instantiation: tx_search.c:av1_accumulate_rd_stats Unexecuted instantiation: txb_rdopt.c:av1_accumulate_rd_stats Unexecuted instantiation: intra_mode_search.c:av1_accumulate_rd_stats Unexecuted instantiation: var_based_part.c:av1_accumulate_rd_stats Unexecuted instantiation: av1_noise_estimate.c:av1_accumulate_rd_stats Unexecuted instantiation: aq_complexity.c:av1_accumulate_rd_stats Unexecuted instantiation: aq_cyclicrefresh.c:av1_accumulate_rd_stats Unexecuted instantiation: aq_variance.c:av1_accumulate_rd_stats Unexecuted instantiation: compound_type.c:av1_accumulate_rd_stats Unexecuted instantiation: encode_strategy.c:av1_accumulate_rd_stats Unexecuted instantiation: global_motion.c:av1_accumulate_rd_stats Unexecuted instantiation: gop_structure.c:av1_accumulate_rd_stats Unexecuted instantiation: interp_search.c:av1_accumulate_rd_stats Unexecuted instantiation: motion_search_facade.c:av1_accumulate_rd_stats |
192 | | |
193 | 0 | static inline int64_t av1_calculate_rd_cost(int mult, int rate, int64_t dist) { |
194 | 0 | assert(mult >= 0); |
195 | 0 | if (rate >= 0) { |
196 | 0 | return RDCOST(mult, rate, dist); |
197 | 0 | } |
198 | 0 | return RDCOST_NEG_R(mult, -rate, dist); |
199 | 0 | } Unexecuted instantiation: av1_cx_iface.c:av1_calculate_rd_cost Unexecuted instantiation: allintra_vis.c:av1_calculate_rd_cost Unexecuted instantiation: av1_quantize.c:av1_calculate_rd_cost Unexecuted instantiation: bitstream.c:av1_calculate_rd_cost Unexecuted instantiation: context_tree.c:av1_calculate_rd_cost Unexecuted instantiation: encodeframe.c:av1_calculate_rd_cost Unexecuted instantiation: encodeframe_utils.c:av1_calculate_rd_cost Unexecuted instantiation: encodemb.c:av1_calculate_rd_cost Unexecuted instantiation: encodemv.c:av1_calculate_rd_cost Unexecuted instantiation: encoder.c:av1_calculate_rd_cost Unexecuted instantiation: encoder_utils.c:av1_calculate_rd_cost Unexecuted instantiation: encodetxb.c:av1_calculate_rd_cost Unexecuted instantiation: ethread.c:av1_calculate_rd_cost Unexecuted instantiation: firstpass.c:av1_calculate_rd_cost Unexecuted instantiation: global_motion_facade.c:av1_calculate_rd_cost Unexecuted instantiation: level.c:av1_calculate_rd_cost Unexecuted instantiation: lookahead.c:av1_calculate_rd_cost Unexecuted instantiation: mcomp.c:av1_calculate_rd_cost Unexecuted instantiation: mv_prec.c:av1_calculate_rd_cost Unexecuted instantiation: palette.c:av1_calculate_rd_cost Unexecuted instantiation: partition_search.c:av1_calculate_rd_cost Unexecuted instantiation: partition_strategy.c:av1_calculate_rd_cost Unexecuted instantiation: pass2_strategy.c:av1_calculate_rd_cost Unexecuted instantiation: pickcdef.c:av1_calculate_rd_cost Unexecuted instantiation: picklpf.c:av1_calculate_rd_cost Unexecuted instantiation: pickrst.c:av1_calculate_rd_cost Unexecuted instantiation: ratectrl.c:av1_calculate_rd_cost Unexecuted instantiation: rd.c:av1_calculate_rd_cost Unexecuted instantiation: rdopt.c:av1_calculate_rd_cost Unexecuted instantiation: nonrd_pickmode.c:av1_calculate_rd_cost Unexecuted instantiation: nonrd_opt.c:av1_calculate_rd_cost Unexecuted instantiation: segmentation.c:av1_calculate_rd_cost Unexecuted instantiation: speed_features.c:av1_calculate_rd_cost Unexecuted instantiation: superres_scale.c:av1_calculate_rd_cost Unexecuted instantiation: svc_layercontext.c:av1_calculate_rd_cost Unexecuted instantiation: temporal_filter.c:av1_calculate_rd_cost Unexecuted instantiation: tokenize.c:av1_calculate_rd_cost Unexecuted instantiation: tpl_model.c:av1_calculate_rd_cost Unexecuted instantiation: tx_search.c:av1_calculate_rd_cost Unexecuted instantiation: txb_rdopt.c:av1_calculate_rd_cost Unexecuted instantiation: intra_mode_search.c:av1_calculate_rd_cost Unexecuted instantiation: var_based_part.c:av1_calculate_rd_cost Unexecuted instantiation: av1_noise_estimate.c:av1_calculate_rd_cost Unexecuted instantiation: aq_complexity.c:av1_calculate_rd_cost Unexecuted instantiation: aq_cyclicrefresh.c:av1_calculate_rd_cost Unexecuted instantiation: aq_variance.c:av1_calculate_rd_cost Unexecuted instantiation: compound_type.c:av1_calculate_rd_cost Unexecuted instantiation: encode_strategy.c:av1_calculate_rd_cost Unexecuted instantiation: global_motion.c:av1_calculate_rd_cost Unexecuted instantiation: gop_structure.c:av1_calculate_rd_cost Unexecuted instantiation: interp_search.c:av1_calculate_rd_cost Unexecuted instantiation: motion_search_facade.c:av1_calculate_rd_cost |
200 | | |
201 | 0 | static inline void av1_rd_cost_update(int mult, RD_STATS *rd_cost) { |
202 | 0 | if (rd_cost->rate < INT_MAX && rd_cost->dist < INT64_MAX && |
203 | 0 | rd_cost->rdcost < INT64_MAX) { |
204 | 0 | rd_cost->rdcost = av1_calculate_rd_cost(mult, rd_cost->rate, rd_cost->dist); |
205 | 0 | } else { |
206 | 0 | av1_invalid_rd_stats(rd_cost); |
207 | 0 | } |
208 | 0 | } Unexecuted instantiation: av1_cx_iface.c:av1_rd_cost_update Unexecuted instantiation: allintra_vis.c:av1_rd_cost_update Unexecuted instantiation: av1_quantize.c:av1_rd_cost_update Unexecuted instantiation: bitstream.c:av1_rd_cost_update Unexecuted instantiation: context_tree.c:av1_rd_cost_update Unexecuted instantiation: encodeframe.c:av1_rd_cost_update Unexecuted instantiation: encodeframe_utils.c:av1_rd_cost_update Unexecuted instantiation: encodemb.c:av1_rd_cost_update Unexecuted instantiation: encodemv.c:av1_rd_cost_update Unexecuted instantiation: encoder.c:av1_rd_cost_update Unexecuted instantiation: encoder_utils.c:av1_rd_cost_update Unexecuted instantiation: encodetxb.c:av1_rd_cost_update Unexecuted instantiation: ethread.c:av1_rd_cost_update Unexecuted instantiation: firstpass.c:av1_rd_cost_update Unexecuted instantiation: global_motion_facade.c:av1_rd_cost_update Unexecuted instantiation: level.c:av1_rd_cost_update Unexecuted instantiation: lookahead.c:av1_rd_cost_update Unexecuted instantiation: mcomp.c:av1_rd_cost_update Unexecuted instantiation: mv_prec.c:av1_rd_cost_update Unexecuted instantiation: palette.c:av1_rd_cost_update Unexecuted instantiation: partition_search.c:av1_rd_cost_update Unexecuted instantiation: partition_strategy.c:av1_rd_cost_update Unexecuted instantiation: pass2_strategy.c:av1_rd_cost_update Unexecuted instantiation: pickcdef.c:av1_rd_cost_update Unexecuted instantiation: picklpf.c:av1_rd_cost_update Unexecuted instantiation: pickrst.c:av1_rd_cost_update Unexecuted instantiation: ratectrl.c:av1_rd_cost_update Unexecuted instantiation: rd.c:av1_rd_cost_update Unexecuted instantiation: rdopt.c:av1_rd_cost_update Unexecuted instantiation: nonrd_pickmode.c:av1_rd_cost_update Unexecuted instantiation: nonrd_opt.c:av1_rd_cost_update Unexecuted instantiation: segmentation.c:av1_rd_cost_update Unexecuted instantiation: speed_features.c:av1_rd_cost_update Unexecuted instantiation: superres_scale.c:av1_rd_cost_update Unexecuted instantiation: svc_layercontext.c:av1_rd_cost_update Unexecuted instantiation: temporal_filter.c:av1_rd_cost_update Unexecuted instantiation: tokenize.c:av1_rd_cost_update Unexecuted instantiation: tpl_model.c:av1_rd_cost_update Unexecuted instantiation: tx_search.c:av1_rd_cost_update Unexecuted instantiation: txb_rdopt.c:av1_rd_cost_update Unexecuted instantiation: intra_mode_search.c:av1_rd_cost_update Unexecuted instantiation: var_based_part.c:av1_rd_cost_update Unexecuted instantiation: av1_noise_estimate.c:av1_rd_cost_update Unexecuted instantiation: aq_complexity.c:av1_rd_cost_update Unexecuted instantiation: aq_cyclicrefresh.c:av1_rd_cost_update Unexecuted instantiation: aq_variance.c:av1_rd_cost_update Unexecuted instantiation: compound_type.c:av1_rd_cost_update Unexecuted instantiation: encode_strategy.c:av1_rd_cost_update Unexecuted instantiation: global_motion.c:av1_rd_cost_update Unexecuted instantiation: gop_structure.c:av1_rd_cost_update Unexecuted instantiation: interp_search.c:av1_rd_cost_update Unexecuted instantiation: motion_search_facade.c:av1_rd_cost_update |
209 | | |
210 | | static inline void av1_rd_stats_subtraction(int mult, |
211 | | const RD_STATS *const left, |
212 | | const RD_STATS *const right, |
213 | 0 | RD_STATS *result) { |
214 | 0 | if (left->rate == INT_MAX || right->rate == INT_MAX || |
215 | 0 | left->dist == INT64_MAX || right->dist == INT64_MAX || |
216 | 0 | left->rdcost == INT64_MAX || right->rdcost == INT64_MAX) { |
217 | 0 | av1_invalid_rd_stats(result); |
218 | 0 | } else { |
219 | 0 | result->rate = left->rate - right->rate; |
220 | 0 | result->dist = left->dist - right->dist; |
221 | 0 | result->rdcost = av1_calculate_rd_cost(mult, result->rate, result->dist); |
222 | 0 | } |
223 | 0 | } Unexecuted instantiation: av1_cx_iface.c:av1_rd_stats_subtraction Unexecuted instantiation: allintra_vis.c:av1_rd_stats_subtraction Unexecuted instantiation: av1_quantize.c:av1_rd_stats_subtraction Unexecuted instantiation: bitstream.c:av1_rd_stats_subtraction Unexecuted instantiation: context_tree.c:av1_rd_stats_subtraction Unexecuted instantiation: encodeframe.c:av1_rd_stats_subtraction Unexecuted instantiation: encodeframe_utils.c:av1_rd_stats_subtraction Unexecuted instantiation: encodemb.c:av1_rd_stats_subtraction Unexecuted instantiation: encodemv.c:av1_rd_stats_subtraction Unexecuted instantiation: encoder.c:av1_rd_stats_subtraction Unexecuted instantiation: encoder_utils.c:av1_rd_stats_subtraction Unexecuted instantiation: encodetxb.c:av1_rd_stats_subtraction Unexecuted instantiation: ethread.c:av1_rd_stats_subtraction Unexecuted instantiation: firstpass.c:av1_rd_stats_subtraction Unexecuted instantiation: global_motion_facade.c:av1_rd_stats_subtraction Unexecuted instantiation: level.c:av1_rd_stats_subtraction Unexecuted instantiation: lookahead.c:av1_rd_stats_subtraction Unexecuted instantiation: mcomp.c:av1_rd_stats_subtraction Unexecuted instantiation: mv_prec.c:av1_rd_stats_subtraction Unexecuted instantiation: palette.c:av1_rd_stats_subtraction Unexecuted instantiation: partition_search.c:av1_rd_stats_subtraction Unexecuted instantiation: partition_strategy.c:av1_rd_stats_subtraction Unexecuted instantiation: pass2_strategy.c:av1_rd_stats_subtraction Unexecuted instantiation: pickcdef.c:av1_rd_stats_subtraction Unexecuted instantiation: picklpf.c:av1_rd_stats_subtraction Unexecuted instantiation: pickrst.c:av1_rd_stats_subtraction Unexecuted instantiation: ratectrl.c:av1_rd_stats_subtraction Unexecuted instantiation: rd.c:av1_rd_stats_subtraction Unexecuted instantiation: rdopt.c:av1_rd_stats_subtraction Unexecuted instantiation: nonrd_pickmode.c:av1_rd_stats_subtraction Unexecuted instantiation: nonrd_opt.c:av1_rd_stats_subtraction Unexecuted instantiation: segmentation.c:av1_rd_stats_subtraction Unexecuted instantiation: speed_features.c:av1_rd_stats_subtraction Unexecuted instantiation: superres_scale.c:av1_rd_stats_subtraction Unexecuted instantiation: svc_layercontext.c:av1_rd_stats_subtraction Unexecuted instantiation: temporal_filter.c:av1_rd_stats_subtraction Unexecuted instantiation: tokenize.c:av1_rd_stats_subtraction Unexecuted instantiation: tpl_model.c:av1_rd_stats_subtraction Unexecuted instantiation: tx_search.c:av1_rd_stats_subtraction Unexecuted instantiation: txb_rdopt.c:av1_rd_stats_subtraction Unexecuted instantiation: intra_mode_search.c:av1_rd_stats_subtraction Unexecuted instantiation: var_based_part.c:av1_rd_stats_subtraction Unexecuted instantiation: av1_noise_estimate.c:av1_rd_stats_subtraction Unexecuted instantiation: aq_complexity.c:av1_rd_stats_subtraction Unexecuted instantiation: aq_cyclicrefresh.c:av1_rd_stats_subtraction Unexecuted instantiation: aq_variance.c:av1_rd_stats_subtraction Unexecuted instantiation: compound_type.c:av1_rd_stats_subtraction Unexecuted instantiation: encode_strategy.c:av1_rd_stats_subtraction Unexecuted instantiation: global_motion.c:av1_rd_stats_subtraction Unexecuted instantiation: gop_structure.c:av1_rd_stats_subtraction Unexecuted instantiation: interp_search.c:av1_rd_stats_subtraction Unexecuted instantiation: motion_search_facade.c:av1_rd_stats_subtraction |
224 | | |
225 | | struct TileInfo; |
226 | | struct TileDataEnc; |
227 | | struct AV1_COMP; |
228 | | struct macroblock; |
229 | | |
230 | | /*!\brief Compute rdmult based on q index and frame update type |
231 | | * |
232 | | * \param[in] bit_depth bit depth |
233 | | * \param[in] update_type frame update type |
234 | | * \param[in] qindex q index |
235 | | * \param[in] tuning visual tuning metric |
236 | | * |
237 | | * \return rdmult |
238 | | */ |
239 | | int av1_compute_rd_mult_based_on_qindex(aom_bit_depth_t bit_depth, |
240 | | FRAME_UPDATE_TYPE update_type, |
241 | | int qindex, aom_tune_metric tuning); |
242 | | |
243 | | int av1_compute_rd_mult(const int qindex, const aom_bit_depth_t bit_depth, |
244 | | const FRAME_UPDATE_TYPE update_type, |
245 | | const int layer_depth, const int boost_index, |
246 | | const FRAME_TYPE frame_type, |
247 | | const int use_fixed_qp_offsets, |
248 | | const int is_stat_consumption_stage, |
249 | | const aom_tune_metric tuning); |
250 | | |
251 | | void av1_initialize_rd_consts(struct AV1_COMP *cpi); |
252 | | |
253 | | // Sets the multiplier to convert mv cost to l1 error during motion search. |
254 | | void av1_set_sad_per_bit(const struct AV1_COMP *cpi, int *sadperbit, |
255 | | int qindex); |
256 | | |
257 | | void av1_model_rd_from_var_lapndz(int64_t var, unsigned int n, |
258 | | unsigned int qstep, int *rate, int64_t *dist); |
259 | | |
260 | | void av1_model_rd_curvfit(BLOCK_SIZE bsize, double sse_norm, double xqr, |
261 | | double *rate_f, double *distbysse_f); |
262 | | |
263 | | int av1_get_switchable_rate(const MACROBLOCK *x, const MACROBLOCKD *xd, |
264 | | InterpFilter interp_filter, int dual_filter); |
265 | | |
266 | | YV12_BUFFER_CONFIG *av1_get_scaled_ref_frame(const struct AV1_COMP *cpi, |
267 | | int ref_frame); |
268 | | |
269 | | void av1_init_me_luts(void); |
270 | | |
271 | | void av1_set_mvcost(MACROBLOCK *x, int ref, int ref_mv_idx); |
272 | | |
273 | | void av1_get_entropy_contexts(BLOCK_SIZE plane_bsize, |
274 | | const struct macroblockd_plane *pd, |
275 | | ENTROPY_CONTEXT t_above[MAX_MIB_SIZE], |
276 | | ENTROPY_CONTEXT t_left[MAX_MIB_SIZE]); |
277 | | |
278 | | void av1_set_rd_speed_thresholds(struct AV1_COMP *cpi); |
279 | | |
280 | | void av1_update_rd_thresh_fact(const AV1_COMMON *const cm, |
281 | | int (*fact)[MAX_MODES], int rd_thresh, |
282 | | BLOCK_SIZE bsize, THR_MODES best_mode_index, |
283 | | THR_MODES inter_mode_start, |
284 | | THR_MODES inter_mode_end, |
285 | | THR_MODES intra_mode_start, |
286 | | THR_MODES intra_mode_end); |
287 | | |
288 | 0 | static inline void reset_thresh_freq_fact(MACROBLOCK *const x) { |
289 | 0 | for (int i = 0; i < BLOCK_SIZES_ALL; ++i) { |
290 | 0 | for (int j = 0; j < MAX_MODES; ++j) { |
291 | 0 | x->thresh_freq_fact[i][j] = RD_THRESH_FAC_FRAC_VAL; |
292 | 0 | } |
293 | 0 | } |
294 | 0 | } Unexecuted instantiation: av1_cx_iface.c:reset_thresh_freq_fact Unexecuted instantiation: allintra_vis.c:reset_thresh_freq_fact Unexecuted instantiation: av1_quantize.c:reset_thresh_freq_fact Unexecuted instantiation: bitstream.c:reset_thresh_freq_fact Unexecuted instantiation: context_tree.c:reset_thresh_freq_fact Unexecuted instantiation: encodeframe.c:reset_thresh_freq_fact Unexecuted instantiation: encodeframe_utils.c:reset_thresh_freq_fact Unexecuted instantiation: encodemb.c:reset_thresh_freq_fact Unexecuted instantiation: encodemv.c:reset_thresh_freq_fact Unexecuted instantiation: encoder.c:reset_thresh_freq_fact Unexecuted instantiation: encoder_utils.c:reset_thresh_freq_fact Unexecuted instantiation: encodetxb.c:reset_thresh_freq_fact Unexecuted instantiation: ethread.c:reset_thresh_freq_fact Unexecuted instantiation: firstpass.c:reset_thresh_freq_fact Unexecuted instantiation: global_motion_facade.c:reset_thresh_freq_fact Unexecuted instantiation: level.c:reset_thresh_freq_fact Unexecuted instantiation: lookahead.c:reset_thresh_freq_fact Unexecuted instantiation: mcomp.c:reset_thresh_freq_fact Unexecuted instantiation: mv_prec.c:reset_thresh_freq_fact Unexecuted instantiation: palette.c:reset_thresh_freq_fact Unexecuted instantiation: partition_search.c:reset_thresh_freq_fact Unexecuted instantiation: partition_strategy.c:reset_thresh_freq_fact Unexecuted instantiation: pass2_strategy.c:reset_thresh_freq_fact Unexecuted instantiation: pickcdef.c:reset_thresh_freq_fact Unexecuted instantiation: picklpf.c:reset_thresh_freq_fact Unexecuted instantiation: pickrst.c:reset_thresh_freq_fact Unexecuted instantiation: ratectrl.c:reset_thresh_freq_fact Unexecuted instantiation: rd.c:reset_thresh_freq_fact Unexecuted instantiation: rdopt.c:reset_thresh_freq_fact Unexecuted instantiation: nonrd_pickmode.c:reset_thresh_freq_fact Unexecuted instantiation: nonrd_opt.c:reset_thresh_freq_fact Unexecuted instantiation: segmentation.c:reset_thresh_freq_fact Unexecuted instantiation: speed_features.c:reset_thresh_freq_fact Unexecuted instantiation: superres_scale.c:reset_thresh_freq_fact Unexecuted instantiation: svc_layercontext.c:reset_thresh_freq_fact Unexecuted instantiation: temporal_filter.c:reset_thresh_freq_fact Unexecuted instantiation: tokenize.c:reset_thresh_freq_fact Unexecuted instantiation: tpl_model.c:reset_thresh_freq_fact Unexecuted instantiation: tx_search.c:reset_thresh_freq_fact Unexecuted instantiation: txb_rdopt.c:reset_thresh_freq_fact Unexecuted instantiation: intra_mode_search.c:reset_thresh_freq_fact Unexecuted instantiation: var_based_part.c:reset_thresh_freq_fact Unexecuted instantiation: av1_noise_estimate.c:reset_thresh_freq_fact Unexecuted instantiation: aq_complexity.c:reset_thresh_freq_fact Unexecuted instantiation: aq_cyclicrefresh.c:reset_thresh_freq_fact Unexecuted instantiation: aq_variance.c:reset_thresh_freq_fact Unexecuted instantiation: compound_type.c:reset_thresh_freq_fact Unexecuted instantiation: encode_strategy.c:reset_thresh_freq_fact Unexecuted instantiation: global_motion.c:reset_thresh_freq_fact Unexecuted instantiation: gop_structure.c:reset_thresh_freq_fact Unexecuted instantiation: interp_search.c:reset_thresh_freq_fact Unexecuted instantiation: motion_search_facade.c:reset_thresh_freq_fact |
295 | | |
296 | | static inline int rd_less_than_thresh(int64_t best_rd, int64_t thresh, |
297 | 0 | int thresh_fact) { |
298 | 0 | return best_rd < (thresh * thresh_fact >> 5) || thresh == INT_MAX; |
299 | 0 | } Unexecuted instantiation: av1_cx_iface.c:rd_less_than_thresh Unexecuted instantiation: allintra_vis.c:rd_less_than_thresh Unexecuted instantiation: av1_quantize.c:rd_less_than_thresh Unexecuted instantiation: bitstream.c:rd_less_than_thresh Unexecuted instantiation: context_tree.c:rd_less_than_thresh Unexecuted instantiation: encodeframe.c:rd_less_than_thresh Unexecuted instantiation: encodeframe_utils.c:rd_less_than_thresh Unexecuted instantiation: encodemb.c:rd_less_than_thresh Unexecuted instantiation: encodemv.c:rd_less_than_thresh Unexecuted instantiation: encoder.c:rd_less_than_thresh Unexecuted instantiation: encoder_utils.c:rd_less_than_thresh Unexecuted instantiation: encodetxb.c:rd_less_than_thresh Unexecuted instantiation: ethread.c:rd_less_than_thresh Unexecuted instantiation: firstpass.c:rd_less_than_thresh Unexecuted instantiation: global_motion_facade.c:rd_less_than_thresh Unexecuted instantiation: level.c:rd_less_than_thresh Unexecuted instantiation: lookahead.c:rd_less_than_thresh Unexecuted instantiation: mcomp.c:rd_less_than_thresh Unexecuted instantiation: mv_prec.c:rd_less_than_thresh Unexecuted instantiation: palette.c:rd_less_than_thresh Unexecuted instantiation: partition_search.c:rd_less_than_thresh Unexecuted instantiation: partition_strategy.c:rd_less_than_thresh Unexecuted instantiation: pass2_strategy.c:rd_less_than_thresh Unexecuted instantiation: pickcdef.c:rd_less_than_thresh Unexecuted instantiation: picklpf.c:rd_less_than_thresh Unexecuted instantiation: pickrst.c:rd_less_than_thresh Unexecuted instantiation: ratectrl.c:rd_less_than_thresh Unexecuted instantiation: rd.c:rd_less_than_thresh Unexecuted instantiation: rdopt.c:rd_less_than_thresh Unexecuted instantiation: nonrd_pickmode.c:rd_less_than_thresh Unexecuted instantiation: nonrd_opt.c:rd_less_than_thresh Unexecuted instantiation: segmentation.c:rd_less_than_thresh Unexecuted instantiation: speed_features.c:rd_less_than_thresh Unexecuted instantiation: superres_scale.c:rd_less_than_thresh Unexecuted instantiation: svc_layercontext.c:rd_less_than_thresh Unexecuted instantiation: temporal_filter.c:rd_less_than_thresh Unexecuted instantiation: tokenize.c:rd_less_than_thresh Unexecuted instantiation: tpl_model.c:rd_less_than_thresh Unexecuted instantiation: tx_search.c:rd_less_than_thresh Unexecuted instantiation: txb_rdopt.c:rd_less_than_thresh Unexecuted instantiation: intra_mode_search.c:rd_less_than_thresh Unexecuted instantiation: var_based_part.c:rd_less_than_thresh Unexecuted instantiation: av1_noise_estimate.c:rd_less_than_thresh Unexecuted instantiation: aq_complexity.c:rd_less_than_thresh Unexecuted instantiation: aq_cyclicrefresh.c:rd_less_than_thresh Unexecuted instantiation: aq_variance.c:rd_less_than_thresh Unexecuted instantiation: compound_type.c:rd_less_than_thresh Unexecuted instantiation: encode_strategy.c:rd_less_than_thresh Unexecuted instantiation: global_motion.c:rd_less_than_thresh Unexecuted instantiation: gop_structure.c:rd_less_than_thresh Unexecuted instantiation: interp_search.c:rd_less_than_thresh Unexecuted instantiation: motion_search_facade.c:rd_less_than_thresh |
300 | | |
301 | | void av1_mv_pred(const struct AV1_COMP *cpi, MACROBLOCK *x, |
302 | | uint8_t *ref_y_buffer, int ref_y_stride, int ref_frame, |
303 | | BLOCK_SIZE block_size); |
304 | | |
305 | | // Sets the multiplier to convert mv cost to l2 error during motion search. |
306 | 0 | static inline void av1_set_error_per_bit(int *errorperbit, int rdmult) { |
307 | 0 | *errorperbit = AOMMAX(rdmult >> RD_EPB_SHIFT, 1); |
308 | 0 | } Unexecuted instantiation: av1_cx_iface.c:av1_set_error_per_bit Unexecuted instantiation: allintra_vis.c:av1_set_error_per_bit Unexecuted instantiation: av1_quantize.c:av1_set_error_per_bit Unexecuted instantiation: bitstream.c:av1_set_error_per_bit Unexecuted instantiation: context_tree.c:av1_set_error_per_bit Unexecuted instantiation: encodeframe.c:av1_set_error_per_bit Unexecuted instantiation: encodeframe_utils.c:av1_set_error_per_bit Unexecuted instantiation: encodemb.c:av1_set_error_per_bit Unexecuted instantiation: encodemv.c:av1_set_error_per_bit Unexecuted instantiation: encoder.c:av1_set_error_per_bit Unexecuted instantiation: encoder_utils.c:av1_set_error_per_bit Unexecuted instantiation: encodetxb.c:av1_set_error_per_bit Unexecuted instantiation: ethread.c:av1_set_error_per_bit Unexecuted instantiation: firstpass.c:av1_set_error_per_bit Unexecuted instantiation: global_motion_facade.c:av1_set_error_per_bit Unexecuted instantiation: level.c:av1_set_error_per_bit Unexecuted instantiation: lookahead.c:av1_set_error_per_bit Unexecuted instantiation: mcomp.c:av1_set_error_per_bit Unexecuted instantiation: mv_prec.c:av1_set_error_per_bit Unexecuted instantiation: palette.c:av1_set_error_per_bit Unexecuted instantiation: partition_search.c:av1_set_error_per_bit Unexecuted instantiation: partition_strategy.c:av1_set_error_per_bit Unexecuted instantiation: pass2_strategy.c:av1_set_error_per_bit Unexecuted instantiation: pickcdef.c:av1_set_error_per_bit Unexecuted instantiation: picklpf.c:av1_set_error_per_bit Unexecuted instantiation: pickrst.c:av1_set_error_per_bit Unexecuted instantiation: ratectrl.c:av1_set_error_per_bit Unexecuted instantiation: rd.c:av1_set_error_per_bit Unexecuted instantiation: rdopt.c:av1_set_error_per_bit Unexecuted instantiation: nonrd_pickmode.c:av1_set_error_per_bit Unexecuted instantiation: nonrd_opt.c:av1_set_error_per_bit Unexecuted instantiation: segmentation.c:av1_set_error_per_bit Unexecuted instantiation: speed_features.c:av1_set_error_per_bit Unexecuted instantiation: superres_scale.c:av1_set_error_per_bit Unexecuted instantiation: svc_layercontext.c:av1_set_error_per_bit Unexecuted instantiation: temporal_filter.c:av1_set_error_per_bit Unexecuted instantiation: tokenize.c:av1_set_error_per_bit Unexecuted instantiation: tpl_model.c:av1_set_error_per_bit Unexecuted instantiation: tx_search.c:av1_set_error_per_bit Unexecuted instantiation: txb_rdopt.c:av1_set_error_per_bit Unexecuted instantiation: intra_mode_search.c:av1_set_error_per_bit Unexecuted instantiation: var_based_part.c:av1_set_error_per_bit Unexecuted instantiation: av1_noise_estimate.c:av1_set_error_per_bit Unexecuted instantiation: aq_complexity.c:av1_set_error_per_bit Unexecuted instantiation: aq_cyclicrefresh.c:av1_set_error_per_bit Unexecuted instantiation: aq_variance.c:av1_set_error_per_bit Unexecuted instantiation: compound_type.c:av1_set_error_per_bit Unexecuted instantiation: encode_strategy.c:av1_set_error_per_bit Unexecuted instantiation: global_motion.c:av1_set_error_per_bit Unexecuted instantiation: gop_structure.c:av1_set_error_per_bit Unexecuted instantiation: interp_search.c:av1_set_error_per_bit Unexecuted instantiation: motion_search_facade.c:av1_set_error_per_bit |
309 | | |
310 | | // Get the threshold for R-D optimization of coefficients depending upon mode |
311 | | // decision/winner mode processing |
312 | | static inline void get_rd_opt_coeff_thresh( |
313 | | const uint32_t (*const coeff_opt_threshold)[2], |
314 | | TxfmSearchParams *txfm_params, int enable_winner_mode_for_coeff_opt, |
315 | 0 | int is_winner_mode) { |
316 | 0 | if (!enable_winner_mode_for_coeff_opt) { |
317 | | // Default initialization of threshold |
318 | 0 | txfm_params->coeff_opt_thresholds[0] = coeff_opt_threshold[DEFAULT_EVAL][0]; |
319 | 0 | txfm_params->coeff_opt_thresholds[1] = coeff_opt_threshold[DEFAULT_EVAL][1]; |
320 | 0 | return; |
321 | 0 | } |
322 | | // TODO(any): Experiment with coeff_opt_dist_threshold values when |
323 | | // enable_winner_mode_for_coeff_opt is ON |
324 | | // TODO(any): Skip the winner mode processing for blocks with lower residual |
325 | | // energy as R-D optimization of coefficients would have been enabled during |
326 | | // mode decision |
327 | | |
328 | | // Use conservative threshold during mode decision and perform R-D |
329 | | // optimization of coeffs always for winner modes |
330 | 0 | if (is_winner_mode) { |
331 | 0 | txfm_params->coeff_opt_thresholds[0] = |
332 | 0 | coeff_opt_threshold[WINNER_MODE_EVAL][0]; |
333 | 0 | txfm_params->coeff_opt_thresholds[1] = |
334 | 0 | coeff_opt_threshold[WINNER_MODE_EVAL][1]; |
335 | 0 | } else { |
336 | 0 | txfm_params->coeff_opt_thresholds[0] = coeff_opt_threshold[MODE_EVAL][0]; |
337 | 0 | txfm_params->coeff_opt_thresholds[1] = coeff_opt_threshold[MODE_EVAL][1]; |
338 | 0 | } |
339 | 0 | } Unexecuted instantiation: av1_cx_iface.c:get_rd_opt_coeff_thresh Unexecuted instantiation: allintra_vis.c:get_rd_opt_coeff_thresh Unexecuted instantiation: av1_quantize.c:get_rd_opt_coeff_thresh Unexecuted instantiation: bitstream.c:get_rd_opt_coeff_thresh Unexecuted instantiation: context_tree.c:get_rd_opt_coeff_thresh Unexecuted instantiation: encodeframe.c:get_rd_opt_coeff_thresh Unexecuted instantiation: encodeframe_utils.c:get_rd_opt_coeff_thresh Unexecuted instantiation: encodemb.c:get_rd_opt_coeff_thresh Unexecuted instantiation: encodemv.c:get_rd_opt_coeff_thresh Unexecuted instantiation: encoder.c:get_rd_opt_coeff_thresh Unexecuted instantiation: encoder_utils.c:get_rd_opt_coeff_thresh Unexecuted instantiation: encodetxb.c:get_rd_opt_coeff_thresh Unexecuted instantiation: ethread.c:get_rd_opt_coeff_thresh Unexecuted instantiation: firstpass.c:get_rd_opt_coeff_thresh Unexecuted instantiation: global_motion_facade.c:get_rd_opt_coeff_thresh Unexecuted instantiation: level.c:get_rd_opt_coeff_thresh Unexecuted instantiation: lookahead.c:get_rd_opt_coeff_thresh Unexecuted instantiation: mcomp.c:get_rd_opt_coeff_thresh Unexecuted instantiation: mv_prec.c:get_rd_opt_coeff_thresh Unexecuted instantiation: palette.c:get_rd_opt_coeff_thresh Unexecuted instantiation: partition_search.c:get_rd_opt_coeff_thresh Unexecuted instantiation: partition_strategy.c:get_rd_opt_coeff_thresh Unexecuted instantiation: pass2_strategy.c:get_rd_opt_coeff_thresh Unexecuted instantiation: pickcdef.c:get_rd_opt_coeff_thresh Unexecuted instantiation: picklpf.c:get_rd_opt_coeff_thresh Unexecuted instantiation: pickrst.c:get_rd_opt_coeff_thresh Unexecuted instantiation: ratectrl.c:get_rd_opt_coeff_thresh Unexecuted instantiation: rd.c:get_rd_opt_coeff_thresh Unexecuted instantiation: rdopt.c:get_rd_opt_coeff_thresh Unexecuted instantiation: nonrd_pickmode.c:get_rd_opt_coeff_thresh Unexecuted instantiation: nonrd_opt.c:get_rd_opt_coeff_thresh Unexecuted instantiation: segmentation.c:get_rd_opt_coeff_thresh Unexecuted instantiation: speed_features.c:get_rd_opt_coeff_thresh Unexecuted instantiation: superres_scale.c:get_rd_opt_coeff_thresh Unexecuted instantiation: svc_layercontext.c:get_rd_opt_coeff_thresh Unexecuted instantiation: temporal_filter.c:get_rd_opt_coeff_thresh Unexecuted instantiation: tokenize.c:get_rd_opt_coeff_thresh Unexecuted instantiation: tpl_model.c:get_rd_opt_coeff_thresh Unexecuted instantiation: tx_search.c:get_rd_opt_coeff_thresh Unexecuted instantiation: txb_rdopt.c:get_rd_opt_coeff_thresh Unexecuted instantiation: intra_mode_search.c:get_rd_opt_coeff_thresh Unexecuted instantiation: var_based_part.c:get_rd_opt_coeff_thresh Unexecuted instantiation: av1_noise_estimate.c:get_rd_opt_coeff_thresh Unexecuted instantiation: aq_complexity.c:get_rd_opt_coeff_thresh Unexecuted instantiation: aq_cyclicrefresh.c:get_rd_opt_coeff_thresh Unexecuted instantiation: aq_variance.c:get_rd_opt_coeff_thresh Unexecuted instantiation: compound_type.c:get_rd_opt_coeff_thresh Unexecuted instantiation: encode_strategy.c:get_rd_opt_coeff_thresh Unexecuted instantiation: global_motion.c:get_rd_opt_coeff_thresh Unexecuted instantiation: gop_structure.c:get_rd_opt_coeff_thresh Unexecuted instantiation: interp_search.c:get_rd_opt_coeff_thresh Unexecuted instantiation: motion_search_facade.c:get_rd_opt_coeff_thresh |
340 | | |
341 | | // Used to reset the state of mb rd hash information |
342 | 0 | static inline void reset_mb_rd_record(MB_RD_RECORD *const mb_rd_record) { |
343 | 0 | if (!mb_rd_record) return; |
344 | | |
345 | | // Reset the state for use_mb_rd_hash |
346 | 0 | mb_rd_record->num = mb_rd_record->index_start = 0; |
347 | 0 | } Unexecuted instantiation: av1_cx_iface.c:reset_mb_rd_record Unexecuted instantiation: allintra_vis.c:reset_mb_rd_record Unexecuted instantiation: av1_quantize.c:reset_mb_rd_record Unexecuted instantiation: bitstream.c:reset_mb_rd_record Unexecuted instantiation: context_tree.c:reset_mb_rd_record Unexecuted instantiation: encodeframe.c:reset_mb_rd_record Unexecuted instantiation: encodeframe_utils.c:reset_mb_rd_record Unexecuted instantiation: encodemb.c:reset_mb_rd_record Unexecuted instantiation: encodemv.c:reset_mb_rd_record Unexecuted instantiation: encoder.c:reset_mb_rd_record Unexecuted instantiation: encoder_utils.c:reset_mb_rd_record Unexecuted instantiation: encodetxb.c:reset_mb_rd_record Unexecuted instantiation: ethread.c:reset_mb_rd_record Unexecuted instantiation: firstpass.c:reset_mb_rd_record Unexecuted instantiation: global_motion_facade.c:reset_mb_rd_record Unexecuted instantiation: level.c:reset_mb_rd_record Unexecuted instantiation: lookahead.c:reset_mb_rd_record Unexecuted instantiation: mcomp.c:reset_mb_rd_record Unexecuted instantiation: mv_prec.c:reset_mb_rd_record Unexecuted instantiation: palette.c:reset_mb_rd_record Unexecuted instantiation: partition_search.c:reset_mb_rd_record Unexecuted instantiation: partition_strategy.c:reset_mb_rd_record Unexecuted instantiation: pass2_strategy.c:reset_mb_rd_record Unexecuted instantiation: pickcdef.c:reset_mb_rd_record Unexecuted instantiation: picklpf.c:reset_mb_rd_record Unexecuted instantiation: pickrst.c:reset_mb_rd_record Unexecuted instantiation: ratectrl.c:reset_mb_rd_record Unexecuted instantiation: rd.c:reset_mb_rd_record Unexecuted instantiation: rdopt.c:reset_mb_rd_record Unexecuted instantiation: nonrd_pickmode.c:reset_mb_rd_record Unexecuted instantiation: nonrd_opt.c:reset_mb_rd_record Unexecuted instantiation: segmentation.c:reset_mb_rd_record Unexecuted instantiation: speed_features.c:reset_mb_rd_record Unexecuted instantiation: superres_scale.c:reset_mb_rd_record Unexecuted instantiation: svc_layercontext.c:reset_mb_rd_record Unexecuted instantiation: temporal_filter.c:reset_mb_rd_record Unexecuted instantiation: tokenize.c:reset_mb_rd_record Unexecuted instantiation: tpl_model.c:reset_mb_rd_record Unexecuted instantiation: tx_search.c:reset_mb_rd_record Unexecuted instantiation: txb_rdopt.c:reset_mb_rd_record Unexecuted instantiation: intra_mode_search.c:reset_mb_rd_record Unexecuted instantiation: var_based_part.c:reset_mb_rd_record Unexecuted instantiation: av1_noise_estimate.c:reset_mb_rd_record Unexecuted instantiation: aq_complexity.c:reset_mb_rd_record Unexecuted instantiation: aq_cyclicrefresh.c:reset_mb_rd_record Unexecuted instantiation: aq_variance.c:reset_mb_rd_record Unexecuted instantiation: compound_type.c:reset_mb_rd_record Unexecuted instantiation: encode_strategy.c:reset_mb_rd_record Unexecuted instantiation: global_motion.c:reset_mb_rd_record Unexecuted instantiation: gop_structure.c:reset_mb_rd_record Unexecuted instantiation: interp_search.c:reset_mb_rd_record Unexecuted instantiation: motion_search_facade.c:reset_mb_rd_record |
348 | | |
349 | | void av1_setup_pred_block(const MACROBLOCKD *xd, |
350 | | struct buf_2d dst[MAX_MB_PLANE], |
351 | | const YV12_BUFFER_CONFIG *src, |
352 | | const struct scale_factors *scale, |
353 | | const struct scale_factors *scale_uv, |
354 | | const int num_planes); |
355 | | |
356 | | int av1_get_intra_cost_penalty(int qindex, int qdelta, |
357 | | aom_bit_depth_t bit_depth); |
358 | | |
359 | | void av1_fill_mode_rates(AV1_COMMON *const cm, ModeCosts *mode_costs, |
360 | | FRAME_CONTEXT *fc); |
361 | | |
362 | | #if !CONFIG_REALTIME_ONLY |
363 | | void av1_fill_lr_rates(ModeCosts *mode_costs, FRAME_CONTEXT *fc); |
364 | | #endif |
365 | | |
366 | | void av1_fill_coeff_costs(CoeffCosts *coeff_costs, FRAME_CONTEXT *fc, |
367 | | const int num_planes); |
368 | | |
369 | | void av1_fill_mv_costs(const nmv_context *nmvc, int integer_mv, int usehp, |
370 | | MvCosts *mv_costs); |
371 | | |
372 | | void av1_fill_dv_costs(const nmv_context *ndvc, IntraBCMVCosts *dv_costs); |
373 | | |
374 | | #if !CONFIG_REALTIME_ONLY |
375 | | int av1_get_adaptive_rdmult(const struct AV1_COMP *cpi, double beta); |
376 | | #endif |
377 | | |
378 | | int av1_get_deltaq_offset(aom_bit_depth_t bit_depth, int qindex, double beta); |
379 | | |
380 | | /*!\brief Adjust current superblock's q_index based on delta q resolution |
381 | | * |
382 | | * \param[in] delta_q_res delta q resolution |
383 | | * \param[in] prev_qindex previous superblock's q index |
384 | | * \param[in] curr_qindex current superblock's q index |
385 | | * |
386 | | * \return the current superblock's adjusted q_index |
387 | | */ |
388 | | int av1_adjust_q_from_delta_q_res(int delta_q_res, int prev_qindex, |
389 | | int curr_qindex); |
390 | | |
391 | | #ifdef __cplusplus |
392 | | } // extern "C" |
393 | | #endif |
394 | | |
395 | | #endif // AOM_AV1_ENCODER_RD_H_ |