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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 int *top_index) { | 639 int *top_index) { |
640 const VP9_COMMON *const cm = &cpi->common; | 640 const VP9_COMMON *const cm = &cpi->common; |
641 const RATE_CONTROL *const rc = &cpi->rc; | 641 const RATE_CONTROL *const rc = &cpi->rc; |
642 const VP9EncoderConfig *const oxcf = &cpi->oxcf; | 642 const VP9EncoderConfig *const oxcf = &cpi->oxcf; |
643 const int cq_level = get_active_cq_level(rc, oxcf); | 643 const int cq_level = get_active_cq_level(rc, oxcf); |
644 int active_best_quality; | 644 int active_best_quality; |
645 int active_worst_quality = calc_active_worst_quality_one_pass_vbr(cpi); | 645 int active_worst_quality = calc_active_worst_quality_one_pass_vbr(cpi); |
646 int q; | 646 int q; |
647 | 647 |
648 if (frame_is_intra_only(cm)) { | 648 if (frame_is_intra_only(cm)) { |
649 active_best_quality = rc->best_quality; | |
650 | 649 |
651 // Handle the special case for key frames forced when we have reached | 650 // Handle the special case for key frames forced when we have reached |
652 // the maximum key frame interval. Here force the Q to a range | 651 // the maximum key frame interval. Here force the Q to a range |
653 // based on the ambient Q to reduce the risk of popping. | 652 // based on the ambient Q to reduce the risk of popping. |
654 if (rc->this_key_frame_forced) { | 653 if (rc->this_key_frame_forced) { |
655 int qindex = rc->last_boosted_qindex; | 654 int qindex = rc->last_boosted_qindex; |
656 double last_boosted_q = vp9_convert_qindex_to_q(qindex); | 655 double last_boosted_q = vp9_convert_qindex_to_q(qindex); |
657 int delta_qindex = vp9_compute_qdelta(rc, last_boosted_q, | 656 int delta_qindex = vp9_compute_qdelta(rc, last_boosted_q, |
658 last_boosted_q * 0.75); | 657 last_boosted_q * 0.75); |
659 active_best_quality = MAX(qindex + delta_qindex, rc->best_quality); | 658 active_best_quality = MAX(qindex + delta_qindex, rc->best_quality); |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1377 // a very high rate is given on the command line or the the rate cannnot | 1376 // a very high rate is given on the command line or the the rate cannnot |
1378 // be acheived because of a user specificed max q (e.g. when the user | 1377 // be acheived because of a user specificed max q (e.g. when the user |
1379 // specifies lossless encode. | 1378 // specifies lossless encode. |
1380 vbr_max_bits = (int)(((int64_t)rc->avg_frame_bandwidth * | 1379 vbr_max_bits = (int)(((int64_t)rc->avg_frame_bandwidth * |
1381 oxcf->two_pass_vbrmax_section) / 100); | 1380 oxcf->two_pass_vbrmax_section) / 100); |
1382 rc->max_frame_bandwidth = MAX(MAX((cm->MBs * MAX_MB_RATE), MAXRATE_1080P), | 1381 rc->max_frame_bandwidth = MAX(MAX((cm->MBs * MAX_MB_RATE), MAXRATE_1080P), |
1383 vbr_max_bits); | 1382 vbr_max_bits); |
1384 | 1383 |
1385 vp9_rc_set_gf_max_interval(cpi, rc); | 1384 vp9_rc_set_gf_max_interval(cpi, rc); |
1386 } | 1385 } |
OLD | NEW |