| OLD | NEW |
| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 static void warn_or_exit_on_error(vpx_codec_ctx_t *ctx, int fatal, | 93 static void warn_or_exit_on_error(vpx_codec_ctx_t *ctx, int fatal, |
| 94 const char *s, ...) { | 94 const char *s, ...) { |
| 95 va_list ap; | 95 va_list ap; |
| 96 | 96 |
| 97 va_start(ap, s); | 97 va_start(ap, s); |
| 98 warn_or_exit_on_errorv(ctx, fatal, s, ap); | 98 warn_or_exit_on_errorv(ctx, fatal, s, ap); |
| 99 va_end(ap); | 99 va_end(ap); |
| 100 } | 100 } |
| 101 | 101 |
| 102 int read_frame(struct VpxInputContext *input_ctx, vpx_image_t *img) { | 102 static int read_frame(struct VpxInputContext *input_ctx, vpx_image_t *img) { |
| 103 FILE *f = input_ctx->file; | 103 FILE *f = input_ctx->file; |
| 104 y4m_input *y4m = &input_ctx->y4m; | 104 y4m_input *y4m = &input_ctx->y4m; |
| 105 int shortread = 0; | 105 int shortread = 0; |
| 106 | 106 |
| 107 if (input_ctx->file_type == FILE_TYPE_Y4M) { | 107 if (input_ctx->file_type == FILE_TYPE_Y4M) { |
| 108 if (y4m_input_fetch_frame(y4m, f, img) < 1) | 108 if (y4m_input_fetch_frame(y4m, f, img) < 1) |
| 109 return 0; | 109 return 0; |
| 110 } else { | 110 } else { |
| 111 shortread = read_yuv_frame(input_ctx, img); | 111 shortread = read_yuv_frame(input_ctx, img); |
| 112 } | 112 } |
| 113 | 113 |
| 114 return !shortread; | 114 return !shortread; |
| 115 } | 115 } |
| 116 | 116 |
| 117 int file_is_y4m(const char detect[4]) { | 117 static int file_is_y4m(const char detect[4]) { |
| 118 if (memcmp(detect, "YUV4", 4) == 0) { | 118 if (memcmp(detect, "YUV4", 4) == 0) { |
| 119 return 1; | 119 return 1; |
| 120 } | 120 } |
| 121 return 0; | 121 return 0; |
| 122 } | 122 } |
| 123 | 123 |
| 124 int fourcc_is_ivf(const char detect[4]) { | 124 static int fourcc_is_ivf(const char detect[4]) { |
| 125 if (memcmp(detect, "DKIF", 4) == 0) { | 125 if (memcmp(detect, "DKIF", 4) == 0) { |
| 126 return 1; | 126 return 1; |
| 127 } | 127 } |
| 128 return 0; | 128 return 0; |
| 129 } | 129 } |
| 130 | 130 |
| 131 static const arg_def_t debugmode = ARG_DEF( | 131 static const arg_def_t debugmode = ARG_DEF( |
| 132 "D", "debug", 0, "Debug mode (makes output deterministic)"); | 132 "D", "debug", 0, "Debug mode (makes output deterministic)"); |
| 133 static const arg_def_t outputfile = ARG_DEF( | 133 static const arg_def_t outputfile = ARG_DEF( |
| 134 "o", "output", 1, "Output filename"); | 134 "o", "output", 1, "Output filename"); |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 VP9E_SET_MAX_INTER_BITRATE_PCT, VP9E_SET_GF_CBR_BOOST_PCT, | 460 VP9E_SET_MAX_INTER_BITRATE_PCT, VP9E_SET_GF_CBR_BOOST_PCT, |
| 461 VP9E_SET_LOSSLESS, VP9E_SET_FRAME_PARALLEL_DECODING, VP9E_SET_AQ_MODE, | 461 VP9E_SET_LOSSLESS, VP9E_SET_FRAME_PARALLEL_DECODING, VP9E_SET_AQ_MODE, |
| 462 VP9E_SET_FRAME_PERIODIC_BOOST, VP9E_SET_NOISE_SENSITIVITY, | 462 VP9E_SET_FRAME_PERIODIC_BOOST, VP9E_SET_NOISE_SENSITIVITY, |
| 463 VP9E_SET_TUNE_CONTENT, VP9E_SET_COLOR_SPACE, | 463 VP9E_SET_TUNE_CONTENT, VP9E_SET_COLOR_SPACE, |
| 464 0 | 464 0 |
| 465 }; | 465 }; |
| 466 #endif | 466 #endif |
| 467 | 467 |
| 468 static const arg_def_t *no_args[] = { NULL }; | 468 static const arg_def_t *no_args[] = { NULL }; |
| 469 | 469 |
| 470 void usage_exit() { | 470 void usage_exit(void) { |
| 471 int i; | 471 int i; |
| 472 | 472 |
| 473 fprintf(stderr, "Usage: %s <options> -o dst_filename src_filename \n", | 473 fprintf(stderr, "Usage: %s <options> -o dst_filename src_filename \n", |
| 474 exec_name); | 474 exec_name); |
| 475 | 475 |
| 476 fprintf(stderr, "\nOptions:\n"); | 476 fprintf(stderr, "\nOptions:\n"); |
| 477 arg_show_usage(stderr, main_args); | 477 arg_show_usage(stderr, main_args); |
| 478 fprintf(stderr, "\nEncoder Global Options:\n"); | 478 fprintf(stderr, "\nEncoder Global Options:\n"); |
| 479 arg_show_usage(stderr, global_args); | 479 arg_show_usage(stderr, global_args); |
| 480 fprintf(stderr, "\nRate Control Options:\n"); | 480 fprintf(stderr, "\nRate Control Options:\n"); |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 stats_io_t stats; | 786 stats_io_t stats; |
| 787 #if CONFIG_FP_MB_STATS | 787 #if CONFIG_FP_MB_STATS |
| 788 stats_io_t fpmb_stats; | 788 stats_io_t fpmb_stats; |
| 789 #endif | 789 #endif |
| 790 struct vpx_image *img; | 790 struct vpx_image *img; |
| 791 vpx_codec_ctx_t decoder; | 791 vpx_codec_ctx_t decoder; |
| 792 int mismatch_seen; | 792 int mismatch_seen; |
| 793 }; | 793 }; |
| 794 | 794 |
| 795 | 795 |
| 796 void validate_positive_rational(const char *msg, | 796 static void validate_positive_rational(const char *msg, |
| 797 struct vpx_rational *rat) { | 797 struct vpx_rational *rat) { |
| 798 if (rat->den < 0) { | 798 if (rat->den < 0) { |
| 799 rat->num *= -1; | 799 rat->num *= -1; |
| 800 rat->den *= -1; | 800 rat->den *= -1; |
| 801 } | 801 } |
| 802 | 802 |
| 803 if (rat->num < 0) | 803 if (rat->num < 0) |
| 804 die("Error: %s must be positive\n", msg); | 804 die("Error: %s must be positive\n", msg); |
| 805 | 805 |
| 806 if (!rat->den) | 806 if (!rat->den) |
| 807 die("Error: %s has zero denominator\n", msg); | 807 die("Error: %s has zero denominator\n", msg); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 } | 912 } |
| 913 | 913 |
| 914 if (global->deadline == VPX_DL_REALTIME && | 914 if (global->deadline == VPX_DL_REALTIME && |
| 915 global->passes > 1) { | 915 global->passes > 1) { |
| 916 warn("Enforcing one-pass encoding in realtime mode\n"); | 916 warn("Enforcing one-pass encoding in realtime mode\n"); |
| 917 global->passes = 1; | 917 global->passes = 1; |
| 918 } | 918 } |
| 919 } | 919 } |
| 920 | 920 |
| 921 | 921 |
| 922 void open_input_file(struct VpxInputContext *input) { | 922 static void open_input_file(struct VpxInputContext *input) { |
| 923 /* Parse certain options from the input file, if possible */ | 923 /* Parse certain options from the input file, if possible */ |
| 924 input->file = strcmp(input->filename, "-") | 924 input->file = strcmp(input->filename, "-") |
| 925 ? fopen(input->filename, "rb") : set_binary_mode(stdin); | 925 ? fopen(input->filename, "rb") : set_binary_mode(stdin); |
| 926 | 926 |
| 927 if (!input->file) | 927 if (!input->file) |
| 928 fatal("Failed to open input file"); | 928 fatal("Failed to open input file"); |
| 929 | 929 |
| 930 if (!fseeko(input->file, 0, SEEK_END)) { | 930 if (!fseeko(input->file, 0, SEEK_END)) { |
| 931 /* Input file is seekable. Figure out how long it is, so we can get | 931 /* Input file is seekable. Figure out how long it is, so we can get |
| 932 * progress info. | 932 * progress info. |
| (...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2257 | 2257 |
| 2258 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH | 2258 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH |
| 2259 if (allocated_raw_shift) | 2259 if (allocated_raw_shift) |
| 2260 vpx_img_free(&raw_shift); | 2260 vpx_img_free(&raw_shift); |
| 2261 #endif | 2261 #endif |
| 2262 vpx_img_free(&raw); | 2262 vpx_img_free(&raw); |
| 2263 free(argv); | 2263 free(argv); |
| 2264 free(streams); | 2264 free(streams); |
| 2265 return res ? EXIT_FAILURE : EXIT_SUCCESS; | 2265 return res ? EXIT_FAILURE : EXIT_SUCCESS; |
| 2266 } | 2266 } |
| OLD | NEW |