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

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

Issue 2700493006: Add optional visualization file writers to VideoProcessor tests. (Closed)
Patch Set: kjellander comments 2. 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"
23 #include "webrtc/test/testsupport/frame_reader.h" 24 #include "webrtc/test/testsupport/frame_reader.h"
24 #include "webrtc/test/testsupport/frame_writer.h" 25 #include "webrtc/test/testsupport/frame_writer.h"
25 26
26 namespace webrtc { 27 namespace webrtc {
27 28
28 class VideoBitrateAllocator; 29 class VideoBitrateAllocator;
29 30
30 namespace test { 31 namespace test {
31 32
32 // Defines which frame types shall be excluded from packet loss and when. 33 // Defines which frame types shall be excluded from packet loss and when.
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 virtual int NumberDroppedFrames() = 0; 155 virtual int NumberDroppedFrames() = 0;
155 156
156 // Return the number of spatial resizes. 157 // Return the number of spatial resizes.
157 virtual int NumberSpatialResizes() = 0; 158 virtual int NumberSpatialResizes() = 0;
158 }; 159 };
159 160
160 class VideoProcessorImpl : public VideoProcessor { 161 class VideoProcessorImpl : public VideoProcessor {
161 public: 162 public:
162 VideoProcessorImpl(webrtc::VideoEncoder* encoder, 163 VideoProcessorImpl(webrtc::VideoEncoder* encoder,
163 webrtc::VideoDecoder* decoder, 164 webrtc::VideoDecoder* decoder,
164 FrameReader* frame_reader, 165 FrameReader* analysis_frame_reader,
165 FrameWriter* frame_writer, 166 FrameWriter* analysis_frame_writer,
166 PacketManipulator* packet_manipulator, 167 PacketManipulator* packet_manipulator,
167 const TestConfig& config, 168 const TestConfig& config,
168 Stats* stats); 169 Stats* stats,
170 FrameWriter* source_frame_writer,
171 IvfFileWriter* encoded_frame_writer,
172 FrameWriter* decoded_frame_writer);
169 virtual ~VideoProcessorImpl(); 173 virtual ~VideoProcessorImpl();
170 bool Init() override; 174 bool Init() override;
171 bool ProcessFrame(int frame_number) override; 175 bool ProcessFrame(int frame_number) override;
172 176
173 private: 177 private:
174 // Callback class required to implement according to the VideoEncoder API. 178 // Callback class required to implement according to the VideoEncoder API.
175 class VideoProcessorEncodeCompleteCallback 179 class VideoProcessorEncodeCompleteCallback
176 : public webrtc::EncodedImageCallback { 180 : public webrtc::EncodedImageCallback {
177 public: 181 public:
178 explicit VideoProcessorEncodeCompleteCallback(VideoProcessorImpl* vp) 182 explicit VideoProcessorEncodeCompleteCallback(VideoProcessorImpl* vp)
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 245
242 // Return the number of dropped frames. 246 // Return the number of dropped frames.
243 int NumberDroppedFrames() override; 247 int NumberDroppedFrames() override;
244 248
245 // Return the number of spatial resizes. 249 // Return the number of spatial resizes.
246 int NumberSpatialResizes() override; 250 int NumberSpatialResizes() override;
247 251
248 webrtc::VideoEncoder* const encoder_; 252 webrtc::VideoEncoder* const encoder_;
249 webrtc::VideoDecoder* const decoder_; 253 webrtc::VideoDecoder* const decoder_;
250 std::unique_ptr<VideoBitrateAllocator> bitrate_allocator_; 254 std::unique_ptr<VideoBitrateAllocator> bitrate_allocator_;
251 FrameReader* const frame_reader_; 255 // These (mandatory) file manipulators are used for, e.g., objective PSNR and
252 FrameWriter* const frame_writer_; 256 // SSIM calculations at the end of a test run.
257 FrameReader* const analysis_frame_reader_;
258 FrameWriter* const analysis_frame_writer_;
253 PacketManipulator* const packet_manipulator_; 259 PacketManipulator* const packet_manipulator_;
254 const TestConfig& config_; 260 const TestConfig& config_;
255 Stats* stats_; 261 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_;
256 271
272 // Adapters for the codec callbacks.
257 std::unique_ptr<EncodedImageCallback> encode_callback_; 273 std::unique_ptr<EncodedImageCallback> encode_callback_;
258 std::unique_ptr<DecodedImageCallback> decode_callback_; 274 std::unique_ptr<DecodedImageCallback> decode_callback_;
259 275
260 // Keep track of the last successful frame, since we need to write that 276 // Keep track of the last successful frame, since we need to write that
261 // when decoding fails. 277 // when decoding fails.
262 std::unique_ptr<uint8_t[]> last_successful_frame_buffer_; 278 std::unique_ptr<uint8_t[]> last_successful_frame_buffer_;
263 // To keep track of if we have excluded the first key frame from packet loss. 279 // To keep track of if we have excluded the first key frame from packet loss.
264 bool first_key_frame_has_been_excluded_; 280 bool first_key_frame_has_been_excluded_;
265 // To tell the decoder previous frame have been dropped due to packet loss. 281 // To tell the decoder previous frame have been dropped due to packet loss.
266 bool last_frame_missing_; 282 bool last_frame_missing_;
(...skipping 10 matching lines...) Expand all
277 // Statistics. 293 // Statistics.
278 double bit_rate_factor_; // Multiply frame length with this to get bit rate. 294 double bit_rate_factor_; // Multiply frame length with this to get bit rate.
279 int64_t encode_start_ns_; 295 int64_t encode_start_ns_;
280 int64_t decode_start_ns_; 296 int64_t decode_start_ns_;
281 }; 297 };
282 298
283 } // namespace test 299 } // namespace test
284 } // namespace webrtc 300 } // namespace webrtc
285 301
286 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_H_ 302 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698