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

Side by Side Diff: source/libvpx/examples/vpx_temporal_svc_encoder.c

Issue 1015483002: libvpx: Pull from upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « README.chromium ('k') | source/libvpx/test/datarate_test.cc » ('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) 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
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
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
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 }
OLDNEW
« no previous file with comments | « README.chromium ('k') | source/libvpx/test/datarate_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698