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}
This commit is contained in:
@ -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
|
||||
};
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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_;
|
||||
|
||||
|
||||
@ -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<int>(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<VideoProcessor>(
|
||||
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<test::VideoProcessor> processor_;
|
||||
|
||||
// Visualization objects.
|
||||
std::unique_ptr<test::FrameWriter> source_frame_writer_;
|
||||
std::unique_ptr<IvfFileWriter> encoded_frame_writer_;
|
||||
std::unique_ptr<test::FrameWriter> decoded_frame_writer_;
|
||||
|
||||
|
||||
@ -59,8 +59,7 @@ class VideoProcessorTest : public testing::Test {
|
||||
video_processor_ = rtc::MakeUnique<VideoProcessor>(
|
||||
&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() {
|
||||
|
||||
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user