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 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 cpi->twopass.est_max_qcorrection_factor -= 0.005; | 979 cpi->twopass.est_max_qcorrection_factor -= 0.005; |
980 else if (rolling_ratio > 1.05) | 980 else if (rolling_ratio > 1.05) |
981 cpi->twopass.est_max_qcorrection_factor += 0.005; | 981 cpi->twopass.est_max_qcorrection_factor += 0.005; |
982 | 982 |
983 cpi->twopass.est_max_qcorrection_factor = fclamp( | 983 cpi->twopass.est_max_qcorrection_factor = fclamp( |
984 cpi->twopass.est_max_qcorrection_factor, 0.1, 10.0); | 984 cpi->twopass.est_max_qcorrection_factor, 0.1, 10.0); |
985 } | 985 } |
986 | 986 |
987 // Corrections for higher compression speed settings | 987 // Corrections for higher compression speed settings |
988 // (reduced compression expected) | 988 // (reduced compression expected) |
| 989 // FIXME(jimbankoski): Once we settle on vp9 speed features we need to |
| 990 // change this code. |
989 if (cpi->compressor_speed == 1) | 991 if (cpi->compressor_speed == 1) |
990 speed_correction = cpi->oxcf.cpu_used <= 5 ? | 992 speed_correction = cpi->oxcf.cpu_used <= 5 ? |
991 1.04 + (cpi->oxcf.cpu_used * 0.04) : | 993 1.04 + (/*cpi->oxcf.cpu_used*/0 * 0.04) : |
992 1.25; | 994 1.25; |
993 | 995 |
994 // Try and pick a max Q that will be high enough to encode the | 996 // Try and pick a max Q that will be high enough to encode the |
995 // content at the given rate. | 997 // content at the given rate. |
996 for (q = cpi->twopass.maxq_min_limit; q < cpi->twopass.maxq_max_limit; q++) { | 998 for (q = cpi->twopass.maxq_min_limit; q < cpi->twopass.maxq_max_limit; q++) { |
997 int bits_per_mb_at_this_q; | 999 int bits_per_mb_at_this_q; |
998 | 1000 |
999 err_correction_factor = calc_correction_factor(err_per_mb, | 1001 err_correction_factor = calc_correction_factor(err_per_mb, |
1000 ERR_DIVISOR, 0.4, 0.90, q) * | 1002 ERR_DIVISOR, 0.4, 0.90, q) * |
1001 sr_correction * speed_correction * | 1003 sr_correction * speed_correction * |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1044 | 1046 |
1045 target_norm_bits_per_mb = (section_target_bandwitdh < (1 << 20)) | 1047 target_norm_bits_per_mb = (section_target_bandwitdh < (1 << 20)) |
1046 ? (512 * section_target_bandwitdh) / num_mbs | 1048 ? (512 * section_target_bandwitdh) / num_mbs |
1047 : 512 * (section_target_bandwitdh / num_mbs); | 1049 : 512 * (section_target_bandwitdh / num_mbs); |
1048 | 1050 |
1049 | 1051 |
1050 // Corrections for higher compression speed settings | 1052 // Corrections for higher compression speed settings |
1051 // (reduced compression expected) | 1053 // (reduced compression expected) |
1052 if (cpi->compressor_speed == 1) { | 1054 if (cpi->compressor_speed == 1) { |
1053 if (cpi->oxcf.cpu_used <= 5) | 1055 if (cpi->oxcf.cpu_used <= 5) |
1054 speed_correction = 1.04 + (cpi->oxcf.cpu_used * 0.04); | 1056 speed_correction = 1.04 + (/*cpi->oxcf.cpu_used*/ 0 * 0.04); |
1055 else | 1057 else |
1056 speed_correction = 1.25; | 1058 speed_correction = 1.25; |
1057 } | 1059 } |
1058 | 1060 |
1059 // Look at the drop in prediction quality between the last frame | 1061 // Look at the drop in prediction quality between the last frame |
1060 // and the GF buffer (which contained an older frame). | 1062 // and the GF buffer (which contained an older frame). |
1061 if (fpstats->sr_coded_error > fpstats->coded_error) { | 1063 if (fpstats->sr_coded_error > fpstats->coded_error) { |
1062 sr_err_diff = | 1064 sr_err_diff = |
1063 (fpstats->sr_coded_error - fpstats->coded_error) / | 1065 (fpstats->sr_coded_error - fpstats->coded_error) / |
1064 (fpstats->count * cpi->common.MBs); | 1066 (fpstats->count * cpi->common.MBs); |
(...skipping 1574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2639 cpi->output_frame_rate); | 2641 cpi->output_frame_rate); |
2640 } | 2642 } |
2641 | 2643 |
2642 // Note the total error score of the kf group minus the key frame itself | 2644 // Note the total error score of the kf group minus the key frame itself |
2643 cpi->twopass.kf_group_error_left = (int)(kf_group_err - kf_mod_err); | 2645 cpi->twopass.kf_group_error_left = (int)(kf_group_err - kf_mod_err); |
2644 | 2646 |
2645 // Adjust the count of total modified error left. | 2647 // Adjust the count of total modified error left. |
2646 // The count of bits left is adjusted elsewhere based on real coded frame size
s | 2648 // The count of bits left is adjusted elsewhere based on real coded frame size
s |
2647 cpi->twopass.modified_error_left -= kf_group_err; | 2649 cpi->twopass.modified_error_left -= kf_group_err; |
2648 } | 2650 } |
OLD | NEW |