OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // Standalone benchmarking application based on FFmpeg. This tool is used to | 5 // Standalone benchmarking application based on FFmpeg. This tool is used to |
6 // measure decoding performance between different FFmpeg compile and run-time | 6 // measure decoding performance between different FFmpeg compile and run-time |
7 // options. We also use this tool to measure performance regressions when | 7 // options. We also use this tool to measure performance regressions when |
8 // testing newer builds of FFmpeg from trunk. | 8 // testing newer builds of FFmpeg from trunk. |
9 | 9 |
10 #include <iomanip> | 10 #include <iomanip> |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 182 |
183 // Parse through the entire stream until we hit EOF. | 183 // Parse through the entire stream until we hit EOF. |
184 base::TimeTicks start = base::TimeTicks::HighResNow(); | 184 base::TimeTicks start = base::TimeTicks::HighResNow(); |
185 while (av_read_frame(format_context, &packet) >= 0) { | 185 while (av_read_frame(format_context, &packet) >= 0) { |
186 // Only decode packets from our target stream. | 186 // Only decode packets from our target stream. |
187 if (packet.stream_index == target_stream) { | 187 if (packet.stream_index == target_stream) { |
188 int result = -1; | 188 int result = -1; |
189 base::TimeTicks decode_start = base::TimeTicks::HighResNow(); | 189 base::TimeTicks decode_start = base::TimeTicks::HighResNow(); |
190 if (target_codec == CODEC_TYPE_AUDIO) { | 190 if (target_codec == CODEC_TYPE_AUDIO) { |
191 int size_out = AVCODEC_MAX_AUDIO_FRAME_SIZE; | 191 int size_out = AVCODEC_MAX_AUDIO_FRAME_SIZE; |
192 result = avcodec_decode_audio2(codec_context, samples, &size_out, | 192 result = avcodec_decode_audio3(codec_context, samples, &size_out, |
193 packet.data, packet.size); | 193 &packet); |
194 } else if (target_codec == CODEC_TYPE_VIDEO) { | 194 } else if (target_codec == CODEC_TYPE_VIDEO) { |
195 int got_picture = 0; | 195 int got_picture = 0; |
196 result = avcodec_decode_video(codec_context, frame, &got_picture, | 196 result = avcodec_decode_video2(codec_context, frame, &got_picture, |
197 packet.data, packet.size); | 197 &packet); |
198 } else { | 198 } else { |
199 NOTREACHED(); | 199 NOTREACHED(); |
200 } | 200 } |
201 base::TimeDelta delta = base::TimeTicks::HighResNow() - decode_start; | 201 base::TimeDelta delta = base::TimeTicks::HighResNow() - decode_start; |
202 decode_times.push_back(delta.InMillisecondsF()); | 202 decode_times.push_back(delta.InMillisecondsF()); |
203 | 203 |
204 // Make sure our decoding went OK. | 204 // Make sure our decoding went OK. |
205 if (result < 0) { | 205 if (result < 0) { |
206 std::cerr << "Error while decoding" << std::endl; | 206 std::cerr << "Error while decoding" << std::endl; |
207 return 1; | 207 return 1; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 std::cout << " Total:" << std::setw(10) << total.InMillisecondsF() | 242 std::cout << " Total:" << std::setw(10) << total.InMillisecondsF() |
243 << " ms" << std::endl; | 243 << " ms" << std::endl; |
244 std::cout << " Summation:" << std::setw(10) << sum | 244 std::cout << " Summation:" << std::setw(10) << sum |
245 << " ms" << std::endl; | 245 << " ms" << std::endl; |
246 std::cout << " Average:" << std::setw(10) << average | 246 std::cout << " Average:" << std::setw(10) << average |
247 << " ms" << std::endl; | 247 << " ms" << std::endl; |
248 std::cout << " StdDev:" << std::setw(10) << stddev | 248 std::cout << " StdDev:" << std::setw(10) << stddev |
249 << " ms" << std::endl; | 249 << " ms" << std::endl; |
250 return 0; | 250 return 0; |
251 } | 251 } |
OLD | NEW |