Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1092)

Side by Side Diff: source/libvpx/vp9/encoder/vp9_ratectrl.c

Issue 394353005: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_ratectrl.h ('k') | source/libvpx/vp9/encoder/vp9_rd.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 return high_motion_minq[q]; 417 return high_motion_minq[q];
418 } else { 418 } else {
419 const int gap = high - low; 419 const int gap = high - low;
420 const int offset = high - gfu_boost; 420 const int offset = high - gfu_boost;
421 const int qdiff = high_motion_minq[q] - low_motion_minq[q]; 421 const int qdiff = high_motion_minq[q] - low_motion_minq[q];
422 const int adjustment = ((offset * qdiff) + (gap >> 1)) / gap; 422 const int adjustment = ((offset * qdiff) + (gap >> 1)) / gap;
423 return low_motion_minq[q] + adjustment; 423 return low_motion_minq[q] + adjustment;
424 } 424 }
425 } 425 }
426 426
427 static int get_kf_active_quality(const RATE_CONTROL *const rc, int q) {
428 return get_active_quality(q, rc->kf_boost, kf_low, kf_high,
429 kf_low_motion_minq, kf_high_motion_minq);
430 }
431
432 static int get_gf_active_quality(const RATE_CONTROL *const rc, int q) {
433 return get_active_quality(q, rc->gfu_boost, gf_low, gf_high,
434 arfgf_low_motion_minq, arfgf_high_motion_minq);
435 }
436
427 static int calc_active_worst_quality_one_pass_vbr(const VP9_COMP *cpi) { 437 static int calc_active_worst_quality_one_pass_vbr(const VP9_COMP *cpi) {
428 const RATE_CONTROL *const rc = &cpi->rc; 438 const RATE_CONTROL *const rc = &cpi->rc;
429 const unsigned int curr_frame = cpi->common.current_video_frame; 439 const unsigned int curr_frame = cpi->common.current_video_frame;
430 int active_worst_quality; 440 int active_worst_quality;
431 441
432 if (cpi->common.frame_type == KEY_FRAME) { 442 if (cpi->common.frame_type == KEY_FRAME) {
433 active_worst_quality = curr_frame == 0 ? rc->worst_quality 443 active_worst_quality = curr_frame == 0 ? rc->worst_quality
434 : rc->last_q[KEY_FRAME] * 2; 444 : rc->last_q[KEY_FRAME] * 2;
435 } else { 445 } else {
436 if (!rc->is_src_frame_alt_ref && 446 if (!rc->is_src_frame_alt_ref &&
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 int qindex = rc->last_boosted_qindex; 526 int qindex = rc->last_boosted_qindex;
517 double last_boosted_q = vp9_convert_qindex_to_q(qindex); 527 double last_boosted_q = vp9_convert_qindex_to_q(qindex);
518 int delta_qindex = vp9_compute_qdelta(rc, last_boosted_q, 528 int delta_qindex = vp9_compute_qdelta(rc, last_boosted_q,
519 (last_boosted_q * 0.75)); 529 (last_boosted_q * 0.75));
520 active_best_quality = MAX(qindex + delta_qindex, rc->best_quality); 530 active_best_quality = MAX(qindex + delta_qindex, rc->best_quality);
521 } else if (cm->current_video_frame > 0) { 531 } else if (cm->current_video_frame > 0) {
522 // not first frame of one pass and kf_boost is set 532 // not first frame of one pass and kf_boost is set
523 double q_adj_factor = 1.0; 533 double q_adj_factor = 1.0;
524 double q_val; 534 double q_val;
525 535
526 active_best_quality = get_active_quality(rc->avg_frame_qindex[KEY_FRAME], 536 active_best_quality =
527 rc->kf_boost, 537 get_kf_active_quality(rc, rc->avg_frame_qindex[KEY_FRAME]);
528 kf_low, kf_high,
529 kf_low_motion_minq,
530 kf_high_motion_minq);
531 538
532 // Allow somewhat lower kf minq with small image formats. 539 // Allow somewhat lower kf minq with small image formats.
533 if ((cm->width * cm->height) <= (352 * 288)) { 540 if ((cm->width * cm->height) <= (352 * 288)) {
534 q_adj_factor -= 0.25; 541 q_adj_factor -= 0.25;
535 } 542 }
536 543
537 // Convert the adjustment factor to a qindex delta 544 // Convert the adjustment factor to a qindex delta
538 // on active_best_quality. 545 // on active_best_quality.
539 q_val = vp9_convert_qindex_to_q(active_best_quality); 546 q_val = vp9_convert_qindex_to_q(active_best_quality);
540 active_best_quality += vp9_compute_qdelta(rc, q_val, 547 active_best_quality += vp9_compute_qdelta(rc, q_val,
541 q_val * q_adj_factor); 548 q_val * q_adj_factor);
542 } 549 }
543 } else if (!rc->is_src_frame_alt_ref && 550 } else if (!rc->is_src_frame_alt_ref &&
544 !cpi->use_svc && 551 !cpi->use_svc &&
545 (cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame)) { 552 (cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame)) {
546 // Use the lower of active_worst_quality and recent 553 // Use the lower of active_worst_quality and recent
547 // average Q as basis for GF/ARF best Q limit unless last frame was 554 // average Q as basis for GF/ARF best Q limit unless last frame was
548 // a key frame. 555 // a key frame.
549 if (rc->frames_since_key > 1 && 556 if (rc->frames_since_key > 1 &&
550 rc->avg_frame_qindex[INTER_FRAME] < active_worst_quality) { 557 rc->avg_frame_qindex[INTER_FRAME] < active_worst_quality) {
551 q = rc->avg_frame_qindex[INTER_FRAME]; 558 q = rc->avg_frame_qindex[INTER_FRAME];
552 } else { 559 } else {
553 q = active_worst_quality; 560 q = active_worst_quality;
554 } 561 }
555 active_best_quality = get_active_quality( 562 active_best_quality = get_gf_active_quality(rc, q);
556 q, rc->gfu_boost, gf_low, gf_high,
557 arfgf_low_motion_minq, arfgf_high_motion_minq);
558 } else { 563 } else {
559 // Use the lower of active_worst_quality and recent/average Q. 564 // Use the lower of active_worst_quality and recent/average Q.
560 if (cm->current_video_frame > 1) { 565 if (cm->current_video_frame > 1) {
561 if (rc->avg_frame_qindex[INTER_FRAME] < active_worst_quality) 566 if (rc->avg_frame_qindex[INTER_FRAME] < active_worst_quality)
562 active_best_quality = rtc_minq[rc->avg_frame_qindex[INTER_FRAME]]; 567 active_best_quality = rtc_minq[rc->avg_frame_qindex[INTER_FRAME]];
563 else 568 else
564 active_best_quality = rtc_minq[active_worst_quality]; 569 active_best_quality = rtc_minq[active_worst_quality];
565 } else { 570 } else {
566 if (rc->avg_frame_qindex[KEY_FRAME] < active_worst_quality) 571 if (rc->avg_frame_qindex[KEY_FRAME] < active_worst_quality)
567 active_best_quality = rtc_minq[rc->avg_frame_qindex[KEY_FRAME]]; 572 active_best_quality = rtc_minq[rc->avg_frame_qindex[KEY_FRAME]];
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 int qindex = rc->last_boosted_qindex; 655 int qindex = rc->last_boosted_qindex;
651 double last_boosted_q = vp9_convert_qindex_to_q(qindex); 656 double last_boosted_q = vp9_convert_qindex_to_q(qindex);
652 int delta_qindex = vp9_compute_qdelta(rc, last_boosted_q, 657 int delta_qindex = vp9_compute_qdelta(rc, last_boosted_q,
653 last_boosted_q * 0.75); 658 last_boosted_q * 0.75);
654 active_best_quality = MAX(qindex + delta_qindex, rc->best_quality); 659 active_best_quality = MAX(qindex + delta_qindex, rc->best_quality);
655 } else { 660 } else {
656 // not first frame of one pass and kf_boost is set 661 // not first frame of one pass and kf_boost is set
657 double q_adj_factor = 1.0; 662 double q_adj_factor = 1.0;
658 double q_val; 663 double q_val;
659 664
660 active_best_quality = get_active_quality(rc->avg_frame_qindex[KEY_FRAME], 665 active_best_quality =
661 rc->kf_boost, 666 get_kf_active_quality(rc, rc->avg_frame_qindex[KEY_FRAME]);
662 kf_low, kf_high,
663 kf_low_motion_minq,
664 kf_high_motion_minq);
665 667
666 // Allow somewhat lower kf minq with small image formats. 668 // Allow somewhat lower kf minq with small image formats.
667 if ((cm->width * cm->height) <= (352 * 288)) { 669 if ((cm->width * cm->height) <= (352 * 288)) {
668 q_adj_factor -= 0.25; 670 q_adj_factor -= 0.25;
669 } 671 }
670 672
671 // Convert the adjustment factor to a qindex delta 673 // Convert the adjustment factor to a qindex delta
672 // on active_best_quality. 674 // on active_best_quality.
673 q_val = vp9_convert_qindex_to_q(active_best_quality); 675 q_val = vp9_convert_qindex_to_q(active_best_quality);
674 active_best_quality += vp9_compute_qdelta(rc, q_val, 676 active_best_quality += vp9_compute_qdelta(rc, q_val,
675 q_val * q_adj_factor); 677 q_val * q_adj_factor);
676 } 678 }
677 } else if (!rc->is_src_frame_alt_ref && 679 } else if (!rc->is_src_frame_alt_ref &&
678 (cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame)) { 680 (cpi->refresh_golden_frame || cpi->refresh_alt_ref_frame)) {
679 // Use the lower of active_worst_quality and recent 681 // Use the lower of active_worst_quality and recent
680 // average Q as basis for GF/ARF best Q limit unless last frame was 682 // average Q as basis for GF/ARF best Q limit unless last frame was
681 // a key frame. 683 // a key frame.
682 if (rc->frames_since_key > 1 && 684 if (rc->frames_since_key > 1 &&
683 rc->avg_frame_qindex[INTER_FRAME] < active_worst_quality) { 685 rc->avg_frame_qindex[INTER_FRAME] < active_worst_quality) {
684 q = rc->avg_frame_qindex[INTER_FRAME]; 686 q = rc->avg_frame_qindex[INTER_FRAME];
685 } else { 687 } else {
686 q = rc->avg_frame_qindex[KEY_FRAME]; 688 q = rc->avg_frame_qindex[KEY_FRAME];
687 } 689 }
688 // For constrained quality dont allow Q less than the cq level 690 // For constrained quality dont allow Q less than the cq level
689 if (oxcf->rc_mode == VPX_CQ) { 691 if (oxcf->rc_mode == VPX_CQ) {
690 if (q < cq_level) 692 if (q < cq_level)
691 q = cq_level; 693 q = cq_level;
692 694
693 active_best_quality = get_active_quality(q, rc->gfu_boost, 695 active_best_quality = get_gf_active_quality(rc, q);
694 gf_low, gf_high,
695 arfgf_low_motion_minq,
696 arfgf_high_motion_minq);
697 696
698 // Constrained quality use slightly lower active best. 697 // Constrained quality use slightly lower active best.
699 active_best_quality = active_best_quality * 15 / 16; 698 active_best_quality = active_best_quality * 15 / 16;
700 699
701 } else if (oxcf->rc_mode == VPX_Q) { 700 } else if (oxcf->rc_mode == VPX_Q) {
702 if (!cpi->refresh_alt_ref_frame) { 701 if (!cpi->refresh_alt_ref_frame) {
703 active_best_quality = cq_level; 702 active_best_quality = cq_level;
704 } else { 703 } else {
705 active_best_quality = get_active_quality( 704 active_best_quality = get_gf_active_quality(rc, q);
706 q, rc->gfu_boost, gf_low, gf_high,
707 arfgf_low_motion_minq, arfgf_high_motion_minq);
708 } 705 }
709 } else { 706 } else {
710 active_best_quality = get_active_quality( 707 active_best_quality = get_gf_active_quality(rc, q);
711 q, rc->gfu_boost, gf_low, gf_high,
712 arfgf_low_motion_minq, arfgf_high_motion_minq);
713 } 708 }
714 } else { 709 } else {
715 if (oxcf->rc_mode == VPX_Q) { 710 if (oxcf->rc_mode == VPX_Q) {
716 active_best_quality = cq_level; 711 active_best_quality = cq_level;
717 } else { 712 } else {
718 // Use the lower of active_worst_quality and recent/average Q. 713 // Use the lower of active_worst_quality and recent/average Q.
719 if (cm->current_video_frame > 1) 714 if (cm->current_video_frame > 1)
720 active_best_quality = inter_minq[rc->avg_frame_qindex[INTER_FRAME]]; 715 active_best_quality = inter_minq[rc->avg_frame_qindex[INTER_FRAME]];
721 else 716 else
722 active_best_quality = inter_minq[rc->avg_frame_qindex[KEY_FRAME]]; 717 active_best_quality = inter_minq[rc->avg_frame_qindex[KEY_FRAME]];
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 int qindex = rc->last_boosted_qindex; 798 int qindex = rc->last_boosted_qindex;
804 double last_boosted_q = vp9_convert_qindex_to_q(qindex); 799 double last_boosted_q = vp9_convert_qindex_to_q(qindex);
805 int delta_qindex = vp9_compute_qdelta(rc, last_boosted_q, 800 int delta_qindex = vp9_compute_qdelta(rc, last_boosted_q,
806 last_boosted_q * 0.75); 801 last_boosted_q * 0.75);
807 active_best_quality = MAX(qindex + delta_qindex, rc->best_quality); 802 active_best_quality = MAX(qindex + delta_qindex, rc->best_quality);
808 } else { 803 } else {
809 // Not forced keyframe. 804 // Not forced keyframe.
810 double q_adj_factor = 1.0; 805 double q_adj_factor = 1.0;
811 double q_val; 806 double q_val;
812 // Baseline value derived from cpi->active_worst_quality and kf boost. 807 // Baseline value derived from cpi->active_worst_quality and kf boost.
813 active_best_quality = get_active_quality(active_worst_quality, 808 active_best_quality = get_kf_active_quality(rc, active_worst_quality);
814 rc->kf_boost,
815 kf_low, kf_high,
816 kf_low_motion_minq,
817 kf_high_motion_minq);
818 809
819 // Allow somewhat lower kf minq with small image formats. 810 // Allow somewhat lower kf minq with small image formats.
820 if ((cm->width * cm->height) <= (352 * 288)) { 811 if ((cm->width * cm->height) <= (352 * 288)) {
821 q_adj_factor -= 0.25; 812 q_adj_factor -= 0.25;
822 } 813 }
823 814
824 // Make a further adjustment based on the kf zero motion measure. 815 // Make a further adjustment based on the kf zero motion measure.
825 q_adj_factor += 0.05 - (0.001 * (double)cpi->twopass.kf_zeromotion_pct); 816 q_adj_factor += 0.05 - (0.001 * (double)cpi->twopass.kf_zeromotion_pct);
826 817
827 // Convert the adjustment factor to a qindex delta 818 // Convert the adjustment factor to a qindex delta
(...skipping 11 matching lines...) Expand all
839 rc->avg_frame_qindex[INTER_FRAME] < active_worst_quality) { 830 rc->avg_frame_qindex[INTER_FRAME] < active_worst_quality) {
840 q = rc->avg_frame_qindex[INTER_FRAME]; 831 q = rc->avg_frame_qindex[INTER_FRAME];
841 } else { 832 } else {
842 q = active_worst_quality; 833 q = active_worst_quality;
843 } 834 }
844 // For constrained quality dont allow Q less than the cq level 835 // For constrained quality dont allow Q less than the cq level
845 if (oxcf->rc_mode == VPX_CQ) { 836 if (oxcf->rc_mode == VPX_CQ) {
846 if (q < cq_level) 837 if (q < cq_level)
847 q = cq_level; 838 q = cq_level;
848 839
849 active_best_quality = get_active_quality(q, rc->gfu_boost, 840 active_best_quality = get_gf_active_quality(rc, q);
850 gf_low, gf_high,
851 arfgf_low_motion_minq,
852 arfgf_high_motion_minq);
853 841
854 // Constrained quality use slightly lower active best. 842 // Constrained quality use slightly lower active best.
855 active_best_quality = active_best_quality * 15 / 16; 843 active_best_quality = active_best_quality * 15 / 16;
856 844
857 } else if (oxcf->rc_mode == VPX_Q) { 845 } else if (oxcf->rc_mode == VPX_Q) {
858 if (!cpi->refresh_alt_ref_frame) { 846 if (!cpi->refresh_alt_ref_frame) {
859 active_best_quality = cq_level; 847 active_best_quality = cq_level;
860 } else { 848 } else {
861 active_best_quality = get_active_quality( 849 active_best_quality = get_gf_active_quality(rc, q);
862 q, rc->gfu_boost, gf_low, gf_high,
863 arfgf_low_motion_minq, arfgf_high_motion_minq);
864 } 850 }
865 } else { 851 } else {
866 active_best_quality = get_active_quality( 852 active_best_quality = get_gf_active_quality(rc, q);
867 q, rc->gfu_boost, gf_low, gf_high,
868 arfgf_low_motion_minq, arfgf_high_motion_minq);
869 } 853 }
870 } else { 854 } else {
871 if (oxcf->rc_mode == VPX_Q) { 855 if (oxcf->rc_mode == VPX_Q) {
872 active_best_quality = cq_level; 856 active_best_quality = cq_level;
873 } else { 857 } else {
874 active_best_quality = inter_minq[active_worst_quality]; 858 active_best_quality = inter_minq[active_worst_quality];
875 859
876 // For the constrained quality mode we don't want 860 // For the constrained quality mode we don't want
877 // q to fall below the cq level. 861 // q to fall below the cq level.
878 if ((oxcf->rc_mode == VPX_CQ) && 862 if ((oxcf->rc_mode == VPX_CQ) &&
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 rc->long_rolling_actual_bits = ROUND_POWER_OF_TWO( 1074 rc->long_rolling_actual_bits = ROUND_POWER_OF_TWO(
1091 rc->long_rolling_actual_bits * 31 + rc->projected_frame_size, 5); 1075 rc->long_rolling_actual_bits * 31 + rc->projected_frame_size, 5);
1092 } 1076 }
1093 1077
1094 // Actual bits spent 1078 // Actual bits spent
1095 rc->total_actual_bits += rc->projected_frame_size; 1079 rc->total_actual_bits += rc->projected_frame_size;
1096 rc->total_target_bits += cm->show_frame ? rc->avg_frame_bandwidth : 0; 1080 rc->total_target_bits += cm->show_frame ? rc->avg_frame_bandwidth : 0;
1097 1081
1098 rc->total_target_vs_actual = rc->total_actual_bits - rc->total_target_bits; 1082 rc->total_target_vs_actual = rc->total_actual_bits - rc->total_target_bits;
1099 1083
1100 if (is_altref_enabled(oxcf) && cpi->refresh_alt_ref_frame && 1084 if (is_altref_enabled(cpi) && cpi->refresh_alt_ref_frame &&
1101 (cm->frame_type != KEY_FRAME)) 1085 (cm->frame_type != KEY_FRAME))
1102 // Update the alternate reference frame stats as appropriate. 1086 // Update the alternate reference frame stats as appropriate.
1103 update_alt_ref_frame_stats(cpi); 1087 update_alt_ref_frame_stats(cpi);
1104 else 1088 else
1105 // Update the Golden frame stats as appropriate. 1089 // Update the Golden frame stats as appropriate.
1106 update_golden_frame_stats(cpi); 1090 update_golden_frame_stats(cpi);
1107 1091
1108 if (cm->frame_type == KEY_FRAME) 1092 if (cm->frame_type == KEY_FRAME)
1109 rc->frames_since_key = 0; 1093 rc->frames_since_key = 0;
1110 if (cm->show_frame) { 1094 if (cm->show_frame) {
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1342 // Convert the q target to an index 1326 // Convert the q target to an index
1343 for (i = rc->best_quality; i < rc->worst_quality; ++i) { 1327 for (i = rc->best_quality; i < rc->worst_quality; ++i) {
1344 target_index = i; 1328 target_index = i;
1345 if (vp9_rc_bits_per_mb(frame_type, i, 1.0) <= target_bits_per_mb ) 1329 if (vp9_rc_bits_per_mb(frame_type, i, 1.0) <= target_bits_per_mb )
1346 break; 1330 break;
1347 } 1331 }
1348 1332
1349 return target_index - qindex; 1333 return target_index - qindex;
1350 } 1334 }
1351 1335
1352 void vp9_rc_set_gf_max_interval(const VP9EncoderConfig *const oxcf, 1336 void vp9_rc_set_gf_max_interval(const VP9_COMP *const cpi,
1353 RATE_CONTROL *const rc) { 1337 RATE_CONTROL *const rc) {
1338 const VP9EncoderConfig *const oxcf = &cpi->oxcf;
1354 // Set Maximum gf/arf interval 1339 // Set Maximum gf/arf interval
1355 rc->max_gf_interval = 16; 1340 rc->max_gf_interval = 16;
1356 1341
1357 // Extended interval for genuinely static scenes 1342 // Extended interval for genuinely static scenes
1358 rc->static_scene_max_gf_interval = oxcf->key_freq >> 1; 1343 rc->static_scene_max_gf_interval = oxcf->key_freq >> 1;
1359 if (rc->static_scene_max_gf_interval > (MAX_LAG_BUFFERS * 2)) 1344 if (rc->static_scene_max_gf_interval > (MAX_LAG_BUFFERS * 2))
1360 rc->static_scene_max_gf_interval = MAX_LAG_BUFFERS * 2; 1345 rc->static_scene_max_gf_interval = MAX_LAG_BUFFERS * 2;
1361 1346
1362 if (is_altref_enabled(oxcf)) { 1347 if (is_altref_enabled(cpi)) {
1363 if (rc->static_scene_max_gf_interval > oxcf->lag_in_frames - 1) 1348 if (rc->static_scene_max_gf_interval > oxcf->lag_in_frames - 1)
1364 rc->static_scene_max_gf_interval = oxcf->lag_in_frames - 1; 1349 rc->static_scene_max_gf_interval = oxcf->lag_in_frames - 1;
1365 } 1350 }
1366 1351
1367 if (rc->max_gf_interval > rc->static_scene_max_gf_interval) 1352 if (rc->max_gf_interval > rc->static_scene_max_gf_interval)
1368 rc->max_gf_interval = rc->static_scene_max_gf_interval; 1353 rc->max_gf_interval = rc->static_scene_max_gf_interval;
1369 } 1354 }
1370 1355
1371 void vp9_rc_update_framerate(VP9_COMP *cpi) { 1356 void vp9_rc_update_framerate(VP9_COMP *cpi) {
1372 const VP9_COMMON *const cm = &cpi->common; 1357 const VP9_COMMON *const cm = &cpi->common;
(...skipping 12 matching lines...) Expand all
1385 // can support decode of 1080P content up to a bitrate of MAX_MB_RATE bits 1370 // can support decode of 1080P content up to a bitrate of MAX_MB_RATE bits
1386 // per 16x16 MB (averaged over a frame). However this limit is extended if 1371 // per 16x16 MB (averaged over a frame). However this limit is extended if
1387 // a very high rate is given on the command line or the the rate cannnot 1372 // a very high rate is given on the command line or the the rate cannnot
1388 // be acheived because of a user specificed max q (e.g. when the user 1373 // be acheived because of a user specificed max q (e.g. when the user
1389 // specifies lossless encode. 1374 // specifies lossless encode.
1390 vbr_max_bits = (int)(((int64_t)rc->avg_frame_bandwidth * 1375 vbr_max_bits = (int)(((int64_t)rc->avg_frame_bandwidth *
1391 oxcf->two_pass_vbrmax_section) / 100); 1376 oxcf->two_pass_vbrmax_section) / 100);
1392 rc->max_frame_bandwidth = MAX(MAX((cm->MBs * MAX_MB_RATE), MAXRATE_1080P), 1377 rc->max_frame_bandwidth = MAX(MAX((cm->MBs * MAX_MB_RATE), MAXRATE_1080P),
1393 vbr_max_bits); 1378 vbr_max_bits);
1394 1379
1395 vp9_rc_set_gf_max_interval(oxcf, rc); 1380 vp9_rc_set_gf_max_interval(cpi, rc);
1396 } 1381 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/encoder/vp9_ratectrl.h ('k') | source/libvpx/vp9/encoder/vp9_rd.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698