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

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

Issue 1029663003: 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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 int speed; 474 int speed;
475 int frame_avail; 475 int frame_avail;
476 int got_data; 476 int got_data;
477 int flags = 0; 477 int flags = 0;
478 unsigned int i; 478 unsigned int i;
479 int pts = 0; // PTS starts at 0. 479 int pts = 0; // PTS starts at 0.
480 int frame_duration = 1; // 1 timebase tick per frame. 480 int frame_duration = 1; // 1 timebase tick per frame.
481 int layering_mode = 0; 481 int layering_mode = 0;
482 int layer_flags[VPX_TS_MAX_PERIODICITY] = {0}; 482 int layer_flags[VPX_TS_MAX_PERIODICITY] = {0};
483 int flag_periodicity = 1; 483 int flag_periodicity = 1;
484 #if VPX_ENCODER_ABI_VERSION > (4 + VPX_CODEC_ABI_VERSION)
484 vpx_svc_layer_id_t layer_id = {0, 0}; 485 vpx_svc_layer_id_t layer_id = {0, 0};
486 #else
487 vpx_svc_layer_id_t layer_id = {0};
488 #endif
485 const VpxInterface *encoder = NULL; 489 const VpxInterface *encoder = NULL;
486 FILE *infile = NULL; 490 FILE *infile = NULL;
487 struct RateControlMetrics rc; 491 struct RateControlMetrics rc;
488 int64_t cx_time = 0; 492 int64_t cx_time = 0;
489 const int min_args_base = 11; 493 const int min_args_base = 11;
490 #if CONFIG_VP9_HIGHBITDEPTH 494 #if CONFIG_VP9_HIGHBITDEPTH
491 vpx_bit_depth_t bit_depth = VPX_BITS_8; 495 vpx_bit_depth_t bit_depth = VPX_BITS_8;
492 int input_bit_depth = 8; 496 int input_bit_depth = 8;
493 const int min_args = min_args_base + 1; 497 const int min_args = min_args_base + 1;
494 #else 498 #else
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 const int max_intra_size_pct = 900; 698 const int max_intra_size_pct = 900;
695 vpx_codec_control(&codec, VP8E_SET_MAX_INTRA_BITRATE_PCT, 699 vpx_codec_control(&codec, VP8E_SET_MAX_INTRA_BITRATE_PCT,
696 max_intra_size_pct); 700 max_intra_size_pct);
697 } 701 }
698 702
699 frame_avail = 1; 703 frame_avail = 1;
700 while (frame_avail || got_data) { 704 while (frame_avail || got_data) {
701 struct vpx_usec_timer timer; 705 struct vpx_usec_timer timer;
702 vpx_codec_iter_t iter = NULL; 706 vpx_codec_iter_t iter = NULL;
703 const vpx_codec_cx_pkt_t *pkt; 707 const vpx_codec_cx_pkt_t *pkt;
708 #if VPX_ENCODER_ABI_VERSION > (4 + VPX_CODEC_ABI_VERSION)
704 // Update the temporal layer_id. No spatial layers in this test. 709 // Update the temporal layer_id. No spatial layers in this test.
705 layer_id.spatial_layer_id = 0; 710 layer_id.spatial_layer_id = 0;
711 #endif
706 layer_id.temporal_layer_id = 712 layer_id.temporal_layer_id =
707 cfg.ts_layer_id[frame_cnt % cfg.ts_periodicity]; 713 cfg.ts_layer_id[frame_cnt % cfg.ts_periodicity];
708 if (strncmp(encoder->name, "vp9", 3) == 0) { 714 if (strncmp(encoder->name, "vp9", 3) == 0) {
709 vpx_codec_control(&codec, VP9E_SET_SVC_LAYER_ID, &layer_id); 715 vpx_codec_control(&codec, VP9E_SET_SVC_LAYER_ID, &layer_id);
710 } else if (strncmp(encoder->name, "vp8", 3) == 0) { 716 } else if (strncmp(encoder->name, "vp8", 3) == 0) {
711 vpx_codec_control(&codec, VP8E_SET_TEMPORAL_LAYER_ID, 717 vpx_codec_control(&codec, VP8E_SET_TEMPORAL_LAYER_ID,
712 layer_id.temporal_layer_id); 718 layer_id.temporal_layer_id);
713 } 719 }
714 flags = layer_flags[frame_cnt % flag_periodicity]; 720 flags = layer_flags[frame_cnt % flag_periodicity];
715 if (layering_mode == 0) 721 if (layering_mode == 0)
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 if (vpx_codec_destroy(&codec)) 801 if (vpx_codec_destroy(&codec))
796 die_codec(&codec, "Failed to destroy codec"); 802 die_codec(&codec, "Failed to destroy codec");
797 803
798 // Try to rewrite the output file headers with the actual frame count. 804 // Try to rewrite the output file headers with the actual frame count.
799 for (i = 0; i < cfg.ts_number_layers; ++i) 805 for (i = 0; i < cfg.ts_number_layers; ++i)
800 vpx_video_writer_close(outfile[i]); 806 vpx_video_writer_close(outfile[i]);
801 807
802 vpx_img_free(&raw); 808 vpx_img_free(&raw);
803 return EXIT_SUCCESS; 809 return EXIT_SUCCESS;
804 } 810 }
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