| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 THR_COMP_LA, | 129 THR_COMP_LA, |
| 130 THR_COMP_GA, | 130 THR_COMP_GA, |
| 131 THR_INTRA, | 131 THR_INTRA, |
| 132 } THR_MODES_SUB8X8; | 132 } THR_MODES_SUB8X8; |
| 133 | 133 |
| 134 typedef enum { | 134 typedef enum { |
| 135 DIAMOND = 0, | 135 DIAMOND = 0, |
| 136 NSTEP = 1, | 136 NSTEP = 1, |
| 137 HEX = 2, | 137 HEX = 2, |
| 138 BIGDIA = 3, | 138 BIGDIA = 3, |
| 139 SQUARE = 4 | 139 SQUARE = 4, |
| 140 FAST_HEX = 5 |
| 140 } SEARCH_METHODS; | 141 } SEARCH_METHODS; |
| 141 | 142 |
| 142 typedef enum { | 143 typedef enum { |
| 143 USE_FULL_RD = 0, | 144 USE_FULL_RD = 0, |
| 144 USE_LARGESTINTRA, | 145 USE_LARGESTINTRA, |
| 145 USE_LARGESTINTRA_MODELINTER, | 146 USE_LARGESTINTRA_MODELINTER, |
| 146 USE_LARGESTALL | 147 USE_LARGESTALL |
| 147 } TX_SIZE_SEARCH_METHOD; | 148 } TX_SIZE_SEARCH_METHOD; |
| 148 | 149 |
| 149 typedef enum { | 150 typedef enum { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 | 211 |
| 211 typedef enum { | 212 typedef enum { |
| 212 // encode_breakout is disabled. | 213 // encode_breakout is disabled. |
| 213 ENCODE_BREAKOUT_DISABLED = 0, | 214 ENCODE_BREAKOUT_DISABLED = 0, |
| 214 // encode_breakout is enabled. | 215 // encode_breakout is enabled. |
| 215 ENCODE_BREAKOUT_ENABLED = 1, | 216 ENCODE_BREAKOUT_ENABLED = 1, |
| 216 // encode_breakout is enabled with small max_thresh limit. | 217 // encode_breakout is enabled with small max_thresh limit. |
| 217 ENCODE_BREAKOUT_LIMITED = 2 | 218 ENCODE_BREAKOUT_LIMITED = 2 |
| 218 } ENCODE_BREAKOUT_TYPE; | 219 } ENCODE_BREAKOUT_TYPE; |
| 219 | 220 |
| 221 typedef enum { |
| 222 // Search partitions using RD/NONRD criterion |
| 223 SEARCH_PARTITION = 0, |
| 224 |
| 225 // Always use a fixed size partition |
| 226 FIXED_PARTITION = 1, |
| 227 |
| 228 // Use a fixed size partition in every 64X64 SB, where the size is |
| 229 // determined based on source variance |
| 230 VAR_BASED_FIXED_PARTITION = 2, |
| 231 |
| 232 // Use an arbitrary partitioning scheme based on source variance within |
| 233 // a 64X64 SB |
| 234 VAR_BASED_PARTITION |
| 235 } PARTITION_SEARCH_TYPE; |
| 236 |
| 220 typedef struct { | 237 typedef struct { |
| 221 // Frame level coding parameter update | 238 // Frame level coding parameter update |
| 222 int frame_parameter_update; | 239 int frame_parameter_update; |
| 223 | 240 |
| 224 // Motion search method (Diamond, NSTEP, Hex, Big Diamond, Square, etc). | 241 // Motion search method (Diamond, NSTEP, Hex, Big Diamond, Square, etc). |
| 225 SEARCH_METHODS search_method; | 242 SEARCH_METHODS search_method; |
| 226 | 243 |
| 227 RECODE_LOOP_TYPE recode_loop; | 244 RECODE_LOOP_TYPE recode_loop; |
| 228 | 245 |
| 229 // Subpel_search_method can only be subpel_tree which does a subpixel | 246 // Subpel_search_method can only be subpel_tree which does a subpixel |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 // between options like full rd, largest for prediction size, largest | 313 // between options like full rd, largest for prediction size, largest |
| 297 // for intra and model coefs for the rest. | 314 // for intra and model coefs for the rest. |
| 298 TX_SIZE_SEARCH_METHOD tx_size_search_method; | 315 TX_SIZE_SEARCH_METHOD tx_size_search_method; |
| 299 | 316 |
| 300 // Low precision 32x32 fdct keeps everything in 16 bits and thus is less | 317 // Low precision 32x32 fdct keeps everything in 16 bits and thus is less |
| 301 // precise but significantly faster than the non lp version. | 318 // precise but significantly faster than the non lp version. |
| 302 int use_lp32x32fdct; | 319 int use_lp32x32fdct; |
| 303 | 320 |
| 304 // TODO(JBB): remove this as its no longer used. | 321 // TODO(JBB): remove this as its no longer used. |
| 305 | 322 |
| 306 // If set partition size will always be always_this_block_size. | |
| 307 int use_one_partition_size_always; | |
| 308 | |
| 309 // Skip rectangular partition test when partition type none gives better | |
| 310 // rd than partition type split. | |
| 311 int less_rectangular_check; | |
| 312 | |
| 313 // Disable testing non square partitions. (eg 16x32) | |
| 314 int use_square_partition_only; | |
| 315 | |
| 316 // After looking at the first set of modes (set by index here), skip | 323 // After looking at the first set of modes (set by index here), skip |
| 317 // checking modes for reference frames that don't match the reference frame | 324 // checking modes for reference frames that don't match the reference frame |
| 318 // of the best so far. | 325 // of the best so far. |
| 319 int mode_skip_start; | 326 int mode_skip_start; |
| 320 | 327 |
| 321 // TODO(JBB): Remove this. | 328 // TODO(JBB): Remove this. |
| 322 int reference_masking; | 329 int reference_masking; |
| 323 | 330 |
| 324 // Used in conjunction with use_one_partition_size_always. | 331 PARTITION_SEARCH_TYPE partition_search_type; |
| 332 |
| 333 // Used if partition_search_type = FIXED_SIZE_PARTITION |
| 325 BLOCK_SIZE always_this_block_size; | 334 BLOCK_SIZE always_this_block_size; |
| 326 | 335 |
| 336 // Skip rectangular partition test when partition type none gives better |
| 337 // rd than partition type split. |
| 338 int less_rectangular_check; |
| 339 |
| 340 // Disable testing non square partitions. (eg 16x32) |
| 341 int use_square_partition_only; |
| 342 |
| 327 // Sets min and max partition sizes for this 64x64 region based on the | 343 // Sets min and max partition sizes for this 64x64 region based on the |
| 328 // same 64x64 in last encoded frame, and the left and above neighbor. | 344 // same 64x64 in last encoded frame, and the left and above neighbor. |
| 329 AUTO_MIN_MAX_MODE auto_min_max_partition_size; | 345 AUTO_MIN_MAX_MODE auto_min_max_partition_size; |
| 330 | 346 |
| 331 // Min and max partition size we enable (block_size) as per auto | 347 // Min and max partition size we enable (block_size) as per auto |
| 332 // min max, but also used by adjust partitioning, and pick_partitioning. | 348 // min max, but also used by adjust partitioning, and pick_partitioning. |
| 333 BLOCK_SIZE min_partition_size; | 349 BLOCK_SIZE min_partition_size; |
| 334 BLOCK_SIZE max_partition_size; | 350 BLOCK_SIZE max_partition_size; |
| 335 | 351 |
| 336 // Whether or not we allow partitions one smaller or one greater than the last | 352 // Whether or not we allow partitions one smaller or one greater than the last |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 // 0: Try the full image with different values. | 404 // 0: Try the full image with different values. |
| 389 // 1: Try a small portion of the image with different values. | 405 // 1: Try a small portion of the image with different values. |
| 390 // 2: Estimate the level based on quantizer and frame type | 406 // 2: Estimate the level based on quantizer and frame type |
| 391 int use_fast_lpf_pick; | 407 int use_fast_lpf_pick; |
| 392 | 408 |
| 393 // This feature limits the number of coefficients updates we actually do | 409 // This feature limits the number of coefficients updates we actually do |
| 394 // by only looking at counts from 1/2 the bands. | 410 // by only looking at counts from 1/2 the bands. |
| 395 int use_fast_coef_updates; // 0: 2-loop, 1: 1-loop, 2: 1-loop reduced | 411 int use_fast_coef_updates; // 0: 2-loop, 1: 1-loop, 2: 1-loop reduced |
| 396 | 412 |
| 397 // This flag controls the use of non-RD mode decision. | 413 // This flag controls the use of non-RD mode decision. |
| 398 int use_pick_mode; | 414 int use_nonrd_pick_mode; |
| 399 | 415 |
| 400 // This variable sets the encode_breakout threshold. Currently, it is only | 416 // This variable sets the encode_breakout threshold. Currently, it is only |
| 401 // enabled in real time mode. | 417 // enabled in real time mode. |
| 402 int encode_breakout_thresh; | 418 int encode_breakout_thresh; |
| 419 |
| 420 // A binary mask indicating if NEARESTMV, NEARMV, ZEROMV, NEWMV |
| 421 // modes are disabled in order from LSB to MSB for each BLOCK_SIZE. |
| 422 int disable_inter_mode_mask[BLOCK_SIZES]; |
| 403 } SPEED_FEATURES; | 423 } SPEED_FEATURES; |
| 404 | 424 |
| 405 typedef struct { | 425 typedef struct { |
| 406 RATE_CONTROL rc; | 426 RATE_CONTROL rc; |
| 407 int target_bandwidth; | 427 int target_bandwidth; |
| 408 int64_t starting_buffer_level; | 428 int64_t starting_buffer_level; |
| 409 int64_t optimal_buffer_level; | 429 int64_t optimal_buffer_level; |
| 410 int64_t maximum_buffer_size; | 430 int64_t maximum_buffer_size; |
| 411 double framerate; | 431 double framerate; |
| 412 int avg_frame_size; | 432 int avg_frame_size; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 438 #if CONFIG_MULTIPLE_ARF | 458 #if CONFIG_MULTIPLE_ARF |
| 439 struct lookahead_entry *alt_ref_source[REF_FRAMES]; | 459 struct lookahead_entry *alt_ref_source[REF_FRAMES]; |
| 440 #else | 460 #else |
| 441 struct lookahead_entry *alt_ref_source; | 461 struct lookahead_entry *alt_ref_source; |
| 442 #endif | 462 #endif |
| 443 | 463 |
| 444 YV12_BUFFER_CONFIG *Source; | 464 YV12_BUFFER_CONFIG *Source; |
| 445 YV12_BUFFER_CONFIG *un_scaled_source; | 465 YV12_BUFFER_CONFIG *un_scaled_source; |
| 446 YV12_BUFFER_CONFIG scaled_source; | 466 YV12_BUFFER_CONFIG scaled_source; |
| 447 | 467 |
| 448 unsigned int key_frame_frequency; | 468 int key_frame_frequency; |
| 449 | 469 |
| 450 int gold_is_last; // gold same as last frame ( short circuit gold searches) | 470 int gold_is_last; // gold same as last frame ( short circuit gold searches) |
| 451 int alt_is_last; // Alt same as last ( short circuit altref search) | 471 int alt_is_last; // Alt same as last ( short circuit altref search) |
| 452 int gold_is_alt; // don't do both alt and gold search ( just do gold). | 472 int gold_is_alt; // don't do both alt and gold search ( just do gold). |
| 453 | 473 |
| 454 int scaled_ref_idx[3]; | 474 int scaled_ref_idx[3]; |
| 455 int lst_fb_idx; | 475 int lst_fb_idx; |
| 456 int gld_fb_idx; | 476 int gld_fb_idx; |
| 457 int alt_fb_idx; | 477 int alt_fb_idx; |
| 458 | 478 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 479 #if CONFIG_MULTIPLE_ARF | 499 #if CONFIG_MULTIPLE_ARF |
| 480 // Position within a frame coding order (including any additional ARF frames). | 500 // Position within a frame coding order (including any additional ARF frames). |
| 481 unsigned int sequence_number; | 501 unsigned int sequence_number; |
| 482 // Next frame in naturally occurring order that has not yet been coded. | 502 // Next frame in naturally occurring order that has not yet been coded. |
| 483 int next_frame_in_order; | 503 int next_frame_in_order; |
| 484 #endif | 504 #endif |
| 485 | 505 |
| 486 // Ambient reconstruction err target for force key frames | 506 // Ambient reconstruction err target for force key frames |
| 487 int ambient_err; | 507 int ambient_err; |
| 488 | 508 |
| 489 unsigned int mode_chosen_counts[MAX_MODES]; | |
| 490 unsigned int sub8x8_mode_chosen_counts[MAX_REFS]; | |
| 491 int64_t mode_skip_mask; | |
| 492 int ref_frame_mask; | |
| 493 int set_ref_frame_mask; | |
| 494 | |
| 495 int rd_threshes[MAX_SEGMENTS][BLOCK_SIZES][MAX_MODES]; | 509 int rd_threshes[MAX_SEGMENTS][BLOCK_SIZES][MAX_MODES]; |
| 496 int rd_thresh_freq_fact[BLOCK_SIZES][MAX_MODES]; | 510 int rd_thresh_freq_fact[BLOCK_SIZES][MAX_MODES]; |
| 497 int rd_thresh_sub8x8[MAX_SEGMENTS][BLOCK_SIZES][MAX_REFS]; | 511 int rd_thresh_sub8x8[MAX_SEGMENTS][BLOCK_SIZES][MAX_REFS]; |
| 498 int rd_thresh_freq_sub8x8[BLOCK_SIZES][MAX_REFS]; | 512 int rd_thresh_freq_sub8x8[BLOCK_SIZES][MAX_REFS]; |
| 499 | 513 |
| 500 int64_t rd_comp_pred_diff[REFERENCE_MODES]; | 514 int64_t rd_comp_pred_diff[REFERENCE_MODES]; |
| 501 int64_t rd_prediction_type_threshes[4][REFERENCE_MODES]; | 515 int64_t rd_prediction_type_threshes[4][REFERENCE_MODES]; |
| 502 int64_t rd_tx_select_diff[TX_MODES]; | 516 int64_t rd_tx_select_diff[TX_MODES]; |
| 503 // FIXME(rbultje) can this overflow? | 517 // FIXME(rbultje) can this overflow? |
| 504 int rd_tx_select_threshes[4][TX_MODES]; | 518 int rd_tx_select_threshes[4][TX_MODES]; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 uint64_t time_pick_lpf; | 596 uint64_t time_pick_lpf; |
| 583 uint64_t time_encode_sb_row; | 597 uint64_t time_encode_sb_row; |
| 584 | 598 |
| 585 struct twopass_rc twopass; | 599 struct twopass_rc twopass; |
| 586 | 600 |
| 587 YV12_BUFFER_CONFIG alt_ref_buffer; | 601 YV12_BUFFER_CONFIG alt_ref_buffer; |
| 588 YV12_BUFFER_CONFIG *frames[MAX_LAG_BUFFERS]; | 602 YV12_BUFFER_CONFIG *frames[MAX_LAG_BUFFERS]; |
| 589 int fixed_divide[512]; | 603 int fixed_divide[512]; |
| 590 | 604 |
| 591 #if CONFIG_INTERNAL_STATS | 605 #if CONFIG_INTERNAL_STATS |
| 606 unsigned int mode_chosen_counts[MAX_MODES]; |
| 607 |
| 592 int count; | 608 int count; |
| 593 double total_y; | 609 double total_y; |
| 594 double total_u; | 610 double total_u; |
| 595 double total_v; | 611 double total_v; |
| 596 double total; | 612 double total; |
| 597 uint64_t total_sq_error; | 613 uint64_t total_sq_error; |
| 598 uint64_t total_samples; | 614 uint64_t total_samples; |
| 599 | 615 |
| 600 double totalp_y; | 616 double totalp_y; |
| 601 double totalp_u; | 617 double totalp_u; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 | 711 |
| 696 static YV12_BUFFER_CONFIG *get_ref_frame_buffer(VP9_COMP *cpi, | 712 static YV12_BUFFER_CONFIG *get_ref_frame_buffer(VP9_COMP *cpi, |
| 697 MV_REFERENCE_FRAME ref_frame) { | 713 MV_REFERENCE_FRAME ref_frame) { |
| 698 VP9_COMMON *const cm = &cpi->common; | 714 VP9_COMMON *const cm = &cpi->common; |
| 699 return &cm->frame_bufs[cm->ref_frame_map[get_ref_frame_idx(cpi, | 715 return &cm->frame_bufs[cm->ref_frame_map[get_ref_frame_idx(cpi, |
| 700 ref_frame)]].buf; | 716 ref_frame)]].buf; |
| 701 } | 717 } |
| 702 | 718 |
| 703 void vp9_encode_frame(VP9_COMP *cpi); | 719 void vp9_encode_frame(VP9_COMP *cpi); |
| 704 | 720 |
| 705 void vp9_pack_bitstream(VP9_COMP *cpi, uint8_t *dest, size_t *size); | |
| 706 | |
| 707 void vp9_set_speed_features(VP9_COMP *cpi); | 721 void vp9_set_speed_features(VP9_COMP *cpi); |
| 708 | 722 |
| 709 int vp9_calc_ss_err(const YV12_BUFFER_CONFIG *source, | 723 int vp9_calc_ss_err(const YV12_BUFFER_CONFIG *source, |
| 710 const YV12_BUFFER_CONFIG *reference); | 724 const YV12_BUFFER_CONFIG *reference); |
| 711 | 725 |
| 712 void vp9_alloc_compressor_data(VP9_COMP *cpi); | 726 void vp9_alloc_compressor_data(VP9_COMP *cpi); |
| 713 | 727 |
| 714 int vp9_compute_qdelta(const VP9_COMP *cpi, double qstart, double qtarget); | 728 int vp9_compute_qdelta(const VP9_COMP *cpi, double qstart, double qtarget); |
| 715 | 729 |
| 716 static int get_token_alloc(int mb_rows, int mb_cols) { | 730 static int get_token_alloc(int mb_rows, int mb_cols) { |
| 717 return mb_rows * mb_cols * (48 * 16 + 4); | 731 return mb_rows * mb_cols * (48 * 16 + 4); |
| 718 } | 732 } |
| 719 | 733 |
| 720 static void set_ref_ptrs(VP9_COMMON *cm, MACROBLOCKD *xd, | 734 static void set_ref_ptrs(VP9_COMMON *cm, MACROBLOCKD *xd, |
| 721 MV_REFERENCE_FRAME ref0, MV_REFERENCE_FRAME ref1) { | 735 MV_REFERENCE_FRAME ref0, MV_REFERENCE_FRAME ref1) { |
| 722 xd->block_refs[0] = &cm->frame_refs[ref0 >= LAST_FRAME ? ref0 - LAST_FRAME | 736 xd->block_refs[0] = &cm->frame_refs[ref0 >= LAST_FRAME ? ref0 - LAST_FRAME |
| 723 : 0]; | 737 : 0]; |
| 724 xd->block_refs[1] = &cm->frame_refs[ref1 >= LAST_FRAME ? ref1 - LAST_FRAME | 738 xd->block_refs[1] = &cm->frame_refs[ref1 >= LAST_FRAME ? ref1 - LAST_FRAME |
| 725 : 0]; | 739 : 0]; |
| 726 } | 740 } |
| 727 | 741 |
| 728 #ifdef __cplusplus | 742 #ifdef __cplusplus |
| 729 } // extern "C" | 743 } // extern "C" |
| 730 #endif | 744 #endif |
| 731 | 745 |
| 732 #endif // VP9_ENCODER_VP9_ONYX_INT_H_ | 746 #endif // VP9_ENCODER_VP9_ONYX_INT_H_ |
| OLD | NEW |