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

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

Issue 478033002: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 4 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/examples/vp8cx_set_ref.c ('k') | source/libvpx/libs.mk » ('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 19 matching lines...) Expand all
30 30
31 void usage_exit() { 31 void usage_exit() {
32 exit(EXIT_FAILURE); 32 exit(EXIT_FAILURE);
33 } 33 }
34 34
35 // Denoiser states, for temporal denoising. 35 // Denoiser states, for temporal denoising.
36 enum denoiserState { 36 enum denoiserState {
37 kDenoiserOff, 37 kDenoiserOff,
38 kDenoiserOnYOnly, 38 kDenoiserOnYOnly,
39 kDenoiserOnYUV, 39 kDenoiserOnYUV,
40 kDenoiserOnYUVAggressive // Aggressive mode not implemented currently. 40 kDenoiserOnYUVAggressive,
41 kDenoiserOnAdaptive
41 }; 42 };
42 43
43 static int mode_to_num_layers[12] = {1, 2, 2, 3, 3, 3, 3, 5, 2, 3, 3, 3}; 44 static int mode_to_num_layers[12] = {1, 2, 2, 3, 3, 3, 3, 5, 2, 3, 3, 3};
44 45
45 // For rate control encoding stats. 46 // For rate control encoding stats.
46 struct RateControlMetrics { 47 struct RateControlMetrics {
47 // Number of input frames per layer. 48 // Number of input frames per layer.
48 int layer_input_frames[VPX_TS_MAX_LAYERS]; 49 int layer_input_frames[VPX_TS_MAX_LAYERS];
49 // Total (cumulative) number of encoded frames per layer. 50 // Total (cumulative) number of encoded frames per layer.
50 int layer_tot_enc_frames[VPX_TS_MAX_LAYERS]; 51 int layer_tot_enc_frames[VPX_TS_MAX_LAYERS];
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 } 573 }
573 // No spatial layers in this encoder. 574 // No spatial layers in this encoder.
574 cfg.ss_number_layers = 1; 575 cfg.ss_number_layers = 1;
575 576
576 // Initialize codec. 577 // Initialize codec.
577 if (vpx_codec_enc_init(&codec, encoder->codec_interface(), &cfg, 0)) 578 if (vpx_codec_enc_init(&codec, encoder->codec_interface(), &cfg, 0))
578 die_codec(&codec, "Failed to initialize encoder"); 579 die_codec(&codec, "Failed to initialize encoder");
579 580
580 if (strncmp(encoder->name, "vp8", 3) == 0) { 581 if (strncmp(encoder->name, "vp8", 3) == 0) {
581 vpx_codec_control(&codec, VP8E_SET_CPUUSED, -speed); 582 vpx_codec_control(&codec, VP8E_SET_CPUUSED, -speed);
582 vpx_codec_control(&codec, VP8E_SET_NOISE_SENSITIVITY, kDenoiserOnYOnly); 583 vpx_codec_control(&codec, VP8E_SET_NOISE_SENSITIVITY, kDenoiserOnYOnly);
583 } else if (strncmp(encoder->name, "vp9", 3) == 0) { 584 } else if (strncmp(encoder->name, "vp9", 3) == 0) {
584 vpx_codec_control(&codec, VP8E_SET_CPUUSED, speed); 585 vpx_codec_control(&codec, VP8E_SET_CPUUSED, speed);
585 vpx_codec_control(&codec, VP9E_SET_AQ_MODE, 3); 586 vpx_codec_control(&codec, VP9E_SET_AQ_MODE, 3);
586 vpx_codec_control(&codec, VP9E_SET_FRAME_PERIODIC_BOOST, 0); 587 vpx_codec_control(&codec, VP9E_SET_FRAME_PERIODIC_BOOST, 0);
587 vpx_codec_control(&codec, VP8E_SET_NOISE_SENSITIVITY, 0); 588 vpx_codec_control(&codec, VP8E_SET_NOISE_SENSITIVITY, 0);
588 if (vpx_codec_control(&codec, VP9E_SET_SVC, 1)) { 589 if (vpx_codec_control(&codec, VP9E_SET_SVC, 1)) {
589 die_codec(&codec, "Failed to set SVC"); 590 die_codec(&codec, "Failed to set SVC");
590 } 591 }
591 } 592 }
592 vpx_codec_control(&codec, VP8E_SET_STATIC_THRESHOLD, 1); 593 vpx_codec_control(&codec, VP8E_SET_STATIC_THRESHOLD, 1);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 if (vpx_codec_destroy(&codec)) 668 if (vpx_codec_destroy(&codec))
668 die_codec(&codec, "Failed to destroy codec"); 669 die_codec(&codec, "Failed to destroy codec");
669 670
670 // Try to rewrite the output file headers with the actual frame count. 671 // Try to rewrite the output file headers with the actual frame count.
671 for (i = 0; i < cfg.ts_number_layers; ++i) 672 for (i = 0; i < cfg.ts_number_layers; ++i)
672 vpx_video_writer_close(outfile[i]); 673 vpx_video_writer_close(outfile[i]);
673 674
674 vpx_img_free(&raw); 675 vpx_img_free(&raw);
675 return EXIT_SUCCESS; 676 return EXIT_SUCCESS;
676 } 677 }
OLDNEW
« no previous file with comments | « source/libvpx/examples/vp8cx_set_ref.c ('k') | source/libvpx/libs.mk » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698