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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 | 670 |
671 if (strncmp(encoder->name, "vp8", 3) == 0) { | 671 if (strncmp(encoder->name, "vp8", 3) == 0) { |
672 vpx_codec_control(&codec, VP8E_SET_CPUUSED, -speed); | 672 vpx_codec_control(&codec, VP8E_SET_CPUUSED, -speed); |
673 vpx_codec_control(&codec, VP8E_SET_NOISE_SENSITIVITY, kDenoiserOnYOnly); | 673 vpx_codec_control(&codec, VP8E_SET_NOISE_SENSITIVITY, kDenoiserOnYOnly); |
674 vpx_codec_control(&codec, VP8E_SET_STATIC_THRESHOLD, 1); | 674 vpx_codec_control(&codec, VP8E_SET_STATIC_THRESHOLD, 1); |
675 } else if (strncmp(encoder->name, "vp9", 3) == 0) { | 675 } else if (strncmp(encoder->name, "vp9", 3) == 0) { |
676 vpx_codec_control(&codec, VP8E_SET_CPUUSED, speed); | 676 vpx_codec_control(&codec, VP8E_SET_CPUUSED, speed); |
677 vpx_codec_control(&codec, VP9E_SET_AQ_MODE, 3); | 677 vpx_codec_control(&codec, VP9E_SET_AQ_MODE, 3); |
678 vpx_codec_control(&codec, VP9E_SET_FRAME_PERIODIC_BOOST, 0); | 678 vpx_codec_control(&codec, VP9E_SET_FRAME_PERIODIC_BOOST, 0); |
679 vpx_codec_control(&codec, VP9E_SET_NOISE_SENSITIVITY, 0); | 679 vpx_codec_control(&codec, VP9E_SET_NOISE_SENSITIVITY, 0); |
680 vpx_codec_control(&codec, VP8E_SET_STATIC_THRESHOLD, 0); | 680 vpx_codec_control(&codec, VP8E_SET_STATIC_THRESHOLD, 1); |
681 vpx_codec_control(&codec, VP9E_SET_TILE_COLUMNS, (cfg.g_threads >> 1)); | 681 vpx_codec_control(&codec, VP9E_SET_TILE_COLUMNS, (cfg.g_threads >> 1)); |
682 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)) { |
683 die_codec(&codec, "Failed to set SVC"); | 683 die_codec(&codec, "Failed to set SVC"); |
684 } | 684 } |
685 } | 685 } |
686 if (strncmp(encoder->name, "vp8", 3) == 0) { | 686 if (strncmp(encoder->name, "vp8", 3) == 0) { |
687 vpx_codec_control(&codec, VP8E_SET_SCREEN_CONTENT_MODE, 0); | 687 vpx_codec_control(&codec, VP8E_SET_SCREEN_CONTENT_MODE, 0); |
688 } | 688 } |
689 vpx_codec_control(&codec, VP8E_SET_TOKEN_PARTITIONS, 1); | 689 vpx_codec_control(&codec, VP8E_SET_TOKEN_PARTITIONS, 1); |
690 // This controls the maximum target size of the key frame. | 690 // This controls the maximum target size of the key frame. |
(...skipping 14 matching lines...) Expand all Loading... |
705 layer_id.spatial_layer_id = 0; | 705 layer_id.spatial_layer_id = 0; |
706 layer_id.temporal_layer_id = | 706 layer_id.temporal_layer_id = |
707 cfg.ts_layer_id[frame_cnt % cfg.ts_periodicity]; | 707 cfg.ts_layer_id[frame_cnt % cfg.ts_periodicity]; |
708 if (strncmp(encoder->name, "vp9", 3) == 0) { | 708 if (strncmp(encoder->name, "vp9", 3) == 0) { |
709 vpx_codec_control(&codec, VP9E_SET_SVC_LAYER_ID, &layer_id); | 709 vpx_codec_control(&codec, VP9E_SET_SVC_LAYER_ID, &layer_id); |
710 } else if (strncmp(encoder->name, "vp8", 3) == 0) { | 710 } else if (strncmp(encoder->name, "vp8", 3) == 0) { |
711 vpx_codec_control(&codec, VP8E_SET_TEMPORAL_LAYER_ID, | 711 vpx_codec_control(&codec, VP8E_SET_TEMPORAL_LAYER_ID, |
712 layer_id.temporal_layer_id); | 712 layer_id.temporal_layer_id); |
713 } | 713 } |
714 flags = layer_flags[frame_cnt % flag_periodicity]; | 714 flags = layer_flags[frame_cnt % flag_periodicity]; |
| 715 if (layering_mode == 0) |
| 716 flags = 0; |
715 frame_avail = vpx_img_read(&raw, infile); | 717 frame_avail = vpx_img_read(&raw, infile); |
716 if (frame_avail) | 718 if (frame_avail) |
717 ++rc.layer_input_frames[layer_id.temporal_layer_id]; | 719 ++rc.layer_input_frames[layer_id.temporal_layer_id]; |
718 vpx_usec_timer_start(&timer); | 720 vpx_usec_timer_start(&timer); |
719 if (vpx_codec_encode(&codec, frame_avail? &raw : NULL, pts, 1, flags, | 721 if (vpx_codec_encode(&codec, frame_avail? &raw : NULL, pts, 1, flags, |
720 VPX_DL_REALTIME)) { | 722 VPX_DL_REALTIME)) { |
721 die_codec(&codec, "Failed to encode frame"); | 723 die_codec(&codec, "Failed to encode frame"); |
722 } | 724 } |
723 vpx_usec_timer_mark(&timer); | 725 vpx_usec_timer_mark(&timer); |
724 cx_time += vpx_usec_timer_elapsed(&timer); | 726 cx_time += vpx_usec_timer_elapsed(&timer); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 if (vpx_codec_destroy(&codec)) | 795 if (vpx_codec_destroy(&codec)) |
794 die_codec(&codec, "Failed to destroy codec"); | 796 die_codec(&codec, "Failed to destroy codec"); |
795 | 797 |
796 // Try to rewrite the output file headers with the actual frame count. | 798 // Try to rewrite the output file headers with the actual frame count. |
797 for (i = 0; i < cfg.ts_number_layers; ++i) | 799 for (i = 0; i < cfg.ts_number_layers; ++i) |
798 vpx_video_writer_close(outfile[i]); | 800 vpx_video_writer_close(outfile[i]); |
799 | 801 |
800 vpx_img_free(&raw); | 802 vpx_img_free(&raw); |
801 return EXIT_SUCCESS; | 803 return EXIT_SUCCESS; |
802 } | 804 } |
OLD | NEW |