OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <deque> | 5 #include <deque> |
6 #include <iostream> | 6 #include <iostream> |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 | 9 |
10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/string_number_conversions.h" | 13 #include "base/string_number_conversions.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 #include "media/base/callback.h" | 15 #include "media/base/callback.h" |
16 #include "media/base/video_frame.h" | 16 #include "media/base/video_frame.h" |
17 #include "media/tools/shader_bench/cpu_color_painter.h" | 17 #include "media/tools/shader_bench/cpu_color_painter.h" |
18 #include "media/tools/shader_bench/gpu_color_painter.h" | 18 #include "media/tools/shader_bench/gpu_color_painter.h" |
19 #include "media/tools/shader_bench/gpu_color_painter_exp.h" | 19 #include "media/tools/shader_bench/gpu_color_painter_exp.h" |
20 #include "media/tools/shader_bench/painter.h" | 20 #include "media/tools/shader_bench/painter.h" |
21 #include "media/tools/shader_bench/window.h" | 21 #include "media/tools/shader_bench/window.h" |
22 #include "ui/gfx/gl/gl_bindings.h" | 22 #include "ui/gfx/gl/gl_bindings.h" |
23 #include "ui/gfx/gl/gl_context.h" | 23 #include "ui/gfx/gl/gl_context.h" |
24 #include "ui/gfx/gl/gl_implementation.h" | 24 #include "ui/gfx/gl/gl_implementation.h" |
25 #include "ui/gfx/gl/gl_surface.h" | 25 #include "ui/gfx/gl/gl_surface.h" |
26 #include "ui/gfx/native_widget_types.h" | 26 #include "ui/gfx/native_widget_types.h" |
27 | 27 |
28 #if defined(OS_LINUX) | 28 #if defined(TOOLKIT_USES_GTK) |
29 #include <gtk/gtk.h> | 29 #include <gtk/gtk.h> |
30 #endif | 30 #endif |
31 | 31 |
32 static const int kNumFramesToPaint = 500; | 32 static const int kNumFramesToPaint = 500; |
33 static base::TimeTicks g_start_; | 33 static base::TimeTicks g_start_; |
34 static base::TimeTicks g_end_; | 34 static base::TimeTicks g_end_; |
35 | 35 |
36 long CalculateYUVFrameSize(FILE* file_handle, int num_frames) { | 36 long CalculateYUVFrameSize(FILE* file_handle, int num_frames) { |
37 fseek(file_handle, 0, SEEK_END); | 37 fseek(file_handle, 0, SEEK_END); |
38 long file_size = (long) ftell(file_handle); | 38 long file_size = (long) ftell(file_handle); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // Read arguments. | 91 // Read arguments. |
92 if (argc == 1) { | 92 if (argc == 1) { |
93 printf("Usage: %s --file=FILE --wxh=DIMENSIONS --frames=NUM_FRAMES\n" | 93 printf("Usage: %s --file=FILE --wxh=DIMENSIONS --frames=NUM_FRAMES\n" |
94 "FILE is a raw .yuv file with 1+ frames in it\n" | 94 "FILE is a raw .yuv file with 1+ frames in it\n" |
95 "DIMENSIONS is the width and height of the frame in pixels\n" | 95 "DIMENSIONS is the width and height of the frame in pixels\n" |
96 "NUM_FRAMES is the number of frames in FILE\n", argv[0]); | 96 "NUM_FRAMES is the number of frames in FILE\n", argv[0]); |
97 return 1; | 97 return 1; |
98 } | 98 } |
99 | 99 |
100 // Read command line. | 100 // Read command line. |
101 #if defined(OS_LINUX) | 101 #if defined(TOOLKIT_USES_GTK) |
102 gtk_init(&argc, &argv); | 102 gtk_init(&argc, &argv); |
103 #endif | 103 #endif |
104 CommandLine::Init(argc, argv); | 104 CommandLine::Init(argc, argv); |
105 | 105 |
106 // Determine file name. | 106 // Determine file name. |
107 std::string file_name = | 107 std::string file_name = |
108 CommandLine::ForCurrentProcess()->GetSwitchValueASCII("file"); | 108 CommandLine::ForCurrentProcess()->GetSwitchValueASCII("file"); |
109 | 109 |
110 // Determine number of frames. | 110 // Determine number of frames. |
111 int num_frames = 0; | 111 int num_frames = 0; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 scoped_ptr<GPUPainter> painter(painters[i].painter); | 156 scoped_ptr<GPUPainter> painter(painters[i].painter); |
157 painter->LoadFrames(&frames); | 157 painter->LoadFrames(&frames); |
158 painter->SetGLContext(surface, context); | 158 painter->SetGLContext(surface, context); |
159 painter->Initialize(width, height); | 159 painter->Initialize(width, height); |
160 printf("Running %s tests...", painters[i].name); | 160 printf("Running %s tests...", painters[i].name); |
161 RunTest(window.get(), painter.get()); | 161 RunTest(window.get(), painter.get()); |
162 } | 162 } |
163 | 163 |
164 return 0; | 164 return 0; |
165 } | 165 } |
OLD | NEW |