| 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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 vp9_cyclic_refresh_estimate_bits_at_q(cpi, rate_correction_factor); | 419 vp9_cyclic_refresh_estimate_bits_at_q(cpi, rate_correction_factor); |
| 420 } else { | 420 } else { |
| 421 projected_size_based_on_q = vp9_estimate_bits_at_q(cpi->common.frame_type, | 421 projected_size_based_on_q = vp9_estimate_bits_at_q(cpi->common.frame_type, |
| 422 cm->base_qindex, | 422 cm->base_qindex, |
| 423 cm->MBs, | 423 cm->MBs, |
| 424 rate_correction_factor, | 424 rate_correction_factor, |
| 425 cm->bit_depth); | 425 cm->bit_depth); |
| 426 } | 426 } |
| 427 // Work out a size correction factor. | 427 // Work out a size correction factor. |
| 428 if (projected_size_based_on_q > FRAME_OVERHEAD_BITS) | 428 if (projected_size_based_on_q > FRAME_OVERHEAD_BITS) |
| 429 correction_factor = (100 * cpi->rc.projected_frame_size) / | 429 correction_factor = (int)((100 * (int64_t)cpi->rc.projected_frame_size) / |
| 430 projected_size_based_on_q; | 430 projected_size_based_on_q); |
| 431 | 431 |
| 432 // More heavily damped adjustment used if we have been oscillating either side | 432 // More heavily damped adjustment used if we have been oscillating either side |
| 433 // of target. | 433 // of target. |
| 434 switch (damp_var) { | 434 switch (damp_var) { |
| 435 case 0: | 435 case 0: |
| 436 adjustment_limit = 0.75; | 436 adjustment_limit = 0.75; |
| 437 break; | 437 break; |
| 438 case 1: | 438 case 1: |
| 439 adjustment_limit = 0.25 + | 439 adjustment_limit = 0.25 + |
| 440 0.5 * MIN(1, fabs(log10(0.01 * correction_factor))); | 440 0.5 * MIN(1, fabs(log10(0.01 * correction_factor))); |
| (...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1658 | 1658 |
| 1659 void vp9_set_target_rate(VP9_COMP *cpi) { | 1659 void vp9_set_target_rate(VP9_COMP *cpi) { |
| 1660 RATE_CONTROL *const rc = &cpi->rc; | 1660 RATE_CONTROL *const rc = &cpi->rc; |
| 1661 int target_rate = rc->base_frame_target; | 1661 int target_rate = rc->base_frame_target; |
| 1662 | 1662 |
| 1663 // Correction to rate target based on prior over or under shoot. | 1663 // Correction to rate target based on prior over or under shoot. |
| 1664 if (cpi->oxcf.rc_mode == VPX_VBR) | 1664 if (cpi->oxcf.rc_mode == VPX_VBR) |
| 1665 vbr_rate_correction(cpi, &target_rate, rc->vbr_bits_off_target); | 1665 vbr_rate_correction(cpi, &target_rate, rc->vbr_bits_off_target); |
| 1666 vp9_rc_set_frame_target(cpi, target_rate); | 1666 vp9_rc_set_frame_target(cpi, target_rate); |
| 1667 } | 1667 } |
| OLD | NEW |