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

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

Issue 375983002: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 5 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/vpx_image.h ('k') | source/libvpx/vpxenc.c » ('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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 static const arg_def_t outputfile = ARG_DEF("o", "output", 1, 70 static const arg_def_t outputfile = ARG_DEF("o", "output", 1,
71 "Output file name pattern (see below )"); 71 "Output file name pattern (see below )");
72 static const arg_def_t threadsarg = ARG_DEF("t", "threads", 1, 72 static const arg_def_t threadsarg = ARG_DEF("t", "threads", 1,
73 "Max threads to use"); 73 "Max threads to use");
74 static const arg_def_t verbosearg = ARG_DEF("v", "verbose", 0, 74 static const arg_def_t verbosearg = ARG_DEF("v", "verbose", 0,
75 "Show version string"); 75 "Show version string");
76 static const arg_def_t error_concealment = ARG_DEF(NULL, "error-concealment", 0, 76 static const arg_def_t error_concealment = ARG_DEF(NULL, "error-concealment", 0,
77 "Enable decoder error-conceal ment"); 77 "Enable decoder error-conceal ment");
78 static const arg_def_t scalearg = ARG_DEF("S", "scale", 0, 78 static const arg_def_t scalearg = ARG_DEF("S", "scale", 0,
79 "Scale output frames uniformly"); 79 "Scale output frames uniformly");
80 static const arg_def_t continuearg =
81 ARG_DEF("k", "keep-going", 0, "(debug) Continue decoding after error");
80 82
81 static const arg_def_t fb_arg = 83 static const arg_def_t fb_arg =
82 ARG_DEF(NULL, "frame-buffers", 1, "Number of frame buffers to use"); 84 ARG_DEF(NULL, "frame-buffers", 1, "Number of frame buffers to use");
83 85
84 static const arg_def_t md5arg = ARG_DEF(NULL, "md5", 0, 86 static const arg_def_t md5arg = ARG_DEF(NULL, "md5", 0,
85 "Compute the MD5 sum of the decoded fram e"); 87 "Compute the MD5 sum of the decoded fram e");
86 88
87 static const arg_def_t *all_args[] = { 89 static const arg_def_t *all_args[] = {
88 &codecarg, &use_yv12, &use_i420, &flipuvarg, &noblitarg, 90 &codecarg, &use_yv12, &use_i420, &flipuvarg, &noblitarg,
89 &progressarg, &limitarg, &skiparg, &postprocarg, &summaryarg, &outputfile, 91 &progressarg, &limitarg, &skiparg, &postprocarg, &summaryarg, &outputfile,
90 &threadsarg, &verbosearg, &scalearg, &fb_arg, 92 &threadsarg, &verbosearg, &scalearg, &fb_arg,
91 &md5arg, 93 &md5arg, &error_concealment, &continuearg,
92 &error_concealment,
93 NULL 94 NULL
94 }; 95 };
95 96
96 #if CONFIG_VP8_DECODER 97 #if CONFIG_VP8_DECODER
97 static const arg_def_t addnoise_level = ARG_DEF(NULL, "noise-level", 1, 98 static const arg_def_t addnoise_level = ARG_DEF(NULL, "noise-level", 1,
98 "Enable VP8 postproc add noise") ; 99 "Enable VP8 postproc add noise") ;
99 static const arg_def_t deblock = ARG_DEF(NULL, "deblock", 0, 100 static const arg_def_t deblock = ARG_DEF(NULL, "deblock", 0,
100 "Enable VP8 deblocking"); 101 "Enable VP8 deblocking");
101 static const arg_def_t demacroblock_level = ARG_DEF(NULL, "demacroblock-level", 1, 102 static const arg_def_t demacroblock_level = ARG_DEF(NULL, "demacroblock-level", 1,
102 "Enable VP8 demacroblocking, w/ level"); 103 "Enable VP8 demacroblocking, w/ level");
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 char *fn = NULL; 491 char *fn = NULL;
491 int i; 492 int i;
492 uint8_t *buf = NULL; 493 uint8_t *buf = NULL;
493 size_t bytes_in_buffer = 0, buffer_size = 0; 494 size_t bytes_in_buffer = 0, buffer_size = 0;
494 FILE *infile; 495 FILE *infile;
495 int frame_in = 0, frame_out = 0, flipuv = 0, noblit = 0; 496 int frame_in = 0, frame_out = 0, flipuv = 0, noblit = 0;
496 int do_md5 = 0, progress = 0; 497 int do_md5 = 0, progress = 0;
497 int stop_after = 0, postproc = 0, summary = 0, quiet = 1; 498 int stop_after = 0, postproc = 0, summary = 0, quiet = 1;
498 int arg_skip = 0; 499 int arg_skip = 0;
499 int ec_enabled = 0; 500 int ec_enabled = 0;
501 int keep_going = 0;
500 const VpxInterface *interface = NULL; 502 const VpxInterface *interface = NULL;
501 const VpxInterface *fourcc_interface = NULL; 503 const VpxInterface *fourcc_interface = NULL;
502 uint64_t dx_time = 0; 504 uint64_t dx_time = 0;
503 struct arg arg; 505 struct arg arg;
504 char **argv, **argi, **argj; 506 char **argv, **argi, **argj;
505 507
506 int single_file; 508 int single_file;
507 int use_y4m = 1; 509 int use_y4m = 1;
508 vpx_codec_dec_cfg_t cfg = {0}; 510 vpx_codec_dec_cfg_t cfg = {0};
509 #if CONFIG_VP8_DECODER 511 #if CONFIG_VP8_DECODER
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 vp8_dbg_color_b_modes = flags; 627 vp8_dbg_color_b_modes = flags;
626 } 628 }
627 } else if (arg_match(&arg, &pp_disp_mvs, argi)) { 629 } else if (arg_match(&arg, &pp_disp_mvs, argi)) {
628 unsigned int flags = arg_parse_int(&arg); 630 unsigned int flags = arg_parse_int(&arg);
629 if (flags) { 631 if (flags) {
630 postproc = 1; 632 postproc = 1;
631 vp8_dbg_display_mv = flags; 633 vp8_dbg_display_mv = flags;
632 } 634 }
633 } else if (arg_match(&arg, &error_concealment, argi)) { 635 } else if (arg_match(&arg, &error_concealment, argi)) {
634 ec_enabled = 1; 636 ec_enabled = 1;
637 } else if (arg_match(&arg, &continuearg, argi)) {
638 keep_going = 1;
635 } 639 }
636 640
637 #endif 641 #endif
638 else 642 else
639 argj++; 643 argj++;
640 } 644 }
641 645
642 /* Check for unrecognized options */ 646 /* Check for unrecognized options */
643 for (argi = argv; *argi; argi++) 647 for (argi = argv; *argi; argi++)
644 if (argi[0][0] == '-' && strlen(argi[0]) > 1) 648 if (argi[0][0] == '-' && strlen(argi[0]) > 1)
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 vpx_usec_timer_start(&timer); 811 vpx_usec_timer_start(&timer);
808 812
809 if (vpx_codec_decode(&decoder, buf, (unsigned int)bytes_in_buffer, 813 if (vpx_codec_decode(&decoder, buf, (unsigned int)bytes_in_buffer,
810 NULL, 0)) { 814 NULL, 0)) {
811 const char *detail = vpx_codec_error_detail(&decoder); 815 const char *detail = vpx_codec_error_detail(&decoder);
812 warn("Failed to decode frame %d: %s", 816 warn("Failed to decode frame %d: %s",
813 frame_in, vpx_codec_error(&decoder)); 817 frame_in, vpx_codec_error(&decoder));
814 818
815 if (detail) 819 if (detail)
816 warn("Additional information: %s", detail); 820 warn("Additional information: %s", detail);
817 goto fail; 821 if (!keep_going)
822 goto fail;
818 } 823 }
819 824
820 vpx_usec_timer_mark(&timer); 825 vpx_usec_timer_mark(&timer);
821 dx_time += vpx_usec_timer_elapsed(&timer); 826 dx_time += vpx_usec_timer_elapsed(&timer);
822 } 827 }
823 } 828 }
824 829
825 vpx_usec_timer_start(&timer); 830 vpx_usec_timer_start(&timer);
826 831
827 got_data = 0; 832 got_data = 0;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 893
889 if (single_file) { 894 if (single_file) {
890 if (use_y4m) { 895 if (use_y4m) {
891 char buf[Y4M_BUFFER_SIZE] = {0}; 896 char buf[Y4M_BUFFER_SIZE] = {0};
892 size_t len = 0; 897 size_t len = 0;
893 if (frame_out == 1) { 898 if (frame_out == 1) {
894 // Y4M file header 899 // Y4M file header
895 len = y4m_write_file_header(buf, sizeof(buf), 900 len = y4m_write_file_header(buf, sizeof(buf),
896 vpx_input_ctx.width, 901 vpx_input_ctx.width,
897 vpx_input_ctx.height, 902 vpx_input_ctx.height,
898 &vpx_input_ctx.framerate, img->fmt); 903 &vpx_input_ctx.framerate,
904 img->fmt, 8);
899 if (do_md5) { 905 if (do_md5) {
900 MD5Update(&md5_ctx, (md5byte *)buf, (unsigned int)len); 906 MD5Update(&md5_ctx, (md5byte *)buf, (unsigned int)len);
901 } else { 907 } else {
902 fputs(buf, outfile); 908 fputs(buf, outfile);
903 } 909 }
904 } 910 }
905 911
906 // Y4M frame header 912 // Y4M frame header
907 len = y4m_write_frame_header(buf, sizeof(buf)); 913 len = y4m_write_frame_header(buf, sizeof(buf));
908 if (do_md5) { 914 if (do_md5) {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 if (arg_match(&arg, &looparg, argi)) { 1003 if (arg_match(&arg, &looparg, argi)) {
998 loops = arg_parse_uint(&arg); 1004 loops = arg_parse_uint(&arg);
999 break; 1005 break;
1000 } 1006 }
1001 } 1007 }
1002 free(argv); 1008 free(argv);
1003 for (i = 0; !error && i < loops; i++) 1009 for (i = 0; !error && i < loops; i++)
1004 error = main_loop(argc, argv_); 1010 error = main_loop(argc, argv_);
1005 return error; 1011 return error;
1006 } 1012 }
OLDNEW
« no previous file with comments | « source/libvpx/vpx/vpx_image.h ('k') | source/libvpx/vpxenc.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698