| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 cfg.rc_min_quantizer = 2; | 603 cfg.rc_min_quantizer = 2; |
| 604 cfg.rc_max_quantizer = 56; | 604 cfg.rc_max_quantizer = 56; |
| 605 if (strncmp(encoder->name, "vp9", 3) == 0) | 605 if (strncmp(encoder->name, "vp9", 3) == 0) |
| 606 cfg.rc_max_quantizer = 52; | 606 cfg.rc_max_quantizer = 52; |
| 607 cfg.rc_undershoot_pct = 50; | 607 cfg.rc_undershoot_pct = 50; |
| 608 cfg.rc_overshoot_pct = 50; | 608 cfg.rc_overshoot_pct = 50; |
| 609 cfg.rc_buf_initial_sz = 500; | 609 cfg.rc_buf_initial_sz = 500; |
| 610 cfg.rc_buf_optimal_sz = 600; | 610 cfg.rc_buf_optimal_sz = 600; |
| 611 cfg.rc_buf_sz = 1000; | 611 cfg.rc_buf_sz = 1000; |
| 612 | 612 |
| 613 // Use 1 thread as default. |
| 614 cfg.g_threads = 1; |
| 615 |
| 613 // Enable error resilient mode. | 616 // Enable error resilient mode. |
| 614 cfg.g_error_resilient = 1; | 617 cfg.g_error_resilient = 1; |
| 615 cfg.g_lag_in_frames = 0; | 618 cfg.g_lag_in_frames = 0; |
| 616 cfg.kf_mode = VPX_KF_AUTO; | 619 cfg.kf_mode = VPX_KF_AUTO; |
| 617 | 620 |
| 618 // Disable automatic keyframe placement. | 621 // Disable automatic keyframe placement. |
| 619 cfg.kf_min_dist = cfg.kf_max_dist = 3000; | 622 cfg.kf_min_dist = cfg.kf_max_dist = 3000; |
| 620 | 623 |
| 621 set_temporal_layer_pattern(layering_mode, | 624 set_temporal_layer_pattern(layering_mode, |
| 622 &cfg, | 625 &cfg, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 if (strncmp(encoder->name, "vp8", 3) == 0) { | 671 if (strncmp(encoder->name, "vp8", 3) == 0) { |
| 669 vpx_codec_control(&codec, VP8E_SET_CPUUSED, -speed); | 672 vpx_codec_control(&codec, VP8E_SET_CPUUSED, -speed); |
| 670 vpx_codec_control(&codec, VP8E_SET_NOISE_SENSITIVITY, kDenoiserOnYOnly); | 673 vpx_codec_control(&codec, VP8E_SET_NOISE_SENSITIVITY, kDenoiserOnYOnly); |
| 671 vpx_codec_control(&codec, VP8E_SET_STATIC_THRESHOLD, 1); | 674 vpx_codec_control(&codec, VP8E_SET_STATIC_THRESHOLD, 1); |
| 672 } else if (strncmp(encoder->name, "vp9", 3) == 0) { | 675 } else if (strncmp(encoder->name, "vp9", 3) == 0) { |
| 673 vpx_codec_control(&codec, VP8E_SET_CPUUSED, speed); | 676 vpx_codec_control(&codec, VP8E_SET_CPUUSED, speed); |
| 674 vpx_codec_control(&codec, VP9E_SET_AQ_MODE, 3); | 677 vpx_codec_control(&codec, VP9E_SET_AQ_MODE, 3); |
| 675 vpx_codec_control(&codec, VP9E_SET_FRAME_PERIODIC_BOOST, 0); | 678 vpx_codec_control(&codec, VP9E_SET_FRAME_PERIODIC_BOOST, 0); |
| 676 vpx_codec_control(&codec, VP9E_SET_NOISE_SENSITIVITY, 0); | 679 vpx_codec_control(&codec, VP9E_SET_NOISE_SENSITIVITY, 0); |
| 677 vpx_codec_control(&codec, VP8E_SET_STATIC_THRESHOLD, 0); | 680 vpx_codec_control(&codec, VP8E_SET_STATIC_THRESHOLD, 0); |
| 681 vpx_codec_control(&codec, VP9E_SET_TILE_COLUMNS, (cfg.g_threads >> 1)); |
| 678 if (vpx_codec_control(&codec, VP9E_SET_SVC, layering_mode > 0 ? 1: 0)) { | 682 if (vpx_codec_control(&codec, VP9E_SET_SVC, layering_mode > 0 ? 1: 0)) { |
| 679 die_codec(&codec, "Failed to set SVC"); | 683 die_codec(&codec, "Failed to set SVC"); |
| 680 } | 684 } |
| 681 } | 685 } |
| 682 if (strncmp(encoder->name, "vp8", 3) == 0) { | 686 if (strncmp(encoder->name, "vp8", 3) == 0) { |
| 683 vpx_codec_control(&codec, VP8E_SET_SCREEN_CONTENT_MODE, 0); | 687 vpx_codec_control(&codec, VP8E_SET_SCREEN_CONTENT_MODE, 0); |
| 684 } | 688 } |
| 685 vpx_codec_control(&codec, VP8E_SET_TOKEN_PARTITIONS, 1); | 689 vpx_codec_control(&codec, VP8E_SET_TOKEN_PARTITIONS, 1); |
| 686 // This controls the maximum target size of the key frame. | 690 // This controls the maximum target size of the key frame. |
| 687 // For generating smaller key frames, use a smaller max_intra_size_pct | 691 // For generating smaller key frames, use a smaller max_intra_size_pct |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 if (vpx_codec_destroy(&codec)) | 793 if (vpx_codec_destroy(&codec)) |
| 790 die_codec(&codec, "Failed to destroy codec"); | 794 die_codec(&codec, "Failed to destroy codec"); |
| 791 | 795 |
| 792 // Try to rewrite the output file headers with the actual frame count. | 796 // Try to rewrite the output file headers with the actual frame count. |
| 793 for (i = 0; i < cfg.ts_number_layers; ++i) | 797 for (i = 0; i < cfg.ts_number_layers; ++i) |
| 794 vpx_video_writer_close(outfile[i]); | 798 vpx_video_writer_close(outfile[i]); |
| 795 | 799 |
| 796 vpx_img_free(&raw); | 800 vpx_img_free(&raw); |
| 797 return EXIT_SUCCESS; | 801 return EXIT_SUCCESS; |
| 798 } | 802 } |
| OLD | NEW |