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

Side by Side Diff: webrtc/modules/video_coding/codecs/test/videoprocessor.h

Issue 2708103002: Revert of Add optional visualization file writers to VideoProcessor tests. (Closed)
Patch Set: Created 3 years, 10 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) 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 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_H_ 11 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_H_
12 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_H_ 12 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_H_
13 13
14 #include <memory> 14 #include <memory>
15 #include <string> 15 #include <string>
16 16
17 #include "webrtc/api/video/video_frame.h" 17 #include "webrtc/api/video/video_frame.h"
18 #include "webrtc/base/checks.h" 18 #include "webrtc/base/checks.h"
19 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" 19 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
20 #include "webrtc/modules/video_coding/include/video_codec_interface.h" 20 #include "webrtc/modules/video_coding/include/video_codec_interface.h"
21 #include "webrtc/modules/video_coding/codecs/test/packet_manipulator.h" 21 #include "webrtc/modules/video_coding/codecs/test/packet_manipulator.h"
22 #include "webrtc/modules/video_coding/codecs/test/stats.h" 22 #include "webrtc/modules/video_coding/codecs/test/stats.h"
23 #include "webrtc/modules/video_coding/utility/ivf_file_writer.h"
24 #include "webrtc/test/testsupport/frame_reader.h" 23 #include "webrtc/test/testsupport/frame_reader.h"
25 #include "webrtc/test/testsupport/frame_writer.h" 24 #include "webrtc/test/testsupport/frame_writer.h"
26 25
27 namespace webrtc { 26 namespace webrtc {
28 27
29 class VideoBitrateAllocator; 28 class VideoBitrateAllocator;
30 29
31 namespace test { 30 namespace test {
32 31
33 // Defines which frame types shall be excluded from packet loss and when. 32 // Defines which frame types shall be excluded from packet loss and when.
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 virtual int NumberDroppedFrames() = 0; 154 virtual int NumberDroppedFrames() = 0;
156 155
157 // Return the number of spatial resizes. 156 // Return the number of spatial resizes.
158 virtual int NumberSpatialResizes() = 0; 157 virtual int NumberSpatialResizes() = 0;
159 }; 158 };
160 159
161 class VideoProcessorImpl : public VideoProcessor { 160 class VideoProcessorImpl : public VideoProcessor {
162 public: 161 public:
163 VideoProcessorImpl(webrtc::VideoEncoder* encoder, 162 VideoProcessorImpl(webrtc::VideoEncoder* encoder,
164 webrtc::VideoDecoder* decoder, 163 webrtc::VideoDecoder* decoder,
165 FrameReader* analysis_frame_reader, 164 FrameReader* frame_reader,
166 FrameWriter* analysis_frame_writer, 165 FrameWriter* frame_writer,
167 PacketManipulator* packet_manipulator, 166 PacketManipulator* packet_manipulator,
168 const TestConfig& config, 167 const TestConfig& config,
169 Stats* stats, 168 Stats* stats);
170 FrameWriter* source_frame_writer,
171 IvfFileWriter* encoded_frame_writer,
172 FrameWriter* decoded_frame_writer);
173 virtual ~VideoProcessorImpl(); 169 virtual ~VideoProcessorImpl();
174 bool Init() override; 170 bool Init() override;
175 bool ProcessFrame(int frame_number) override; 171 bool ProcessFrame(int frame_number) override;
176 172
177 private: 173 private:
178 // Callback class required to implement according to the VideoEncoder API. 174 // Callback class required to implement according to the VideoEncoder API.
179 class VideoProcessorEncodeCompleteCallback 175 class VideoProcessorEncodeCompleteCallback
180 : public webrtc::EncodedImageCallback { 176 : public webrtc::EncodedImageCallback {
181 public: 177 public:
182 explicit VideoProcessorEncodeCompleteCallback(VideoProcessorImpl* vp) 178 explicit VideoProcessorEncodeCompleteCallback(VideoProcessorImpl* vp)
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 241
246 // Return the number of dropped frames. 242 // Return the number of dropped frames.
247 int NumberDroppedFrames() override; 243 int NumberDroppedFrames() override;
248 244
249 // Return the number of spatial resizes. 245 // Return the number of spatial resizes.
250 int NumberSpatialResizes() override; 246 int NumberSpatialResizes() override;
251 247
252 webrtc::VideoEncoder* const encoder_; 248 webrtc::VideoEncoder* const encoder_;
253 webrtc::VideoDecoder* const decoder_; 249 webrtc::VideoDecoder* const decoder_;
254 std::unique_ptr<VideoBitrateAllocator> bitrate_allocator_; 250 std::unique_ptr<VideoBitrateAllocator> bitrate_allocator_;
255 // These (mandatory) file manipulators are used for, e.g., objective PSNR and 251 FrameReader* const frame_reader_;
256 // SSIM calculations at the end of a test run. 252 FrameWriter* const frame_writer_;
257 FrameReader* const analysis_frame_reader_;
258 FrameWriter* const analysis_frame_writer_;
259 PacketManipulator* const packet_manipulator_; 253 PacketManipulator* const packet_manipulator_;
260 const TestConfig& config_; 254 const TestConfig& config_;
261 Stats* stats_; 255 Stats* stats_;
262 // These (optional) file writers are used for persistently storing the output
263 // of the coding pipeline at different stages: pre encode (source), post
264 // encode (encoded), and post decode (decoded). The purpose is to give the
265 // experimenter an option to subjectively evaluate the quality of the
266 // encoding, given the test settings. Each frame writer is enabled by being
267 // non-null.
268 FrameWriter* const source_frame_writer_;
269 IvfFileWriter* const encoded_frame_writer_;
270 FrameWriter* const decoded_frame_writer_;
271 256
272 // Adapters for the codec callbacks.
273 std::unique_ptr<EncodedImageCallback> encode_callback_; 257 std::unique_ptr<EncodedImageCallback> encode_callback_;
274 std::unique_ptr<DecodedImageCallback> decode_callback_; 258 std::unique_ptr<DecodedImageCallback> decode_callback_;
275 259
276 // Keep track of the last successful frame, since we need to write that 260 // Keep track of the last successful frame, since we need to write that
277 // when decoding fails. 261 // when decoding fails.
278 std::unique_ptr<uint8_t[]> last_successful_frame_buffer_; 262 std::unique_ptr<uint8_t[]> last_successful_frame_buffer_;
279 // To keep track of if we have excluded the first key frame from packet loss. 263 // To keep track of if we have excluded the first key frame from packet loss.
280 bool first_key_frame_has_been_excluded_; 264 bool first_key_frame_has_been_excluded_;
281 // To tell the decoder previous frame have been dropped due to packet loss. 265 // To tell the decoder previous frame have been dropped due to packet loss.
282 bool last_frame_missing_; 266 bool last_frame_missing_;
(...skipping 10 matching lines...) Expand all
293 // Statistics. 277 // Statistics.
294 double bit_rate_factor_; // Multiply frame length with this to get bit rate. 278 double bit_rate_factor_; // Multiply frame length with this to get bit rate.
295 int64_t encode_start_ns_; 279 int64_t encode_start_ns_;
296 int64_t decode_start_ns_; 280 int64_t decode_start_ns_;
297 }; 281 };
298 282
299 } // namespace test 283 } // namespace test
300 } // namespace webrtc 284 } // namespace webrtc
301 285
302 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_H_ 286 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698