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

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

Issue 1169543007: libvpx: Pull from upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: Created 5 years, 6 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 | « source/libvpx/vpxdec.c ('k') | source/libvpx/webmenc.h » ('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) 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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 &kf_min_dist, &kf_max_dist, &kf_disabled, NULL 323 &kf_min_dist, &kf_max_dist, &kf_disabled, NULL
324 }; 324 };
325 325
326 326
327 static const arg_def_t noise_sens = ARG_DEF( 327 static const arg_def_t noise_sens = ARG_DEF(
328 NULL, "noise-sensitivity", 1, "Noise sensitivity (frames to blur)"); 328 NULL, "noise-sensitivity", 1, "Noise sensitivity (frames to blur)");
329 static const arg_def_t sharpness = ARG_DEF( 329 static const arg_def_t sharpness = ARG_DEF(
330 NULL, "sharpness", 1, "Loop filter sharpness (0..7)"); 330 NULL, "sharpness", 1, "Loop filter sharpness (0..7)");
331 static const arg_def_t static_thresh = ARG_DEF( 331 static const arg_def_t static_thresh = ARG_DEF(
332 NULL, "static-thresh", 1, "Motion detection threshold"); 332 NULL, "static-thresh", 1, "Motion detection threshold");
333 static const arg_def_t cpu_used_vp8 = ARG_DEF(
334 NULL, "cpu-used", 1, "CPU Used (-16..16)");
335 static const arg_def_t cpu_used_vp9 = ARG_DEF(
336 NULL, "cpu-used", 1, "CPU Used (-8..8)");
337 static const arg_def_t auto_altref = ARG_DEF( 333 static const arg_def_t auto_altref = ARG_DEF(
338 NULL, "auto-alt-ref", 1, "Enable automatic alt reference frames"); 334 NULL, "auto-alt-ref", 1, "Enable automatic alt reference frames");
339 static const arg_def_t arnr_maxframes = ARG_DEF( 335 static const arg_def_t arnr_maxframes = ARG_DEF(
340 NULL, "arnr-maxframes", 1, "AltRef max frames (0..15)"); 336 NULL, "arnr-maxframes", 1, "AltRef max frames (0..15)");
341 static const arg_def_t arnr_strength = ARG_DEF( 337 static const arg_def_t arnr_strength = ARG_DEF(
342 NULL, "arnr-strength", 1, "AltRef filter strength (0..6)"); 338 NULL, "arnr-strength", 1, "AltRef filter strength (0..6)");
343 static const arg_def_t arnr_type = ARG_DEF( 339 static const arg_def_t arnr_type = ARG_DEF(
344 NULL, "arnr-type", 1, "AltRef type"); 340 NULL, "arnr-type", 1, "AltRef type");
345 static const struct arg_enum_list tuning_enum[] = { 341 static const struct arg_enum_list tuning_enum[] = {
346 {"psnr", VP8_TUNE_PSNR}, 342 {"psnr", VP8_TUNE_PSNR},
347 {"ssim", VP8_TUNE_SSIM}, 343 {"ssim", VP8_TUNE_SSIM},
348 {NULL, 0} 344 {NULL, 0}
349 }; 345 };
350 static const arg_def_t tune_ssim = ARG_DEF_ENUM( 346 static const arg_def_t tune_ssim = ARG_DEF_ENUM(
351 NULL, "tune", 1, "Material to favor", tuning_enum); 347 NULL, "tune", 1, "Material to favor", tuning_enum);
352 static const arg_def_t cq_level = ARG_DEF( 348 static const arg_def_t cq_level = ARG_DEF(
353 NULL, "cq-level", 1, "Constant/Constrained Quality level"); 349 NULL, "cq-level", 1, "Constant/Constrained Quality level");
354 static const arg_def_t max_intra_rate_pct = ARG_DEF( 350 static const arg_def_t max_intra_rate_pct = ARG_DEF(
355 NULL, "max-intra-rate", 1, "Max I-frame bitrate (pct)"); 351 NULL, "max-intra-rate", 1, "Max I-frame bitrate (pct)");
356 static const arg_def_t max_inter_rate_pct = ARG_DEF(
357 NULL, "max-inter-rate", 1, "Max P-frame bitrate (pct)");
358 static const arg_def_t gf_cbr_boost_pct = ARG_DEF(
359 NULL, "gf-cbr-boost", 1, "Boost for Golden Frame in CBR mode (pct)");
360
361 static const arg_def_t screen_content_mode = ARG_DEF(NULL, "screen-content-mode" , 1,
362 "Screen content mode");
363 352
364 #if CONFIG_VP8_ENCODER 353 #if CONFIG_VP8_ENCODER
354 static const arg_def_t cpu_used_vp8 = ARG_DEF(
355 NULL, "cpu-used", 1, "CPU Used (-16..16)");
365 static const arg_def_t token_parts = ARG_DEF( 356 static const arg_def_t token_parts = ARG_DEF(
366 NULL, "token-parts", 1, "Number of token partitions to use, log2"); 357 NULL, "token-parts", 1, "Number of token partitions to use, log2");
358 static const arg_def_t screen_content_mode = ARG_DEF(
359 NULL, "screen-content-mode", 1, "Screen content mode");
367 static const arg_def_t *vp8_args[] = { 360 static const arg_def_t *vp8_args[] = {
368 &cpu_used_vp8, &auto_altref, &noise_sens, &sharpness, &static_thresh, 361 &cpu_used_vp8, &auto_altref, &noise_sens, &sharpness, &static_thresh,
369 &token_parts, &arnr_maxframes, &arnr_strength, &arnr_type, 362 &token_parts, &arnr_maxframes, &arnr_strength, &arnr_type,
370 &tune_ssim, &cq_level, &max_intra_rate_pct, &screen_content_mode, 363 &tune_ssim, &cq_level, &max_intra_rate_pct, &screen_content_mode,
371 NULL 364 NULL
372 }; 365 };
373 static const int vp8_arg_ctrl_map[] = { 366 static const int vp8_arg_ctrl_map[] = {
374 VP8E_SET_CPUUSED, VP8E_SET_ENABLEAUTOALTREF, 367 VP8E_SET_CPUUSED, VP8E_SET_ENABLEAUTOALTREF,
375 VP8E_SET_NOISE_SENSITIVITY, VP8E_SET_SHARPNESS, VP8E_SET_STATIC_THRESHOLD, 368 VP8E_SET_NOISE_SENSITIVITY, VP8E_SET_SHARPNESS, VP8E_SET_STATIC_THRESHOLD,
376 VP8E_SET_TOKEN_PARTITIONS, 369 VP8E_SET_TOKEN_PARTITIONS,
377 VP8E_SET_ARNR_MAXFRAMES, VP8E_SET_ARNR_STRENGTH, VP8E_SET_ARNR_TYPE, 370 VP8E_SET_ARNR_MAXFRAMES, VP8E_SET_ARNR_STRENGTH, VP8E_SET_ARNR_TYPE,
378 VP8E_SET_TUNING, VP8E_SET_CQ_LEVEL, VP8E_SET_MAX_INTRA_BITRATE_PCT, 371 VP8E_SET_TUNING, VP8E_SET_CQ_LEVEL, VP8E_SET_MAX_INTRA_BITRATE_PCT,
379 VP8E_SET_SCREEN_CONTENT_MODE, 372 VP8E_SET_SCREEN_CONTENT_MODE,
380 0 373 0
381 }; 374 };
382 #endif 375 #endif
383 376
384 #if CONFIG_VP9_ENCODER 377 #if CONFIG_VP9_ENCODER
378 static const arg_def_t cpu_used_vp9 = ARG_DEF(
379 NULL, "cpu-used", 1, "CPU Used (-8..8)");
385 static const arg_def_t tile_cols = ARG_DEF( 380 static const arg_def_t tile_cols = ARG_DEF(
386 NULL, "tile-columns", 1, "Number of tile columns to use, log2"); 381 NULL, "tile-columns", 1, "Number of tile columns to use, log2");
387 static const arg_def_t tile_rows = ARG_DEF( 382 static const arg_def_t tile_rows = ARG_DEF(
388 NULL, "tile-rows", 1, "Number of tile rows to use, log2"); 383 NULL, "tile-rows", 1, "Number of tile rows to use, log2");
389 static const arg_def_t lossless = ARG_DEF( 384 static const arg_def_t lossless = ARG_DEF(
390 NULL, "lossless", 1, "Lossless mode"); 385 NULL, "lossless", 1, "Lossless mode");
391 static const arg_def_t frame_parallel_decoding = ARG_DEF( 386 static const arg_def_t frame_parallel_decoding = ARG_DEF(
392 NULL, "frame-parallel", 1, "Enable frame parallel decodability features"); 387 NULL, "frame-parallel", 1, "Enable frame parallel decodability features");
393 static const arg_def_t aq_mode = ARG_DEF( 388 static const arg_def_t aq_mode = ARG_DEF(
394 NULL, "aq-mode", 1, 389 NULL, "aq-mode", 1,
395 "Adaptive quantization mode (0: off (default), 1: variance 2: complexity, " 390 "Adaptive quantization mode (0: off (default), 1: variance 2: complexity, "
396 "3: cyclic refresh)"); 391 "3: cyclic refresh)");
397 static const arg_def_t frame_periodic_boost = ARG_DEF( 392 static const arg_def_t frame_periodic_boost = ARG_DEF(
398 NULL, "frame-boost", 1, 393 NULL, "frame-boost", 1,
399 "Enable frame periodic boost (0: off (default), 1: on)"); 394 "Enable frame periodic boost (0: off (default), 1: on)");
395 static const arg_def_t gf_cbr_boost_pct = ARG_DEF(
396 NULL, "gf-cbr-boost", 1, "Boost for Golden Frame in CBR mode (pct)");
397 static const arg_def_t max_inter_rate_pct = ARG_DEF(
398 NULL, "max-inter-rate", 1, "Max P-frame bitrate (pct)");
400 399
401 static const struct arg_enum_list color_space_enum[] = { 400 static const struct arg_enum_list color_space_enum[] = {
402 { "unknown", VPX_CS_UNKNOWN }, 401 { "unknown", VPX_CS_UNKNOWN },
403 { "bt601", VPX_CS_BT_601 }, 402 { "bt601", VPX_CS_BT_601 },
404 { "bt709", VPX_CS_BT_709 }, 403 { "bt709", VPX_CS_BT_709 },
405 { "smpte170", VPX_CS_SMPTE_170 }, 404 { "smpte170", VPX_CS_SMPTE_170 },
406 { "smpte240", VPX_CS_SMPTE_240 }, 405 { "smpte240", VPX_CS_SMPTE_240 },
407 { "bt2020", VPX_CS_BT_2020 }, 406 { "bt2020", VPX_CS_BT_2020 },
408 { "reserved", VPX_CS_RESERVED }, 407 { "reserved", VPX_CS_RESERVED },
409 { "sRGB", VPX_CS_SRGB }, 408 { "sRGB", VPX_CS_SRGB },
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 VP9E_SET_FRAME_PERIODIC_BOOST, VP9E_SET_NOISE_SENSITIVITY, 461 VP9E_SET_FRAME_PERIODIC_BOOST, VP9E_SET_NOISE_SENSITIVITY,
463 VP9E_SET_TUNE_CONTENT, VP9E_SET_COLOR_SPACE, 462 VP9E_SET_TUNE_CONTENT, VP9E_SET_COLOR_SPACE,
464 0 463 0
465 }; 464 };
466 #endif 465 #endif
467 466
468 static const arg_def_t *no_args[] = { NULL }; 467 static const arg_def_t *no_args[] = { NULL };
469 468
470 void usage_exit(void) { 469 void usage_exit(void) {
471 int i; 470 int i;
471 const int num_encoder = get_vpx_encoder_count();
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");
481 arg_show_usage(stderr, rc_args); 481 arg_show_usage(stderr, rc_args);
482 fprintf(stderr, "\nTwopass Rate Control Options:\n"); 482 fprintf(stderr, "\nTwopass Rate Control Options:\n");
483 arg_show_usage(stderr, rc_twopass_args); 483 arg_show_usage(stderr, rc_twopass_args);
484 fprintf(stderr, "\nKeyframe Placement Options:\n"); 484 fprintf(stderr, "\nKeyframe Placement Options:\n");
485 arg_show_usage(stderr, kf_args); 485 arg_show_usage(stderr, kf_args);
486 #if CONFIG_VP8_ENCODER 486 #if CONFIG_VP8_ENCODER
487 fprintf(stderr, "\nVP8 Specific Options:\n"); 487 fprintf(stderr, "\nVP8 Specific Options:\n");
488 arg_show_usage(stderr, vp8_args); 488 arg_show_usage(stderr, vp8_args);
489 #endif 489 #endif
490 #if CONFIG_VP9_ENCODER 490 #if CONFIG_VP9_ENCODER
491 fprintf(stderr, "\nVP9 Specific Options:\n"); 491 fprintf(stderr, "\nVP9 Specific Options:\n");
492 arg_show_usage(stderr, vp9_args); 492 arg_show_usage(stderr, vp9_args);
493 #endif 493 #endif
494 fprintf(stderr, "\nStream timebase (--timebase):\n" 494 fprintf(stderr, "\nStream timebase (--timebase):\n"
495 " The desired precision of timestamps in the output, expressed\n" 495 " The desired precision of timestamps in the output, expressed\n"
496 " in fractional seconds. Default is 1/1000.\n"); 496 " in fractional seconds. Default is 1/1000.\n");
497 fprintf(stderr, "\nIncluded encoders:\n\n"); 497 fprintf(stderr, "\nIncluded encoders:\n\n");
498 498
499 for (i = 0; i < get_vpx_encoder_count(); ++i) { 499 for (i = 0; i < num_encoder; ++i) {
500 const VpxInterface *const encoder = get_vpx_encoder_by_index(i); 500 const VpxInterface *const encoder = get_vpx_encoder_by_index(i);
501 fprintf(stderr, " %-6s - %s\n", 501 const char* defstr = (i == (num_encoder - 1)) ? "(default)" : "";
502 encoder->name, vpx_codec_iface_name(encoder->codec_interface())); 502 fprintf(stderr, " %-6s - %s %s\n",
503 encoder->name, vpx_codec_iface_name(encoder->codec_interface()),
504 defstr);
503 } 505 }
506 fprintf(stderr, "\n ");
507 fprintf(stderr, "Use --codec to switch to a non-default encoder.\n\n");
504 508
505 exit(EXIT_FAILURE); 509 exit(EXIT_FAILURE);
506 } 510 }
507 511
508 #define mmin(a, b) ((a) < (b) ? (a) : (b)) 512 #define mmin(a, b) ((a) < (b) ? (a) : (b))
509 513
510 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH 514 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
511 static void find_mismatch_high(const vpx_image_t *const img1, 515 static void find_mismatch_high(const vpx_image_t *const img1,
512 const vpx_image_t *const img2, 516 const vpx_image_t *const img2,
513 int yloc[4], int uloc[4], int vloc[4]) { 517 int yloc[4], int uloc[4], int vloc[4]) {
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 die("Error: %s must be positive\n", msg); 808 die("Error: %s must be positive\n", msg);
805 809
806 if (!rat->den) 810 if (!rat->den)
807 die("Error: %s has zero denominator\n", msg); 811 die("Error: %s has zero denominator\n", msg);
808 } 812 }
809 813
810 814
811 static void parse_global_config(struct VpxEncoderConfig *global, char **argv) { 815 static void parse_global_config(struct VpxEncoderConfig *global, char **argv) {
812 char **argi, **argj; 816 char **argi, **argj;
813 struct arg arg; 817 struct arg arg;
818 const int num_encoder = get_vpx_encoder_count();
819
820 if (num_encoder < 1)
821 die("Error: no valid encoder available\n");
814 822
815 /* Initialize default parameters */ 823 /* Initialize default parameters */
816 memset(global, 0, sizeof(*global)); 824 memset(global, 0, sizeof(*global));
817 global->codec = get_vpx_encoder_by_index(0); 825 global->codec = get_vpx_encoder_by_index(num_encoder - 1);
818 global->passes = 0; 826 global->passes = 0;
819 global->color_type = I420; 827 global->color_type = I420;
820 /* Assign default deadline to good quality */ 828 /* Assign default deadline to good quality */
821 global->deadline = VPX_DL_GOOD_QUALITY; 829 global->deadline = VPX_DL_GOOD_QUALITY;
822 830
823 for (argi = argj = argv; (*argj = *argi); argi += arg.argv_step) { 831 for (argi = argj = argv; (*argj = *argi); argi += arg.argv_step) {
824 arg.argv_step = 1; 832 arg.argv_step = 1;
825 833
826 if (arg_match(&arg, &codecarg, argi)) { 834 if (arg_match(&arg, &codecarg, argi)) {
827 global->codec = get_vpx_encoder_by_name(arg.val); 835 global->codec = get_vpx_encoder_by_name(arg.val);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 fatal("Failed to open input file"); 936 fatal("Failed to open input file");
929 937
930 if (!fseeko(input->file, 0, SEEK_END)) { 938 if (!fseeko(input->file, 0, SEEK_END)) {
931 /* Input file is seekable. Figure out how long it is, so we can get 939 /* Input file is seekable. Figure out how long it is, so we can get
932 * progress info. 940 * progress info.
933 */ 941 */
934 input->length = ftello(input->file); 942 input->length = ftello(input->file);
935 rewind(input->file); 943 rewind(input->file);
936 } 944 }
937 945
946 /* Default to 1:1 pixel aspect ratio. */
947 input->pixel_aspect_ratio.numerator = 1;
948 input->pixel_aspect_ratio.denominator = 1;
949
938 /* For RAW input sources, these bytes will applied on the first frame 950 /* For RAW input sources, these bytes will applied on the first frame
939 * in read_frame(). 951 * in read_frame().
940 */ 952 */
941 input->detect.buf_read = fread(input->detect.buf, 1, 4, input->file); 953 input->detect.buf_read = fread(input->detect.buf, 1, 4, input->file);
942 input->detect.position = 0; 954 input->detect.position = 0;
943 955
944 if (input->detect.buf_read == 4 956 if (input->detect.buf_read == 4
945 && file_is_y4m(input->detect.buf)) { 957 && file_is_y4m(input->detect.buf)) {
946 if (y4m_input_open(&input->y4m, input->file, input->detect.buf, 4, 958 if (y4m_input_open(&input->y4m, input->file, input->detect.buf, 4,
947 input->only_i420) >= 0) { 959 input->only_i420) >= 0) {
948 input->file_type = FILE_TYPE_Y4M; 960 input->file_type = FILE_TYPE_Y4M;
949 input->width = input->y4m.pic_w; 961 input->width = input->y4m.pic_w;
950 input->height = input->y4m.pic_h; 962 input->height = input->y4m.pic_h;
963 input->pixel_aspect_ratio.numerator = input->y4m.par_n;
964 input->pixel_aspect_ratio.denominator = input->y4m.par_d;
951 input->framerate.numerator = input->y4m.fps_n; 965 input->framerate.numerator = input->y4m.fps_n;
952 input->framerate.denominator = input->y4m.fps_d; 966 input->framerate.denominator = input->y4m.fps_d;
953 input->fmt = input->y4m.vpx_fmt; 967 input->fmt = input->y4m.vpx_fmt;
954 input->bit_depth = input->y4m.bit_depth; 968 input->bit_depth = input->y4m.bit_depth;
955 } else 969 } else
956 fatal("Unsupported Y4M stream."); 970 fatal("Unsupported Y4M stream.");
957 } else if (input->detect.buf_read == 4 && fourcc_is_ivf(input->detect.buf)) { 971 } else if (input->detect.buf_read == 4 && fourcc_is_ivf(input->detect.buf)) {
958 fatal("IVF is not supported as input."); 972 fatal("IVF is not supported as input.");
959 } else { 973 } else {
960 input->file_type = FILE_TYPE_RAW; 974 input->file_type = FILE_TYPE_RAW;
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
1374 SHOW(rc_2pass_vbr_bias_pct); 1388 SHOW(rc_2pass_vbr_bias_pct);
1375 SHOW(rc_2pass_vbr_minsection_pct); 1389 SHOW(rc_2pass_vbr_minsection_pct);
1376 SHOW(rc_2pass_vbr_maxsection_pct); 1390 SHOW(rc_2pass_vbr_maxsection_pct);
1377 SHOW(kf_mode); 1391 SHOW(kf_mode);
1378 SHOW(kf_min_dist); 1392 SHOW(kf_min_dist);
1379 SHOW(kf_max_dist); 1393 SHOW(kf_max_dist);
1380 } 1394 }
1381 1395
1382 1396
1383 static void open_output_file(struct stream_state *stream, 1397 static void open_output_file(struct stream_state *stream,
1384 struct VpxEncoderConfig *global) { 1398 struct VpxEncoderConfig *global,
1399 const struct VpxRational *pixel_aspect_ratio) {
1385 const char *fn = stream->config.out_fn; 1400 const char *fn = stream->config.out_fn;
1386 const struct vpx_codec_enc_cfg *const cfg = &stream->config.cfg; 1401 const struct vpx_codec_enc_cfg *const cfg = &stream->config.cfg;
1387 1402
1388 if (cfg->g_pass == VPX_RC_FIRST_PASS) 1403 if (cfg->g_pass == VPX_RC_FIRST_PASS)
1389 return; 1404 return;
1390 1405
1391 stream->file = strcmp(fn, "-") ? fopen(fn, "wb") : set_binary_mode(stdout); 1406 stream->file = strcmp(fn, "-") ? fopen(fn, "wb") : set_binary_mode(stdout);
1392 1407
1393 if (!stream->file) 1408 if (!stream->file)
1394 fatal("Failed to open output file"); 1409 fatal("Failed to open output file");
1395 1410
1396 if (stream->config.write_webm && fseek(stream->file, 0, SEEK_CUR)) 1411 if (stream->config.write_webm && fseek(stream->file, 0, SEEK_CUR))
1397 fatal("WebM output to pipes not supported."); 1412 fatal("WebM output to pipes not supported.");
1398 1413
1399 #if CONFIG_WEBM_IO 1414 #if CONFIG_WEBM_IO
1400 if (stream->config.write_webm) { 1415 if (stream->config.write_webm) {
1401 stream->ebml.stream = stream->file; 1416 stream->ebml.stream = stream->file;
1402 write_webm_file_header(&stream->ebml, cfg, 1417 write_webm_file_header(&stream->ebml, cfg,
1403 &global->framerate, 1418 &global->framerate,
1404 stream->config.stereo_fmt, 1419 stream->config.stereo_fmt,
1405 global->codec->fourcc); 1420 global->codec->fourcc,
1421 pixel_aspect_ratio);
1406 } 1422 }
1407 #endif 1423 #endif
1408 1424
1409 if (!stream->config.write_webm) { 1425 if (!stream->config.write_webm) {
1410 ivf_write_file_header(stream->file, cfg, global->codec->fourcc, 0); 1426 ivf_write_file_header(stream->file, cfg, global->codec->fourcc, 0);
1411 } 1427 }
1412 } 1428 }
1413 1429
1414 1430
1415 static void close_output_file(struct stream_state *stream, 1431 static void close_output_file(struct stream_state *stream,
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
2028 memset(&raw, 0, sizeof(raw)); 2044 memset(&raw, 0, sizeof(raw));
2029 else 2045 else
2030 vpx_img_alloc(&raw, input.fmt, input.width, input.height, 32); 2046 vpx_img_alloc(&raw, input.fmt, input.width, input.height, 32);
2031 2047
2032 FOREACH_STREAM(stream->rate_hist = 2048 FOREACH_STREAM(stream->rate_hist =
2033 init_rate_histogram(&stream->config.cfg, 2049 init_rate_histogram(&stream->config.cfg,
2034 &global.framerate)); 2050 &global.framerate));
2035 } 2051 }
2036 2052
2037 FOREACH_STREAM(setup_pass(stream, &global, pass)); 2053 FOREACH_STREAM(setup_pass(stream, &global, pass));
2038 FOREACH_STREAM(open_output_file(stream, &global)); 2054 FOREACH_STREAM(open_output_file(stream, &global,
2055 &input.pixel_aspect_ratio));
2039 FOREACH_STREAM(initialize_encoder(stream, &global)); 2056 FOREACH_STREAM(initialize_encoder(stream, &global));
2040 2057
2041 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH 2058 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
2042 if (strcmp(global.codec->name, "vp9") == 0) { 2059 if (strcmp(global.codec->name, "vp9") == 0) {
2043 // Check to see if at least one stream uses 16 bit internal. 2060 // Check to see if at least one stream uses 16 bit internal.
2044 // Currently assume that the bit_depths for all streams using 2061 // Currently assume that the bit_depths for all streams using
2045 // highbitdepth are the same. 2062 // highbitdepth are the same.
2046 FOREACH_STREAM({ 2063 FOREACH_STREAM({
2047 if (stream->config.use_16bit_internal) { 2064 if (stream->config.use_16bit_internal) {
2048 use_16bit_internal = 1; 2065 use_16bit_internal = 1;
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
2257 2274
2258 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH 2275 #if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH
2259 if (allocated_raw_shift) 2276 if (allocated_raw_shift)
2260 vpx_img_free(&raw_shift); 2277 vpx_img_free(&raw_shift);
2261 #endif 2278 #endif
2262 vpx_img_free(&raw); 2279 vpx_img_free(&raw);
2263 free(argv); 2280 free(argv);
2264 free(streams); 2281 free(streams);
2265 return res ? EXIT_FAILURE : EXIT_SUCCESS; 2282 return res ? EXIT_FAILURE : EXIT_SUCCESS;
2266 } 2283 }
OLDNEW
« no previous file with comments | « source/libvpx/vpxdec.c ('k') | source/libvpx/webmenc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698