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

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

Issue 2993063002: Remove source file writer from VideoProcessor. (Closed)
Patch Set: video_quality_measurement updates. Created 3 years, 4 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
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 int max_key_frame_size_mismatch; 98 int max_key_frame_size_mismatch;
99 int max_delta_frame_size_mismatch; 99 int max_delta_frame_size_mismatch;
100 int max_encoding_rate_mismatch; 100 int max_encoding_rate_mismatch;
101 int max_time_hit_target; 101 int max_time_hit_target;
102 int num_spatial_resizes; // Set to -1 to disable check. 102 int num_spatial_resizes; // Set to -1 to disable check.
103 int num_key_frames; // Set to -1 to disable check. 103 int num_key_frames; // Set to -1 to disable check.
104 }; 104 };
105 105
106 // Should video files be saved persistently to disk for post-run visualization? 106 // Should video files be saved persistently to disk for post-run visualization?
107 struct VisualizationParams { 107 struct VisualizationParams {
108 bool save_source_y4m;
109 bool save_encoded_ivf; 108 bool save_encoded_ivf;
110 bool save_decoded_y4m; 109 bool save_decoded_y4m;
111 }; 110 };
112 111
113 #if !defined(WEBRTC_IOS) 112 #if !defined(WEBRTC_IOS)
114 const int kNumFramesShort = 100; 113 const int kNumFramesShort = 100;
115 #endif 114 #endif
116 const int kNumFramesLong = 299; 115 const int kNumFramesLong = 299;
117 116
118 // Parameters from VP8 wrapper, which control target size of key frames. 117 // Parameters from VP8 wrapper, which control target size of key frames.
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 if (visualization_params) { 230 if (visualization_params) {
232 // clang-format off 231 // clang-format off
233 const std::string output_filename_base = 232 const std::string output_filename_base =
234 test::OutputPath() + config_.filename + 233 test::OutputPath() + config_.filename +
235 "_cd-" + CodecTypeToPayloadName( 234 "_cd-" + CodecTypeToPayloadName(
236 config_.codec_settings->codecType).value_or("") + 235 config_.codec_settings->codecType).value_or("") +
237 "_hw-" + std::to_string(config_.hw_codec) + 236 "_hw-" + std::to_string(config_.hw_codec) +
238 "_br-" + std::to_string( 237 "_br-" + std::to_string(
239 static_cast<int>(config_.codec_settings->startBitrate)); 238 static_cast<int>(config_.codec_settings->startBitrate));
240 // clang-format on 239 // clang-format on
241 if (visualization_params->save_source_y4m) {
242 source_frame_writer_.reset(new test::Y4mFrameWriterImpl(
243 output_filename_base + "_source.y4m", config_.codec_settings->width,
244 config_.codec_settings->height, start_frame_rate_));
245 RTC_CHECK(source_frame_writer_->Init());
246 }
247 if (visualization_params->save_encoded_ivf) { 240 if (visualization_params->save_encoded_ivf) {
248 rtc::File post_encode_file = 241 rtc::File post_encode_file =
249 rtc::File::Create(output_filename_base + "_encoded.ivf"); 242 rtc::File::Create(output_filename_base + "_encoded.ivf");
250 encoded_frame_writer_ = 243 encoded_frame_writer_ =
251 IvfFileWriter::Wrap(std::move(post_encode_file), 0); 244 IvfFileWriter::Wrap(std::move(post_encode_file), 0);
252 } 245 }
253 if (visualization_params->save_decoded_y4m) { 246 if (visualization_params->save_decoded_y4m) {
254 decoded_frame_writer_.reset(new test::Y4mFrameWriterImpl( 247 decoded_frame_writer_.reset(new test::Y4mFrameWriterImpl(
255 output_filename_base + "_decoded.y4m", 248 output_filename_base + "_decoded.y4m",
256 config_.codec_settings->width, config_.codec_settings->height, 249 config_.codec_settings->width, config_.codec_settings->height,
257 start_frame_rate_)); 250 start_frame_rate_));
258 RTC_CHECK(decoded_frame_writer_->Init()); 251 RTC_CHECK(decoded_frame_writer_->Init());
259 } 252 }
260 } 253 }
261 254
262 packet_manipulator_.reset(new test::PacketManipulatorImpl( 255 packet_manipulator_.reset(new test::PacketManipulatorImpl(
263 &packet_reader_, config_.networking_config, config_.verbose)); 256 &packet_reader_, config_.networking_config, config_.verbose));
264 processor_ = rtc::MakeUnique<VideoProcessor>( 257 processor_ = rtc::MakeUnique<VideoProcessor>(
265 encoder_.get(), decoder_.get(), analysis_frame_reader_.get(), 258 encoder_.get(), decoder_.get(), analysis_frame_reader_.get(),
266 analysis_frame_writer_.get(), packet_manipulator_.get(), config_, 259 analysis_frame_writer_.get(), packet_manipulator_.get(), config_,
267 &stats_, source_frame_writer_.get(), encoded_frame_writer_.get(), 260 &stats_, encoded_frame_writer_.get(), decoded_frame_writer_.get());
268 decoded_frame_writer_.get());
269 processor_->Init(); 261 processor_->Init();
270 } 262 }
271 263
272 // Reset quantities after each encoder update, update the target per-frame 264 // Reset quantities after each encoder update, update the target per-frame
273 // bandwidth. 265 // bandwidth.
274 void ResetRateControlMetrics(int num_frames_to_hit_target) { 266 void ResetRateControlMetrics(int num_frames_to_hit_target) {
275 for (int i = 0; i < num_temporal_layers_; i++) { 267 for (int i = 0; i < num_temporal_layers_; i++) {
276 num_frames_per_update_[i] = 0; 268 num_frames_per_update_[i] = 0;
277 sum_frame_size_mismatch_[i] = 0.0f; 269 sum_frame_size_mismatch_[i] = 0.0f;
278 sum_encoded_frame_size_[i] = 0.0f; 270 sum_encoded_frame_size_[i] = 0.0f;
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 570
579 // Release encoder and decoder to make sure they have finished processing. 571 // Release encoder and decoder to make sure they have finished processing.
580 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Release()); 572 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, encoder_->Release());
581 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, decoder_->Release()); 573 EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, decoder_->Release());
582 574
583 // Close the analysis files before we use them for SSIM/PSNR calculations. 575 // Close the analysis files before we use them for SSIM/PSNR calculations.
584 analysis_frame_reader_->Close(); 576 analysis_frame_reader_->Close();
585 analysis_frame_writer_->Close(); 577 analysis_frame_writer_->Close();
586 578
587 // Close visualization files. 579 // Close visualization files.
588 if (source_frame_writer_) {
589 source_frame_writer_->Close();
590 }
591 if (encoded_frame_writer_) { 580 if (encoded_frame_writer_) {
592 EXPECT_TRUE(encoded_frame_writer_->Close()); 581 EXPECT_TRUE(encoded_frame_writer_->Close());
593 } 582 }
594 if (decoded_frame_writer_) { 583 if (decoded_frame_writer_) {
595 decoded_frame_writer_->Close(); 584 decoded_frame_writer_->Close();
596 } 585 }
597 586
598 // TODO(marpan): Should compute these quality metrics per SetRates update. 587 // TODO(marpan): Should compute these quality metrics per SetRates update.
599 test::QualityMetricsResult psnr_result, ssim_result; 588 test::QualityMetricsResult psnr_result, ssim_result;
600 EXPECT_EQ(0, test::I420MetricsFromFiles(config_.input_filename.c_str(), 589 EXPECT_EQ(0, test::I420MetricsFromFiles(config_.input_filename.c_str(),
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 std::unique_ptr<test::FrameReader> analysis_frame_reader_; 720 std::unique_ptr<test::FrameReader> analysis_frame_reader_;
732 std::unique_ptr<test::FrameWriter> analysis_frame_writer_; 721 std::unique_ptr<test::FrameWriter> analysis_frame_writer_;
733 test::PacketReader packet_reader_; 722 test::PacketReader packet_reader_;
734 std::unique_ptr<test::PacketManipulator> packet_manipulator_; 723 std::unique_ptr<test::PacketManipulator> packet_manipulator_;
735 test::Stats stats_; 724 test::Stats stats_;
736 test::TestConfig config_; 725 test::TestConfig config_;
737 // Must be destroyed before |encoder_| and |decoder_|. 726 // Must be destroyed before |encoder_| and |decoder_|.
738 std::unique_ptr<test::VideoProcessor> processor_; 727 std::unique_ptr<test::VideoProcessor> processor_;
739 728
740 // Visualization objects. 729 // Visualization objects.
741 std::unique_ptr<test::FrameWriter> source_frame_writer_;
742 std::unique_ptr<IvfFileWriter> encoded_frame_writer_; 730 std::unique_ptr<IvfFileWriter> encoded_frame_writer_;
743 std::unique_ptr<test::FrameWriter> decoded_frame_writer_; 731 std::unique_ptr<test::FrameWriter> decoded_frame_writer_;
744 732
745 // Quantities defined/updated for every encoder rate update. 733 // Quantities defined/updated for every encoder rate update.
746 int num_frames_per_update_[kMaxNumTemporalLayers]; 734 int num_frames_per_update_[kMaxNumTemporalLayers];
747 float sum_frame_size_mismatch_[kMaxNumTemporalLayers]; 735 float sum_frame_size_mismatch_[kMaxNumTemporalLayers];
748 float sum_encoded_frame_size_[kMaxNumTemporalLayers]; 736 float sum_encoded_frame_size_[kMaxNumTemporalLayers];
749 float encoding_bitrate_[kMaxNumTemporalLayers]; 737 float encoding_bitrate_[kMaxNumTemporalLayers];
750 float per_frame_bandwidth_[kMaxNumTemporalLayers]; 738 float per_frame_bandwidth_[kMaxNumTemporalLayers];
751 float bit_rate_layer_[kMaxNumTemporalLayers]; 739 float bit_rate_layer_[kMaxNumTemporalLayers];
(...skipping 13 matching lines...) Expand all
765 int start_frame_rate_; 753 int start_frame_rate_;
766 754
767 // Codec and network settings. 755 // Codec and network settings.
768 int num_temporal_layers_; 756 int num_temporal_layers_;
769 }; 757 };
770 758
771 } // namespace test 759 } // namespace test
772 } // namespace webrtc 760 } // namespace webrtc
773 761
774 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_INTEGRATIONTES T_H_ 762 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_INTEGRATIONTES T_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698