/src/aom/av1/encoder/rdopt_utils.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (c) 2019, 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_RDOPT_UTILS_H_ |
13 | | #define AOM_AV1_ENCODER_RDOPT_UTILS_H_ |
14 | | |
15 | | #include "aom/aom_integer.h" |
16 | | #include "av1/encoder/block.h" |
17 | | #include "av1/common/cfl.h" |
18 | | #include "av1/common/pred_common.h" |
19 | | #include "av1/encoder/rdopt_data_defs.h" |
20 | | |
21 | | #ifdef __cplusplus |
22 | | extern "C" { |
23 | | #endif |
24 | | |
25 | 0 | #define MAX_REF_MV_SEARCH 3 |
26 | 0 | #define INTER_INTRA_RD_THRESH_SCALE 9 |
27 | 0 | #define INTER_INTRA_RD_THRESH_SHIFT 4 |
28 | | |
29 | | typedef struct { |
30 | | PREDICTION_MODE mode; |
31 | | MV_REFERENCE_FRAME ref_frame[2]; |
32 | | } MODE_DEFINITION; |
33 | | |
34 | | // This array defines the mapping from the enums in THR_MODES to the actual |
35 | | // prediction modes and refrence frames |
36 | | static const MODE_DEFINITION av1_mode_defs[MAX_MODES] = { |
37 | | { NEARESTMV, { LAST_FRAME, NONE_FRAME } }, |
38 | | { NEARESTMV, { LAST2_FRAME, NONE_FRAME } }, |
39 | | { NEARESTMV, { LAST3_FRAME, NONE_FRAME } }, |
40 | | { NEARESTMV, { BWDREF_FRAME, NONE_FRAME } }, |
41 | | { NEARESTMV, { ALTREF2_FRAME, NONE_FRAME } }, |
42 | | { NEARESTMV, { ALTREF_FRAME, NONE_FRAME } }, |
43 | | { NEARESTMV, { GOLDEN_FRAME, NONE_FRAME } }, |
44 | | |
45 | | { NEWMV, { LAST_FRAME, NONE_FRAME } }, |
46 | | { NEWMV, { LAST2_FRAME, NONE_FRAME } }, |
47 | | { NEWMV, { LAST3_FRAME, NONE_FRAME } }, |
48 | | { NEWMV, { BWDREF_FRAME, NONE_FRAME } }, |
49 | | { NEWMV, { ALTREF2_FRAME, NONE_FRAME } }, |
50 | | { NEWMV, { ALTREF_FRAME, NONE_FRAME } }, |
51 | | { NEWMV, { GOLDEN_FRAME, NONE_FRAME } }, |
52 | | |
53 | | { NEARMV, { LAST_FRAME, NONE_FRAME } }, |
54 | | { NEARMV, { LAST2_FRAME, NONE_FRAME } }, |
55 | | { NEARMV, { LAST3_FRAME, NONE_FRAME } }, |
56 | | { NEARMV, { BWDREF_FRAME, NONE_FRAME } }, |
57 | | { NEARMV, { ALTREF2_FRAME, NONE_FRAME } }, |
58 | | { NEARMV, { ALTREF_FRAME, NONE_FRAME } }, |
59 | | { NEARMV, { GOLDEN_FRAME, NONE_FRAME } }, |
60 | | |
61 | | { GLOBALMV, { LAST_FRAME, NONE_FRAME } }, |
62 | | { GLOBALMV, { LAST2_FRAME, NONE_FRAME } }, |
63 | | { GLOBALMV, { LAST3_FRAME, NONE_FRAME } }, |
64 | | { GLOBALMV, { BWDREF_FRAME, NONE_FRAME } }, |
65 | | { GLOBALMV, { ALTREF2_FRAME, NONE_FRAME } }, |
66 | | { GLOBALMV, { ALTREF_FRAME, NONE_FRAME } }, |
67 | | { GLOBALMV, { GOLDEN_FRAME, NONE_FRAME } }, |
68 | | |
69 | | // TODO(zoeliu): May need to reconsider the order on the modes to check |
70 | | |
71 | | { NEAREST_NEARESTMV, { LAST_FRAME, ALTREF_FRAME } }, |
72 | | { NEAREST_NEARESTMV, { LAST2_FRAME, ALTREF_FRAME } }, |
73 | | { NEAREST_NEARESTMV, { LAST3_FRAME, ALTREF_FRAME } }, |
74 | | { NEAREST_NEARESTMV, { GOLDEN_FRAME, ALTREF_FRAME } }, |
75 | | { NEAREST_NEARESTMV, { LAST_FRAME, BWDREF_FRAME } }, |
76 | | { NEAREST_NEARESTMV, { LAST2_FRAME, BWDREF_FRAME } }, |
77 | | { NEAREST_NEARESTMV, { LAST3_FRAME, BWDREF_FRAME } }, |
78 | | { NEAREST_NEARESTMV, { GOLDEN_FRAME, BWDREF_FRAME } }, |
79 | | { NEAREST_NEARESTMV, { LAST_FRAME, ALTREF2_FRAME } }, |
80 | | { NEAREST_NEARESTMV, { LAST2_FRAME, ALTREF2_FRAME } }, |
81 | | { NEAREST_NEARESTMV, { LAST3_FRAME, ALTREF2_FRAME } }, |
82 | | { NEAREST_NEARESTMV, { GOLDEN_FRAME, ALTREF2_FRAME } }, |
83 | | |
84 | | { NEAREST_NEARESTMV, { LAST_FRAME, LAST2_FRAME } }, |
85 | | { NEAREST_NEARESTMV, { LAST_FRAME, LAST3_FRAME } }, |
86 | | { NEAREST_NEARESTMV, { LAST_FRAME, GOLDEN_FRAME } }, |
87 | | { NEAREST_NEARESTMV, { BWDREF_FRAME, ALTREF_FRAME } }, |
88 | | |
89 | | { NEAR_NEARMV, { LAST_FRAME, BWDREF_FRAME } }, |
90 | | { NEW_NEWMV, { LAST_FRAME, BWDREF_FRAME } }, |
91 | | { NEW_NEARESTMV, { LAST_FRAME, BWDREF_FRAME } }, |
92 | | { NEAREST_NEWMV, { LAST_FRAME, BWDREF_FRAME } }, |
93 | | { NEW_NEARMV, { LAST_FRAME, BWDREF_FRAME } }, |
94 | | { NEAR_NEWMV, { LAST_FRAME, BWDREF_FRAME } }, |
95 | | { GLOBAL_GLOBALMV, { LAST_FRAME, BWDREF_FRAME } }, |
96 | | |
97 | | { NEAR_NEARMV, { LAST_FRAME, ALTREF_FRAME } }, |
98 | | { NEW_NEWMV, { LAST_FRAME, ALTREF_FRAME } }, |
99 | | { NEW_NEARESTMV, { LAST_FRAME, ALTREF_FRAME } }, |
100 | | { NEAREST_NEWMV, { LAST_FRAME, ALTREF_FRAME } }, |
101 | | { NEW_NEARMV, { LAST_FRAME, ALTREF_FRAME } }, |
102 | | { NEAR_NEWMV, { LAST_FRAME, ALTREF_FRAME } }, |
103 | | { GLOBAL_GLOBALMV, { LAST_FRAME, ALTREF_FRAME } }, |
104 | | |
105 | | { NEAR_NEARMV, { LAST2_FRAME, ALTREF_FRAME } }, |
106 | | { NEW_NEWMV, { LAST2_FRAME, ALTREF_FRAME } }, |
107 | | { NEW_NEARESTMV, { LAST2_FRAME, ALTREF_FRAME } }, |
108 | | { NEAREST_NEWMV, { LAST2_FRAME, ALTREF_FRAME } }, |
109 | | { NEW_NEARMV, { LAST2_FRAME, ALTREF_FRAME } }, |
110 | | { NEAR_NEWMV, { LAST2_FRAME, ALTREF_FRAME } }, |
111 | | { GLOBAL_GLOBALMV, { LAST2_FRAME, ALTREF_FRAME } }, |
112 | | |
113 | | { NEAR_NEARMV, { LAST3_FRAME, ALTREF_FRAME } }, |
114 | | { NEW_NEWMV, { LAST3_FRAME, ALTREF_FRAME } }, |
115 | | { NEW_NEARESTMV, { LAST3_FRAME, ALTREF_FRAME } }, |
116 | | { NEAREST_NEWMV, { LAST3_FRAME, ALTREF_FRAME } }, |
117 | | { NEW_NEARMV, { LAST3_FRAME, ALTREF_FRAME } }, |
118 | | { NEAR_NEWMV, { LAST3_FRAME, ALTREF_FRAME } }, |
119 | | { GLOBAL_GLOBALMV, { LAST3_FRAME, ALTREF_FRAME } }, |
120 | | |
121 | | { NEAR_NEARMV, { GOLDEN_FRAME, ALTREF_FRAME } }, |
122 | | { NEW_NEWMV, { GOLDEN_FRAME, ALTREF_FRAME } }, |
123 | | { NEW_NEARESTMV, { GOLDEN_FRAME, ALTREF_FRAME } }, |
124 | | { NEAREST_NEWMV, { GOLDEN_FRAME, ALTREF_FRAME } }, |
125 | | { NEW_NEARMV, { GOLDEN_FRAME, ALTREF_FRAME } }, |
126 | | { NEAR_NEWMV, { GOLDEN_FRAME, ALTREF_FRAME } }, |
127 | | { GLOBAL_GLOBALMV, { GOLDEN_FRAME, ALTREF_FRAME } }, |
128 | | |
129 | | { NEAR_NEARMV, { LAST2_FRAME, BWDREF_FRAME } }, |
130 | | { NEW_NEWMV, { LAST2_FRAME, BWDREF_FRAME } }, |
131 | | { NEW_NEARESTMV, { LAST2_FRAME, BWDREF_FRAME } }, |
132 | | { NEAREST_NEWMV, { LAST2_FRAME, BWDREF_FRAME } }, |
133 | | { NEW_NEARMV, { LAST2_FRAME, BWDREF_FRAME } }, |
134 | | { NEAR_NEWMV, { LAST2_FRAME, BWDREF_FRAME } }, |
135 | | { GLOBAL_GLOBALMV, { LAST2_FRAME, BWDREF_FRAME } }, |
136 | | |
137 | | { NEAR_NEARMV, { LAST3_FRAME, BWDREF_FRAME } }, |
138 | | { NEW_NEWMV, { LAST3_FRAME, BWDREF_FRAME } }, |
139 | | { NEW_NEARESTMV, { LAST3_FRAME, BWDREF_FRAME } }, |
140 | | { NEAREST_NEWMV, { LAST3_FRAME, BWDREF_FRAME } }, |
141 | | { NEW_NEARMV, { LAST3_FRAME, BWDREF_FRAME } }, |
142 | | { NEAR_NEWMV, { LAST3_FRAME, BWDREF_FRAME } }, |
143 | | { GLOBAL_GLOBALMV, { LAST3_FRAME, BWDREF_FRAME } }, |
144 | | |
145 | | { NEAR_NEARMV, { GOLDEN_FRAME, BWDREF_FRAME } }, |
146 | | { NEW_NEWMV, { GOLDEN_FRAME, BWDREF_FRAME } }, |
147 | | { NEW_NEARESTMV, { GOLDEN_FRAME, BWDREF_FRAME } }, |
148 | | { NEAREST_NEWMV, { GOLDEN_FRAME, BWDREF_FRAME } }, |
149 | | { NEW_NEARMV, { GOLDEN_FRAME, BWDREF_FRAME } }, |
150 | | { NEAR_NEWMV, { GOLDEN_FRAME, BWDREF_FRAME } }, |
151 | | { GLOBAL_GLOBALMV, { GOLDEN_FRAME, BWDREF_FRAME } }, |
152 | | |
153 | | { NEAR_NEARMV, { LAST_FRAME, ALTREF2_FRAME } }, |
154 | | { NEW_NEWMV, { LAST_FRAME, ALTREF2_FRAME } }, |
155 | | { NEW_NEARESTMV, { LAST_FRAME, ALTREF2_FRAME } }, |
156 | | { NEAREST_NEWMV, { LAST_FRAME, ALTREF2_FRAME } }, |
157 | | { NEW_NEARMV, { LAST_FRAME, ALTREF2_FRAME } }, |
158 | | { NEAR_NEWMV, { LAST_FRAME, ALTREF2_FRAME } }, |
159 | | { GLOBAL_GLOBALMV, { LAST_FRAME, ALTREF2_FRAME } }, |
160 | | |
161 | | { NEAR_NEARMV, { LAST2_FRAME, ALTREF2_FRAME } }, |
162 | | { NEW_NEWMV, { LAST2_FRAME, ALTREF2_FRAME } }, |
163 | | { NEW_NEARESTMV, { LAST2_FRAME, ALTREF2_FRAME } }, |
164 | | { NEAREST_NEWMV, { LAST2_FRAME, ALTREF2_FRAME } }, |
165 | | { NEW_NEARMV, { LAST2_FRAME, ALTREF2_FRAME } }, |
166 | | { NEAR_NEWMV, { LAST2_FRAME, ALTREF2_FRAME } }, |
167 | | { GLOBAL_GLOBALMV, { LAST2_FRAME, ALTREF2_FRAME } }, |
168 | | |
169 | | { NEAR_NEARMV, { LAST3_FRAME, ALTREF2_FRAME } }, |
170 | | { NEW_NEWMV, { LAST3_FRAME, ALTREF2_FRAME } }, |
171 | | { NEW_NEARESTMV, { LAST3_FRAME, ALTREF2_FRAME } }, |
172 | | { NEAREST_NEWMV, { LAST3_FRAME, ALTREF2_FRAME } }, |
173 | | { NEW_NEARMV, { LAST3_FRAME, ALTREF2_FRAME } }, |
174 | | { NEAR_NEWMV, { LAST3_FRAME, ALTREF2_FRAME } }, |
175 | | { GLOBAL_GLOBALMV, { LAST3_FRAME, ALTREF2_FRAME } }, |
176 | | |
177 | | { NEAR_NEARMV, { GOLDEN_FRAME, ALTREF2_FRAME } }, |
178 | | { NEW_NEWMV, { GOLDEN_FRAME, ALTREF2_FRAME } }, |
179 | | { NEW_NEARESTMV, { GOLDEN_FRAME, ALTREF2_FRAME } }, |
180 | | { NEAREST_NEWMV, { GOLDEN_FRAME, ALTREF2_FRAME } }, |
181 | | { NEW_NEARMV, { GOLDEN_FRAME, ALTREF2_FRAME } }, |
182 | | { NEAR_NEWMV, { GOLDEN_FRAME, ALTREF2_FRAME } }, |
183 | | { GLOBAL_GLOBALMV, { GOLDEN_FRAME, ALTREF2_FRAME } }, |
184 | | |
185 | | { NEAR_NEARMV, { LAST_FRAME, LAST2_FRAME } }, |
186 | | { NEW_NEWMV, { LAST_FRAME, LAST2_FRAME } }, |
187 | | { NEW_NEARESTMV, { LAST_FRAME, LAST2_FRAME } }, |
188 | | { NEAREST_NEWMV, { LAST_FRAME, LAST2_FRAME } }, |
189 | | { NEW_NEARMV, { LAST_FRAME, LAST2_FRAME } }, |
190 | | { NEAR_NEWMV, { LAST_FRAME, LAST2_FRAME } }, |
191 | | { GLOBAL_GLOBALMV, { LAST_FRAME, LAST2_FRAME } }, |
192 | | |
193 | | { NEAR_NEARMV, { LAST_FRAME, LAST3_FRAME } }, |
194 | | { NEW_NEWMV, { LAST_FRAME, LAST3_FRAME } }, |
195 | | { NEW_NEARESTMV, { LAST_FRAME, LAST3_FRAME } }, |
196 | | { NEAREST_NEWMV, { LAST_FRAME, LAST3_FRAME } }, |
197 | | { NEW_NEARMV, { LAST_FRAME, LAST3_FRAME } }, |
198 | | { NEAR_NEWMV, { LAST_FRAME, LAST3_FRAME } }, |
199 | | { GLOBAL_GLOBALMV, { LAST_FRAME, LAST3_FRAME } }, |
200 | | |
201 | | { NEAR_NEARMV, { LAST_FRAME, GOLDEN_FRAME } }, |
202 | | { NEW_NEWMV, { LAST_FRAME, GOLDEN_FRAME } }, |
203 | | { NEW_NEARESTMV, { LAST_FRAME, GOLDEN_FRAME } }, |
204 | | { NEAREST_NEWMV, { LAST_FRAME, GOLDEN_FRAME } }, |
205 | | { NEW_NEARMV, { LAST_FRAME, GOLDEN_FRAME } }, |
206 | | { NEAR_NEWMV, { LAST_FRAME, GOLDEN_FRAME } }, |
207 | | { GLOBAL_GLOBALMV, { LAST_FRAME, GOLDEN_FRAME } }, |
208 | | |
209 | | { NEAR_NEARMV, { BWDREF_FRAME, ALTREF_FRAME } }, |
210 | | { NEW_NEWMV, { BWDREF_FRAME, ALTREF_FRAME } }, |
211 | | { NEW_NEARESTMV, { BWDREF_FRAME, ALTREF_FRAME } }, |
212 | | { NEAREST_NEWMV, { BWDREF_FRAME, ALTREF_FRAME } }, |
213 | | { NEW_NEARMV, { BWDREF_FRAME, ALTREF_FRAME } }, |
214 | | { NEAR_NEWMV, { BWDREF_FRAME, ALTREF_FRAME } }, |
215 | | { GLOBAL_GLOBALMV, { BWDREF_FRAME, ALTREF_FRAME } }, |
216 | | |
217 | | // intra modes |
218 | | { DC_PRED, { INTRA_FRAME, NONE_FRAME } }, |
219 | | { PAETH_PRED, { INTRA_FRAME, NONE_FRAME } }, |
220 | | { SMOOTH_PRED, { INTRA_FRAME, NONE_FRAME } }, |
221 | | { SMOOTH_V_PRED, { INTRA_FRAME, NONE_FRAME } }, |
222 | | { SMOOTH_H_PRED, { INTRA_FRAME, NONE_FRAME } }, |
223 | | { H_PRED, { INTRA_FRAME, NONE_FRAME } }, |
224 | | { V_PRED, { INTRA_FRAME, NONE_FRAME } }, |
225 | | { D135_PRED, { INTRA_FRAME, NONE_FRAME } }, |
226 | | { D203_PRED, { INTRA_FRAME, NONE_FRAME } }, |
227 | | { D157_PRED, { INTRA_FRAME, NONE_FRAME } }, |
228 | | { D67_PRED, { INTRA_FRAME, NONE_FRAME } }, |
229 | | { D113_PRED, { INTRA_FRAME, NONE_FRAME } }, |
230 | | { D45_PRED, { INTRA_FRAME, NONE_FRAME } }, |
231 | | }; |
232 | | |
233 | | static AOM_INLINE void restore_dst_buf(MACROBLOCKD *xd, const BUFFER_SET dst, |
234 | 0 | const int num_planes) { |
235 | 0 | for (int i = 0; i < num_planes; i++) { |
236 | 0 | xd->plane[i].dst.buf = dst.plane[i]; |
237 | 0 | xd->plane[i].dst.stride = dst.stride[i]; |
238 | 0 | } |
239 | 0 | } Unexecuted instantiation: encoder.c:restore_dst_buf Unexecuted instantiation: encoder_utils.c:restore_dst_buf Unexecuted instantiation: encodetxb.c:restore_dst_buf Unexecuted instantiation: ethread.c:restore_dst_buf Unexecuted instantiation: global_motion_facade.c:restore_dst_buf Unexecuted instantiation: mcomp.c:restore_dst_buf Unexecuted instantiation: palette.c:restore_dst_buf Unexecuted instantiation: rdopt.c:restore_dst_buf Unexecuted instantiation: speed_features.c:restore_dst_buf Unexecuted instantiation: superres_scale.c:restore_dst_buf Unexecuted instantiation: svc_layercontext.c:restore_dst_buf Unexecuted instantiation: tokenize.c:restore_dst_buf Unexecuted instantiation: tpl_model.c:restore_dst_buf Unexecuted instantiation: tx_search.c:restore_dst_buf Unexecuted instantiation: intra_mode_search.c:restore_dst_buf Unexecuted instantiation: allintra_vis.c:restore_dst_buf Unexecuted instantiation: compound_type.c:restore_dst_buf Unexecuted instantiation: encodeframe.c:restore_dst_buf Unexecuted instantiation: encodeframe_utils.c:restore_dst_buf Unexecuted instantiation: encodemb.c:restore_dst_buf Unexecuted instantiation: encode_strategy.c:restore_dst_buf Unexecuted instantiation: interp_search.c:restore_dst_buf Unexecuted instantiation: motion_search_facade.c:restore_dst_buf Unexecuted instantiation: partition_search.c:restore_dst_buf Unexecuted instantiation: partition_strategy.c:restore_dst_buf Unexecuted instantiation: nonrd_pickmode.c:restore_dst_buf |
240 | | |
241 | | static AOM_INLINE void swap_dst_buf(MACROBLOCKD *xd, |
242 | | const BUFFER_SET *dst_bufs[2], |
243 | 0 | int num_planes) { |
244 | 0 | const BUFFER_SET *buf0 = dst_bufs[0]; |
245 | 0 | dst_bufs[0] = dst_bufs[1]; |
246 | 0 | dst_bufs[1] = buf0; |
247 | 0 | restore_dst_buf(xd, *dst_bufs[0], num_planes); |
248 | 0 | } Unexecuted instantiation: encoder.c:swap_dst_buf Unexecuted instantiation: encoder_utils.c:swap_dst_buf Unexecuted instantiation: encodetxb.c:swap_dst_buf Unexecuted instantiation: ethread.c:swap_dst_buf Unexecuted instantiation: global_motion_facade.c:swap_dst_buf Unexecuted instantiation: mcomp.c:swap_dst_buf Unexecuted instantiation: palette.c:swap_dst_buf Unexecuted instantiation: rdopt.c:swap_dst_buf Unexecuted instantiation: speed_features.c:swap_dst_buf Unexecuted instantiation: superres_scale.c:swap_dst_buf Unexecuted instantiation: svc_layercontext.c:swap_dst_buf Unexecuted instantiation: tokenize.c:swap_dst_buf Unexecuted instantiation: tpl_model.c:swap_dst_buf Unexecuted instantiation: tx_search.c:swap_dst_buf Unexecuted instantiation: intra_mode_search.c:swap_dst_buf Unexecuted instantiation: allintra_vis.c:swap_dst_buf Unexecuted instantiation: compound_type.c:swap_dst_buf Unexecuted instantiation: encodeframe.c:swap_dst_buf Unexecuted instantiation: encodeframe_utils.c:swap_dst_buf Unexecuted instantiation: encodemb.c:swap_dst_buf Unexecuted instantiation: encode_strategy.c:swap_dst_buf Unexecuted instantiation: interp_search.c:swap_dst_buf Unexecuted instantiation: motion_search_facade.c:swap_dst_buf Unexecuted instantiation: partition_search.c:swap_dst_buf Unexecuted instantiation: partition_strategy.c:swap_dst_buf Unexecuted instantiation: nonrd_pickmode.c:swap_dst_buf |
249 | | |
250 | | /* clang-format on */ |
251 | | // Calculate rd threshold based on ref best rd and relevant scaling factors |
252 | | static AOM_INLINE int64_t get_rd_thresh_from_best_rd(int64_t ref_best_rd, |
253 | | int mul_factor, |
254 | 0 | int div_factor) { |
255 | 0 | int64_t rd_thresh = ref_best_rd; |
256 | 0 | if (div_factor != 0) { |
257 | 0 | rd_thresh = ref_best_rd < (div_factor * (INT64_MAX / mul_factor)) |
258 | 0 | ? ((ref_best_rd / div_factor) * mul_factor) |
259 | 0 | : INT64_MAX; |
260 | 0 | } |
261 | 0 | return rd_thresh; |
262 | 0 | } Unexecuted instantiation: encoder.c:get_rd_thresh_from_best_rd Unexecuted instantiation: encoder_utils.c:get_rd_thresh_from_best_rd Unexecuted instantiation: encodetxb.c:get_rd_thresh_from_best_rd Unexecuted instantiation: ethread.c:get_rd_thresh_from_best_rd Unexecuted instantiation: global_motion_facade.c:get_rd_thresh_from_best_rd Unexecuted instantiation: mcomp.c:get_rd_thresh_from_best_rd Unexecuted instantiation: palette.c:get_rd_thresh_from_best_rd Unexecuted instantiation: rdopt.c:get_rd_thresh_from_best_rd Unexecuted instantiation: speed_features.c:get_rd_thresh_from_best_rd Unexecuted instantiation: superres_scale.c:get_rd_thresh_from_best_rd Unexecuted instantiation: svc_layercontext.c:get_rd_thresh_from_best_rd Unexecuted instantiation: tokenize.c:get_rd_thresh_from_best_rd Unexecuted instantiation: tpl_model.c:get_rd_thresh_from_best_rd Unexecuted instantiation: tx_search.c:get_rd_thresh_from_best_rd Unexecuted instantiation: intra_mode_search.c:get_rd_thresh_from_best_rd Unexecuted instantiation: allintra_vis.c:get_rd_thresh_from_best_rd Unexecuted instantiation: compound_type.c:get_rd_thresh_from_best_rd Unexecuted instantiation: encodeframe.c:get_rd_thresh_from_best_rd Unexecuted instantiation: encodeframe_utils.c:get_rd_thresh_from_best_rd Unexecuted instantiation: encodemb.c:get_rd_thresh_from_best_rd Unexecuted instantiation: encode_strategy.c:get_rd_thresh_from_best_rd Unexecuted instantiation: interp_search.c:get_rd_thresh_from_best_rd Unexecuted instantiation: motion_search_facade.c:get_rd_thresh_from_best_rd Unexecuted instantiation: partition_search.c:get_rd_thresh_from_best_rd Unexecuted instantiation: partition_strategy.c:get_rd_thresh_from_best_rd Unexecuted instantiation: nonrd_pickmode.c:get_rd_thresh_from_best_rd |
263 | | |
264 | | static AOM_INLINE THR_MODES |
265 | | get_prediction_mode_idx(PREDICTION_MODE this_mode, MV_REFERENCE_FRAME ref_frame, |
266 | 0 | MV_REFERENCE_FRAME second_ref_frame) { |
267 | 0 | if (this_mode < INTRA_MODE_END) { |
268 | 0 | assert(ref_frame == INTRA_FRAME); |
269 | 0 | assert(second_ref_frame == NONE_FRAME); |
270 | 0 | return intra_to_mode_idx[this_mode - INTRA_MODE_START]; |
271 | 0 | } |
272 | 0 | if (this_mode >= SINGLE_INTER_MODE_START && |
273 | 0 | this_mode < SINGLE_INTER_MODE_END) { |
274 | 0 | assert((ref_frame > INTRA_FRAME) && (ref_frame <= ALTREF_FRAME)); |
275 | 0 | return single_inter_to_mode_idx[this_mode - SINGLE_INTER_MODE_START] |
276 | 0 | [ref_frame]; |
277 | 0 | } |
278 | 0 | if (this_mode >= COMP_INTER_MODE_START && this_mode < COMP_INTER_MODE_END && |
279 | 0 | second_ref_frame != NONE_FRAME) { |
280 | 0 | assert((ref_frame > INTRA_FRAME) && (ref_frame <= ALTREF_FRAME)); |
281 | 0 | assert((second_ref_frame > INTRA_FRAME) && |
282 | 0 | (second_ref_frame <= ALTREF_FRAME)); |
283 | 0 | return comp_inter_to_mode_idx[this_mode - COMP_INTER_MODE_START][ref_frame] |
284 | 0 | [second_ref_frame]; |
285 | 0 | } |
286 | 0 | assert(0); |
287 | 0 | return THR_INVALID; |
288 | 0 | } Unexecuted instantiation: encoder.c:get_prediction_mode_idx Unexecuted instantiation: encoder_utils.c:get_prediction_mode_idx Unexecuted instantiation: encodetxb.c:get_prediction_mode_idx Unexecuted instantiation: ethread.c:get_prediction_mode_idx Unexecuted instantiation: global_motion_facade.c:get_prediction_mode_idx Unexecuted instantiation: mcomp.c:get_prediction_mode_idx Unexecuted instantiation: palette.c:get_prediction_mode_idx Unexecuted instantiation: rdopt.c:get_prediction_mode_idx Unexecuted instantiation: speed_features.c:get_prediction_mode_idx Unexecuted instantiation: superres_scale.c:get_prediction_mode_idx Unexecuted instantiation: svc_layercontext.c:get_prediction_mode_idx Unexecuted instantiation: tokenize.c:get_prediction_mode_idx Unexecuted instantiation: tpl_model.c:get_prediction_mode_idx Unexecuted instantiation: tx_search.c:get_prediction_mode_idx Unexecuted instantiation: intra_mode_search.c:get_prediction_mode_idx Unexecuted instantiation: allintra_vis.c:get_prediction_mode_idx Unexecuted instantiation: compound_type.c:get_prediction_mode_idx Unexecuted instantiation: encodeframe.c:get_prediction_mode_idx Unexecuted instantiation: encodeframe_utils.c:get_prediction_mode_idx Unexecuted instantiation: encodemb.c:get_prediction_mode_idx Unexecuted instantiation: encode_strategy.c:get_prediction_mode_idx Unexecuted instantiation: interp_search.c:get_prediction_mode_idx Unexecuted instantiation: motion_search_facade.c:get_prediction_mode_idx Unexecuted instantiation: partition_search.c:get_prediction_mode_idx Unexecuted instantiation: partition_strategy.c:get_prediction_mode_idx Unexecuted instantiation: nonrd_pickmode.c:get_prediction_mode_idx |
289 | | |
290 | 0 | static AOM_INLINE int inter_mode_data_block_idx(BLOCK_SIZE bsize) { |
291 | 0 | if (bsize == BLOCK_4X4 || bsize == BLOCK_4X8 || bsize == BLOCK_8X4 || |
292 | 0 | bsize == BLOCK_4X16 || bsize == BLOCK_16X4) { |
293 | 0 | return -1; |
294 | 0 | } |
295 | 0 | return 1; |
296 | 0 | } Unexecuted instantiation: encoder.c:inter_mode_data_block_idx Unexecuted instantiation: encoder_utils.c:inter_mode_data_block_idx Unexecuted instantiation: encodetxb.c:inter_mode_data_block_idx Unexecuted instantiation: ethread.c:inter_mode_data_block_idx Unexecuted instantiation: global_motion_facade.c:inter_mode_data_block_idx Unexecuted instantiation: mcomp.c:inter_mode_data_block_idx Unexecuted instantiation: palette.c:inter_mode_data_block_idx Unexecuted instantiation: rdopt.c:inter_mode_data_block_idx Unexecuted instantiation: speed_features.c:inter_mode_data_block_idx Unexecuted instantiation: superres_scale.c:inter_mode_data_block_idx Unexecuted instantiation: svc_layercontext.c:inter_mode_data_block_idx Unexecuted instantiation: tokenize.c:inter_mode_data_block_idx Unexecuted instantiation: tpl_model.c:inter_mode_data_block_idx Unexecuted instantiation: tx_search.c:inter_mode_data_block_idx Unexecuted instantiation: intra_mode_search.c:inter_mode_data_block_idx Unexecuted instantiation: allintra_vis.c:inter_mode_data_block_idx Unexecuted instantiation: compound_type.c:inter_mode_data_block_idx Unexecuted instantiation: encodeframe.c:inter_mode_data_block_idx Unexecuted instantiation: encodeframe_utils.c:inter_mode_data_block_idx Unexecuted instantiation: encodemb.c:inter_mode_data_block_idx Unexecuted instantiation: encode_strategy.c:inter_mode_data_block_idx Unexecuted instantiation: interp_search.c:inter_mode_data_block_idx Unexecuted instantiation: motion_search_facade.c:inter_mode_data_block_idx Unexecuted instantiation: partition_search.c:inter_mode_data_block_idx Unexecuted instantiation: partition_strategy.c:inter_mode_data_block_idx Unexecuted instantiation: nonrd_pickmode.c:inter_mode_data_block_idx |
297 | | |
298 | | // Get transform block visible dimensions cropped to the MI units. |
299 | | static AOM_INLINE void get_txb_dimensions(const MACROBLOCKD *xd, int plane, |
300 | | BLOCK_SIZE plane_bsize, int blk_row, |
301 | | int blk_col, BLOCK_SIZE tx_bsize, |
302 | | int *width, int *height, |
303 | | int *visible_width, |
304 | 0 | int *visible_height) { |
305 | 0 | assert(tx_bsize <= plane_bsize); |
306 | 0 | const int txb_height = block_size_high[tx_bsize]; |
307 | 0 | const int txb_width = block_size_wide[tx_bsize]; |
308 | 0 | const struct macroblockd_plane *const pd = &xd->plane[plane]; |
309 | | |
310 | | // TODO(aconverse@google.com): Investigate using crop_width/height here rather |
311 | | // than the MI size |
312 | 0 | if (xd->mb_to_bottom_edge >= 0) { |
313 | 0 | *visible_height = txb_height; |
314 | 0 | } else { |
315 | 0 | const int block_height = block_size_high[plane_bsize]; |
316 | 0 | const int block_rows = |
317 | 0 | (xd->mb_to_bottom_edge >> (3 + pd->subsampling_y)) + block_height; |
318 | 0 | *visible_height = |
319 | 0 | clamp(block_rows - (blk_row << MI_SIZE_LOG2), 0, txb_height); |
320 | 0 | } |
321 | 0 | if (height) *height = txb_height; |
322 | |
|
323 | 0 | if (xd->mb_to_right_edge >= 0) { |
324 | 0 | *visible_width = txb_width; |
325 | 0 | } else { |
326 | 0 | const int block_width = block_size_wide[plane_bsize]; |
327 | 0 | const int block_cols = |
328 | 0 | (xd->mb_to_right_edge >> (3 + pd->subsampling_x)) + block_width; |
329 | 0 | *visible_width = |
330 | 0 | clamp(block_cols - (blk_col << MI_SIZE_LOG2), 0, txb_width); |
331 | 0 | } |
332 | 0 | if (width) *width = txb_width; |
333 | 0 | } Unexecuted instantiation: encoder.c:get_txb_dimensions Unexecuted instantiation: encoder_utils.c:get_txb_dimensions Unexecuted instantiation: encodetxb.c:get_txb_dimensions Unexecuted instantiation: ethread.c:get_txb_dimensions Unexecuted instantiation: global_motion_facade.c:get_txb_dimensions Unexecuted instantiation: mcomp.c:get_txb_dimensions Unexecuted instantiation: palette.c:get_txb_dimensions Unexecuted instantiation: rdopt.c:get_txb_dimensions Unexecuted instantiation: speed_features.c:get_txb_dimensions Unexecuted instantiation: superres_scale.c:get_txb_dimensions Unexecuted instantiation: svc_layercontext.c:get_txb_dimensions Unexecuted instantiation: tokenize.c:get_txb_dimensions Unexecuted instantiation: tpl_model.c:get_txb_dimensions Unexecuted instantiation: tx_search.c:get_txb_dimensions Unexecuted instantiation: intra_mode_search.c:get_txb_dimensions Unexecuted instantiation: allintra_vis.c:get_txb_dimensions Unexecuted instantiation: compound_type.c:get_txb_dimensions Unexecuted instantiation: encodeframe.c:get_txb_dimensions Unexecuted instantiation: encodeframe_utils.c:get_txb_dimensions Unexecuted instantiation: encodemb.c:get_txb_dimensions Unexecuted instantiation: encode_strategy.c:get_txb_dimensions Unexecuted instantiation: interp_search.c:get_txb_dimensions Unexecuted instantiation: motion_search_facade.c:get_txb_dimensions Unexecuted instantiation: partition_search.c:get_txb_dimensions Unexecuted instantiation: partition_strategy.c:get_txb_dimensions Unexecuted instantiation: nonrd_pickmode.c:get_txb_dimensions |
334 | | |
335 | 0 | static AOM_INLINE int bsize_to_num_blk(BLOCK_SIZE bsize) { |
336 | 0 | int num_blk = 1 << (num_pels_log2_lookup[bsize] - 2 * MI_SIZE_LOG2); |
337 | 0 | return num_blk; |
338 | 0 | } Unexecuted instantiation: encoder.c:bsize_to_num_blk Unexecuted instantiation: encoder_utils.c:bsize_to_num_blk Unexecuted instantiation: encodetxb.c:bsize_to_num_blk Unexecuted instantiation: ethread.c:bsize_to_num_blk Unexecuted instantiation: global_motion_facade.c:bsize_to_num_blk Unexecuted instantiation: mcomp.c:bsize_to_num_blk Unexecuted instantiation: palette.c:bsize_to_num_blk Unexecuted instantiation: rdopt.c:bsize_to_num_blk Unexecuted instantiation: speed_features.c:bsize_to_num_blk Unexecuted instantiation: superres_scale.c:bsize_to_num_blk Unexecuted instantiation: svc_layercontext.c:bsize_to_num_blk Unexecuted instantiation: tokenize.c:bsize_to_num_blk Unexecuted instantiation: tpl_model.c:bsize_to_num_blk Unexecuted instantiation: tx_search.c:bsize_to_num_blk Unexecuted instantiation: intra_mode_search.c:bsize_to_num_blk Unexecuted instantiation: allintra_vis.c:bsize_to_num_blk Unexecuted instantiation: compound_type.c:bsize_to_num_blk Unexecuted instantiation: encodeframe.c:bsize_to_num_blk Unexecuted instantiation: encodeframe_utils.c:bsize_to_num_blk Unexecuted instantiation: encodemb.c:bsize_to_num_blk Unexecuted instantiation: encode_strategy.c:bsize_to_num_blk Unexecuted instantiation: interp_search.c:bsize_to_num_blk Unexecuted instantiation: motion_search_facade.c:bsize_to_num_blk Unexecuted instantiation: partition_search.c:bsize_to_num_blk Unexecuted instantiation: partition_strategy.c:bsize_to_num_blk Unexecuted instantiation: nonrd_pickmode.c:bsize_to_num_blk |
339 | | |
340 | | static INLINE int check_txfm_eval(MACROBLOCK *const x, BLOCK_SIZE bsize, |
341 | | int64_t best_skip_rd, int64_t skip_rd, |
342 | 0 | int level, int is_luma_only) { |
343 | 0 | int eval_txfm = 1; |
344 | | // Derive aggressiveness factor for gating the transform search |
345 | | // Lower value indicates more aggressiveness. Be more conservative (high |
346 | | // value) for (i) low quantizers (ii) regions where prediction is poor |
347 | 0 | const int scale[5] = { INT_MAX, 4, 3, 2, 2 }; |
348 | 0 | const int qslope = 2 * (!is_luma_only); |
349 | 0 | const int level_to_qindex_map[5] = { 0, 0, 0, 80, 100 }; |
350 | 0 | int aggr_factor = 4; |
351 | 0 | const int pred_qindex_thresh = level_to_qindex_map[level]; |
352 | 0 | if (!is_luma_only && level <= 2) { |
353 | 0 | aggr_factor = 4 * AOMMAX(1, ROUND_POWER_OF_TWO((MAXQ - x->qindex) * qslope, |
354 | 0 | QINDEX_BITS)); |
355 | 0 | } |
356 | 0 | if ((best_skip_rd > |
357 | 0 | (x->source_variance << (num_pels_log2_lookup[bsize] + RDDIV_BITS))) && |
358 | 0 | (x->qindex >= pred_qindex_thresh)) |
359 | 0 | aggr_factor *= scale[level]; |
360 | | // For level setting 1, be more conservative for non-luma-only case even when |
361 | | // prediction is good. |
362 | 0 | else if ((level <= 1) && !is_luma_only) |
363 | 0 | aggr_factor = (aggr_factor >> 2) * 6; |
364 | | |
365 | | // Be more conservative for luma only cases (called from compound type rd) |
366 | | // since best_skip_rd is computed after and skip_rd is computed (with 8-bit |
367 | | // prediction signals blended for WEDGE/DIFFWTD rather than 16-bit) before |
368 | | // interpolation filter search |
369 | 0 | const int luma_mul[5] = { INT_MAX, 32, 29, 17, 17 }; |
370 | 0 | int mul_factor = is_luma_only ? luma_mul[level] : 16; |
371 | 0 | int64_t rd_thresh = |
372 | 0 | (best_skip_rd == INT64_MAX) |
373 | 0 | ? best_skip_rd |
374 | 0 | : (int64_t)(best_skip_rd * aggr_factor * mul_factor >> 6); |
375 | 0 | if (skip_rd > rd_thresh) eval_txfm = 0; |
376 | 0 | return eval_txfm; |
377 | 0 | } Unexecuted instantiation: encoder.c:check_txfm_eval Unexecuted instantiation: encoder_utils.c:check_txfm_eval Unexecuted instantiation: encodetxb.c:check_txfm_eval Unexecuted instantiation: ethread.c:check_txfm_eval Unexecuted instantiation: global_motion_facade.c:check_txfm_eval Unexecuted instantiation: mcomp.c:check_txfm_eval Unexecuted instantiation: palette.c:check_txfm_eval Unexecuted instantiation: rdopt.c:check_txfm_eval Unexecuted instantiation: speed_features.c:check_txfm_eval Unexecuted instantiation: superres_scale.c:check_txfm_eval Unexecuted instantiation: svc_layercontext.c:check_txfm_eval Unexecuted instantiation: tokenize.c:check_txfm_eval Unexecuted instantiation: tpl_model.c:check_txfm_eval Unexecuted instantiation: tx_search.c:check_txfm_eval Unexecuted instantiation: intra_mode_search.c:check_txfm_eval Unexecuted instantiation: allintra_vis.c:check_txfm_eval Unexecuted instantiation: compound_type.c:check_txfm_eval Unexecuted instantiation: encodeframe.c:check_txfm_eval Unexecuted instantiation: encodeframe_utils.c:check_txfm_eval Unexecuted instantiation: encodemb.c:check_txfm_eval Unexecuted instantiation: encode_strategy.c:check_txfm_eval Unexecuted instantiation: interp_search.c:check_txfm_eval Unexecuted instantiation: motion_search_facade.c:check_txfm_eval Unexecuted instantiation: partition_search.c:check_txfm_eval Unexecuted instantiation: partition_strategy.c:check_txfm_eval Unexecuted instantiation: nonrd_pickmode.c:check_txfm_eval |
378 | | |
379 | | static TX_MODE select_tx_mode( |
380 | 0 | const AV1_COMMON *cm, const TX_SIZE_SEARCH_METHOD tx_size_search_method) { |
381 | 0 | if (cm->features.coded_lossless) return ONLY_4X4; |
382 | 0 | if (tx_size_search_method == USE_LARGESTALL) { |
383 | 0 | return TX_MODE_LARGEST; |
384 | 0 | } else { |
385 | 0 | assert(tx_size_search_method == USE_FULL_RD || |
386 | 0 | tx_size_search_method == USE_FAST_RD); |
387 | 0 | return TX_MODE_SELECT; |
388 | 0 | } |
389 | 0 | } Unexecuted instantiation: encoder.c:select_tx_mode Unexecuted instantiation: encoder_utils.c:select_tx_mode Unexecuted instantiation: encodetxb.c:select_tx_mode Unexecuted instantiation: ethread.c:select_tx_mode Unexecuted instantiation: global_motion_facade.c:select_tx_mode Unexecuted instantiation: mcomp.c:select_tx_mode Unexecuted instantiation: palette.c:select_tx_mode Unexecuted instantiation: rdopt.c:select_tx_mode Unexecuted instantiation: speed_features.c:select_tx_mode Unexecuted instantiation: superres_scale.c:select_tx_mode Unexecuted instantiation: svc_layercontext.c:select_tx_mode Unexecuted instantiation: tokenize.c:select_tx_mode Unexecuted instantiation: tpl_model.c:select_tx_mode Unexecuted instantiation: tx_search.c:select_tx_mode Unexecuted instantiation: intra_mode_search.c:select_tx_mode Unexecuted instantiation: allintra_vis.c:select_tx_mode Unexecuted instantiation: compound_type.c:select_tx_mode Unexecuted instantiation: encodeframe.c:select_tx_mode Unexecuted instantiation: encodeframe_utils.c:select_tx_mode Unexecuted instantiation: encodemb.c:select_tx_mode Unexecuted instantiation: encode_strategy.c:select_tx_mode Unexecuted instantiation: interp_search.c:select_tx_mode Unexecuted instantiation: motion_search_facade.c:select_tx_mode Unexecuted instantiation: partition_search.c:select_tx_mode Unexecuted instantiation: partition_strategy.c:select_tx_mode Unexecuted instantiation: nonrd_pickmode.c:select_tx_mode |
390 | | // Checks the conditions to enable winner mode processing |
391 | | static INLINE int is_winner_mode_processing_enabled( |
392 | | const struct AV1_COMP *cpi, const MACROBLOCK *const x, |
393 | 0 | MB_MODE_INFO *const mbmi, const PREDICTION_MODE best_mode) { |
394 | 0 | const SPEED_FEATURES *sf = &cpi->sf; |
395 | | |
396 | | // Disable winner mode processing for blocks with low source variance. |
397 | | // The aggressiveness of this pruning logic reduces as qindex increases. |
398 | | // The threshold decreases linearly from 64 as qindex varies from 0 to 255. |
399 | 0 | if (sf->winner_mode_sf.prune_winner_mode_processing_using_src_var) { |
400 | 0 | const unsigned int src_var_thresh = 64 - 48 * x->qindex / (MAXQ + 1); |
401 | 0 | if (x->source_variance < src_var_thresh) return 0; |
402 | 0 | } |
403 | | |
404 | | // TODO(any): Move block independent condition checks to frame level |
405 | 0 | if (is_inter_block(mbmi)) { |
406 | 0 | if (is_inter_mode(best_mode) && |
407 | 0 | (sf->tx_sf.tx_type_search.fast_inter_tx_type_prob_thresh != INT_MAX) && |
408 | 0 | !cpi->oxcf.txfm_cfg.use_inter_dct_only) |
409 | 0 | return 1; |
410 | 0 | } else { |
411 | 0 | if (sf->tx_sf.tx_type_search.fast_intra_tx_type_search && |
412 | 0 | !cpi->oxcf.txfm_cfg.use_intra_default_tx_only && |
413 | 0 | !cpi->oxcf.txfm_cfg.use_intra_dct_only) |
414 | 0 | return 1; |
415 | 0 | } |
416 | | |
417 | | // Check speed feature related to winner mode processing |
418 | 0 | if (sf->winner_mode_sf.enable_winner_mode_for_coeff_opt && |
419 | 0 | cpi->optimize_seg_arr[mbmi->segment_id] != NO_TRELLIS_OPT && |
420 | 0 | cpi->optimize_seg_arr[mbmi->segment_id] != FINAL_PASS_TRELLIS_OPT) |
421 | 0 | return 1; |
422 | 0 | if (sf->winner_mode_sf.enable_winner_mode_for_tx_size_srch) return 1; |
423 | | |
424 | 0 | return 0; |
425 | 0 | } Unexecuted instantiation: encoder.c:is_winner_mode_processing_enabled Unexecuted instantiation: encoder_utils.c:is_winner_mode_processing_enabled Unexecuted instantiation: encodetxb.c:is_winner_mode_processing_enabled Unexecuted instantiation: ethread.c:is_winner_mode_processing_enabled Unexecuted instantiation: global_motion_facade.c:is_winner_mode_processing_enabled Unexecuted instantiation: mcomp.c:is_winner_mode_processing_enabled Unexecuted instantiation: palette.c:is_winner_mode_processing_enabled Unexecuted instantiation: rdopt.c:is_winner_mode_processing_enabled Unexecuted instantiation: speed_features.c:is_winner_mode_processing_enabled Unexecuted instantiation: superres_scale.c:is_winner_mode_processing_enabled Unexecuted instantiation: svc_layercontext.c:is_winner_mode_processing_enabled Unexecuted instantiation: tokenize.c:is_winner_mode_processing_enabled Unexecuted instantiation: tpl_model.c:is_winner_mode_processing_enabled Unexecuted instantiation: tx_search.c:is_winner_mode_processing_enabled Unexecuted instantiation: intra_mode_search.c:is_winner_mode_processing_enabled Unexecuted instantiation: allintra_vis.c:is_winner_mode_processing_enabled Unexecuted instantiation: compound_type.c:is_winner_mode_processing_enabled Unexecuted instantiation: encodeframe.c:is_winner_mode_processing_enabled Unexecuted instantiation: encodeframe_utils.c:is_winner_mode_processing_enabled Unexecuted instantiation: encodemb.c:is_winner_mode_processing_enabled Unexecuted instantiation: encode_strategy.c:is_winner_mode_processing_enabled Unexecuted instantiation: interp_search.c:is_winner_mode_processing_enabled Unexecuted instantiation: motion_search_facade.c:is_winner_mode_processing_enabled Unexecuted instantiation: partition_search.c:is_winner_mode_processing_enabled Unexecuted instantiation: partition_strategy.c:is_winner_mode_processing_enabled Unexecuted instantiation: nonrd_pickmode.c:is_winner_mode_processing_enabled |
426 | | |
427 | | static INLINE void set_tx_size_search_method( |
428 | | const AV1_COMMON *cm, const WinnerModeParams *winner_mode_params, |
429 | | TxfmSearchParams *txfm_params, int enable_winner_mode_for_tx_size_srch, |
430 | 0 | int is_winner_mode) { |
431 | | // Populate transform size search method/transform mode appropriately |
432 | 0 | txfm_params->tx_size_search_method = |
433 | 0 | winner_mode_params->tx_size_search_methods[DEFAULT_EVAL]; |
434 | 0 | if (enable_winner_mode_for_tx_size_srch) { |
435 | 0 | if (is_winner_mode) |
436 | 0 | txfm_params->tx_size_search_method = |
437 | 0 | winner_mode_params->tx_size_search_methods[WINNER_MODE_EVAL]; |
438 | 0 | else |
439 | 0 | txfm_params->tx_size_search_method = |
440 | 0 | winner_mode_params->tx_size_search_methods[MODE_EVAL]; |
441 | 0 | } |
442 | 0 | txfm_params->tx_mode_search_type = |
443 | 0 | select_tx_mode(cm, txfm_params->tx_size_search_method); |
444 | 0 | } Unexecuted instantiation: encoder.c:set_tx_size_search_method Unexecuted instantiation: encoder_utils.c:set_tx_size_search_method Unexecuted instantiation: encodetxb.c:set_tx_size_search_method Unexecuted instantiation: ethread.c:set_tx_size_search_method Unexecuted instantiation: global_motion_facade.c:set_tx_size_search_method Unexecuted instantiation: mcomp.c:set_tx_size_search_method Unexecuted instantiation: palette.c:set_tx_size_search_method Unexecuted instantiation: rdopt.c:set_tx_size_search_method Unexecuted instantiation: speed_features.c:set_tx_size_search_method Unexecuted instantiation: superres_scale.c:set_tx_size_search_method Unexecuted instantiation: svc_layercontext.c:set_tx_size_search_method Unexecuted instantiation: tokenize.c:set_tx_size_search_method Unexecuted instantiation: tpl_model.c:set_tx_size_search_method Unexecuted instantiation: tx_search.c:set_tx_size_search_method Unexecuted instantiation: intra_mode_search.c:set_tx_size_search_method Unexecuted instantiation: allintra_vis.c:set_tx_size_search_method Unexecuted instantiation: compound_type.c:set_tx_size_search_method Unexecuted instantiation: encodeframe.c:set_tx_size_search_method Unexecuted instantiation: encodeframe_utils.c:set_tx_size_search_method Unexecuted instantiation: encodemb.c:set_tx_size_search_method Unexecuted instantiation: encode_strategy.c:set_tx_size_search_method Unexecuted instantiation: interp_search.c:set_tx_size_search_method Unexecuted instantiation: motion_search_facade.c:set_tx_size_search_method Unexecuted instantiation: partition_search.c:set_tx_size_search_method Unexecuted instantiation: partition_strategy.c:set_tx_size_search_method Unexecuted instantiation: nonrd_pickmode.c:set_tx_size_search_method |
445 | | |
446 | | static INLINE void set_tx_type_prune(const SPEED_FEATURES *sf, |
447 | | TxfmSearchParams *txfm_params, |
448 | | int winner_mode_tx_type_pruning, |
449 | 0 | int is_winner_mode) { |
450 | | // Populate prune transform mode appropriately |
451 | 0 | txfm_params->prune_2d_txfm_mode = sf->tx_sf.tx_type_search.prune_2d_txfm_mode; |
452 | 0 | if (!winner_mode_tx_type_pruning) return; |
453 | | |
454 | 0 | const int prune_mode[4][2] = { { TX_TYPE_PRUNE_3, TX_TYPE_PRUNE_0 }, |
455 | 0 | { TX_TYPE_PRUNE_4, TX_TYPE_PRUNE_0 }, |
456 | 0 | { TX_TYPE_PRUNE_5, TX_TYPE_PRUNE_2 }, |
457 | 0 | { TX_TYPE_PRUNE_5, TX_TYPE_PRUNE_3 } }; |
458 | 0 | txfm_params->prune_2d_txfm_mode = |
459 | 0 | prune_mode[winner_mode_tx_type_pruning - 1][is_winner_mode]; |
460 | 0 | } Unexecuted instantiation: encoder.c:set_tx_type_prune Unexecuted instantiation: encoder_utils.c:set_tx_type_prune Unexecuted instantiation: encodetxb.c:set_tx_type_prune Unexecuted instantiation: ethread.c:set_tx_type_prune Unexecuted instantiation: global_motion_facade.c:set_tx_type_prune Unexecuted instantiation: mcomp.c:set_tx_type_prune Unexecuted instantiation: palette.c:set_tx_type_prune Unexecuted instantiation: rdopt.c:set_tx_type_prune Unexecuted instantiation: speed_features.c:set_tx_type_prune Unexecuted instantiation: superres_scale.c:set_tx_type_prune Unexecuted instantiation: svc_layercontext.c:set_tx_type_prune Unexecuted instantiation: tokenize.c:set_tx_type_prune Unexecuted instantiation: tpl_model.c:set_tx_type_prune Unexecuted instantiation: tx_search.c:set_tx_type_prune Unexecuted instantiation: intra_mode_search.c:set_tx_type_prune Unexecuted instantiation: allintra_vis.c:set_tx_type_prune Unexecuted instantiation: compound_type.c:set_tx_type_prune Unexecuted instantiation: encodeframe.c:set_tx_type_prune Unexecuted instantiation: encodeframe_utils.c:set_tx_type_prune Unexecuted instantiation: encodemb.c:set_tx_type_prune Unexecuted instantiation: encode_strategy.c:set_tx_type_prune Unexecuted instantiation: interp_search.c:set_tx_type_prune Unexecuted instantiation: motion_search_facade.c:set_tx_type_prune Unexecuted instantiation: partition_search.c:set_tx_type_prune Unexecuted instantiation: partition_strategy.c:set_tx_type_prune Unexecuted instantiation: nonrd_pickmode.c:set_tx_type_prune |
461 | | |
462 | | static INLINE void set_tx_domain_dist_params( |
463 | | const WinnerModeParams *winner_mode_params, TxfmSearchParams *txfm_params, |
464 | 0 | int enable_winner_mode_for_tx_domain_dist, int is_winner_mode) { |
465 | 0 | if (!enable_winner_mode_for_tx_domain_dist) { |
466 | 0 | txfm_params->use_transform_domain_distortion = |
467 | 0 | winner_mode_params->use_transform_domain_distortion[DEFAULT_EVAL]; |
468 | 0 | txfm_params->tx_domain_dist_threshold = |
469 | 0 | winner_mode_params->tx_domain_dist_threshold[DEFAULT_EVAL]; |
470 | 0 | return; |
471 | 0 | } |
472 | | |
473 | 0 | if (is_winner_mode) { |
474 | 0 | txfm_params->use_transform_domain_distortion = |
475 | 0 | winner_mode_params->use_transform_domain_distortion[WINNER_MODE_EVAL]; |
476 | 0 | txfm_params->tx_domain_dist_threshold = |
477 | 0 | winner_mode_params->tx_domain_dist_threshold[WINNER_MODE_EVAL]; |
478 | 0 | } else { |
479 | 0 | txfm_params->use_transform_domain_distortion = |
480 | 0 | winner_mode_params->use_transform_domain_distortion[MODE_EVAL]; |
481 | 0 | txfm_params->tx_domain_dist_threshold = |
482 | 0 | winner_mode_params->tx_domain_dist_threshold[MODE_EVAL]; |
483 | 0 | } |
484 | 0 | } Unexecuted instantiation: encoder.c:set_tx_domain_dist_params Unexecuted instantiation: encoder_utils.c:set_tx_domain_dist_params Unexecuted instantiation: encodetxb.c:set_tx_domain_dist_params Unexecuted instantiation: ethread.c:set_tx_domain_dist_params Unexecuted instantiation: global_motion_facade.c:set_tx_domain_dist_params Unexecuted instantiation: mcomp.c:set_tx_domain_dist_params Unexecuted instantiation: palette.c:set_tx_domain_dist_params Unexecuted instantiation: rdopt.c:set_tx_domain_dist_params Unexecuted instantiation: speed_features.c:set_tx_domain_dist_params Unexecuted instantiation: superres_scale.c:set_tx_domain_dist_params Unexecuted instantiation: svc_layercontext.c:set_tx_domain_dist_params Unexecuted instantiation: tokenize.c:set_tx_domain_dist_params Unexecuted instantiation: tpl_model.c:set_tx_domain_dist_params Unexecuted instantiation: tx_search.c:set_tx_domain_dist_params Unexecuted instantiation: intra_mode_search.c:set_tx_domain_dist_params Unexecuted instantiation: allintra_vis.c:set_tx_domain_dist_params Unexecuted instantiation: compound_type.c:set_tx_domain_dist_params Unexecuted instantiation: encodeframe.c:set_tx_domain_dist_params Unexecuted instantiation: encodeframe_utils.c:set_tx_domain_dist_params Unexecuted instantiation: encodemb.c:set_tx_domain_dist_params Unexecuted instantiation: encode_strategy.c:set_tx_domain_dist_params Unexecuted instantiation: interp_search.c:set_tx_domain_dist_params Unexecuted instantiation: motion_search_facade.c:set_tx_domain_dist_params Unexecuted instantiation: partition_search.c:set_tx_domain_dist_params Unexecuted instantiation: partition_strategy.c:set_tx_domain_dist_params Unexecuted instantiation: nonrd_pickmode.c:set_tx_domain_dist_params |
485 | | |
486 | | // This function sets mode parameters for different mode evaluation stages |
487 | | static INLINE void set_mode_eval_params(const struct AV1_COMP *cpi, |
488 | | MACROBLOCK *x, |
489 | 0 | MODE_EVAL_TYPE mode_eval_type) { |
490 | 0 | const AV1_COMMON *cm = &cpi->common; |
491 | 0 | const SPEED_FEATURES *sf = &cpi->sf; |
492 | 0 | const WinnerModeParams *winner_mode_params = &cpi->winner_mode_params; |
493 | 0 | TxfmSearchParams *txfm_params = &x->txfm_search_params; |
494 | |
|
495 | 0 | switch (mode_eval_type) { |
496 | 0 | case DEFAULT_EVAL: |
497 | 0 | txfm_params->default_inter_tx_type_prob_thresh = INT_MAX; |
498 | 0 | txfm_params->use_default_intra_tx_type = 0; |
499 | 0 | txfm_params->skip_txfm_level = |
500 | 0 | winner_mode_params->skip_txfm_level[DEFAULT_EVAL]; |
501 | 0 | txfm_params->predict_dc_level = |
502 | 0 | winner_mode_params->predict_dc_level[DEFAULT_EVAL]; |
503 | | // Set default transform domain distortion type |
504 | 0 | set_tx_domain_dist_params(winner_mode_params, txfm_params, 0, 0); |
505 | | |
506 | | // Get default threshold for R-D optimization of coefficients |
507 | 0 | get_rd_opt_coeff_thresh(winner_mode_params->coeff_opt_thresholds, |
508 | 0 | txfm_params, 0, 0); |
509 | | |
510 | | // Set default transform size search method |
511 | 0 | set_tx_size_search_method(cm, winner_mode_params, txfm_params, 0, 0); |
512 | | // Set default transform type prune |
513 | 0 | set_tx_type_prune(sf, txfm_params, 0, 0); |
514 | 0 | break; |
515 | 0 | case MODE_EVAL: |
516 | 0 | txfm_params->use_default_intra_tx_type = |
517 | 0 | (cpi->sf.tx_sf.tx_type_search.fast_intra_tx_type_search || |
518 | 0 | cpi->oxcf.txfm_cfg.use_intra_default_tx_only); |
519 | 0 | txfm_params->default_inter_tx_type_prob_thresh = |
520 | 0 | cpi->sf.tx_sf.tx_type_search.fast_inter_tx_type_prob_thresh; |
521 | 0 | txfm_params->skip_txfm_level = |
522 | 0 | winner_mode_params->skip_txfm_level[MODE_EVAL]; |
523 | 0 | txfm_params->predict_dc_level = |
524 | 0 | winner_mode_params->predict_dc_level[MODE_EVAL]; |
525 | | // Set transform domain distortion type for mode evaluation |
526 | 0 | set_tx_domain_dist_params( |
527 | 0 | winner_mode_params, txfm_params, |
528 | 0 | sf->winner_mode_sf.enable_winner_mode_for_use_tx_domain_dist, 0); |
529 | | |
530 | | // Get threshold for R-D optimization of coefficients during mode |
531 | | // evaluation |
532 | 0 | get_rd_opt_coeff_thresh( |
533 | 0 | winner_mode_params->coeff_opt_thresholds, txfm_params, |
534 | 0 | sf->winner_mode_sf.enable_winner_mode_for_coeff_opt, 0); |
535 | | |
536 | | // Set the transform size search method for mode evaluation |
537 | 0 | set_tx_size_search_method( |
538 | 0 | cm, winner_mode_params, txfm_params, |
539 | 0 | sf->winner_mode_sf.enable_winner_mode_for_tx_size_srch, 0); |
540 | | // Set transform type prune for mode evaluation |
541 | 0 | set_tx_type_prune(sf, txfm_params, |
542 | 0 | sf->tx_sf.tx_type_search.winner_mode_tx_type_pruning, |
543 | 0 | 0); |
544 | 0 | break; |
545 | 0 | case WINNER_MODE_EVAL: |
546 | 0 | txfm_params->default_inter_tx_type_prob_thresh = INT_MAX; |
547 | 0 | txfm_params->use_default_intra_tx_type = 0; |
548 | 0 | txfm_params->skip_txfm_level = |
549 | 0 | winner_mode_params->skip_txfm_level[WINNER_MODE_EVAL]; |
550 | 0 | txfm_params->predict_dc_level = |
551 | 0 | winner_mode_params->predict_dc_level[WINNER_MODE_EVAL]; |
552 | | |
553 | | // Set transform domain distortion type for winner mode evaluation |
554 | 0 | set_tx_domain_dist_params( |
555 | 0 | winner_mode_params, txfm_params, |
556 | 0 | sf->winner_mode_sf.enable_winner_mode_for_use_tx_domain_dist, 1); |
557 | | |
558 | | // Get threshold for R-D optimization of coefficients for winner mode |
559 | | // evaluation |
560 | 0 | get_rd_opt_coeff_thresh( |
561 | 0 | winner_mode_params->coeff_opt_thresholds, txfm_params, |
562 | 0 | sf->winner_mode_sf.enable_winner_mode_for_coeff_opt, 1); |
563 | | |
564 | | // Set the transform size search method for winner mode evaluation |
565 | 0 | set_tx_size_search_method( |
566 | 0 | cm, winner_mode_params, txfm_params, |
567 | 0 | sf->winner_mode_sf.enable_winner_mode_for_tx_size_srch, 1); |
568 | | // Set default transform type prune mode for winner mode evaluation |
569 | 0 | set_tx_type_prune(sf, txfm_params, |
570 | 0 | sf->tx_sf.tx_type_search.winner_mode_tx_type_pruning, |
571 | 0 | 1); |
572 | 0 | reset_mb_rd_record(x->txfm_search_info.mb_rd_record); |
573 | 0 | break; |
574 | 0 | default: assert(0); |
575 | 0 | } |
576 | 0 | } Unexecuted instantiation: encoder.c:set_mode_eval_params Unexecuted instantiation: encoder_utils.c:set_mode_eval_params Unexecuted instantiation: encodetxb.c:set_mode_eval_params Unexecuted instantiation: ethread.c:set_mode_eval_params Unexecuted instantiation: global_motion_facade.c:set_mode_eval_params Unexecuted instantiation: mcomp.c:set_mode_eval_params Unexecuted instantiation: palette.c:set_mode_eval_params Unexecuted instantiation: rdopt.c:set_mode_eval_params Unexecuted instantiation: speed_features.c:set_mode_eval_params Unexecuted instantiation: superres_scale.c:set_mode_eval_params Unexecuted instantiation: svc_layercontext.c:set_mode_eval_params Unexecuted instantiation: tokenize.c:set_mode_eval_params Unexecuted instantiation: tpl_model.c:set_mode_eval_params Unexecuted instantiation: tx_search.c:set_mode_eval_params Unexecuted instantiation: intra_mode_search.c:set_mode_eval_params Unexecuted instantiation: allintra_vis.c:set_mode_eval_params Unexecuted instantiation: compound_type.c:set_mode_eval_params Unexecuted instantiation: encodeframe.c:set_mode_eval_params Unexecuted instantiation: encodeframe_utils.c:set_mode_eval_params Unexecuted instantiation: encodemb.c:set_mode_eval_params Unexecuted instantiation: encode_strategy.c:set_mode_eval_params Unexecuted instantiation: interp_search.c:set_mode_eval_params Unexecuted instantiation: motion_search_facade.c:set_mode_eval_params Unexecuted instantiation: partition_search.c:set_mode_eval_params Unexecuted instantiation: partition_strategy.c:set_mode_eval_params Unexecuted instantiation: nonrd_pickmode.c:set_mode_eval_params |
577 | | |
578 | | // Similar to store_cfl_required(), but for use during the RDO process, |
579 | | // where we haven't yet determined whether this block uses CfL. |
580 | | static INLINE CFL_ALLOWED_TYPE store_cfl_required_rdo(const AV1_COMMON *cm, |
581 | 0 | const MACROBLOCK *x) { |
582 | 0 | const MACROBLOCKD *xd = &x->e_mbd; |
583 | |
|
584 | 0 | if (cm->seq_params->monochrome || !xd->is_chroma_ref) return CFL_DISALLOWED; |
585 | | |
586 | 0 | if (!xd->is_chroma_ref) { |
587 | | // For non-chroma-reference blocks, we should always store the luma pixels, |
588 | | // in case the corresponding chroma-reference block uses CfL. |
589 | | // Note that this can only happen for block sizes which are <8 on |
590 | | // their shortest side, as otherwise they would be chroma reference |
591 | | // blocks. |
592 | 0 | return CFL_ALLOWED; |
593 | 0 | } |
594 | | |
595 | | // For chroma reference blocks, we should store data in the encoder iff we're |
596 | | // allowed to try out CfL. |
597 | 0 | return is_cfl_allowed(xd); |
598 | 0 | } Unexecuted instantiation: encoder.c:store_cfl_required_rdo Unexecuted instantiation: encoder_utils.c:store_cfl_required_rdo Unexecuted instantiation: encodetxb.c:store_cfl_required_rdo Unexecuted instantiation: ethread.c:store_cfl_required_rdo Unexecuted instantiation: global_motion_facade.c:store_cfl_required_rdo Unexecuted instantiation: mcomp.c:store_cfl_required_rdo Unexecuted instantiation: palette.c:store_cfl_required_rdo Unexecuted instantiation: rdopt.c:store_cfl_required_rdo Unexecuted instantiation: speed_features.c:store_cfl_required_rdo Unexecuted instantiation: superres_scale.c:store_cfl_required_rdo Unexecuted instantiation: svc_layercontext.c:store_cfl_required_rdo Unexecuted instantiation: tokenize.c:store_cfl_required_rdo Unexecuted instantiation: tpl_model.c:store_cfl_required_rdo Unexecuted instantiation: tx_search.c:store_cfl_required_rdo Unexecuted instantiation: intra_mode_search.c:store_cfl_required_rdo Unexecuted instantiation: allintra_vis.c:store_cfl_required_rdo Unexecuted instantiation: compound_type.c:store_cfl_required_rdo Unexecuted instantiation: encodeframe.c:store_cfl_required_rdo Unexecuted instantiation: encodeframe_utils.c:store_cfl_required_rdo Unexecuted instantiation: encodemb.c:store_cfl_required_rdo Unexecuted instantiation: encode_strategy.c:store_cfl_required_rdo Unexecuted instantiation: interp_search.c:store_cfl_required_rdo Unexecuted instantiation: motion_search_facade.c:store_cfl_required_rdo Unexecuted instantiation: partition_search.c:store_cfl_required_rdo Unexecuted instantiation: partition_strategy.c:store_cfl_required_rdo Unexecuted instantiation: nonrd_pickmode.c:store_cfl_required_rdo |
599 | | |
600 | 0 | static AOM_INLINE void init_sbuv_mode(MB_MODE_INFO *const mbmi) { |
601 | 0 | mbmi->uv_mode = UV_DC_PRED; |
602 | 0 | mbmi->palette_mode_info.palette_size[1] = 0; |
603 | 0 | } Unexecuted instantiation: encoder.c:init_sbuv_mode Unexecuted instantiation: encoder_utils.c:init_sbuv_mode Unexecuted instantiation: encodetxb.c:init_sbuv_mode Unexecuted instantiation: ethread.c:init_sbuv_mode Unexecuted instantiation: global_motion_facade.c:init_sbuv_mode Unexecuted instantiation: mcomp.c:init_sbuv_mode Unexecuted instantiation: palette.c:init_sbuv_mode Unexecuted instantiation: rdopt.c:init_sbuv_mode Unexecuted instantiation: speed_features.c:init_sbuv_mode Unexecuted instantiation: superres_scale.c:init_sbuv_mode Unexecuted instantiation: svc_layercontext.c:init_sbuv_mode Unexecuted instantiation: tokenize.c:init_sbuv_mode Unexecuted instantiation: tpl_model.c:init_sbuv_mode Unexecuted instantiation: tx_search.c:init_sbuv_mode Unexecuted instantiation: intra_mode_search.c:init_sbuv_mode Unexecuted instantiation: allintra_vis.c:init_sbuv_mode Unexecuted instantiation: compound_type.c:init_sbuv_mode Unexecuted instantiation: encodeframe.c:init_sbuv_mode Unexecuted instantiation: encodeframe_utils.c:init_sbuv_mode Unexecuted instantiation: encodemb.c:init_sbuv_mode Unexecuted instantiation: encode_strategy.c:init_sbuv_mode Unexecuted instantiation: interp_search.c:init_sbuv_mode Unexecuted instantiation: motion_search_facade.c:init_sbuv_mode Unexecuted instantiation: partition_search.c:init_sbuv_mode Unexecuted instantiation: partition_strategy.c:init_sbuv_mode Unexecuted instantiation: nonrd_pickmode.c:init_sbuv_mode |
604 | | |
605 | | // Store best mode stats for winner mode processing |
606 | | static INLINE void store_winner_mode_stats( |
607 | | const AV1_COMMON *const cm, MACROBLOCK *x, const MB_MODE_INFO *mbmi, |
608 | | RD_STATS *rd_cost, RD_STATS *rd_cost_y, RD_STATS *rd_cost_uv, |
609 | | THR_MODES mode_index, uint8_t *color_map, BLOCK_SIZE bsize, int64_t this_rd, |
610 | 0 | int multi_winner_mode_type, int txfm_search_done) { |
611 | 0 | WinnerModeStats *winner_mode_stats = x->winner_mode_stats; |
612 | 0 | int mode_idx = 0; |
613 | 0 | int is_palette_mode = mbmi->palette_mode_info.palette_size[PLANE_TYPE_Y] > 0; |
614 | | // Mode stat is not required when multiwinner mode processing is disabled |
615 | 0 | if (multi_winner_mode_type == MULTI_WINNER_MODE_OFF) return; |
616 | | // Ignore mode with maximum rd |
617 | 0 | if (this_rd == INT64_MAX) return; |
618 | | // TODO(any): Winner mode processing is currently not applicable for palette |
619 | | // mode in Inter frames. Clean-up the following code, once support is added |
620 | 0 | if (!frame_is_intra_only(cm) && is_palette_mode) return; |
621 | | |
622 | 0 | int max_winner_mode_count = frame_is_intra_only(cm) |
623 | 0 | ? MAX_WINNER_MODE_COUNT_INTRA |
624 | 0 | : MAX_WINNER_MODE_COUNT_INTER; |
625 | 0 | max_winner_mode_count = (multi_winner_mode_type == MULTI_WINNER_MODE_FAST) |
626 | 0 | ? AOMMIN(max_winner_mode_count, 2) |
627 | 0 | : max_winner_mode_count; |
628 | 0 | assert(x->winner_mode_count >= 0 && |
629 | 0 | x->winner_mode_count <= max_winner_mode_count); |
630 | |
|
631 | 0 | if (x->winner_mode_count) { |
632 | | // Find the mode which has higher rd cost than this_rd |
633 | 0 | for (mode_idx = 0; mode_idx < x->winner_mode_count; mode_idx++) |
634 | 0 | if (winner_mode_stats[mode_idx].rd > this_rd) break; |
635 | |
|
636 | 0 | if (mode_idx == max_winner_mode_count) { |
637 | | // No mode has higher rd cost than this_rd |
638 | 0 | return; |
639 | 0 | } else if (mode_idx < max_winner_mode_count - 1) { |
640 | | // Create a slot for current mode and move others to the next slot |
641 | 0 | memmove( |
642 | 0 | &winner_mode_stats[mode_idx + 1], &winner_mode_stats[mode_idx], |
643 | 0 | (max_winner_mode_count - mode_idx - 1) * sizeof(*winner_mode_stats)); |
644 | 0 | } |
645 | 0 | } |
646 | | // Add a mode stat for winner mode processing |
647 | 0 | winner_mode_stats[mode_idx].mbmi = *mbmi; |
648 | 0 | winner_mode_stats[mode_idx].rd = this_rd; |
649 | 0 | winner_mode_stats[mode_idx].mode_index = mode_index; |
650 | | |
651 | | // Update rd stats required for inter frame |
652 | 0 | if (!frame_is_intra_only(cm) && rd_cost && rd_cost_y && rd_cost_uv) { |
653 | 0 | const MACROBLOCKD *xd = &x->e_mbd; |
654 | 0 | const int skip_ctx = av1_get_skip_txfm_context(xd); |
655 | 0 | const int is_intra_mode = av1_mode_defs[mode_index].mode < INTRA_MODE_END; |
656 | 0 | const int skip_txfm = mbmi->skip_txfm && !is_intra_mode; |
657 | |
|
658 | 0 | winner_mode_stats[mode_idx].rd_cost = *rd_cost; |
659 | 0 | if (txfm_search_done) { |
660 | 0 | winner_mode_stats[mode_idx].rate_y = |
661 | 0 | rd_cost_y->rate + |
662 | 0 | x->mode_costs |
663 | 0 | .skip_txfm_cost[skip_ctx][rd_cost->skip_txfm || skip_txfm]; |
664 | 0 | winner_mode_stats[mode_idx].rate_uv = rd_cost_uv->rate; |
665 | 0 | } |
666 | 0 | } |
667 | |
|
668 | 0 | if (color_map) { |
669 | | // Store color_index_map for palette mode |
670 | 0 | const MACROBLOCKD *const xd = &x->e_mbd; |
671 | 0 | int block_width, block_height; |
672 | 0 | av1_get_block_dimensions(bsize, AOM_PLANE_Y, xd, &block_width, |
673 | 0 | &block_height, NULL, NULL); |
674 | 0 | memcpy(winner_mode_stats[mode_idx].color_index_map, color_map, |
675 | 0 | block_width * block_height * sizeof(color_map[0])); |
676 | 0 | } |
677 | |
|
678 | 0 | x->winner_mode_count = |
679 | 0 | AOMMIN(x->winner_mode_count + 1, max_winner_mode_count); |
680 | 0 | } Unexecuted instantiation: encoder.c:store_winner_mode_stats Unexecuted instantiation: encoder_utils.c:store_winner_mode_stats Unexecuted instantiation: encodetxb.c:store_winner_mode_stats Unexecuted instantiation: ethread.c:store_winner_mode_stats Unexecuted instantiation: global_motion_facade.c:store_winner_mode_stats Unexecuted instantiation: mcomp.c:store_winner_mode_stats Unexecuted instantiation: palette.c:store_winner_mode_stats Unexecuted instantiation: rdopt.c:store_winner_mode_stats Unexecuted instantiation: speed_features.c:store_winner_mode_stats Unexecuted instantiation: superres_scale.c:store_winner_mode_stats Unexecuted instantiation: svc_layercontext.c:store_winner_mode_stats Unexecuted instantiation: tokenize.c:store_winner_mode_stats Unexecuted instantiation: tpl_model.c:store_winner_mode_stats Unexecuted instantiation: tx_search.c:store_winner_mode_stats Unexecuted instantiation: intra_mode_search.c:store_winner_mode_stats Unexecuted instantiation: allintra_vis.c:store_winner_mode_stats Unexecuted instantiation: compound_type.c:store_winner_mode_stats Unexecuted instantiation: encodeframe.c:store_winner_mode_stats Unexecuted instantiation: encodeframe_utils.c:store_winner_mode_stats Unexecuted instantiation: encodemb.c:store_winner_mode_stats Unexecuted instantiation: encode_strategy.c:store_winner_mode_stats Unexecuted instantiation: interp_search.c:store_winner_mode_stats Unexecuted instantiation: motion_search_facade.c:store_winner_mode_stats Unexecuted instantiation: partition_search.c:store_winner_mode_stats Unexecuted instantiation: partition_strategy.c:store_winner_mode_stats Unexecuted instantiation: nonrd_pickmode.c:store_winner_mode_stats |
681 | | |
682 | | unsigned int av1_get_sby_perpixel_variance(const struct AV1_COMP *cpi, |
683 | | const struct buf_2d *ref, |
684 | | BLOCK_SIZE bs); |
685 | | |
686 | | unsigned int av1_high_get_sby_perpixel_variance(const struct AV1_COMP *cpi, |
687 | | const struct buf_2d *ref, |
688 | | BLOCK_SIZE bs, int bd); |
689 | | |
690 | 0 | static INLINE int is_mode_intra(PREDICTION_MODE mode) { |
691 | 0 | return mode < INTRA_MODE_END; |
692 | 0 | } Unexecuted instantiation: encoder.c:is_mode_intra Unexecuted instantiation: encoder_utils.c:is_mode_intra Unexecuted instantiation: encodetxb.c:is_mode_intra Unexecuted instantiation: ethread.c:is_mode_intra Unexecuted instantiation: global_motion_facade.c:is_mode_intra Unexecuted instantiation: mcomp.c:is_mode_intra Unexecuted instantiation: palette.c:is_mode_intra Unexecuted instantiation: rdopt.c:is_mode_intra Unexecuted instantiation: speed_features.c:is_mode_intra Unexecuted instantiation: superres_scale.c:is_mode_intra Unexecuted instantiation: svc_layercontext.c:is_mode_intra Unexecuted instantiation: tokenize.c:is_mode_intra Unexecuted instantiation: tpl_model.c:is_mode_intra Unexecuted instantiation: tx_search.c:is_mode_intra Unexecuted instantiation: intra_mode_search.c:is_mode_intra Unexecuted instantiation: allintra_vis.c:is_mode_intra Unexecuted instantiation: compound_type.c:is_mode_intra Unexecuted instantiation: encodeframe.c:is_mode_intra Unexecuted instantiation: encodeframe_utils.c:is_mode_intra Unexecuted instantiation: encodemb.c:is_mode_intra Unexecuted instantiation: encode_strategy.c:is_mode_intra Unexecuted instantiation: interp_search.c:is_mode_intra Unexecuted instantiation: motion_search_facade.c:is_mode_intra Unexecuted instantiation: partition_search.c:is_mode_intra Unexecuted instantiation: partition_strategy.c:is_mode_intra Unexecuted instantiation: nonrd_pickmode.c:is_mode_intra |
693 | | |
694 | | #ifdef __cplusplus |
695 | | } // extern "C" |
696 | | #endif |
697 | | |
698 | | #endif // AOM_AV1_ENCODER_RDOPT_UTILS_H_ |