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

Side by Side Diff: source/libvpx/vpxenc.c

Issue 23600008: libvpx: Pull from upstream (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 7 years, 3 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/vpx_scale/yv12config.h ('k') | no next file » | 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) 2010 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2010 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 1670 matching lines...) Expand 10 before | Expand all | Expand 10 after
1681 } 1681 }
1682 1682
1683 1683
1684 static void parse_global_config(struct global_config *global, char **argv) { 1684 static void parse_global_config(struct global_config *global, char **argv) {
1685 char **argi, **argj; 1685 char **argi, **argj;
1686 struct arg arg; 1686 struct arg arg;
1687 1687
1688 /* Initialize default parameters */ 1688 /* Initialize default parameters */
1689 memset(global, 0, sizeof(*global)); 1689 memset(global, 0, sizeof(*global));
1690 global->codec = codecs; 1690 global->codec = codecs;
1691 global->passes = 1; 1691 global->passes = 0;
1692 global->use_i420 = 1; 1692 global->use_i420 = 1;
1693 /* Assign default deadline to good quality */
1694 global->deadline = VPX_DL_GOOD_QUALITY;
1693 1695
1694 for (argi = argj = argv; (*argj = *argi); argi += arg.argv_step) { 1696 for (argi = argj = argv; (*argj = *argi); argi += arg.argv_step) {
1695 arg.argv_step = 1; 1697 arg.argv_step = 1;
1696 1698
1697 if (arg_match(&arg, &codecarg, argi)) { 1699 if (arg_match(&arg, &codecarg, argi)) {
1698 int j, k = -1; 1700 int j, k = -1;
1699 1701
1700 for (j = 0; j < sizeof(codecs) / sizeof(codecs[0]); j++) 1702 for (j = 0; j < sizeof(codecs) / sizeof(codecs[0]); j++)
1701 if (!strcmp(codecs[j].name, arg.val)) 1703 if (!strcmp(codecs[j].name, arg.val))
1702 k = j; 1704 k = j;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1754 global->debug = 1; 1756 global->debug = 1;
1755 else if (arg_match(&arg, &q_hist_n, argi)) 1757 else if (arg_match(&arg, &q_hist_n, argi))
1756 global->show_q_hist_buckets = arg_parse_uint(&arg); 1758 global->show_q_hist_buckets = arg_parse_uint(&arg);
1757 else if (arg_match(&arg, &rate_hist_n, argi)) 1759 else if (arg_match(&arg, &rate_hist_n, argi))
1758 global->show_rate_hist_buckets = arg_parse_uint(&arg); 1760 global->show_rate_hist_buckets = arg_parse_uint(&arg);
1759 else 1761 else
1760 argj++; 1762 argj++;
1761 } 1763 }
1762 1764
1763 /* Validate global config */ 1765 /* Validate global config */
1766 if (global->passes == 0) {
1767 // Make default VP9 passes = 2 until there is a better quality 1-pass
1768 // encoder
1769 global->passes = (global->codec->iface == vpx_codec_vp9_cx ? 2 : 1);
1770 }
1764 1771
1765 if (global->pass) { 1772 if (global->pass) {
1766 /* DWIM: Assume the user meant passes=2 if pass=2 is specified */ 1773 /* DWIM: Assume the user meant passes=2 if pass=2 is specified */
1767 if (global->pass > global->passes) { 1774 if (global->pass > global->passes) {
1768 warn("Assuming --pass=%d implies --passes=%d\n", 1775 warn("Assuming --pass=%d implies --passes=%d\n",
1769 global->pass, global->pass); 1776 global->pass, global->pass);
1770 global->passes = global->pass; 1777 global->passes = global->pass;
1771 } 1778 }
1772 } 1779 }
1773 } 1780 }
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
2624 vpx_img_alloc(&raw, 2631 vpx_img_alloc(&raw,
2625 input.use_i420 ? VPX_IMG_FMT_I420 2632 input.use_i420 ? VPX_IMG_FMT_I420
2626 : VPX_IMG_FMT_YV12, 2633 : VPX_IMG_FMT_YV12,
2627 input.w, input.h, 32); 2634 input.w, input.h, 32);
2628 2635
2629 FOREACH_STREAM(init_rate_histogram(&stream->rate_hist, 2636 FOREACH_STREAM(init_rate_histogram(&stream->rate_hist,
2630 &stream->config.cfg, 2637 &stream->config.cfg,
2631 &global.framerate)); 2638 &global.framerate));
2632 } 2639 }
2633 2640
2641 FOREACH_STREAM(setup_pass(stream, &global, pass));
2634 FOREACH_STREAM(open_output_file(stream, &global)); 2642 FOREACH_STREAM(open_output_file(stream, &global));
2635 FOREACH_STREAM(setup_pass(stream, &global, pass));
2636 FOREACH_STREAM(initialize_encoder(stream, &global)); 2643 FOREACH_STREAM(initialize_encoder(stream, &global));
2637 2644
2638 frame_avail = 1; 2645 frame_avail = 1;
2639 got_data = 0; 2646 got_data = 0;
2640 2647
2641 while (frame_avail || got_data) { 2648 while (frame_avail || got_data) {
2642 struct vpx_usec_timer timer; 2649 struct vpx_usec_timer timer;
2643 2650
2644 if (!global.limit || frames_in < global.limit) { 2651 if (!global.limit || frames_in < global.limit) {
2645 frame_avail = read_frame(&input, &raw); 2652 frame_avail = read_frame(&input, &raw);
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
2784 } 2791 }
2785 fclose(f); 2792 fclose(f);
2786 }); 2793 });
2787 #endif 2794 #endif
2788 2795
2789 vpx_img_free(&raw); 2796 vpx_img_free(&raw);
2790 free(argv); 2797 free(argv);
2791 free(streams); 2798 free(streams);
2792 return res ? EXIT_FAILURE : EXIT_SUCCESS; 2799 return res ? EXIT_FAILURE : EXIT_SUCCESS;
2793 } 2800 }
OLDNEW
« no previous file with comments | « source/libvpx/vpx_scale/yv12config.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698