OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "vpx_ports/mem.h" | 26 #include "vpx_ports/mem.h" |
27 #include "vpx/internal/vpx_codec_internal.h" | 27 #include "vpx/internal/vpx_codec_internal.h" |
28 #include "vp9/encoder/vp9_mcomp.h" | 28 #include "vp9/encoder/vp9_mcomp.h" |
29 #include "vp9/common/vp9_findnearmv.h" | 29 #include "vp9/common/vp9_findnearmv.h" |
30 #include "vp9/encoder/vp9_lookahead.h" | 30 #include "vp9/encoder/vp9_lookahead.h" |
31 | 31 |
32 // Experimental rate control switches | 32 // Experimental rate control switches |
33 #if CONFIG_ONESHOTQ | 33 #if CONFIG_ONESHOTQ |
34 #define ONE_SHOT_Q_ESTIMATE 0 | 34 #define ONE_SHOT_Q_ESTIMATE 0 |
35 #define STRICT_ONE_SHOT_Q 0 | 35 #define STRICT_ONE_SHOT_Q 0 |
| 36 #endif |
36 #define DISABLE_RC_LONG_TERM_MEM 0 | 37 #define DISABLE_RC_LONG_TERM_MEM 0 |
37 #endif | |
38 | 38 |
39 // #define MODE_TEST_HIT_STATS | 39 // #define MODE_TEST_HIT_STATS |
40 | 40 |
41 // #define SPEEDSTATS 1 | 41 // #define SPEEDSTATS 1 |
42 #if CONFIG_MULTIPLE_ARF | 42 #if CONFIG_MULTIPLE_ARF |
43 // Set MIN_GF_INTERVAL to 1 for the full decomposition. | 43 // Set MIN_GF_INTERVAL to 1 for the full decomposition. |
44 #define MIN_GF_INTERVAL 2 | 44 #define MIN_GF_INTERVAL 2 |
45 #else | 45 #else |
46 #define MIN_GF_INTERVAL 4 | 46 #define MIN_GF_INTERVAL 4 |
47 #endif | 47 #endif |
48 #define DEFAULT_GF_INTERVAL 7 | 48 #define DEFAULT_GF_INTERVAL 7 |
49 | 49 |
50 #define KEY_FRAME_CONTEXT 5 | 50 #define KEY_FRAME_CONTEXT 5 |
51 | 51 |
52 #define MAX_MODES 36 | 52 #define MAX_MODES 30 |
| 53 #define MAX_REFS 6 |
53 | 54 |
54 #define MIN_THRESHMULT 32 | 55 #define MIN_THRESHMULT 32 |
55 #define MAX_THRESHMULT 512 | 56 #define MAX_THRESHMULT 512 |
56 | 57 |
57 #define GF_ZEROMV_ZBIN_BOOST 0 | 58 #define GF_ZEROMV_ZBIN_BOOST 0 |
58 #define LF_ZEROMV_ZBIN_BOOST 0 | 59 #define LF_ZEROMV_ZBIN_BOOST 0 |
59 #define MV_ZBIN_BOOST 0 | 60 #define MV_ZBIN_BOOST 0 |
60 #define SPLIT_MV_ZBIN_BOOST 0 | 61 #define SPLIT_MV_ZBIN_BOOST 0 |
61 #define INTRA_ZBIN_BOOST 0 | 62 #define INTRA_ZBIN_BOOST 0 |
62 | 63 |
63 typedef struct { | 64 typedef struct { |
64 nmv_context nmvc; | |
65 int nmvjointcost[MV_JOINTS]; | 65 int nmvjointcost[MV_JOINTS]; |
66 int nmvcosts[2][MV_VALS]; | 66 int nmvcosts[2][MV_VALS]; |
67 int nmvcosts_hp[2][MV_VALS]; | 67 int nmvcosts_hp[2][MV_VALS]; |
68 | 68 |
69 vp9_prob segment_pred_probs[PREDICTION_PROBS]; | 69 vp9_prob segment_pred_probs[PREDICTION_PROBS]; |
70 vp9_prob intra_inter_prob[INTRA_INTER_CONTEXTS]; | |
71 vp9_prob comp_inter_prob[COMP_INTER_CONTEXTS]; | |
72 vp9_prob single_ref_prob[REF_CONTEXTS][2]; | |
73 vp9_prob comp_ref_prob[REF_CONTEXTS]; | |
74 | 70 |
75 unsigned char *last_frame_seg_map_copy; | 71 unsigned char *last_frame_seg_map_copy; |
76 | 72 |
77 // 0 = Intra, Last, GF, ARF | 73 // 0 = Intra, Last, GF, ARF |
78 signed char last_ref_lf_deltas[MAX_REF_LF_DELTAS]; | 74 signed char last_ref_lf_deltas[MAX_REF_LF_DELTAS]; |
79 // 0 = ZERO_MV, MV | 75 // 0 = ZERO_MV, MV |
80 signed char last_mode_lf_deltas[MAX_MODE_LF_DELTAS]; | 76 signed char last_mode_lf_deltas[MAX_MODE_LF_DELTAS]; |
81 | 77 |
82 vp9_coeff_probs_model coef_probs[TX_SIZES][BLOCK_TYPES]; | |
83 | |
84 vp9_prob y_mode_prob[4][INTRA_MODES - 1]; | |
85 vp9_prob uv_mode_prob[INTRA_MODES][INTRA_MODES - 1]; | |
86 vp9_prob partition_prob[2][NUM_PARTITION_CONTEXTS][PARTITION_TYPES - 1]; | |
87 | |
88 vp9_prob switchable_interp_prob[SWITCHABLE_FILTERS + 1] | |
89 [SWITCHABLE_FILTERS - 1]; | |
90 | |
91 int inter_mode_counts[INTER_MODE_CONTEXTS][INTER_MODES - 1][2]; | 78 int inter_mode_counts[INTER_MODE_CONTEXTS][INTER_MODES - 1][2]; |
92 vp9_prob inter_mode_probs[INTER_MODE_CONTEXTS][INTER_MODES - 1]; | 79 FRAME_CONTEXT fc; |
93 | |
94 struct tx_probs tx_probs; | |
95 vp9_prob mbskip_probs[MBSKIP_CONTEXTS]; | |
96 } CODING_CONTEXT; | 80 } CODING_CONTEXT; |
97 | 81 |
98 typedef struct { | 82 typedef struct { |
99 double frame; | 83 double frame; |
100 double intra_error; | 84 double intra_error; |
101 double coded_error; | 85 double coded_error; |
102 double sr_coded_error; | 86 double sr_coded_error; |
103 double ssim_weighted_pred_err; | 87 double ssim_weighted_pred_err; |
104 double pcnt_inter; | 88 double pcnt_inter; |
105 double pcnt_motion; | 89 double pcnt_motion; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 THR_COMP_NEARESTGA, | 146 THR_COMP_NEARESTGA, |
163 | 147 |
164 THR_TM, | 148 THR_TM, |
165 | 149 |
166 THR_COMP_NEARLA, | 150 THR_COMP_NEARLA, |
167 THR_COMP_NEWLA, | 151 THR_COMP_NEWLA, |
168 THR_NEARG, | 152 THR_NEARG, |
169 THR_COMP_NEARGA, | 153 THR_COMP_NEARGA, |
170 THR_COMP_NEWGA, | 154 THR_COMP_NEWGA, |
171 | 155 |
172 THR_SPLITMV, | |
173 THR_SPLITG, | |
174 THR_SPLITA, | |
175 THR_COMP_SPLITLA, | |
176 THR_COMP_SPLITGA, | |
177 | |
178 THR_ZEROMV, | 156 THR_ZEROMV, |
179 THR_ZEROG, | 157 THR_ZEROG, |
180 THR_ZEROA, | 158 THR_ZEROA, |
181 THR_COMP_ZEROLA, | 159 THR_COMP_ZEROLA, |
182 THR_COMP_ZEROGA, | 160 THR_COMP_ZEROGA, |
183 | 161 |
184 THR_B_PRED, | |
185 THR_H_PRED, | 162 THR_H_PRED, |
186 THR_V_PRED, | 163 THR_V_PRED, |
187 THR_D135_PRED, | 164 THR_D135_PRED, |
188 THR_D207_PRED, | 165 THR_D207_PRED, |
189 THR_D153_PRED, | 166 THR_D153_PRED, |
190 THR_D63_PRED, | 167 THR_D63_PRED, |
191 THR_D117_PRED, | 168 THR_D117_PRED, |
192 THR_D45_PRED, | 169 THR_D45_PRED, |
193 } THR_MODES; | 170 } THR_MODES; |
194 | 171 |
195 typedef enum { | 172 typedef enum { |
| 173 THR_LAST, |
| 174 THR_GOLD, |
| 175 THR_ALTR, |
| 176 THR_COMP_LA, |
| 177 THR_COMP_GA, |
| 178 THR_INTRA, |
| 179 } THR_MODES_SUB8X8; |
| 180 |
| 181 typedef enum { |
196 DIAMOND = 0, | 182 DIAMOND = 0, |
197 NSTEP = 1, | 183 NSTEP = 1, |
198 HEX = 2, | 184 HEX = 2, |
199 BIGDIA = 3, | 185 BIGDIA = 3, |
200 SQUARE = 4 | 186 SQUARE = 4 |
201 } SEARCH_METHODS; | 187 } SEARCH_METHODS; |
202 | 188 |
203 typedef enum { | 189 typedef enum { |
204 USE_FULL_RD = 0, | 190 USE_FULL_RD = 0, |
205 USE_LARGESTINTRA, | 191 USE_LARGESTINTRA, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 223 |
238 typedef enum { | 224 typedef enum { |
239 SUBPEL_ITERATIVE = 0, | 225 SUBPEL_ITERATIVE = 0, |
240 SUBPEL_TREE = 1, | 226 SUBPEL_TREE = 1, |
241 // Other methods to come | 227 // Other methods to come |
242 } SUBPEL_SEARCH_METHODS; | 228 } SUBPEL_SEARCH_METHODS; |
243 | 229 |
244 #define ALL_INTRA_MODES 0x3FF | 230 #define ALL_INTRA_MODES 0x3FF |
245 #define INTRA_DC_ONLY 0x01 | 231 #define INTRA_DC_ONLY 0x01 |
246 #define INTRA_DC_TM ((1 << TM_PRED) | (1 << DC_PRED)) | 232 #define INTRA_DC_TM ((1 << TM_PRED) | (1 << DC_PRED)) |
| 233 #define INTRA_DC_H_V ((1 << DC_PRED) | (1 << V_PRED) | (1 << H_PRED)) |
247 #define INTRA_DC_TM_H_V (INTRA_DC_TM | (1 << V_PRED) | (1 << H_PRED)) | 234 #define INTRA_DC_TM_H_V (INTRA_DC_TM | (1 << V_PRED) | (1 << H_PRED)) |
248 | 235 |
| 236 typedef enum { |
| 237 LAST_FRAME_PARTITION_OFF = 0, |
| 238 LAST_FRAME_PARTITION_LOW_MOTION = 1, |
| 239 LAST_FRAME_PARTITION_ALL = 2 |
| 240 } LAST_FRAME_PARTITION_METHOD; |
| 241 |
249 typedef struct { | 242 typedef struct { |
250 int RD; | 243 int RD; |
251 SEARCH_METHODS search_method; | 244 SEARCH_METHODS search_method; |
252 int auto_filter; | 245 int auto_filter; |
253 int recode_loop; | 246 int recode_loop; |
254 SUBPEL_SEARCH_METHODS subpel_search_method; | 247 SUBPEL_SEARCH_METHODS subpel_search_method; |
255 int subpel_iters_per_step; | 248 int subpel_iters_per_step; |
256 int thresh_mult[MAX_MODES]; | 249 int thresh_mult[MAX_MODES]; |
| 250 int thresh_mult_sub8x8[MAX_REFS]; |
257 int max_step_search_steps; | 251 int max_step_search_steps; |
258 int reduce_first_step_size; | 252 int reduce_first_step_size; |
259 int auto_mv_step_size; | 253 int auto_mv_step_size; |
260 int optimize_coefficients; | 254 int optimize_coefficients; |
261 int static_segmentation; | 255 int static_segmentation; |
| 256 int variance_adaptive_quantization; |
262 int comp_inter_joint_search_thresh; | 257 int comp_inter_joint_search_thresh; |
263 int adaptive_rd_thresh; | 258 int adaptive_rd_thresh; |
264 int skip_encode_sb; | 259 int skip_encode_sb; |
265 int skip_encode_frame; | 260 int skip_encode_frame; |
266 int use_lastframe_partitioning; | 261 LAST_FRAME_PARTITION_METHOD use_lastframe_partitioning; |
267 TX_SIZE_SEARCH_METHOD tx_size_search_method; | 262 TX_SIZE_SEARCH_METHOD tx_size_search_method; |
268 int use_lp32x32fdct; | 263 int use_lp32x32fdct; |
269 int use_avoid_tested_higherror; | 264 int use_avoid_tested_higherror; |
270 int partition_by_variance; | |
271 int use_one_partition_size_always; | 265 int use_one_partition_size_always; |
272 int less_rectangular_check; | 266 int less_rectangular_check; |
273 int use_square_partition_only; | 267 int use_square_partition_only; |
274 int mode_skip_start; | 268 int mode_skip_start; |
275 int reference_masking; | 269 int reference_masking; |
276 BLOCK_SIZE always_this_block_size; | 270 BLOCK_SIZE always_this_block_size; |
277 int auto_min_max_partition_size; | 271 int auto_min_max_partition_size; |
278 int auto_min_max_partition_interval; | |
279 int auto_min_max_partition_count; | |
280 BLOCK_SIZE min_partition_size; | 272 BLOCK_SIZE min_partition_size; |
281 BLOCK_SIZE max_partition_size; | 273 BLOCK_SIZE max_partition_size; |
282 int adjust_partitioning_from_last_frame; | 274 int adjust_partitioning_from_last_frame; |
283 int last_partitioning_redo_frequency; | 275 int last_partitioning_redo_frequency; |
284 int disable_splitmv; | 276 int disable_split_mask; |
285 int using_small_partition_info; | 277 int using_small_partition_info; |
286 // TODO(jingning): combine the related motion search speed features | 278 // TODO(jingning): combine the related motion search speed features |
287 int adaptive_motion_search; | 279 int adaptive_motion_search; |
288 | 280 |
289 // Implements various heuristics to skip searching modes | 281 // Implements various heuristics to skip searching modes |
290 // The heuristics selected are based on flags | 282 // The heuristics selected are based on flags |
291 // defined in the MODE_SEARCH_SKIP_HEURISTICS enum | 283 // defined in the MODE_SEARCH_SKIP_HEURISTICS enum |
292 unsigned int mode_search_skip_flags; | 284 unsigned int mode_search_skip_flags; |
293 // A source variance threshold below which the split mode is disabled | 285 // A source variance threshold below which the split mode is disabled |
294 unsigned int disable_split_var_thresh; | 286 unsigned int disable_split_var_thresh; |
295 // A source variance threshold below which filter search is disabled | 287 // A source variance threshold below which filter search is disabled |
296 // Choose a very large value (UINT_MAX) to use 8-tap always | 288 // Choose a very large value (UINT_MAX) to use 8-tap always |
297 unsigned int disable_filter_search_var_thresh; | 289 unsigned int disable_filter_search_var_thresh; |
298 int intra_y_mode_mask; | 290 int intra_y_mode_mask[TX_SIZES]; |
299 int intra_uv_mode_mask; | 291 int intra_uv_mode_mask[TX_SIZES]; |
300 int use_rd_breakout; | 292 int use_rd_breakout; |
301 int use_uv_intra_rd_estimate; | 293 int use_uv_intra_rd_estimate; |
302 int use_fast_lpf_pick; | 294 int use_fast_lpf_pick; |
303 int use_fast_coef_updates; // 0: 2-loop, 1: 1-loop, 2: 1-loop reduced | 295 int use_fast_coef_updates; // 0: 2-loop, 1: 1-loop, 2: 1-loop reduced |
304 } SPEED_FEATURES; | 296 } SPEED_FEATURES; |
305 | 297 |
306 typedef struct VP9_COMP { | 298 typedef struct VP9_COMP { |
307 DECLARE_ALIGNED(16, int16_t, y_quant[QINDEX_RANGE][8]); | 299 DECLARE_ALIGNED(16, int16_t, y_quant[QINDEX_RANGE][8]); |
308 DECLARE_ALIGNED(16, int16_t, y_quant_shift[QINDEX_RANGE][8]); | 300 DECLARE_ALIGNED(16, int16_t, y_quant_shift[QINDEX_RANGE][8]); |
309 DECLARE_ALIGNED(16, int16_t, y_zbin[QINDEX_RANGE][8]); | 301 DECLARE_ALIGNED(16, int16_t, y_zbin[QINDEX_RANGE][8]); |
310 DECLARE_ALIGNED(16, int16_t, y_round[QINDEX_RANGE][8]); | 302 DECLARE_ALIGNED(16, int16_t, y_round[QINDEX_RANGE][8]); |
311 | 303 |
312 DECLARE_ALIGNED(16, int16_t, uv_quant[QINDEX_RANGE][8]); | 304 DECLARE_ALIGNED(16, int16_t, uv_quant[QINDEX_RANGE][8]); |
313 DECLARE_ALIGNED(16, int16_t, uv_quant_shift[QINDEX_RANGE][8]); | 305 DECLARE_ALIGNED(16, int16_t, uv_quant_shift[QINDEX_RANGE][8]); |
314 DECLARE_ALIGNED(16, int16_t, uv_zbin[QINDEX_RANGE][8]); | 306 DECLARE_ALIGNED(16, int16_t, uv_zbin[QINDEX_RANGE][8]); |
315 DECLARE_ALIGNED(16, int16_t, uv_round[QINDEX_RANGE][8]); | 307 DECLARE_ALIGNED(16, int16_t, uv_round[QINDEX_RANGE][8]); |
316 | 308 |
317 #if CONFIG_ALPHA | 309 #if CONFIG_ALPHA |
318 DECLARE_ALIGNED(16, int16_t, a_quant[QINDEX_RANGE][8]); | 310 DECLARE_ALIGNED(16, int16_t, a_quant[QINDEX_RANGE][8]); |
319 DECLARE_ALIGNED(16, int16_t, a_quant_shift[QINDEX_RANGE][8]); | 311 DECLARE_ALIGNED(16, int16_t, a_quant_shift[QINDEX_RANGE][8]); |
320 DECLARE_ALIGNED(16, int16_t, a_zbin[QINDEX_RANGE][8]); | 312 DECLARE_ALIGNED(16, int16_t, a_zbin[QINDEX_RANGE][8]); |
321 DECLARE_ALIGNED(16, int16_t, a_round[QINDEX_RANGE][8]); | 313 DECLARE_ALIGNED(16, int16_t, a_round[QINDEX_RANGE][8]); |
322 #endif | 314 #endif |
323 | 315 |
324 MACROBLOCK mb; | 316 MACROBLOCK mb; |
325 VP9_COMMON common; | 317 VP9_COMMON common; |
326 VP9_CONFIG oxcf; | 318 VP9_CONFIG oxcf; |
| 319 struct rdcost_block_args rdcost_stack; |
327 | 320 |
328 struct lookahead_ctx *lookahead; | 321 struct lookahead_ctx *lookahead; |
329 struct lookahead_entry *source; | 322 struct lookahead_entry *source; |
330 #if CONFIG_MULTIPLE_ARF | 323 #if CONFIG_MULTIPLE_ARF |
331 struct lookahead_entry *alt_ref_source[NUM_REF_FRAMES]; | 324 struct lookahead_entry *alt_ref_source[NUM_REF_FRAMES]; |
332 #else | 325 #else |
333 struct lookahead_entry *alt_ref_source; | 326 struct lookahead_entry *alt_ref_source; |
334 #endif | 327 #endif |
335 | 328 |
336 YV12_BUFFER_CONFIG *Source; | 329 YV12_BUFFER_CONFIG *Source; |
337 YV12_BUFFER_CONFIG *un_scaled_source; | 330 YV12_BUFFER_CONFIG *un_scaled_source; |
338 YV12_BUFFER_CONFIG scaled_source; | 331 YV12_BUFFER_CONFIG scaled_source; |
339 | 332 |
340 unsigned int frames_till_alt_ref_frame; | 333 unsigned int frames_till_alt_ref_frame; |
341 int source_alt_ref_pending; // frame in src_buffers has been identified to be
encoded as an alt ref | 334 int source_alt_ref_pending; |
342 int source_alt_ref_active; // an alt ref frame has been encoded and is usable | 335 int source_alt_ref_active; |
343 | 336 |
344 int is_src_frame_alt_ref; // source of frame to encode is an exact copy of a
n alt ref frame | 337 int is_src_frame_alt_ref; |
345 | 338 |
346 int gold_is_last; // golden frame same as last frame ( short circuit gold sear
ches) | 339 int gold_is_last; // gold same as last frame ( short circuit gold searches) |
347 int alt_is_last; // Alt reference frame same as last ( short circuit altref s
earch) | 340 int alt_is_last; // Alt same as last ( short circuit altref search) |
348 int gold_is_alt; // don't do both alt and gold search ( just do gold). | 341 int gold_is_alt; // don't do both alt and gold search ( just do gold). |
349 | 342 |
350 int scaled_ref_idx[3]; | 343 int scaled_ref_idx[3]; |
351 int lst_fb_idx; | 344 int lst_fb_idx; |
352 int gld_fb_idx; | 345 int gld_fb_idx; |
353 int alt_fb_idx; | 346 int alt_fb_idx; |
354 | 347 |
355 int current_layer; | 348 int current_layer; |
356 int use_svc; | 349 int use_svc; |
357 | 350 |
(...skipping 16 matching lines...) Expand all Loading... |
374 #if CONFIG_MULTIPLE_ARF | 367 #if CONFIG_MULTIPLE_ARF |
375 // Position within a frame coding order (including any additional ARF frames). | 368 // Position within a frame coding order (including any additional ARF frames). |
376 unsigned int sequence_number; | 369 unsigned int sequence_number; |
377 // Next frame in naturally occurring order that has not yet been coded. | 370 // Next frame in naturally occurring order that has not yet been coded. |
378 int next_frame_in_order; | 371 int next_frame_in_order; |
379 #endif | 372 #endif |
380 | 373 |
381 // Ambient reconstruction err target for force key frames | 374 // Ambient reconstruction err target for force key frames |
382 int ambient_err; | 375 int ambient_err; |
383 | 376 |
384 unsigned int mode_check_freq[MAX_MODES]; | |
385 unsigned int mode_test_hit_counts[MAX_MODES]; | |
386 unsigned int mode_chosen_counts[MAX_MODES]; | 377 unsigned int mode_chosen_counts[MAX_MODES]; |
| 378 unsigned int sub8x8_mode_chosen_counts[MAX_REFS]; |
387 int64_t mode_skip_mask; | 379 int64_t mode_skip_mask; |
388 int ref_frame_mask; | 380 int ref_frame_mask; |
389 int set_ref_frame_mask; | 381 int set_ref_frame_mask; |
390 | 382 |
391 int rd_threshes[BLOCK_SIZES][MAX_MODES]; | 383 int rd_threshes[MAX_SEGMENTS][BLOCK_SIZES][MAX_MODES]; |
392 int rd_thresh_freq_fact[BLOCK_SIZES][MAX_MODES]; | 384 int rd_thresh_freq_fact[BLOCK_SIZES][MAX_MODES]; |
| 385 int rd_thresh_sub8x8[MAX_SEGMENTS][BLOCK_SIZES][MAX_REFS]; |
| 386 int rd_thresh_freq_sub8x8[BLOCK_SIZES][MAX_REFS]; |
393 | 387 |
394 int64_t rd_comp_pred_diff[NB_PREDICTION_TYPES]; | 388 int64_t rd_comp_pred_diff[NB_PREDICTION_TYPES]; |
395 // FIXME(rbultje) int64_t? | 389 int64_t rd_prediction_type_threshes[4][NB_PREDICTION_TYPES]; |
396 int rd_prediction_type_threshes[4][NB_PREDICTION_TYPES]; | |
397 unsigned int intra_inter_count[INTRA_INTER_CONTEXTS][2]; | 390 unsigned int intra_inter_count[INTRA_INTER_CONTEXTS][2]; |
398 unsigned int comp_inter_count[COMP_INTER_CONTEXTS][2]; | 391 unsigned int comp_inter_count[COMP_INTER_CONTEXTS][2]; |
399 unsigned int single_ref_count[REF_CONTEXTS][2][2]; | 392 unsigned int single_ref_count[REF_CONTEXTS][2][2]; |
400 unsigned int comp_ref_count[REF_CONTEXTS][2]; | 393 unsigned int comp_ref_count[REF_CONTEXTS][2]; |
401 | 394 |
402 int64_t rd_tx_select_diff[TX_MODES]; | 395 int64_t rd_tx_select_diff[TX_MODES]; |
403 // FIXME(rbultje) can this overflow? | 396 // FIXME(rbultje) can this overflow? |
404 int rd_tx_select_threshes[4][TX_MODES]; | 397 int rd_tx_select_threshes[4][TX_MODES]; |
405 | 398 |
406 int64_t rd_filter_diff[SWITCHABLE_FILTERS + 1]; | 399 int64_t rd_filter_diff[SWITCHABLE_FILTER_CONTEXTS]; |
407 int64_t rd_filter_threshes[4][SWITCHABLE_FILTERS + 1]; | 400 int64_t rd_filter_threshes[4][SWITCHABLE_FILTER_CONTEXTS]; |
408 int64_t rd_filter_cache[SWITCHABLE_FILTERS + 1]; | 401 int64_t rd_filter_cache[SWITCHABLE_FILTER_CONTEXTS]; |
409 | 402 |
410 int RDMULT; | 403 int RDMULT; |
411 int RDDIV; | 404 int RDDIV; |
412 | 405 |
413 CODING_CONTEXT coding_context; | 406 CODING_CONTEXT coding_context; |
414 | 407 |
415 // Rate targetting variables | 408 // Rate targetting variables |
416 int this_frame_target; | 409 int this_frame_target; |
417 int projected_frame_size; | 410 int projected_frame_size; |
418 int last_q[2]; // Separate values for Intra/Inter | 411 int last_q[2]; // Separate values for Intra/Inter |
419 int last_boosted_qindex; // Last boosted GF/KF/ARF q | 412 int last_boosted_qindex; // Last boosted GF/KF/ARF q |
420 | 413 |
421 double rate_correction_factor; | 414 double rate_correction_factor; |
422 double key_frame_rate_correction_factor; | 415 double key_frame_rate_correction_factor; |
423 double gf_rate_correction_factor; | 416 double gf_rate_correction_factor; |
424 | 417 |
425 unsigned int frames_since_golden; | 418 unsigned int frames_since_golden; |
426 int frames_till_gf_update_due; // Count down till next GF | 419 int frames_till_gf_update_due; // Count down till next GF |
427 | 420 |
428 int gf_overspend_bits; // Total bits overspent becasue of GF boost
(cumulative) | 421 int gf_overspend_bits; // cumulative bits overspent because of GF boost |
429 | 422 |
430 int non_gf_bitrate_adjustment; // Used in the few frames following a GF to
recover the extra bits spent in that GF | 423 int non_gf_bitrate_adjustment; // Following GF to recover extra bits spent |
431 | 424 |
432 int kf_overspend_bits; // Extra bits spent on key frames that need
to be recovered on inter frames | 425 int kf_overspend_bits; // Bits spent on key frames to be recovered on inters |
433 int kf_bitrate_adjustment; // Current number of bit s to try and recove
r on each inter frame. | 426 int kf_bitrate_adjustment; // number of bits to recover on each inter frame. |
434 int max_gf_interval; | 427 int max_gf_interval; |
435 int baseline_gf_interval; | 428 int baseline_gf_interval; |
436 int active_arnr_frames; // <= cpi->oxcf.arnr_max_frames | 429 int active_arnr_frames; // <= cpi->oxcf.arnr_max_frames |
437 int active_arnr_strength; // <= cpi->oxcf.arnr_max_strength | 430 int active_arnr_strength; // <= cpi->oxcf.arnr_max_strength |
438 | 431 |
439 int64_t key_frame_count; | 432 int64_t key_frame_count; |
440 int prior_key_frame_distance[KEY_FRAME_CONTEXT]; | 433 int prior_key_frame_distance[KEY_FRAME_CONTEXT]; |
441 int per_frame_bandwidth; // Current section per frame bandwidth targe
t | 434 int per_frame_bandwidth; // Current section per frame bandwidth target |
442 int av_per_frame_bandwidth; // Average frame size target for clip | 435 int av_per_frame_bandwidth; // Average frame size target for clip |
443 int min_frame_bandwidth; // Minimum allocation that should be used fo
r any frame | 436 int min_frame_bandwidth; // Minimum allocation used for any frame |
444 int inter_frame_target; | 437 int inter_frame_target; |
445 double output_framerate; | 438 double output_framerate; |
446 int64_t last_time_stamp_seen; | 439 int64_t last_time_stamp_seen; |
447 int64_t last_end_time_stamp_seen; | 440 int64_t last_end_time_stamp_seen; |
448 int64_t first_time_stamp_ever; | 441 int64_t first_time_stamp_ever; |
449 | 442 |
450 int ni_av_qi; | 443 int ni_av_qi; |
451 int ni_tot_qi; | 444 int ni_tot_qi; |
452 int ni_frames; | 445 int ni_frames; |
453 int avg_frame_qindex; | 446 int avg_frame_qindex; |
(...skipping 21 matching lines...) Expand all Loading... |
475 | 468 |
476 int worst_quality; | 469 int worst_quality; |
477 int active_worst_quality; | 470 int active_worst_quality; |
478 int best_quality; | 471 int best_quality; |
479 int active_best_quality; | 472 int active_best_quality; |
480 | 473 |
481 int cq_target_quality; | 474 int cq_target_quality; |
482 | 475 |
483 int y_mode_count[4][INTRA_MODES]; | 476 int y_mode_count[4][INTRA_MODES]; |
484 int y_uv_mode_count[INTRA_MODES][INTRA_MODES]; | 477 int y_uv_mode_count[INTRA_MODES][INTRA_MODES]; |
485 unsigned int partition_count[NUM_PARTITION_CONTEXTS][PARTITION_TYPES]; | 478 unsigned int partition_count[PARTITION_CONTEXTS][PARTITION_TYPES]; |
486 | 479 |
487 nmv_context_counts NMVcount; | 480 nmv_context_counts NMVcount; |
488 | 481 |
489 vp9_coeff_count coef_counts[TX_SIZES][BLOCK_TYPES]; | 482 vp9_coeff_count coef_counts[TX_SIZES][BLOCK_TYPES]; |
490 vp9_coeff_probs_model frame_coef_probs[TX_SIZES][BLOCK_TYPES]; | 483 vp9_coeff_probs_model frame_coef_probs[TX_SIZES][BLOCK_TYPES]; |
491 vp9_coeff_stats frame_branch_ct[TX_SIZES][BLOCK_TYPES]; | 484 vp9_coeff_stats frame_branch_ct[TX_SIZES][BLOCK_TYPES]; |
492 | 485 |
493 int gfu_boost; | 486 int gfu_boost; |
494 int last_boost; | 487 int last_boost; |
495 int kf_boost; | 488 int kf_boost; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 int last_skip_probs_q[3]; | 522 int last_skip_probs_q[3]; |
530 | 523 |
531 int ref_frame_flags; | 524 int ref_frame_flags; |
532 | 525 |
533 SPEED_FEATURES sf; | 526 SPEED_FEATURES sf; |
534 int error_bins[1024]; | 527 int error_bins[1024]; |
535 | 528 |
536 unsigned int max_mv_magnitude; | 529 unsigned int max_mv_magnitude; |
537 int mv_step_param; | 530 int mv_step_param; |
538 | 531 |
539 // Data used for real time conferencing mode to help determine if it would be
good to update the gf | 532 // Data used for real time conferencing mode to help determine if it |
| 533 // would be good to update the gf |
540 int inter_zz_count; | 534 int inter_zz_count; |
541 int gf_bad_count; | 535 int gf_bad_count; |
542 int gf_update_recommended; | 536 int gf_update_recommended; |
543 | 537 |
544 unsigned char *segmentation_map; | 538 unsigned char *segmentation_map; |
545 | 539 |
546 // segment threashold for encode breakout | 540 // segment threashold for encode breakout |
547 int segment_encode_breakout[MAX_SEGMENTS]; | 541 int segment_encode_breakout[MAX_SEGMENTS]; |
548 | 542 |
549 unsigned char *active_map; | 543 unsigned char *active_map; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 int *mb_norm_activity_map; | 634 int *mb_norm_activity_map; |
641 int output_partition; | 635 int output_partition; |
642 | 636 |
643 /* force next frame to intra when kf_auto says so */ | 637 /* force next frame to intra when kf_auto says so */ |
644 int force_next_frame_intra; | 638 int force_next_frame_intra; |
645 | 639 |
646 int droppable; | 640 int droppable; |
647 | 641 |
648 int dummy_packing; /* flag to indicate if packing is dummy */ | 642 int dummy_packing; /* flag to indicate if packing is dummy */ |
649 | 643 |
650 unsigned int switchable_interp_count[SWITCHABLE_FILTERS + 1] | 644 unsigned int switchable_interp_count[SWITCHABLE_FILTER_CONTEXTS] |
651 [SWITCHABLE_FILTERS]; | 645 [SWITCHABLE_FILTERS]; |
652 | 646 |
653 unsigned int txfm_stepdown_count[TX_SIZES]; | 647 unsigned int tx_stepdown_count[TX_SIZES]; |
654 | 648 |
655 int initial_width; | 649 int initial_width; |
656 int initial_height; | 650 int initial_height; |
657 | 651 |
658 int number_spatial_layers; | 652 int number_spatial_layers; |
659 int enable_encode_breakout; // Default value is 1. From first pass stats, | 653 int enable_encode_breakout; // Default value is 1. From first pass stats, |
660 // encode_breakout may be disabled. | 654 // encode_breakout may be disabled. |
661 | 655 |
662 #if CONFIG_MULTIPLE_ARF | 656 #if CONFIG_MULTIPLE_ARF |
663 // ARF tracking variables. | 657 // ARF tracking variables. |
(...skipping 10 matching lines...) Expand all Loading... |
674 | 668 |
675 #ifdef ENTROPY_STATS | 669 #ifdef ENTROPY_STATS |
676 int64_t mv_ref_stats[INTER_MODE_CONTEXTS][INTER_MODES - 1][2]; | 670 int64_t mv_ref_stats[INTER_MODE_CONTEXTS][INTER_MODES - 1][2]; |
677 #endif | 671 #endif |
678 | 672 |
679 | 673 |
680 #ifdef MODE_TEST_HIT_STATS | 674 #ifdef MODE_TEST_HIT_STATS |
681 // Debug / test stats | 675 // Debug / test stats |
682 int64_t mode_test_hits[BLOCK_SIZES]; | 676 int64_t mode_test_hits[BLOCK_SIZES]; |
683 #endif | 677 #endif |
| 678 |
| 679 /* Y,U,V,(A) */ |
| 680 ENTROPY_CONTEXT *above_context[MAX_MB_PLANE]; |
| 681 ENTROPY_CONTEXT left_context[MAX_MB_PLANE][16]; |
| 682 |
| 683 PARTITION_CONTEXT *above_seg_context; |
| 684 PARTITION_CONTEXT left_seg_context[8]; |
684 } VP9_COMP; | 685 } VP9_COMP; |
685 | 686 |
686 static int get_ref_frame_idx(VP9_COMP *cpi, MV_REFERENCE_FRAME ref_frame) { | 687 static int get_ref_frame_idx(VP9_COMP *cpi, MV_REFERENCE_FRAME ref_frame) { |
687 if (ref_frame == LAST_FRAME) { | 688 if (ref_frame == LAST_FRAME) { |
688 return cpi->lst_fb_idx; | 689 return cpi->lst_fb_idx; |
689 } else if (ref_frame == GOLDEN_FRAME) { | 690 } else if (ref_frame == GOLDEN_FRAME) { |
690 return cpi->gld_fb_idx; | 691 return cpi->gld_fb_idx; |
691 } else { | 692 } else { |
692 return cpi->alt_fb_idx; | 693 return cpi->alt_fb_idx; |
693 } | 694 } |
(...skipping 12 matching lines...) Expand all Loading... |
706 | 707 |
707 void vp9_encode_frame(VP9_COMP *cpi); | 708 void vp9_encode_frame(VP9_COMP *cpi); |
708 | 709 |
709 void vp9_pack_bitstream(VP9_COMP *cpi, unsigned char *dest, | 710 void vp9_pack_bitstream(VP9_COMP *cpi, unsigned char *dest, |
710 unsigned long *size); | 711 unsigned long *size); |
711 | 712 |
712 void vp9_activity_masking(VP9_COMP *cpi, MACROBLOCK *x); | 713 void vp9_activity_masking(VP9_COMP *cpi, MACROBLOCK *x); |
713 | 714 |
714 void vp9_set_speed_features(VP9_COMP *cpi); | 715 void vp9_set_speed_features(VP9_COMP *cpi); |
715 | 716 |
716 extern int vp9_calc_ss_err(YV12_BUFFER_CONFIG *source, | 717 int vp9_calc_ss_err(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest); |
717 YV12_BUFFER_CONFIG *dest); | |
718 | 718 |
719 extern void vp9_alloc_compressor_data(VP9_COMP *cpi); | 719 void vp9_alloc_compressor_data(VP9_COMP *cpi); |
| 720 |
| 721 int vp9_compute_qdelta(VP9_COMP *cpi, double qstart, double qtarget); |
| 722 |
| 723 static int get_token_alloc(int mb_rows, int mb_cols) { |
| 724 return mb_rows * mb_cols * (48 * 16 + 4); |
| 725 } |
720 | 726 |
721 #endif // VP9_ENCODER_VP9_ONYX_INT_H_ | 727 #endif // VP9_ENCODER_VP9_ONYX_INT_H_ |
OLD | NEW |