| 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 11 matching lines...) Expand all Loading... |
| 22 #include "vp9/encoder/vp9_encodemb.h" | 22 #include "vp9/encoder/vp9_encodemb.h" |
| 23 #include "vp9/encoder/vp9_quantize.h" | 23 #include "vp9/encoder/vp9_quantize.h" |
| 24 #include "vp9/common/vp9_entropy.h" | 24 #include "vp9/common/vp9_entropy.h" |
| 25 #include "vp9/common/vp9_entropymode.h" | 25 #include "vp9/common/vp9_entropymode.h" |
| 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 | |
| 33 #if CONFIG_ONESHOTQ | |
| 34 #define ONE_SHOT_Q_ESTIMATE 0 | |
| 35 #define STRICT_ONE_SHOT_Q 0 | |
| 36 #endif | |
| 37 #define DISABLE_RC_LONG_TERM_MEM 0 | 32 #define DISABLE_RC_LONG_TERM_MEM 0 |
| 38 | |
| 39 // #define MODE_TEST_HIT_STATS | 33 // #define MODE_TEST_HIT_STATS |
| 40 | 34 |
| 41 // #define SPEEDSTATS 1 | 35 // #define SPEEDSTATS 1 |
| 42 #if CONFIG_MULTIPLE_ARF | 36 #if CONFIG_MULTIPLE_ARF |
| 43 // Set MIN_GF_INTERVAL to 1 for the full decomposition. | 37 // Set MIN_GF_INTERVAL to 1 for the full decomposition. |
| 44 #define MIN_GF_INTERVAL 2 | 38 #define MIN_GF_INTERVAL 2 |
| 45 #else | 39 #else |
| 46 #define MIN_GF_INTERVAL 4 | 40 #define MIN_GF_INTERVAL 4 |
| 47 #endif | 41 #endif |
| 48 #define DEFAULT_GF_INTERVAL 7 | 42 #define DEFAULT_GF_INTERVAL 7 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 int recode_loop; | 240 int recode_loop; |
| 247 SUBPEL_SEARCH_METHODS subpel_search_method; | 241 SUBPEL_SEARCH_METHODS subpel_search_method; |
| 248 int subpel_iters_per_step; | 242 int subpel_iters_per_step; |
| 249 int thresh_mult[MAX_MODES]; | 243 int thresh_mult[MAX_MODES]; |
| 250 int thresh_mult_sub8x8[MAX_REFS]; | 244 int thresh_mult_sub8x8[MAX_REFS]; |
| 251 int max_step_search_steps; | 245 int max_step_search_steps; |
| 252 int reduce_first_step_size; | 246 int reduce_first_step_size; |
| 253 int auto_mv_step_size; | 247 int auto_mv_step_size; |
| 254 int optimize_coefficients; | 248 int optimize_coefficients; |
| 255 int static_segmentation; | 249 int static_segmentation; |
| 256 int variance_adaptive_quantization; | |
| 257 int comp_inter_joint_search_thresh; | 250 int comp_inter_joint_search_thresh; |
| 258 int adaptive_rd_thresh; | 251 int adaptive_rd_thresh; |
| 259 int skip_encode_sb; | 252 int skip_encode_sb; |
| 260 int skip_encode_frame; | 253 int skip_encode_frame; |
| 261 LAST_FRAME_PARTITION_METHOD use_lastframe_partitioning; | 254 LAST_FRAME_PARTITION_METHOD use_lastframe_partitioning; |
| 262 TX_SIZE_SEARCH_METHOD tx_size_search_method; | 255 TX_SIZE_SEARCH_METHOD tx_size_search_method; |
| 263 int use_lp32x32fdct; | 256 int use_lp32x32fdct; |
| 264 int use_avoid_tested_higherror; | 257 int use_avoid_tested_higherror; |
| 265 int use_one_partition_size_always; | 258 int use_one_partition_size_always; |
| 266 int less_rectangular_check; | 259 int less_rectangular_check; |
| 267 int use_square_partition_only; | 260 int use_square_partition_only; |
| 268 int mode_skip_start; | 261 int mode_skip_start; |
| 269 int reference_masking; | 262 int reference_masking; |
| 270 BLOCK_SIZE always_this_block_size; | 263 BLOCK_SIZE always_this_block_size; |
| 271 int auto_min_max_partition_size; | 264 int auto_min_max_partition_size; |
| 272 BLOCK_SIZE min_partition_size; | 265 BLOCK_SIZE min_partition_size; |
| 273 BLOCK_SIZE max_partition_size; | 266 BLOCK_SIZE max_partition_size; |
| 274 int adjust_partitioning_from_last_frame; | 267 int adjust_partitioning_from_last_frame; |
| 275 int last_partitioning_redo_frequency; | 268 int last_partitioning_redo_frequency; |
| 276 int disable_split_mask; | 269 int disable_split_mask; |
| 277 int using_small_partition_info; | 270 int using_small_partition_info; |
| 278 // TODO(jingning): combine the related motion search speed features | 271 // TODO(jingning): combine the related motion search speed features |
| 279 int adaptive_motion_search; | 272 int adaptive_motion_search; |
| 273 int adaptive_pred_filter_type; |
| 280 | 274 |
| 281 // Implements various heuristics to skip searching modes | 275 // Implements various heuristics to skip searching modes |
| 282 // The heuristics selected are based on flags | 276 // The heuristics selected are based on flags |
| 283 // defined in the MODE_SEARCH_SKIP_HEURISTICS enum | 277 // defined in the MODE_SEARCH_SKIP_HEURISTICS enum |
| 284 unsigned int mode_search_skip_flags; | 278 unsigned int mode_search_skip_flags; |
| 285 // A source variance threshold below which the split mode is disabled | 279 // A source variance threshold below which the split mode is disabled |
| 286 unsigned int disable_split_var_thresh; | 280 unsigned int disable_split_var_thresh; |
| 287 // A source variance threshold below which filter search is disabled | 281 // A source variance threshold below which filter search is disabled |
| 288 // Choose a very large value (UINT_MAX) to use 8-tap always | 282 // Choose a very large value (UINT_MAX) to use 8-tap always |
| 289 unsigned int disable_filter_search_var_thresh; | 283 unsigned int disable_filter_search_var_thresh; |
| 290 int intra_y_mode_mask[TX_SIZES]; | 284 int intra_y_mode_mask[TX_SIZES]; |
| 291 int intra_uv_mode_mask[TX_SIZES]; | 285 int intra_uv_mode_mask[TX_SIZES]; |
| 292 int use_rd_breakout; | 286 int use_rd_breakout; |
| 293 int use_uv_intra_rd_estimate; | 287 int use_uv_intra_rd_estimate; |
| 294 int use_fast_lpf_pick; | 288 int use_fast_lpf_pick; |
| 295 int use_fast_coef_updates; // 0: 2-loop, 1: 1-loop, 2: 1-loop reduced | 289 int use_fast_coef_updates; // 0: 2-loop, 1: 1-loop, 2: 1-loop reduced |
| 296 } SPEED_FEATURES; | 290 } SPEED_FEATURES; |
| 297 | 291 |
| 292 typedef struct { |
| 293 // Rate targetting variables |
| 294 int this_frame_target; |
| 295 int projected_frame_size; |
| 296 int sb64_target_rate; |
| 297 int last_q[2]; // Separate values for Intra/Inter |
| 298 int last_boosted_qindex; // Last boosted GF/KF/ARF q |
| 299 |
| 300 int gfu_boost; |
| 301 int last_boost; |
| 302 int kf_boost; |
| 303 |
| 304 double rate_correction_factor; |
| 305 double key_frame_rate_correction_factor; |
| 306 double gf_rate_correction_factor; |
| 307 |
| 308 unsigned int frames_since_golden; |
| 309 int frames_till_gf_update_due; // Count down till next GF |
| 310 |
| 311 int max_gf_interval; |
| 312 int baseline_gf_interval; |
| 313 |
| 314 int64_t key_frame_count; |
| 315 int prior_key_frame_distance[KEY_FRAME_CONTEXT]; |
| 316 int per_frame_bandwidth; // Current section per frame bandwidth target |
| 317 int av_per_frame_bandwidth; // Average frame size target for clip |
| 318 int min_frame_bandwidth; // Minimum allocation used for any frame |
| 319 |
| 320 int ni_av_qi; |
| 321 int ni_tot_qi; |
| 322 int ni_frames; |
| 323 int avg_frame_qindex; |
| 324 double tot_q; |
| 325 double avg_q; |
| 326 |
| 327 int buffer_level; |
| 328 int bits_off_target; |
| 329 |
| 330 int rolling_target_bits; |
| 331 int rolling_actual_bits; |
| 332 |
| 333 int long_rolling_target_bits; |
| 334 int long_rolling_actual_bits; |
| 335 |
| 336 int64_t total_actual_bits; |
| 337 int total_target_vs_actual; // debug stats |
| 338 |
| 339 int worst_quality; |
| 340 int active_worst_quality; |
| 341 int best_quality; |
| 342 // int active_best_quality; |
| 343 } RATE_CONTROL; |
| 344 |
| 298 typedef struct VP9_COMP { | 345 typedef struct VP9_COMP { |
| 299 DECLARE_ALIGNED(16, int16_t, y_quant[QINDEX_RANGE][8]); | 346 DECLARE_ALIGNED(16, int16_t, y_quant[QINDEX_RANGE][8]); |
| 300 DECLARE_ALIGNED(16, int16_t, y_quant_shift[QINDEX_RANGE][8]); | 347 DECLARE_ALIGNED(16, int16_t, y_quant_shift[QINDEX_RANGE][8]); |
| 301 DECLARE_ALIGNED(16, int16_t, y_zbin[QINDEX_RANGE][8]); | 348 DECLARE_ALIGNED(16, int16_t, y_zbin[QINDEX_RANGE][8]); |
| 302 DECLARE_ALIGNED(16, int16_t, y_round[QINDEX_RANGE][8]); | 349 DECLARE_ALIGNED(16, int16_t, y_round[QINDEX_RANGE][8]); |
| 303 | 350 |
| 304 DECLARE_ALIGNED(16, int16_t, uv_quant[QINDEX_RANGE][8]); | 351 DECLARE_ALIGNED(16, int16_t, uv_quant[QINDEX_RANGE][8]); |
| 305 DECLARE_ALIGNED(16, int16_t, uv_quant_shift[QINDEX_RANGE][8]); | 352 DECLARE_ALIGNED(16, int16_t, uv_quant_shift[QINDEX_RANGE][8]); |
| 306 DECLARE_ALIGNED(16, int16_t, uv_zbin[QINDEX_RANGE][8]); | 353 DECLARE_ALIGNED(16, int16_t, uv_zbin[QINDEX_RANGE][8]); |
| 307 DECLARE_ALIGNED(16, int16_t, uv_round[QINDEX_RANGE][8]); | 354 DECLARE_ALIGNED(16, int16_t, uv_round[QINDEX_RANGE][8]); |
| 308 | 355 |
| 309 #if CONFIG_ALPHA | 356 #if CONFIG_ALPHA |
| 310 DECLARE_ALIGNED(16, int16_t, a_quant[QINDEX_RANGE][8]); | 357 DECLARE_ALIGNED(16, int16_t, a_quant[QINDEX_RANGE][8]); |
| 311 DECLARE_ALIGNED(16, int16_t, a_quant_shift[QINDEX_RANGE][8]); | 358 DECLARE_ALIGNED(16, int16_t, a_quant_shift[QINDEX_RANGE][8]); |
| 312 DECLARE_ALIGNED(16, int16_t, a_zbin[QINDEX_RANGE][8]); | 359 DECLARE_ALIGNED(16, int16_t, a_zbin[QINDEX_RANGE][8]); |
| 313 DECLARE_ALIGNED(16, int16_t, a_round[QINDEX_RANGE][8]); | 360 DECLARE_ALIGNED(16, int16_t, a_round[QINDEX_RANGE][8]); |
| 314 #endif | 361 #endif |
| 315 | 362 |
| 316 MACROBLOCK mb; | 363 MACROBLOCK mb; |
| 317 VP9_COMMON common; | 364 VP9_COMMON common; |
| 318 VP9_CONFIG oxcf; | 365 VP9_CONFIG oxcf; |
| 319 struct rdcost_block_args rdcost_stack; | 366 struct rdcost_block_args rdcost_stack; |
| 320 | |
| 321 struct lookahead_ctx *lookahead; | 367 struct lookahead_ctx *lookahead; |
| 322 struct lookahead_entry *source; | 368 struct lookahead_entry *source; |
| 323 #if CONFIG_MULTIPLE_ARF | 369 #if CONFIG_MULTIPLE_ARF |
| 324 struct lookahead_entry *alt_ref_source[NUM_REF_FRAMES]; | 370 struct lookahead_entry *alt_ref_source[REF_FRAMES]; |
| 325 #else | 371 #else |
| 326 struct lookahead_entry *alt_ref_source; | 372 struct lookahead_entry *alt_ref_source; |
| 327 #endif | 373 #endif |
| 328 | 374 |
| 329 YV12_BUFFER_CONFIG *Source; | 375 YV12_BUFFER_CONFIG *Source; |
| 330 YV12_BUFFER_CONFIG *un_scaled_source; | 376 YV12_BUFFER_CONFIG *un_scaled_source; |
| 331 YV12_BUFFER_CONFIG scaled_source; | 377 YV12_BUFFER_CONFIG scaled_source; |
| 332 | 378 |
| 333 unsigned int frames_till_alt_ref_frame; | 379 unsigned int frames_till_alt_ref_frame; |
| 334 int source_alt_ref_pending; | 380 int source_alt_ref_pending; |
| 335 int source_alt_ref_active; | 381 int source_alt_ref_active; |
| 336 | 382 |
| 337 int is_src_frame_alt_ref; | 383 int is_src_frame_alt_ref; |
| 338 | 384 |
| 339 int gold_is_last; // gold same as last frame ( short circuit gold searches) | 385 int gold_is_last; // gold same as last frame ( short circuit gold searches) |
| 340 int alt_is_last; // Alt same as last ( short circuit altref search) | 386 int alt_is_last; // Alt same as last ( short circuit altref search) |
| 341 int gold_is_alt; // don't do both alt and gold search ( just do gold). | 387 int gold_is_alt; // don't do both alt and gold search ( just do gold). |
| 342 | 388 |
| 343 int scaled_ref_idx[3]; | 389 int scaled_ref_idx[3]; |
| 344 int lst_fb_idx; | 390 int lst_fb_idx; |
| 345 int gld_fb_idx; | 391 int gld_fb_idx; |
| 346 int alt_fb_idx; | 392 int alt_fb_idx; |
| 347 | 393 |
| 348 int current_layer; | 394 int current_layer; |
| 349 int use_svc; | 395 int use_svc; |
| 350 | 396 |
| 351 #if CONFIG_MULTIPLE_ARF | 397 #if CONFIG_MULTIPLE_ARF |
| 352 int alt_ref_fb_idx[NUM_REF_FRAMES - 3]; | 398 int alt_ref_fb_idx[REF_FRAMES - 3]; |
| 353 #endif | 399 #endif |
| 354 int refresh_last_frame; | 400 int refresh_last_frame; |
| 355 int refresh_golden_frame; | 401 int refresh_golden_frame; |
| 356 int refresh_alt_ref_frame; | 402 int refresh_alt_ref_frame; |
| 357 YV12_BUFFER_CONFIG last_frame_uf; | 403 YV12_BUFFER_CONFIG last_frame_uf; |
| 358 | 404 |
| 359 TOKENEXTRA *tok; | 405 TOKENEXTRA *tok; |
| 360 unsigned int tok_count[4][1 << 6]; | 406 unsigned int tok_count[4][1 << 6]; |
| 361 | 407 |
| 362 | 408 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 378 unsigned int sub8x8_mode_chosen_counts[MAX_REFS]; | 424 unsigned int sub8x8_mode_chosen_counts[MAX_REFS]; |
| 379 int64_t mode_skip_mask; | 425 int64_t mode_skip_mask; |
| 380 int ref_frame_mask; | 426 int ref_frame_mask; |
| 381 int set_ref_frame_mask; | 427 int set_ref_frame_mask; |
| 382 | 428 |
| 383 int rd_threshes[MAX_SEGMENTS][BLOCK_SIZES][MAX_MODES]; | 429 int rd_threshes[MAX_SEGMENTS][BLOCK_SIZES][MAX_MODES]; |
| 384 int rd_thresh_freq_fact[BLOCK_SIZES][MAX_MODES]; | 430 int rd_thresh_freq_fact[BLOCK_SIZES][MAX_MODES]; |
| 385 int rd_thresh_sub8x8[MAX_SEGMENTS][BLOCK_SIZES][MAX_REFS]; | 431 int rd_thresh_sub8x8[MAX_SEGMENTS][BLOCK_SIZES][MAX_REFS]; |
| 386 int rd_thresh_freq_sub8x8[BLOCK_SIZES][MAX_REFS]; | 432 int rd_thresh_freq_sub8x8[BLOCK_SIZES][MAX_REFS]; |
| 387 | 433 |
| 388 int64_t rd_comp_pred_diff[NB_PREDICTION_TYPES]; | 434 int64_t rd_comp_pred_diff[REFERENCE_MODES]; |
| 389 int64_t rd_prediction_type_threshes[4][NB_PREDICTION_TYPES]; | 435 int64_t rd_prediction_type_threshes[4][REFERENCE_MODES]; |
| 390 unsigned int intra_inter_count[INTRA_INTER_CONTEXTS][2]; | 436 unsigned int intra_inter_count[INTRA_INTER_CONTEXTS][2]; |
| 391 unsigned int comp_inter_count[COMP_INTER_CONTEXTS][2]; | 437 unsigned int comp_inter_count[COMP_INTER_CONTEXTS][2]; |
| 392 unsigned int single_ref_count[REF_CONTEXTS][2][2]; | 438 unsigned int single_ref_count[REF_CONTEXTS][2][2]; |
| 393 unsigned int comp_ref_count[REF_CONTEXTS][2]; | 439 unsigned int comp_ref_count[REF_CONTEXTS][2]; |
| 394 | 440 |
| 395 int64_t rd_tx_select_diff[TX_MODES]; | 441 int64_t rd_tx_select_diff[TX_MODES]; |
| 396 // FIXME(rbultje) can this overflow? | 442 // FIXME(rbultje) can this overflow? |
| 397 int rd_tx_select_threshes[4][TX_MODES]; | 443 int rd_tx_select_threshes[4][TX_MODES]; |
| 398 | 444 |
| 399 int64_t rd_filter_diff[SWITCHABLE_FILTER_CONTEXTS]; | 445 int64_t rd_filter_diff[SWITCHABLE_FILTER_CONTEXTS]; |
| 400 int64_t rd_filter_threshes[4][SWITCHABLE_FILTER_CONTEXTS]; | 446 int64_t rd_filter_threshes[4][SWITCHABLE_FILTER_CONTEXTS]; |
| 401 int64_t rd_filter_cache[SWITCHABLE_FILTER_CONTEXTS]; | 447 int64_t rd_filter_cache[SWITCHABLE_FILTER_CONTEXTS]; |
| 402 | 448 |
| 403 int RDMULT; | 449 int RDMULT; |
| 404 int RDDIV; | 450 int RDDIV; |
| 405 | 451 |
| 406 CODING_CONTEXT coding_context; | 452 CODING_CONTEXT coding_context; |
| 407 | 453 |
| 408 // Rate targetting variables | 454 int zbin_mode_boost; |
| 409 int this_frame_target; | 455 int zbin_mode_boost_enabled; |
| 410 int projected_frame_size; | |
| 411 int last_q[2]; // Separate values for Intra/Inter | |
| 412 int last_boosted_qindex; // Last boosted GF/KF/ARF q | |
| 413 | |
| 414 double rate_correction_factor; | |
| 415 double key_frame_rate_correction_factor; | |
| 416 double gf_rate_correction_factor; | |
| 417 | |
| 418 unsigned int frames_since_golden; | |
| 419 int frames_till_gf_update_due; // Count down till next GF | |
| 420 | |
| 421 int gf_overspend_bits; // cumulative bits overspent because of GF boost | |
| 422 | |
| 423 int non_gf_bitrate_adjustment; // Following GF to recover extra bits spent | |
| 424 | |
| 425 int kf_overspend_bits; // Bits spent on key frames to be recovered on inters | |
| 426 int kf_bitrate_adjustment; // number of bits to recover on each inter frame. | |
| 427 int max_gf_interval; | |
| 428 int baseline_gf_interval; | |
| 429 int active_arnr_frames; // <= cpi->oxcf.arnr_max_frames | 456 int active_arnr_frames; // <= cpi->oxcf.arnr_max_frames |
| 430 int active_arnr_strength; // <= cpi->oxcf.arnr_max_strength | 457 int active_arnr_strength; // <= cpi->oxcf.arnr_max_strength |
| 431 | 458 |
| 432 int64_t key_frame_count; | |
| 433 int prior_key_frame_distance[KEY_FRAME_CONTEXT]; | |
| 434 int per_frame_bandwidth; // Current section per frame bandwidth target | |
| 435 int av_per_frame_bandwidth; // Average frame size target for clip | |
| 436 int min_frame_bandwidth; // Minimum allocation used for any frame | |
| 437 int inter_frame_target; | |
| 438 double output_framerate; | 459 double output_framerate; |
| 439 int64_t last_time_stamp_seen; | 460 int64_t last_time_stamp_seen; |
| 440 int64_t last_end_time_stamp_seen; | 461 int64_t last_end_time_stamp_seen; |
| 441 int64_t first_time_stamp_ever; | 462 int64_t first_time_stamp_ever; |
| 442 | 463 |
| 443 int ni_av_qi; | 464 RATE_CONTROL rc; |
| 444 int ni_tot_qi; | |
| 445 int ni_frames; | |
| 446 int avg_frame_qindex; | |
| 447 double tot_q; | |
| 448 double avg_q; | |
| 449 | |
| 450 int zbin_mode_boost; | |
| 451 int zbin_mode_boost_enabled; | |
| 452 | |
| 453 int64_t total_byte_count; | |
| 454 | |
| 455 int buffered_mode; | |
| 456 | |
| 457 int buffer_level; | |
| 458 int bits_off_target; | |
| 459 | |
| 460 int rolling_target_bits; | |
| 461 int rolling_actual_bits; | |
| 462 | |
| 463 int long_rolling_target_bits; | |
| 464 int long_rolling_actual_bits; | |
| 465 | |
| 466 int64_t total_actual_bits; | |
| 467 int total_target_vs_actual; // debug stats | |
| 468 | |
| 469 int worst_quality; | |
| 470 int active_worst_quality; | |
| 471 int best_quality; | |
| 472 int active_best_quality; | |
| 473 | 465 |
| 474 int cq_target_quality; | 466 int cq_target_quality; |
| 475 | 467 |
| 476 int y_mode_count[4][INTRA_MODES]; | 468 int y_mode_count[4][INTRA_MODES]; |
| 477 int y_uv_mode_count[INTRA_MODES][INTRA_MODES]; | 469 int y_uv_mode_count[INTRA_MODES][INTRA_MODES]; |
| 478 unsigned int partition_count[PARTITION_CONTEXTS][PARTITION_TYPES]; | |
| 479 | 470 |
| 480 nmv_context_counts NMVcount; | 471 nmv_context_counts NMVcount; |
| 481 | 472 |
| 482 vp9_coeff_count coef_counts[TX_SIZES][BLOCK_TYPES]; | 473 vp9_coeff_count coef_counts[TX_SIZES][PLANE_TYPES]; |
| 483 vp9_coeff_probs_model frame_coef_probs[TX_SIZES][BLOCK_TYPES]; | 474 vp9_coeff_probs_model frame_coef_probs[TX_SIZES][PLANE_TYPES]; |
| 484 vp9_coeff_stats frame_branch_ct[TX_SIZES][BLOCK_TYPES]; | 475 vp9_coeff_stats frame_branch_ct[TX_SIZES][PLANE_TYPES]; |
| 485 | 476 |
| 486 int gfu_boost; | |
| 487 int last_boost; | |
| 488 int kf_boost; | |
| 489 int kf_zeromotion_pct; | 477 int kf_zeromotion_pct; |
| 490 int gf_zeromotion_pct; | 478 int gf_zeromotion_pct; |
| 491 | 479 |
| 492 int64_t target_bandwidth; | 480 int64_t target_bandwidth; |
| 493 struct vpx_codec_pkt_list *output_pkt_list; | 481 struct vpx_codec_pkt_list *output_pkt_list; |
| 494 | 482 |
| 495 #if 0 | 483 #if 0 |
| 496 // Experimental code for lagged and one pass | 484 // Experimental code for lagged and one pass |
| 497 ONEPASS_FRAMESTATS one_pass_frame_stats[MAX_LAG_BUFFERS]; | 485 ONEPASS_FRAMESTATS one_pass_frame_stats[MAX_LAG_BUFFERS]; |
| 498 int one_pass_frame_index; | 486 int one_pass_frame_index; |
| 499 #endif | 487 #endif |
| 500 MBGRAPH_FRAME_STATS mbgraph_stats[MAX_LAG_BUFFERS]; | 488 MBGRAPH_FRAME_STATS mbgraph_stats[MAX_LAG_BUFFERS]; |
| 501 int mbgraph_n_frames; // number of frames filled in the above | 489 int mbgraph_n_frames; // number of frames filled in the above |
| 502 int static_mb_pct; // % forced skip mbs by segmentation | 490 int static_mb_pct; // % forced skip mbs by segmentation |
| 503 int seg0_progress, seg0_idx, seg0_cnt; | 491 int seg0_progress, seg0_idx, seg0_cnt; |
| 504 | 492 |
| 505 int decimation_factor; | 493 int decimation_factor; |
| 506 int decimation_count; | 494 int decimation_count; |
| 507 | 495 |
| 508 // for real time encoding | 496 // for real time encoding |
| 509 int avg_encode_time; // microsecond | |
| 510 int avg_pick_mode_time; // microsecond | |
| 511 int speed; | 497 int speed; |
| 512 unsigned int cpu_freq; // Mhz | |
| 513 int compressor_speed; | 498 int compressor_speed; |
| 514 | 499 |
| 515 int interquantizer; | |
| 516 int goldfreq; | |
| 517 int auto_worst_q; | |
| 518 int cpu_used; | 500 int cpu_used; |
| 519 int pass; | 501 int pass; |
| 520 | 502 |
| 521 vp9_prob last_skip_false_probs[3][MBSKIP_CONTEXTS]; | 503 vp9_prob last_skip_false_probs[3][MBSKIP_CONTEXTS]; |
| 522 int last_skip_probs_q[3]; | 504 int last_skip_probs_q[3]; |
| 523 | 505 |
| 524 int ref_frame_flags; | 506 int ref_frame_flags; |
| 525 | 507 |
| 526 SPEED_FEATURES sf; | 508 SPEED_FEATURES sf; |
| 527 int error_bins[1024]; | 509 int error_bins[1024]; |
| 528 | 510 |
| 529 unsigned int max_mv_magnitude; | 511 unsigned int max_mv_magnitude; |
| 530 int mv_step_param; | 512 int mv_step_param; |
| 531 | 513 |
| 532 // Data used for real time conferencing mode to help determine if it | |
| 533 // would be good to update the gf | |
| 534 int inter_zz_count; | |
| 535 int gf_bad_count; | |
| 536 int gf_update_recommended; | |
| 537 | |
| 538 unsigned char *segmentation_map; | 514 unsigned char *segmentation_map; |
| 539 | 515 |
| 540 // segment threashold for encode breakout | 516 // segment threashold for encode breakout |
| 541 int segment_encode_breakout[MAX_SEGMENTS]; | 517 int segment_encode_breakout[MAX_SEGMENTS]; |
| 542 | 518 |
| 519 unsigned char *complexity_map; |
| 520 |
| 543 unsigned char *active_map; | 521 unsigned char *active_map; |
| 544 unsigned int active_map_enabled; | 522 unsigned int active_map_enabled; |
| 545 | 523 |
| 546 fractional_mv_step_fp *find_fractional_mv_step; | 524 fractional_mv_step_fp *find_fractional_mv_step; |
| 547 fractional_mv_step_comp_fp *find_fractional_mv_step_comp; | 525 fractional_mv_step_comp_fp *find_fractional_mv_step_comp; |
| 548 vp9_full_search_fn_t full_search_sad; | 526 vp9_full_search_fn_t full_search_sad; |
| 549 vp9_refining_search_fn_t refining_search_sad; | 527 vp9_refining_search_fn_t refining_search_sad; |
| 550 vp9_diamond_search_fn_t diamond_search_sad; | 528 vp9_diamond_search_fn_t diamond_search_sad; |
| 551 vp9_variance_fn_ptr_t fn_ptr[BLOCK_SIZES]; | 529 vp9_variance_fn_ptr_t fn_ptr[BLOCK_SIZES]; |
| 552 uint64_t time_receive_data; | 530 uint64_t time_receive_data; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 // Error score of frames still to be coded in kf group | 563 // Error score of frames still to be coded in kf group |
| 586 int64_t kf_group_error_left; | 564 int64_t kf_group_error_left; |
| 587 | 565 |
| 588 // Projected Bits available for a group of frames including 1 GF or ARF | 566 // Projected Bits available for a group of frames including 1 GF or ARF |
| 589 int64_t gf_group_bits; | 567 int64_t gf_group_bits; |
| 590 // Bits for the golden frame or ARF - 2 pass only | 568 // Bits for the golden frame or ARF - 2 pass only |
| 591 int gf_bits; | 569 int gf_bits; |
| 592 int alt_extra_bits; | 570 int alt_extra_bits; |
| 593 | 571 |
| 594 int sr_update_lag; | 572 int sr_update_lag; |
| 595 double est_max_qcorrection_factor; | |
| 596 } twopass; | 573 } twopass; |
| 597 | 574 |
| 598 YV12_BUFFER_CONFIG alt_ref_buffer; | 575 YV12_BUFFER_CONFIG alt_ref_buffer; |
| 599 YV12_BUFFER_CONFIG *frames[MAX_LAG_BUFFERS]; | 576 YV12_BUFFER_CONFIG *frames[MAX_LAG_BUFFERS]; |
| 600 int fixed_divide[512]; | 577 int fixed_divide[512]; |
| 601 | 578 |
| 602 #if CONFIG_INTERNAL_STATS | 579 #if CONFIG_INTERNAL_STATS |
| 603 int count; | 580 int count; |
| 604 double total_y; | 581 double total_y; |
| 605 double total_u; | 582 double total_u; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 return 0; | 677 return 0; |
| 701 } else if (ref_frame == GOLDEN_FRAME) { | 678 } else if (ref_frame == GOLDEN_FRAME) { |
| 702 return 1; | 679 return 1; |
| 703 } else { | 680 } else { |
| 704 return 2; | 681 return 2; |
| 705 } | 682 } |
| 706 } | 683 } |
| 707 | 684 |
| 708 void vp9_encode_frame(VP9_COMP *cpi); | 685 void vp9_encode_frame(VP9_COMP *cpi); |
| 709 | 686 |
| 710 void vp9_pack_bitstream(VP9_COMP *cpi, unsigned char *dest, | 687 void vp9_pack_bitstream(VP9_COMP *cpi, uint8_t *dest, size_t *size); |
| 711 unsigned long *size); | |
| 712 | 688 |
| 713 void vp9_activity_masking(VP9_COMP *cpi, MACROBLOCK *x); | 689 void vp9_activity_masking(VP9_COMP *cpi, MACROBLOCK *x); |
| 714 | 690 |
| 715 void vp9_set_speed_features(VP9_COMP *cpi); | 691 void vp9_set_speed_features(VP9_COMP *cpi); |
| 716 | 692 |
| 717 int vp9_calc_ss_err(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest); | 693 int vp9_calc_ss_err(YV12_BUFFER_CONFIG *source, YV12_BUFFER_CONFIG *dest); |
| 718 | 694 |
| 719 void vp9_alloc_compressor_data(VP9_COMP *cpi); | 695 void vp9_alloc_compressor_data(VP9_COMP *cpi); |
| 720 | 696 |
| 721 int vp9_compute_qdelta(VP9_COMP *cpi, double qstart, double qtarget); | 697 int vp9_compute_qdelta(const VP9_COMP *cpi, double qstart, double qtarget); |
| 722 | 698 |
| 723 static int get_token_alloc(int mb_rows, int mb_cols) { | 699 static int get_token_alloc(int mb_rows, int mb_cols) { |
| 724 return mb_rows * mb_cols * (48 * 16 + 4); | 700 return mb_rows * mb_cols * (48 * 16 + 4); |
| 725 } | 701 } |
| 726 | 702 |
| 727 #endif // VP9_ENCODER_VP9_ONYX_INT_H_ | 703 #endif // VP9_ENCODER_VP9_ONYX_INT_H_ |
| OLD | NEW |