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

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

Issue 13042014: Description: (Closed) Base URL: https://src.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: libvpx: Pull from upstream Created 7 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
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 12 matching lines...) Expand all
23 #include "vpx/vpx_decoder.h" 23 #include "vpx/vpx_decoder.h"
24 #include "vpx_ports/vpx_timer.h" 24 #include "vpx_ports/vpx_timer.h"
25 #if CONFIG_VP8_DECODER || CONFIG_VP9_DECODER 25 #if CONFIG_VP8_DECODER || CONFIG_VP9_DECODER
26 #include "vpx/vp8dx.h" 26 #include "vpx/vp8dx.h"
27 #endif 27 #endif
28 #if CONFIG_MD5 28 #if CONFIG_MD5
29 #include "md5_utils.h" 29 #include "md5_utils.h"
30 #endif 30 #endif
31 #include "tools_common.h" 31 #include "tools_common.h"
32 #include "nestegg/include/nestegg/nestegg.h" 32 #include "nestegg/include/nestegg/nestegg.h"
33 #include "third_party/libyuv/include/libyuv/scale.h"
33 34
34 #if CONFIG_OS_SUPPORT 35 #if CONFIG_OS_SUPPORT
35 #if defined(_MSC_VER) 36 #if defined(_MSC_VER)
36 #include <io.h> 37 #include <io.h>
37 #define snprintf _snprintf 38 #define snprintf _snprintf
38 #define isatty _isatty 39 #define isatty _isatty
39 #define fileno _fileno 40 #define fileno _fileno
40 #else 41 #else
41 #include <unistd.h> 42 #include <unistd.h>
42 #endif 43 #endif
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 static const arg_def_t summaryarg = ARG_DEF(NULL, "summary", 0, 87 static const arg_def_t summaryarg = ARG_DEF(NULL, "summary", 0,
87 "Show timing summary"); 88 "Show timing summary");
88 static const arg_def_t outputfile = ARG_DEF("o", "output", 1, 89 static const arg_def_t outputfile = ARG_DEF("o", "output", 1,
89 "Output file name pattern (see below )"); 90 "Output file name pattern (see below )");
90 static const arg_def_t threadsarg = ARG_DEF("t", "threads", 1, 91 static const arg_def_t threadsarg = ARG_DEF("t", "threads", 1,
91 "Max threads to use"); 92 "Max threads to use");
92 static const arg_def_t verbosearg = ARG_DEF("v", "verbose", 0, 93 static const arg_def_t verbosearg = ARG_DEF("v", "verbose", 0,
93 "Show version string"); 94 "Show version string");
94 static const arg_def_t error_concealment = ARG_DEF(NULL, "error-concealment", 0, 95 static const arg_def_t error_concealment = ARG_DEF(NULL, "error-concealment", 0,
95 "Enable decoder error-conceal ment"); 96 "Enable decoder error-conceal ment");
97 static const arg_def_t scalearg = ARG_DEF("S", "scale", 0,
98 "Scale output frames uniformly");
96 99
97 100
98 #if CONFIG_MD5 101 #if CONFIG_MD5
99 static const arg_def_t md5arg = ARG_DEF(NULL, "md5", 0, 102 static const arg_def_t md5arg = ARG_DEF(NULL, "md5", 0,
100 "Compute the MD5 sum of the decoded fram e"); 103 "Compute the MD5 sum of the decoded fram e");
101 #endif 104 #endif
102 static const arg_def_t *all_args[] = { 105 static const arg_def_t *all_args[] = {
103 &codecarg, &use_yv12, &use_i420, &flipuvarg, &noblitarg, 106 &codecarg, &use_yv12, &use_i420, &flipuvarg, &noblitarg,
104 &progressarg, &limitarg, &skiparg, &postprocarg, &summaryarg, &outputfile, 107 &progressarg, &limitarg, &skiparg, &postprocarg, &summaryarg, &outputfile,
105 &threadsarg, &verbosearg, 108 &threadsarg, &verbosearg, &scalearg,
106 #if CONFIG_MD5 109 #if CONFIG_MD5
107 &md5arg, 110 &md5arg,
108 #endif 111 #endif
109 &error_concealment, 112 &error_concealment,
110 NULL 113 NULL
111 }; 114 };
112 115
113 #if CONFIG_VP8_DECODER 116 #if CONFIG_VP8_DECODER
114 static const arg_def_t addnoise_level = ARG_DEF(NULL, "noise-level", 1, 117 static const arg_def_t addnoise_level = ARG_DEF(NULL, "noise-level", 1,
115 "Enable VP8 postproc add noise") ; 118 "Enable VP8 postproc add noise") ;
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 #if CONFIG_VP8_DECODER 704 #if CONFIG_VP8_DECODER
702 vp8_postproc_cfg_t vp8_pp_cfg = {0}; 705 vp8_postproc_cfg_t vp8_pp_cfg = {0};
703 int vp8_dbg_color_ref_frame = 0; 706 int vp8_dbg_color_ref_frame = 0;
704 int vp8_dbg_color_mb_modes = 0; 707 int vp8_dbg_color_mb_modes = 0;
705 int vp8_dbg_color_b_modes = 0; 708 int vp8_dbg_color_b_modes = 0;
706 int vp8_dbg_display_mv = 0; 709 int vp8_dbg_display_mv = 0;
707 #endif 710 #endif
708 struct input_ctx input = {0}; 711 struct input_ctx input = {0};
709 int frames_corrupted = 0; 712 int frames_corrupted = 0;
710 int dec_flags = 0; 713 int dec_flags = 0;
714 int do_scale = 0;
715 int stream_w = 0, stream_h = 0;
716 vpx_image_t *scaled_img = NULL;
711 717
712 /* Parse command line */ 718 /* Parse command line */
713 exec_name = argv_[0]; 719 exec_name = argv_[0];
714 argv = argv_dup(argc - 1, argv_ + 1); 720 argv = argv_dup(argc - 1, argv_ + 1);
715 721
716 for (argi = argj = argv; (*argj = *argi); argi += arg.argv_step) { 722 for (argi = argj = argv; (*argj = *argi); argi += arg.argv_step) {
717 memset(&arg, 0, sizeof(arg)); 723 memset(&arg, 0, sizeof(arg));
718 arg.argv_step = 1; 724 arg.argv_step = 1;
719 725
720 if (arg_match(&arg, &codecarg, argi)) { 726 if (arg_match(&arg, &codecarg, argi)) {
(...skipping 29 matching lines...) Expand all
750 else if (arg_match(&arg, &postprocarg, argi)) 756 else if (arg_match(&arg, &postprocarg, argi))
751 postproc = 1; 757 postproc = 1;
752 else if (arg_match(&arg, &md5arg, argi)) 758 else if (arg_match(&arg, &md5arg, argi))
753 do_md5 = 1; 759 do_md5 = 1;
754 else if (arg_match(&arg, &summaryarg, argi)) 760 else if (arg_match(&arg, &summaryarg, argi))
755 summary = 1; 761 summary = 1;
756 else if (arg_match(&arg, &threadsarg, argi)) 762 else if (arg_match(&arg, &threadsarg, argi))
757 cfg.threads = arg_parse_uint(&arg); 763 cfg.threads = arg_parse_uint(&arg);
758 else if (arg_match(&arg, &verbosearg, argi)) 764 else if (arg_match(&arg, &verbosearg, argi))
759 quiet = 0; 765 quiet = 0;
766 else if (arg_match(&arg, &scalearg, argi))
767 do_scale = 1;
760 768
761 #if CONFIG_VP8_DECODER 769 #if CONFIG_VP8_DECODER
762 else if (arg_match(&arg, &addnoise_level, argi)) { 770 else if (arg_match(&arg, &addnoise_level, argi)) {
763 postproc = 1; 771 postproc = 1;
764 vp8_pp_cfg.post_proc_flag |= VP8_ADDNOISE; 772 vp8_pp_cfg.post_proc_flag |= VP8_ADDNOISE;
765 vp8_pp_cfg.noise_level = arg_parse_uint(&arg); 773 vp8_pp_cfg.noise_level = arg_parse_uint(&arg);
766 } else if (arg_match(&arg, &demacroblock_level, argi)) { 774 } else if (arg_match(&arg, &demacroblock_level, argi)) {
767 postproc = 1; 775 postproc = 1;
768 vp8_pp_cfg.post_proc_flag |= VP8_DEMACROBLOCK; 776 vp8_pp_cfg.post_proc_flag |= VP8_DEMACROBLOCK;
769 vp8_pp_cfg.deblocking_level = arg_parse_uint(&arg); 777 vp8_pp_cfg.deblocking_level = arg_parse_uint(&arg);
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 if ((img = vpx_codec_get_frame(&decoder, &iter))) 1016 if ((img = vpx_codec_get_frame(&decoder, &iter)))
1009 ++frame_out; 1017 ++frame_out;
1010 1018
1011 vpx_usec_timer_mark(&timer); 1019 vpx_usec_timer_mark(&timer);
1012 dx_time += (unsigned int)vpx_usec_timer_elapsed(&timer); 1020 dx_time += (unsigned int)vpx_usec_timer_elapsed(&timer);
1013 1021
1014 if (progress) 1022 if (progress)
1015 show_progress(frame_in, frame_out, dx_time); 1023 show_progress(frame_in, frame_out, dx_time);
1016 1024
1017 if (!noblit) { 1025 if (!noblit) {
1026 if (do_scale) {
1027 if (img && frame_out == 1) {
1028 stream_w = img->d_w;
1029 stream_h = img->d_h;
1030 scaled_img = vpx_img_alloc(NULL, VPX_IMG_FMT_I420,
1031 stream_w, stream_h, 16);
1032 }
1033 if (img && (img->d_w != stream_w || img->d_h != stream_h)) {
1034 I420Scale(img->planes[VPX_PLANE_Y], img->stride[VPX_PLANE_Y],
1035 img->planes[VPX_PLANE_U], img->stride[VPX_PLANE_U],
1036 img->planes[VPX_PLANE_V], img->stride[VPX_PLANE_V],
1037 img->d_w, img->d_h,
1038 scaled_img->planes[VPX_PLANE_Y],
1039 scaled_img->stride[VPX_PLANE_Y],
1040 scaled_img->planes[VPX_PLANE_U],
1041 scaled_img->stride[VPX_PLANE_U],
1042 scaled_img->planes[VPX_PLANE_V],
1043 scaled_img->stride[VPX_PLANE_V],
1044 stream_w, stream_h,
1045 kFilterBox);
1046 img = scaled_img;
1047 }
1048 }
1049
1018 if (img) { 1050 if (img) {
1019 unsigned int y; 1051 unsigned int y;
1020 char out_fn[PATH_MAX]; 1052 char out_fn[PATH_MAX];
1021 uint8_t *buf; 1053 uint8_t *buf;
1022 1054
1023 if (!single_file) { 1055 if (!single_file) {
1024 size_t len = sizeof(out_fn) - 1; 1056 size_t len = sizeof(out_fn) - 1;
1025 1057
1026 out_fn[len] = '\0'; 1058 out_fn[len] = '\0';
1027 generate_filename(outfile_pattern, out_fn, len - 1, 1059 generate_filename(outfile_pattern, out_fn, len - 1,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 1112
1081 if (input.nestegg_ctx) 1113 if (input.nestegg_ctx)
1082 nestegg_destroy(input.nestegg_ctx); 1114 nestegg_destroy(input.nestegg_ctx);
1083 if (input.kind != WEBM_FILE) 1115 if (input.kind != WEBM_FILE)
1084 free(buf); 1116 free(buf);
1085 fclose(infile); 1117 fclose(infile);
1086 free(argv); 1118 free(argv);
1087 1119
1088 return frames_corrupted ? EXIT_FAILURE : EXIT_SUCCESS; 1120 return frames_corrupted ? EXIT_FAILURE : EXIT_SUCCESS;
1089 } 1121 }
OLDNEW
« no previous file with comments | « source/libvpx/vp9/encoder/x86/vp9_temporal_filter_apply_sse2.asm ('k') | source/libvpx/vpxenc.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698