OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC 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 |
| 11 #include <memory> |
| 12 |
11 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
12 #include "webrtc/base/checks.h" | 14 #include "webrtc/base/checks.h" |
13 #include "webrtc/base/scoped_ptr.h" | |
14 #include "webrtc/common_video/include/video_image.h" | 15 #include "webrtc/common_video/include/video_image.h" |
15 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 16 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
16 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" | 17 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" |
17 #include "webrtc/system_wrappers/include/tick_util.h" | 18 #include "webrtc/system_wrappers/include/tick_util.h" |
18 #include "webrtc/test/testsupport/fileutils.h" | 19 #include "webrtc/test/testsupport/fileutils.h" |
19 #include "webrtc/test/testsupport/metrics/video_metrics.h" | 20 #include "webrtc/test/testsupport/metrics/video_metrics.h" |
20 #include "webrtc/tools/simple_command_line_parser.h" | 21 #include "webrtc/tools/simple_command_line_parser.h" |
21 #include "webrtc/video_frame.h" | 22 #include "webrtc/video_frame.h" |
22 | 23 |
23 class Vp8SequenceCoderEncodeCallback : public webrtc::EncodedImageCallback { | 24 class Vp8SequenceCoderEncodeCallback : public webrtc::EncodedImageCallback { |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 inst.width = width; | 141 inst.width = width; |
141 inst.height = height; | 142 inst.height = height; |
142 | 143 |
143 if (encoder->InitEncode(&inst, 1, 1440) < 0) { | 144 if (encoder->InitEncode(&inst, 1, 1440) < 0) { |
144 fprintf(stderr, "Error: Cannot initialize vp8 encoder\n"); | 145 fprintf(stderr, "Error: Cannot initialize vp8 encoder\n"); |
145 return -1; | 146 return -1; |
146 } | 147 } |
147 EXPECT_EQ(0, decoder->InitDecode(&inst, 1)); | 148 EXPECT_EQ(0, decoder->InitDecode(&inst, 1)); |
148 webrtc::VideoFrame input_frame; | 149 webrtc::VideoFrame input_frame; |
149 size_t length = webrtc::CalcBufferSize(webrtc::kI420, width, height); | 150 size_t length = webrtc::CalcBufferSize(webrtc::kI420, width, height); |
150 rtc::scoped_ptr<uint8_t[]> frame_buffer(new uint8_t[length]); | 151 std::unique_ptr<uint8_t[]> frame_buffer(new uint8_t[length]); |
151 | 152 |
152 int half_width = (width + 1) / 2; | 153 int half_width = (width + 1) / 2; |
153 // Set and register callbacks. | 154 // Set and register callbacks. |
154 Vp8SequenceCoderEncodeCallback encoder_callback(encoded_file); | 155 Vp8SequenceCoderEncodeCallback encoder_callback(encoded_file); |
155 encoder->RegisterEncodeCompleteCallback(&encoder_callback); | 156 encoder->RegisterEncodeCompleteCallback(&encoder_callback); |
156 Vp8SequenceCoderDecodeCallback decoder_callback(output_file); | 157 Vp8SequenceCoderDecodeCallback decoder_callback(output_file); |
157 decoder->RegisterDecodeCompleteCallback(&decoder_callback); | 158 decoder->RegisterDecodeCompleteCallback(&decoder_callback); |
158 // Read->Encode->Decode sequence. | 159 // Read->Encode->Decode sequence. |
159 // num_frames = -1 implies unlimited encoding (entire sequence). | 160 // num_frames = -1 implies unlimited encoding (entire sequence). |
160 int64_t starttime = webrtc::TickTime::MillisecondTimestamp(); | 161 int64_t starttime = webrtc::TickTime::MillisecondTimestamp(); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 | 237 |
237 parser.ProcessFlags(); | 238 parser.ProcessFlags(); |
238 if (parser.GetFlag("help") == "true") { | 239 if (parser.GetFlag("help") == "true") { |
239 parser.PrintUsageMessage(); | 240 parser.PrintUsageMessage(); |
240 exit(EXIT_SUCCESS); | 241 exit(EXIT_SUCCESS); |
241 } | 242 } |
242 parser.PrintEnteredFlags(); | 243 parser.PrintEnteredFlags(); |
243 | 244 |
244 return SequenceCoder(&parser); | 245 return SequenceCoder(&parser); |
245 } | 246 } |
OLD | NEW |