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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 | 584 |
585 sf->thresh_mult[THR_COMP_NEARLA ] += speed_multiplier * 1500; | 585 sf->thresh_mult[THR_COMP_NEARLA ] += speed_multiplier * 1500; |
586 sf->thresh_mult[THR_COMP_NEARGA ] += speed_multiplier * 1500; | 586 sf->thresh_mult[THR_COMP_NEARGA ] += speed_multiplier * 1500; |
587 | 587 |
588 sf->thresh_mult[THR_COMP_NEWLA ] += speed_multiplier * 2000; | 588 sf->thresh_mult[THR_COMP_NEWLA ] += speed_multiplier * 2000; |
589 sf->thresh_mult[THR_COMP_NEWGA ] += speed_multiplier * 2000; | 589 sf->thresh_mult[THR_COMP_NEWGA ] += speed_multiplier * 2000; |
590 | 590 |
591 sf->thresh_mult[THR_COMP_SPLITLA ] += speed_multiplier * 4500; | 591 sf->thresh_mult[THR_COMP_SPLITLA ] += speed_multiplier * 4500; |
592 sf->thresh_mult[THR_COMP_SPLITGA ] += speed_multiplier * 4500; | 592 sf->thresh_mult[THR_COMP_SPLITGA ] += speed_multiplier * 4500; |
593 | 593 |
594 if (speed > 4) { | 594 if (cpi->sf.skip_lots_of_modes) { |
595 for (i = 0; i < MAX_MODES; ++i) | 595 for (i = 0; i < MAX_MODES; ++i) |
596 sf->thresh_mult[i] = INT_MAX; | 596 sf->thresh_mult[i] = INT_MAX; |
597 | 597 |
598 sf->thresh_mult[THR_DC ] = 0; | 598 sf->thresh_mult[THR_DC] = 0; |
599 sf->thresh_mult[THR_TM ] = 0; | 599 sf->thresh_mult[THR_TM] = 0; |
600 sf->thresh_mult[THR_NEWMV ] = 4000; | 600 sf->thresh_mult[THR_NEWMV] = 4000; |
601 sf->thresh_mult[THR_NEWG ] = 4000; | 601 sf->thresh_mult[THR_NEWG] = 4000; |
602 sf->thresh_mult[THR_NEWA ] = 4000; | 602 sf->thresh_mult[THR_NEWA] = 4000; |
603 sf->thresh_mult[THR_NEARESTMV] = 0; | 603 sf->thresh_mult[THR_NEARESTMV] = 0; |
604 sf->thresh_mult[THR_NEARESTG ] = 0; | 604 sf->thresh_mult[THR_NEARESTG] = 0; |
605 sf->thresh_mult[THR_NEARESTA ] = 0; | 605 sf->thresh_mult[THR_NEARESTA] = 0; |
606 sf->thresh_mult[THR_NEARMV ] = 2000; | 606 sf->thresh_mult[THR_NEARMV] = 2000; |
607 sf->thresh_mult[THR_NEARG ] = 2000; | 607 sf->thresh_mult[THR_NEARG] = 2000; |
608 sf->thresh_mult[THR_NEARA ] = 2000; | 608 sf->thresh_mult[THR_NEARA] = 2000; |
609 sf->thresh_mult[THR_COMP_NEARESTLA] = 2000; | 609 sf->thresh_mult[THR_COMP_NEARESTLA] = 2000; |
| 610 sf->thresh_mult[THR_SPLITMV] = 2500; |
| 611 sf->thresh_mult[THR_SPLITG] = 2500; |
| 612 sf->thresh_mult[THR_SPLITA] = 2500; |
610 sf->recode_loop = 0; | 613 sf->recode_loop = 0; |
611 } | 614 } |
612 | 615 |
613 /* disable frame modes if flags not set */ | 616 /* disable frame modes if flags not set */ |
614 if (!(cpi->ref_frame_flags & VP9_LAST_FLAG)) { | 617 if (!(cpi->ref_frame_flags & VP9_LAST_FLAG)) { |
615 sf->thresh_mult[THR_NEWMV ] = INT_MAX; | 618 sf->thresh_mult[THR_NEWMV ] = INT_MAX; |
616 sf->thresh_mult[THR_NEARESTMV] = INT_MAX; | 619 sf->thresh_mult[THR_NEARESTMV] = INT_MAX; |
617 sf->thresh_mult[THR_ZEROMV ] = INT_MAX; | 620 sf->thresh_mult[THR_ZEROMV ] = INT_MAX; |
618 sf->thresh_mult[THR_NEARMV ] = INT_MAX; | 621 sf->thresh_mult[THR_NEARMV ] = INT_MAX; |
619 sf->thresh_mult[THR_SPLITMV ] = INT_MAX; | 622 sf->thresh_mult[THR_SPLITMV ] = INT_MAX; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 sf->auto_filter = 1; | 677 sf->auto_filter = 1; |
675 sf->recode_loop = 1; | 678 sf->recode_loop = 1; |
676 sf->quarter_pixel_search = 1; | 679 sf->quarter_pixel_search = 1; |
677 sf->half_pixel_search = 1; | 680 sf->half_pixel_search = 1; |
678 sf->iterative_sub_pixel = 1; | 681 sf->iterative_sub_pixel = 1; |
679 sf->optimize_coefficients = !cpi->oxcf.lossless; | 682 sf->optimize_coefficients = !cpi->oxcf.lossless; |
680 sf->first_step = 0; | 683 sf->first_step = 0; |
681 sf->max_step_search_steps = MAX_MVSEARCH_STEPS; | 684 sf->max_step_search_steps = MAX_MVSEARCH_STEPS; |
682 sf->comp_inter_joint_search_thresh = BLOCK_SIZE_AB4X4; | 685 sf->comp_inter_joint_search_thresh = BLOCK_SIZE_AB4X4; |
683 sf->adpative_rd_thresh = 0; | 686 sf->adpative_rd_thresh = 0; |
| 687 sf->use_lastframe_partitioning = 0; |
| 688 sf->use_largest_txform = 0; |
| 689 sf->use_8tap_always = 0; |
| 690 sf->use_avoid_tested_higherror = 0; |
| 691 sf->skip_lots_of_modes = 0; |
| 692 sf->adjust_thresholds_by_speed = 0; |
| 693 sf->partition_by_variance = 0; |
| 694 sf->use_one_partition_size_always = 0; |
| 695 sf->use_partitions_less_than = 0; |
| 696 sf->less_than_block_size = BLOCK_SIZE_MB16X16; |
| 697 sf->use_partitions_greater_than = 0; |
| 698 sf->greater_than_block_size = BLOCK_SIZE_SB8X8; |
684 | 699 |
685 #if CONFIG_MULTIPLE_ARF | 700 #if CONFIG_MULTIPLE_ARF |
686 // Switch segmentation off. | 701 // Switch segmentation off. |
687 sf->static_segmentation = 0; | 702 sf->static_segmentation = 0; |
688 #else | 703 #else |
689 sf->static_segmentation = 0; | 704 sf->static_segmentation = 0; |
690 #endif | 705 #endif |
691 | 706 |
692 switch (mode) { | 707 switch (mode) { |
693 case 0: // best quality mode | 708 case 0: // best quality mode |
694 sf->search_best_filter = SEARCH_BEST_FILTER; | 709 sf->search_best_filter = SEARCH_BEST_FILTER; |
695 break; | 710 break; |
696 | 711 |
697 case 1: | 712 case 1: |
698 #if CONFIG_MULTIPLE_ARF | 713 #if CONFIG_MULTIPLE_ARF |
699 // Switch segmentation off. | 714 // Switch segmentation off. |
700 sf->static_segmentation = 0; | 715 sf->static_segmentation = 0; |
701 #else | 716 #else |
702 sf->static_segmentation = 0; | 717 sf->static_segmentation = 0; |
703 #endif | 718 #endif |
704 sf->comp_inter_joint_search_thresh = BLOCK_SIZE_SB8X8; | 719 sf->comp_inter_joint_search_thresh = BLOCK_SIZE_SB8X8; |
705 sf->adpative_rd_thresh = 1; | 720 sf->adpative_rd_thresh = 1; |
706 if (speed > 0) { | 721 if (speed > 0) { |
707 sf->comp_inter_joint_search_thresh = BLOCK_SIZE_TYPES; | 722 sf->comp_inter_joint_search_thresh = BLOCK_SIZE_TYPES; |
708 sf->optimize_coefficients = 0; | 723 sf->optimize_coefficients = 0; |
709 sf->first_step = 1; | 724 sf->first_step = 1; |
710 } | 725 } |
711 break; | 726 if (speed == 2) { |
| 727 sf->comp_inter_joint_search_thresh = BLOCK_SIZE_SB8X8; |
| 728 sf->use_lastframe_partitioning = 1; |
| 729 sf->first_step = 0; |
| 730 } |
| 731 if (speed == 3) { |
| 732 sf->comp_inter_joint_search_thresh = BLOCK_SIZE_SB8X8; |
| 733 sf->partition_by_variance = 1; |
| 734 sf->first_step = 0; |
| 735 } |
| 736 if (speed == 4) { |
| 737 sf->first_step = 0; |
| 738 sf->comp_inter_joint_search_thresh = BLOCK_SIZE_SB8X8; |
| 739 sf->use_one_partition_size_always = 1; |
| 740 sf->always_this_block_size = BLOCK_SIZE_MB16X16; |
| 741 } |
| 742 if (speed == 2) { |
| 743 sf->first_step = 0; |
| 744 sf->comp_inter_joint_search_thresh = BLOCK_SIZE_SB8X8; |
| 745 sf->use_partitions_less_than = 1; |
| 746 sf->less_than_block_size = BLOCK_SIZE_MB16X16; |
| 747 } |
| 748 if (speed == 3) { |
| 749 sf->first_step = 0; |
| 750 sf->comp_inter_joint_search_thresh = BLOCK_SIZE_SB8X8; |
| 751 sf->use_partitions_greater_than = 1; |
| 752 sf->greater_than_block_size = BLOCK_SIZE_SB8X8; |
| 753 } |
| 754 |
| 755 break; |
712 | 756 |
713 }; /* switch */ | 757 }; /* switch */ |
714 | 758 |
715 // Set rd thresholds based on mode and speed setting | 759 // Set rd thresholds based on mode and speed setting |
716 set_rd_speed_thresholds(cpi, mode, speed); | 760 if(cpi->sf.adjust_thresholds_by_speed) |
| 761 set_rd_speed_thresholds(cpi, mode, speed); |
| 762 else |
| 763 set_rd_speed_thresholds(cpi, mode, 0); |
717 | 764 |
718 // Slow quant, dct and trellis not worthwhile for first pass | 765 // Slow quant, dct and trellis not worthwhile for first pass |
719 // so make sure they are always turned off. | 766 // so make sure they are always turned off. |
720 if (cpi->pass == 1) { | 767 if (cpi->pass == 1) { |
721 sf->optimize_coefficients = 0; | 768 sf->optimize_coefficients = 0; |
722 } | 769 } |
723 | 770 |
724 cpi->mb.fwd_txm16x16 = vp9_short_fdct16x16; | 771 cpi->mb.fwd_txm16x16 = vp9_short_fdct16x16; |
725 cpi->mb.fwd_txm8x8 = vp9_short_fdct8x8; | 772 cpi->mb.fwd_txm8x8 = vp9_short_fdct8x8; |
726 cpi->mb.fwd_txm8x4 = vp9_short_fdct8x4; | 773 cpi->mb.fwd_txm8x4 = vp9_short_fdct8x4; |
(...skipping 2259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2986 vp9_copy(cpi->common.fc.partition_counts, cpi->partition_count); | 3033 vp9_copy(cpi->common.fc.partition_counts, cpi->partition_count); |
2987 vp9_copy(cm->fc.intra_inter_count, cpi->intra_inter_count); | 3034 vp9_copy(cm->fc.intra_inter_count, cpi->intra_inter_count); |
2988 vp9_copy(cm->fc.comp_inter_count, cpi->comp_inter_count); | 3035 vp9_copy(cm->fc.comp_inter_count, cpi->comp_inter_count); |
2989 vp9_copy(cm->fc.single_ref_count, cpi->single_ref_count); | 3036 vp9_copy(cm->fc.single_ref_count, cpi->single_ref_count); |
2990 vp9_copy(cm->fc.comp_ref_count, cpi->comp_ref_count); | 3037 vp9_copy(cm->fc.comp_ref_count, cpi->comp_ref_count); |
2991 cpi->common.fc.NMVcount = cpi->NMVcount; | 3038 cpi->common.fc.NMVcount = cpi->NMVcount; |
2992 if (!cpi->common.error_resilient_mode && | 3039 if (!cpi->common.error_resilient_mode && |
2993 !cpi->common.frame_parallel_decoding_mode) { | 3040 !cpi->common.frame_parallel_decoding_mode) { |
2994 vp9_adapt_mode_probs(&cpi->common); | 3041 vp9_adapt_mode_probs(&cpi->common); |
2995 vp9_adapt_mode_context(&cpi->common); | 3042 vp9_adapt_mode_context(&cpi->common); |
2996 vp9_adapt_nmv_probs(&cpi->common, cpi->mb.e_mbd.allow_high_precision_mv); | 3043 vp9_adapt_mv_probs(&cpi->common, cpi->mb.e_mbd.allow_high_precision_mv); |
2997 } | 3044 } |
2998 } | 3045 } |
2999 | 3046 |
3000 #ifdef ENTROPY_STATS | 3047 #ifdef ENTROPY_STATS |
3001 vp9_update_mode_context_stats(cpi); | 3048 vp9_update_mode_context_stats(cpi); |
3002 #endif | 3049 #endif |
3003 | 3050 |
3004 /* Move storing frame_type out of the above loop since it is also | 3051 /* Move storing frame_type out of the above loop since it is also |
3005 * needed in motion search besides loopfilter */ | 3052 * needed in motion search besides loopfilter */ |
3006 cm->last_frame_type = cm->frame_type; | 3053 cm->last_frame_type = cm->frame_type; |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3320 cm->prev_mi = cm->prev_mip + cm->mode_info_stride + 1; | 3367 cm->prev_mi = cm->prev_mip + cm->mode_info_stride + 1; |
3321 } | 3368 } |
3322 | 3369 |
3323 static void Pass2Encode(VP9_COMP *cpi, unsigned long *size, | 3370 static void Pass2Encode(VP9_COMP *cpi, unsigned long *size, |
3324 unsigned char *dest, unsigned int *frame_flags) { | 3371 unsigned char *dest, unsigned int *frame_flags) { |
3325 | 3372 |
3326 if (!cpi->refresh_alt_ref_frame) | 3373 if (!cpi->refresh_alt_ref_frame) |
3327 vp9_second_pass(cpi); | 3374 vp9_second_pass(cpi); |
3328 | 3375 |
3329 encode_frame_to_data_rate(cpi, size, dest, frame_flags); | 3376 encode_frame_to_data_rate(cpi, size, dest, frame_flags); |
3330 | 3377 //vp9_print_modes_and_motion_vectors(&cpi->common, "encode.stt"); |
3331 #ifdef DISABLE_RC_LONG_TERM_MEM | 3378 #ifdef DISABLE_RC_LONG_TERM_MEM |
3332 cpi->twopass.bits_left -= cpi->this_frame_target; | 3379 cpi->twopass.bits_left -= cpi->this_frame_target; |
3333 #else | 3380 #else |
3334 cpi->twopass.bits_left -= 8 * *size; | 3381 cpi->twopass.bits_left -= 8 * *size; |
3335 #endif | 3382 #endif |
3336 | 3383 |
3337 if (!cpi->refresh_alt_ref_frame) { | 3384 if (!cpi->refresh_alt_ref_frame) { |
3338 double lower_bounds_min_rate = FRAME_OVERHEAD_BITS * cpi->oxcf.frame_rate; | 3385 double lower_bounds_min_rate = FRAME_OVERHEAD_BITS * cpi->oxcf.frame_rate; |
3339 double two_pass_min_rate = (double)(cpi->oxcf.target_bandwidth | 3386 double two_pass_min_rate = (double)(cpi->oxcf.target_bandwidth |
3340 * cpi->oxcf.two_pass_vbrmin_section / 10
0); | 3387 * cpi->oxcf.two_pass_vbrmin_section / 10
0); |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3923 dst += 16 * dest->y_stride; | 3970 dst += 16 * dest->y_stride; |
3924 } | 3971 } |
3925 | 3972 |
3926 return total; | 3973 return total; |
3927 } | 3974 } |
3928 | 3975 |
3929 | 3976 |
3930 int vp9_get_quantizer(VP9_PTR c) { | 3977 int vp9_get_quantizer(VP9_PTR c) { |
3931 return ((VP9_COMP *)c)->common.base_qindex; | 3978 return ((VP9_COMP *)c)->common.base_qindex; |
3932 } | 3979 } |
OLD | NEW |