From c287c80781cca3dcdbb7399903908a9d1c11968c Mon Sep 17 00:00:00 2001 From: brandtr Date: Mon, 7 Aug 2017 08:30:43 -0700 Subject: [PATCH] Remove source file writer from VideoProcessor. It serves a very limited purpose: converting from the input YUV file to an output Y4M file. The experimenter can do this manually, if this is of interest. (It is generally not.) BUG=webrtc:6634 Review-Url: https://codereview.webrtc.org/2993063002 Cr-Commit-Position: refs/heads/master@{#19257} --- .../test/plot_videoprocessor_integrationtest.cc | 1 - .../video_coding/codecs/test/videoprocessor.cc | 12 ------------ .../video_coding/codecs/test/videoprocessor.h | 12 ++++-------- .../codecs/test/videoprocessor_integrationtest.h | 14 +------------- .../codecs/test/videoprocessor_unittest.cc | 3 +-- .../codecs/tools/video_quality_measurement.cc | 4 ++-- 6 files changed, 8 insertions(+), 38 deletions(-) diff --git a/webrtc/modules/video_coding/codecs/test/plot_videoprocessor_integrationtest.cc b/webrtc/modules/video_coding/codecs/test/plot_videoprocessor_integrationtest.cc index cb1578bce0..c57b822ee4 100644 --- a/webrtc/modules/video_coding/codecs/test/plot_videoprocessor_integrationtest.cc +++ b/webrtc/modules/video_coding/codecs/test/plot_videoprocessor_integrationtest.cc @@ -35,7 +35,6 @@ const bool kBatchMode = true; const float kPacketLoss = 0.0f; const VisualizationParams kVisualizationParams = { - false, // save_source_y4m false, // save_encoded_ivf false, // save_decoded_y4m }; diff --git a/webrtc/modules/video_coding/codecs/test/videoprocessor.cc b/webrtc/modules/video_coding/codecs/test/videoprocessor.cc index 5b2c4c081b..55303b82a2 100644 --- a/webrtc/modules/video_coding/codecs/test/videoprocessor.cc +++ b/webrtc/modules/video_coding/codecs/test/videoprocessor.cc @@ -112,7 +112,6 @@ VideoProcessor::VideoProcessor(webrtc::VideoEncoder* encoder, PacketManipulator* packet_manipulator, const TestConfig& config, Stats* stats, - FrameWriter* source_frame_writer, IvfFileWriter* encoded_frame_writer, FrameWriter* decoded_frame_writer) : encoder_(encoder), @@ -124,7 +123,6 @@ VideoProcessor::VideoProcessor(webrtc::VideoEncoder* encoder, config_(config), analysis_frame_reader_(analysis_frame_reader), analysis_frame_writer_(analysis_frame_writer), - source_frame_writer_(source_frame_writer), encoded_frame_writer_(encoded_frame_writer), decoded_frame_writer_(decoded_frame_writer), initialized_(false), @@ -210,16 +208,6 @@ bool VideoProcessor::ProcessFrame(int frame_number) { return false; } - if (source_frame_writer_) { - size_t length = - CalcBufferSize(VideoType::kI420, buffer->width(), buffer->height()); - rtc::Buffer extracted_buffer(length); - int extracted_length = - ExtractBuffer(buffer, length, extracted_buffer.data()); - RTC_DCHECK_EQ(extracted_length, source_frame_writer_->FrameLength()); - RTC_CHECK(source_frame_writer_->WriteFrame(extracted_buffer.data())); - } - uint32_t timestamp = FrameNumberToTimestamp(frame_number); VideoFrame source_frame(buffer, timestamp, 0, webrtc::kVideoRotation_0); diff --git a/webrtc/modules/video_coding/codecs/test/videoprocessor.h b/webrtc/modules/video_coding/codecs/test/videoprocessor.h index f939009c8d..56c70541e7 100644 --- a/webrtc/modules/video_coding/codecs/test/videoprocessor.h +++ b/webrtc/modules/video_coding/codecs/test/videoprocessor.h @@ -145,7 +145,6 @@ class VideoProcessor { PacketManipulator* packet_manipulator, const TestConfig& config, Stats* stats, - FrameWriter* source_frame_writer, IvfFileWriter* encoded_frame_writer, FrameWriter* decoded_frame_writer); ~VideoProcessor(); @@ -287,13 +286,10 @@ class VideoProcessor { FrameReader* const analysis_frame_reader_; FrameWriter* const analysis_frame_writer_; - // These (optional) file writers are used for persistently storing the output - // of the coding pipeline at different stages: pre encode (source), post - // encode (encoded), and post decode (decoded). The purpose is to give the - // experimenter an option to subjectively evaluate the quality of the - // encoding, given the test settings. Each frame writer is enabled by being - // non-null. - FrameWriter* const source_frame_writer_; + // These (optional) file writers are used to persistently store the encoded + // and decoded bitstreams. The purpose is to give the experimenter an option + // to subjectively evaluate the quality of the processing. Each frame writer + // is enabled by being non-null. IvfFileWriter* const encoded_frame_writer_; FrameWriter* const decoded_frame_writer_; diff --git a/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.h b/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.h index 1dad49c9d7..c13d714353 100644 --- a/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.h +++ b/webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.h @@ -105,7 +105,6 @@ struct RateControlThresholds { // Should video files be saved persistently to disk for post-run visualization? struct VisualizationParams { - bool save_source_y4m; bool save_encoded_ivf; bool save_decoded_y4m; }; @@ -238,12 +237,6 @@ class VideoProcessorIntegrationTest : public testing::Test { "_br-" + std::to_string( static_cast(config_.codec_settings->startBitrate)); // clang-format on - if (visualization_params->save_source_y4m) { - source_frame_writer_.reset(new test::Y4mFrameWriterImpl( - output_filename_base + "_source.y4m", config_.codec_settings->width, - config_.codec_settings->height, start_frame_rate_)); - RTC_CHECK(source_frame_writer_->Init()); - } if (visualization_params->save_encoded_ivf) { rtc::File post_encode_file = rtc::File::Create(output_filename_base + "_encoded.ivf"); @@ -264,8 +257,7 @@ class VideoProcessorIntegrationTest : public testing::Test { processor_ = rtc::MakeUnique( encoder_.get(), decoder_.get(), analysis_frame_reader_.get(), analysis_frame_writer_.get(), packet_manipulator_.get(), config_, - &stats_, source_frame_writer_.get(), encoded_frame_writer_.get(), - decoded_frame_writer_.get()); + &stats_, encoded_frame_writer_.get(), decoded_frame_writer_.get()); processor_->Init(); } @@ -585,9 +577,6 @@ class VideoProcessorIntegrationTest : public testing::Test { analysis_frame_writer_->Close(); // Close visualization files. - if (source_frame_writer_) { - source_frame_writer_->Close(); - } if (encoded_frame_writer_) { EXPECT_TRUE(encoded_frame_writer_->Close()); } @@ -738,7 +727,6 @@ class VideoProcessorIntegrationTest : public testing::Test { std::unique_ptr processor_; // Visualization objects. - std::unique_ptr source_frame_writer_; std::unique_ptr encoded_frame_writer_; std::unique_ptr decoded_frame_writer_; diff --git a/webrtc/modules/video_coding/codecs/test/videoprocessor_unittest.cc b/webrtc/modules/video_coding/codecs/test/videoprocessor_unittest.cc index 96e20377b9..47e27d72f4 100644 --- a/webrtc/modules/video_coding/codecs/test/videoprocessor_unittest.cc +++ b/webrtc/modules/video_coding/codecs/test/videoprocessor_unittest.cc @@ -59,8 +59,7 @@ class VideoProcessorTest : public testing::Test { video_processor_ = rtc::MakeUnique( &encoder_mock_, &decoder_mock_, &frame_reader_mock_, &frame_writer_mock_, &packet_manipulator_mock_, config_, &stats_, - nullptr /* source_frame_writer */, nullptr /* encoded_frame_writer */, - nullptr /* decoded_frame_writer */); + nullptr /* encoded_frame_writer */, nullptr /* decoded_frame_writer */); } void ExpectInit() { diff --git a/webrtc/modules/video_coding/codecs/tools/video_quality_measurement.cc b/webrtc/modules/video_coding/codecs/tools/video_quality_measurement.cc index 1b90c67899..95d1b1c759 100644 --- a/webrtc/modules/video_coding/codecs/tools/video_quality_measurement.cc +++ b/webrtc/modules/video_coding/codecs/tools/video_quality_measurement.cc @@ -508,8 +508,8 @@ int main(int argc, char* argv[]) { } webrtc::test::VideoProcessor* processor = new webrtc::test::VideoProcessor( encoder, decoder, &frame_reader, &frame_writer, &packet_manipulator, - config, &stats, nullptr /* source_frame_writer */, - nullptr /* encoded_frame_writer */, nullptr /* decoded_frame_writer */); + config, &stats, nullptr /* encoded_frame_writer */, + nullptr /* decoded_frame_writer */); processor->Init(); int frame_number = 0;