| OLD | NEW |
| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 virtual ~VideoProcessorIntegrationTest() = default; | 144 virtual ~VideoProcessorIntegrationTest() = default; |
| 145 | 145 |
| 146 void CreateEncoderAndDecoder() { | 146 void CreateEncoderAndDecoder() { |
| 147 if (config_.hw_codec) { | 147 if (config_.hw_codec) { |
| 148 #if defined(WEBRTC_VIDEOPROCESSOR_INTEGRATIONTEST_HW_CODECS_ENABLED) | 148 #if defined(WEBRTC_VIDEOPROCESSOR_INTEGRATIONTEST_HW_CODECS_ENABLED) |
| 149 #if defined(WEBRTC_ANDROID) | 149 #if defined(WEBRTC_ANDROID) |
| 150 // In general, external codecs should be destroyed by the factories that | 150 // In general, external codecs should be destroyed by the factories that |
| 151 // allocated them. For the particular case of the Android | 151 // allocated them. For the particular case of the Android |
| 152 // MediaCodecVideo{En,De}coderFactory's, however, it turns out that it is | 152 // MediaCodecVideo{En,De}coderFactory's, however, it turns out that it is |
| 153 // fine for the std::unique_ptr to destroy the owned codec directly. | 153 // fine for the std::unique_ptr to destroy the owned codec directly. |
| 154 switch (config_.codec_settings->codecType) { | 154 switch (config_.codec_settings.codecType) { |
| 155 case kVideoCodecH264: | 155 case kVideoCodecH264: |
| 156 encoder_.reset(external_encoder_factory_->CreateVideoEncoder( | 156 encoder_.reset(external_encoder_factory_->CreateVideoEncoder( |
| 157 cricket::VideoCodec(cricket::kH264CodecName))); | 157 cricket::VideoCodec(cricket::kH264CodecName))); |
| 158 decoder_.reset( | 158 decoder_.reset( |
| 159 external_decoder_factory_->CreateVideoDecoder(kVideoCodecH264)); | 159 external_decoder_factory_->CreateVideoDecoder(kVideoCodecH264)); |
| 160 break; | 160 break; |
| 161 case kVideoCodecVP8: | 161 case kVideoCodecVP8: |
| 162 encoder_.reset(external_encoder_factory_->CreateVideoEncoder( | 162 encoder_.reset(external_encoder_factory_->CreateVideoEncoder( |
| 163 cricket::VideoCodec(cricket::kVp8CodecName))); | 163 cricket::VideoCodec(cricket::kVp8CodecName))); |
| 164 decoder_.reset( | 164 decoder_.reset( |
| 165 external_decoder_factory_->CreateVideoDecoder(kVideoCodecVP8)); | 165 external_decoder_factory_->CreateVideoDecoder(kVideoCodecVP8)); |
| 166 break; | 166 break; |
| 167 case kVideoCodecVP9: | 167 case kVideoCodecVP9: |
| 168 encoder_.reset(external_encoder_factory_->CreateVideoEncoder( | 168 encoder_.reset(external_encoder_factory_->CreateVideoEncoder( |
| 169 cricket::VideoCodec(cricket::kVp9CodecName))); | 169 cricket::VideoCodec(cricket::kVp9CodecName))); |
| 170 decoder_.reset( | 170 decoder_.reset( |
| 171 external_decoder_factory_->CreateVideoDecoder(kVideoCodecVP9)); | 171 external_decoder_factory_->CreateVideoDecoder(kVideoCodecVP9)); |
| 172 break; | 172 break; |
| 173 default: | 173 default: |
| 174 RTC_NOTREACHED(); | 174 RTC_NOTREACHED(); |
| 175 break; | 175 break; |
| 176 } | 176 } |
| 177 #elif defined(WEBRTC_IOS) | 177 #elif defined(WEBRTC_IOS) |
| 178 ASSERT_EQ(kVideoCodecH264, config_.codec_settings->codecType) | 178 ASSERT_EQ(kVideoCodecH264, config_.codec_settings.codecType) |
| 179 << "iOS HW codecs only support H264."; | 179 << "iOS HW codecs only support H264."; |
| 180 std::unique_ptr<cricket::WebRtcVideoEncoderFactory> encoder_factory = | 180 std::unique_ptr<cricket::WebRtcVideoEncoderFactory> encoder_factory = |
| 181 CreateObjCEncoderFactory(); | 181 CreateObjCEncoderFactory(); |
| 182 std::unique_ptr<cricket::WebRtcVideoDecoderFactory> decoder_factory = | 182 std::unique_ptr<cricket::WebRtcVideoDecoderFactory> decoder_factory = |
| 183 CreateObjCDecoderFactory(); | 183 CreateObjCDecoderFactory(); |
| 184 cricket::VideoCodec codecInfo = encoder_factory->supported_codecs().at(0); | 184 cricket::VideoCodec codecInfo = encoder_factory->supported_codecs().at(0); |
| 185 encoder_.reset(encoder_factory->CreateVideoEncoder(codecInfo)); | 185 encoder_.reset(encoder_factory->CreateVideoEncoder(codecInfo)); |
| 186 decoder_.reset(decoder_factory->CreateVideoDecoder(kVideoCodecH264)); | 186 decoder_.reset(decoder_factory->CreateVideoDecoder(kVideoCodecH264)); |
| 187 #else | 187 #else |
| 188 RTC_NOTREACHED() << "Only support HW codecs on Android and iOS."; | 188 RTC_NOTREACHED() << "Only support HW codecs on Android and iOS."; |
| 189 #endif | 189 #endif |
| 190 #endif // WEBRTC_VIDEOPROCESSOR_INTEGRATIONTEST_HW_CODECS_ENABLED | 190 #endif // WEBRTC_VIDEOPROCESSOR_INTEGRATIONTEST_HW_CODECS_ENABLED |
| 191 RTC_CHECK(encoder_) << "HW encoder not successfully created."; | 191 RTC_CHECK(encoder_) << "HW encoder not successfully created."; |
| 192 RTC_CHECK(decoder_) << "HW decoder not successfully created."; | 192 RTC_CHECK(decoder_) << "HW decoder not successfully created."; |
| 193 return; | 193 return; |
| 194 } | 194 } |
| 195 | 195 |
| 196 // SW codecs. | 196 // SW codecs. |
| 197 switch (config_.codec_settings->codecType) { | 197 switch (config_.codec_settings.codecType) { |
| 198 case kVideoCodecH264: | 198 case kVideoCodecH264: |
| 199 encoder_.reset( | 199 encoder_.reset( |
| 200 H264Encoder::Create(cricket::VideoCodec(cricket::kH264CodecName))); | 200 H264Encoder::Create(cricket::VideoCodec(cricket::kH264CodecName))); |
| 201 decoder_.reset(H264Decoder::Create()); | 201 decoder_.reset(H264Decoder::Create()); |
| 202 break; | 202 break; |
| 203 case kVideoCodecVP8: | 203 case kVideoCodecVP8: |
| 204 encoder_.reset(VP8Encoder::Create()); | 204 encoder_.reset(VP8Encoder::Create()); |
| 205 decoder_.reset(VP8Decoder::Create()); | 205 decoder_.reset(VP8Decoder::Create()); |
| 206 break; | 206 break; |
| 207 case kVideoCodecVP9: | 207 case kVideoCodecVP9: |
| 208 encoder_.reset(VP9Encoder::Create()); | 208 encoder_.reset(VP9Encoder::Create()); |
| 209 decoder_.reset(VP9Decoder::Create()); | 209 decoder_.reset(VP9Decoder::Create()); |
| 210 break; | 210 break; |
| 211 default: | 211 default: |
| 212 RTC_NOTREACHED(); | 212 RTC_NOTREACHED(); |
| 213 break; | 213 break; |
| 214 } | 214 } |
| 215 } | 215 } |
| 216 | 216 |
| 217 void SetUpObjects(const VisualizationParams* visualization_params) { | 217 void SetUpObjects(const VisualizationParams* visualization_params) { |
| 218 CreateEncoderAndDecoder(); | 218 CreateEncoderAndDecoder(); |
| 219 | 219 |
| 220 // Create file objects for quality analysis. | 220 // Create file objects for quality analysis. |
| 221 analysis_frame_reader_.reset(new test::YuvFrameReaderImpl( | 221 analysis_frame_reader_.reset(new test::YuvFrameReaderImpl( |
| 222 config_.input_filename, config_.codec_settings->width, | 222 config_.input_filename, config_.codec_settings.width, |
| 223 config_.codec_settings->height)); | 223 config_.codec_settings.height)); |
| 224 analysis_frame_writer_.reset(new test::YuvFrameWriterImpl( | 224 analysis_frame_writer_.reset(new test::YuvFrameWriterImpl( |
| 225 config_.output_filename, config_.codec_settings->width, | 225 config_.output_filename, config_.codec_settings.width, |
| 226 config_.codec_settings->height)); | 226 config_.codec_settings.height)); |
| 227 RTC_CHECK(analysis_frame_reader_->Init()); | 227 RTC_CHECK(analysis_frame_reader_->Init()); |
| 228 RTC_CHECK(analysis_frame_writer_->Init()); | 228 RTC_CHECK(analysis_frame_writer_->Init()); |
| 229 | 229 |
| 230 if (visualization_params) { | 230 if (visualization_params) { |
| 231 // clang-format off | 231 // clang-format off |
| 232 const std::string output_filename_base = | 232 const std::string output_filename_base = |
| 233 test::OutputPath() + config_.filename + | 233 test::OutputPath() + config_.filename + |
| 234 "_cd-" + CodecTypeToPayloadName( | 234 "_cd-" + CodecTypeToPayloadName( |
| 235 config_.codec_settings->codecType).value_or("") + | 235 config_.codec_settings.codecType).value_or("") + |
| 236 "_hw-" + std::to_string(config_.hw_codec) + | 236 "_hw-" + std::to_string(config_.hw_codec) + |
| 237 "_br-" + std::to_string( | 237 "_br-" + std::to_string( |
| 238 static_cast<int>(config_.codec_settings->startBitrate)); | 238 static_cast<int>(config_.codec_settings.startBitrate)); |
| 239 // clang-format on | 239 // clang-format on |
| 240 if (visualization_params->save_encoded_ivf) { | 240 if (visualization_params->save_encoded_ivf) { |
| 241 rtc::File post_encode_file = | 241 rtc::File post_encode_file = |
| 242 rtc::File::Create(output_filename_base + "_encoded.ivf"); | 242 rtc::File::Create(output_filename_base + "_encoded.ivf"); |
| 243 encoded_frame_writer_ = | 243 encoded_frame_writer_ = |
| 244 IvfFileWriter::Wrap(std::move(post_encode_file), 0); | 244 IvfFileWriter::Wrap(std::move(post_encode_file), 0); |
| 245 } | 245 } |
| 246 if (visualization_params->save_decoded_y4m) { | 246 if (visualization_params->save_decoded_y4m) { |
| 247 decoded_frame_writer_.reset(new test::Y4mFrameWriterImpl( | 247 decoded_frame_writer_.reset(new test::Y4mFrameWriterImpl( |
| 248 output_filename_base + "_decoded.y4m", | 248 output_filename_base + "_decoded.y4m", config_.codec_settings.width, |
| 249 config_.codec_settings->width, config_.codec_settings->height, | 249 config_.codec_settings.height, start_frame_rate_)); |
| 250 start_frame_rate_)); | |
| 251 RTC_CHECK(decoded_frame_writer_->Init()); | 250 RTC_CHECK(decoded_frame_writer_->Init()); |
| 252 } | 251 } |
| 253 } | 252 } |
| 254 | 253 |
| 255 packet_manipulator_.reset(new test::PacketManipulatorImpl( | 254 packet_manipulator_.reset(new test::PacketManipulatorImpl( |
| 256 &packet_reader_, config_.networking_config, config_.verbose)); | 255 &packet_reader_, config_.networking_config, config_.verbose)); |
| 257 processor_ = rtc::MakeUnique<VideoProcessor>( | 256 processor_ = rtc::MakeUnique<VideoProcessor>( |
| 258 encoder_.get(), decoder_.get(), analysis_frame_reader_.get(), | 257 encoder_.get(), decoder_.get(), analysis_frame_reader_.get(), |
| 259 analysis_frame_writer_.get(), packet_manipulator_.get(), config_, | 258 analysis_frame_writer_.get(), packet_manipulator_.get(), config_, |
| 260 &stats_, encoded_frame_writer_.get(), decoded_frame_writer_.get()); | 259 &stats_, encoded_frame_writer_.get(), decoded_frame_writer_.get()); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 const test::QualityMetricsResult& ssim_result, | 399 const test::QualityMetricsResult& ssim_result, |
| 401 const QualityThresholds& quality_thresholds) { | 400 const QualityThresholds& quality_thresholds) { |
| 402 EXPECT_GT(psnr_result.average, quality_thresholds.min_avg_psnr); | 401 EXPECT_GT(psnr_result.average, quality_thresholds.min_avg_psnr); |
| 403 EXPECT_GT(psnr_result.min, quality_thresholds.min_min_psnr); | 402 EXPECT_GT(psnr_result.min, quality_thresholds.min_min_psnr); |
| 404 EXPECT_GT(ssim_result.average, quality_thresholds.min_avg_ssim); | 403 EXPECT_GT(ssim_result.average, quality_thresholds.min_avg_ssim); |
| 405 EXPECT_GT(ssim_result.min, quality_thresholds.min_min_ssim); | 404 EXPECT_GT(ssim_result.min, quality_thresholds.min_min_ssim); |
| 406 } | 405 } |
| 407 | 406 |
| 408 void VerifyQpParser(int frame_number) { | 407 void VerifyQpParser(int frame_number) { |
| 409 if (!config_.hw_codec && | 408 if (!config_.hw_codec && |
| 410 (config_.codec_settings->codecType == kVideoCodecVP8 || | 409 (config_.codec_settings.codecType == kVideoCodecVP8 || |
| 411 config_.codec_settings->codecType == kVideoCodecVP9)) { | 410 config_.codec_settings.codecType == kVideoCodecVP9)) { |
| 412 EXPECT_EQ(processor_->GetQpFromEncoder(frame_number), | 411 EXPECT_EQ(processor_->GetQpFromEncoder(frame_number), |
| 413 processor_->GetQpFromBitstream(frame_number)); | 412 processor_->GetQpFromBitstream(frame_number)); |
| 414 } | 413 } |
| 415 } | 414 } |
| 416 | 415 |
| 417 int NumberOfTemporalLayers(const VideoCodec* codec_settings) { | 416 int NumberOfTemporalLayers(const VideoCodec& codec_settings) { |
| 418 if (codec_settings->codecType == kVideoCodecVP8) { | 417 if (codec_settings.codecType == kVideoCodecVP8) { |
| 419 return codec_settings->VP8().numberOfTemporalLayers; | 418 return codec_settings.VP8().numberOfTemporalLayers; |
| 420 } else if (codec_settings->codecType == kVideoCodecVP9) { | 419 } else if (codec_settings.codecType == kVideoCodecVP9) { |
| 421 return codec_settings->VP9().numberOfTemporalLayers; | 420 return codec_settings.VP9().numberOfTemporalLayers; |
| 422 } else { | 421 } else { |
| 423 return 1; | 422 return 1; |
| 424 } | 423 } |
| 425 } | 424 } |
| 426 | 425 |
| 427 // Temporal layer index corresponding to frame number, for up to 3 layers. | 426 // Temporal layer index corresponding to frame number, for up to 3 layers. |
| 428 int TemporalLayerIndexForFrame(int frame_number) { | 427 int TemporalLayerIndexForFrame(int frame_number) { |
| 429 int tl_idx = -1; | 428 int tl_idx = -1; |
| 430 switch (num_temporal_layers_) { | 429 switch (num_temporal_layers_) { |
| 431 case 1: | 430 case 1: |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 // Processes all frames in the clip and verifies the result. | 479 // Processes all frames in the clip and verifies the result. |
| 481 // TODO(brandtr): Change the second last argument to be a | 480 // TODO(brandtr): Change the second last argument to be a |
| 482 // const std::vector<RateControlThresholds>&, so we can ensure that the user | 481 // const std::vector<RateControlThresholds>&, so we can ensure that the user |
| 483 // does not expect us to do mid-clip rate updates when we are not able to, | 482 // does not expect us to do mid-clip rate updates when we are not able to, |
| 484 // e.g., when we are operating in batch mode. | 483 // e.g., when we are operating in batch mode. |
| 485 void ProcessFramesAndVerify(const QualityThresholds& quality_thresholds, | 484 void ProcessFramesAndVerify(const QualityThresholds& quality_thresholds, |
| 486 const RateProfile& rate_profile, | 485 const RateProfile& rate_profile, |
| 487 RateControlThresholds* rc_thresholds, | 486 RateControlThresholds* rc_thresholds, |
| 488 const VisualizationParams* visualization_params) { | 487 const VisualizationParams* visualization_params) { |
| 489 // Codec/config settings. | 488 // Codec/config settings. |
| 490 RTC_CHECK(config_.codec_settings); | |
| 491 num_temporal_layers_ = NumberOfTemporalLayers(config_.codec_settings); | 489 num_temporal_layers_ = NumberOfTemporalLayers(config_.codec_settings); |
| 492 config_.codec_settings->startBitrate = rate_profile.target_bit_rate[0]; | 490 config_.codec_settings.startBitrate = rate_profile.target_bit_rate[0]; |
| 493 start_frame_rate_ = rate_profile.input_frame_rate[0]; | 491 start_frame_rate_ = rate_profile.input_frame_rate[0]; |
| 494 SetUpObjects(visualization_params); | 492 SetUpObjects(visualization_params); |
| 495 // Update the temporal layers and the codec with the initial rates. | 493 // Update the temporal layers and the codec with the initial rates. |
| 496 bit_rate_ = rate_profile.target_bit_rate[0]; | 494 bit_rate_ = rate_profile.target_bit_rate[0]; |
| 497 frame_rate_ = rate_profile.input_frame_rate[0]; | 495 frame_rate_ = rate_profile.input_frame_rate[0]; |
| 498 SetTemporalLayerRates(); | 496 SetTemporalLayerRates(); |
| 499 // Set the initial target size for key frame. | 497 // Set the initial target size for key frame. |
| 500 target_size_key_frame_initial_ = | 498 target_size_key_frame_initial_ = |
| 501 0.5 * kInitialBufferSize * bit_rate_layer_[0]; | 499 0.5 * kInitialBufferSize * bit_rate_layer_[0]; |
| 502 processor_->SetRates(bit_rate_, frame_rate_); | 500 processor_->SetRates(bit_rate_, frame_rate_); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 EXPECT_TRUE(encoded_frame_writer_->Close()); | 579 EXPECT_TRUE(encoded_frame_writer_->Close()); |
| 582 } | 580 } |
| 583 if (decoded_frame_writer_) { | 581 if (decoded_frame_writer_) { |
| 584 decoded_frame_writer_->Close(); | 582 decoded_frame_writer_->Close(); |
| 585 } | 583 } |
| 586 | 584 |
| 587 // TODO(marpan): Should compute these quality metrics per SetRates update. | 585 // TODO(marpan): Should compute these quality metrics per SetRates update. |
| 588 test::QualityMetricsResult psnr_result, ssim_result; | 586 test::QualityMetricsResult psnr_result, ssim_result; |
| 589 EXPECT_EQ(0, test::I420MetricsFromFiles(config_.input_filename.c_str(), | 587 EXPECT_EQ(0, test::I420MetricsFromFiles(config_.input_filename.c_str(), |
| 590 config_.output_filename.c_str(), | 588 config_.output_filename.c_str(), |
| 591 config_.codec_settings->width, | 589 config_.codec_settings.width, |
| 592 config_.codec_settings->height, | 590 config_.codec_settings.height, |
| 593 &psnr_result, &ssim_result)); | 591 &psnr_result, &ssim_result)); |
| 594 VerifyQuality(psnr_result, ssim_result, quality_thresholds); | 592 VerifyQuality(psnr_result, ssim_result, quality_thresholds); |
| 595 stats_.PrintSummary(); | 593 stats_.PrintSummary(); |
| 596 printf("PSNR avg: %f, min: %f\nSSIM avg: %f, min: %f\n", | 594 printf("PSNR avg: %f, min: %f\nSSIM avg: %f, min: %f\n", |
| 597 psnr_result.average, psnr_result.min, ssim_result.average, | 595 psnr_result.average, psnr_result.min, ssim_result.average, |
| 598 ssim_result.min); | 596 ssim_result.min); |
| 599 printf("\n"); | 597 printf("\n"); |
| 600 | 598 |
| 601 // Remove analysis file. | 599 // Remove analysis file. |
| 602 if (remove(config_.output_filename.c_str()) < 0) { | 600 if (remove(config_.output_filename.c_str()) < 0) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 620 test::OutputPath(), "videoprocessor_integrationtest"); | 618 test::OutputPath(), "videoprocessor_integrationtest"); |
| 621 config->hw_codec = hw_codec; | 619 config->hw_codec = hw_codec; |
| 622 config->use_single_core = use_single_core; | 620 config->use_single_core = use_single_core; |
| 623 config->keyframe_interval = key_frame_interval; | 621 config->keyframe_interval = key_frame_interval; |
| 624 config->networking_config.packet_loss_probability = packet_loss_probability; | 622 config->networking_config.packet_loss_probability = packet_loss_probability; |
| 625 config->verbose = verbose_logging; | 623 config->verbose = verbose_logging; |
| 626 config->batch_mode = batch_mode; | 624 config->batch_mode = batch_mode; |
| 627 } | 625 } |
| 628 | 626 |
| 629 static void SetCodecSettings(test::TestConfig* config, | 627 static void SetCodecSettings(test::TestConfig* config, |
| 630 VideoCodec* codec_settings, | |
| 631 VideoCodecType codec_type, | 628 VideoCodecType codec_type, |
| 632 int num_temporal_layers, | 629 int num_temporal_layers, |
| 633 bool error_concealment_on, | 630 bool error_concealment_on, |
| 634 bool denoising_on, | 631 bool denoising_on, |
| 635 bool frame_dropper_on, | 632 bool frame_dropper_on, |
| 636 bool spatial_resize_on, | 633 bool spatial_resize_on, |
| 637 bool resilience_on, | 634 bool resilience_on, |
| 638 int width, | 635 int width, |
| 639 int height) { | 636 int height) { |
| 640 VideoCodingModule::Codec(codec_type, codec_settings); | 637 VideoCodingModule::Codec(codec_type, &config->codec_settings); |
| 641 config->codec_settings = codec_settings; | 638 config->codec_settings.width = width; |
| 642 config->codec_settings->width = width; | 639 config->codec_settings.height = height; |
| 643 config->codec_settings->height = height; | 640 switch (config->codec_settings.codecType) { |
| 644 switch (config->codec_settings->codecType) { | |
| 645 case kVideoCodecH264: | 641 case kVideoCodecH264: |
| 646 config->codec_settings->H264()->frameDroppingOn = frame_dropper_on; | 642 config->codec_settings.H264()->frameDroppingOn = frame_dropper_on; |
| 647 config->codec_settings->H264()->keyFrameInterval = | 643 config->codec_settings.H264()->keyFrameInterval = kBaseKeyFrameInterval; |
| 648 kBaseKeyFrameInterval; | |
| 649 break; | 644 break; |
| 650 case kVideoCodecVP8: | 645 case kVideoCodecVP8: |
| 651 config->codec_settings->VP8()->errorConcealmentOn = | 646 config->codec_settings.VP8()->errorConcealmentOn = error_concealment_on; |
| 652 error_concealment_on; | 647 config->codec_settings.VP8()->denoisingOn = denoising_on; |
| 653 config->codec_settings->VP8()->denoisingOn = denoising_on; | 648 config->codec_settings.VP8()->numberOfTemporalLayers = |
| 654 config->codec_settings->VP8()->numberOfTemporalLayers = | |
| 655 num_temporal_layers; | 649 num_temporal_layers; |
| 656 config->codec_settings->VP8()->frameDroppingOn = frame_dropper_on; | 650 config->codec_settings.VP8()->frameDroppingOn = frame_dropper_on; |
| 657 config->codec_settings->VP8()->automaticResizeOn = spatial_resize_on; | 651 config->codec_settings.VP8()->automaticResizeOn = spatial_resize_on; |
| 658 config->codec_settings->VP8()->keyFrameInterval = kBaseKeyFrameInterval; | 652 config->codec_settings.VP8()->keyFrameInterval = kBaseKeyFrameInterval; |
| 659 config->codec_settings->VP8()->resilience = | 653 config->codec_settings.VP8()->resilience = |
| 660 resilience_on ? kResilientStream : kResilienceOff; | 654 resilience_on ? kResilientStream : kResilienceOff; |
| 661 break; | 655 break; |
| 662 case kVideoCodecVP9: | 656 case kVideoCodecVP9: |
| 663 config->codec_settings->VP9()->denoisingOn = denoising_on; | 657 config->codec_settings.VP9()->denoisingOn = denoising_on; |
| 664 config->codec_settings->VP9()->numberOfTemporalLayers = | 658 config->codec_settings.VP9()->numberOfTemporalLayers = |
| 665 num_temporal_layers; | 659 num_temporal_layers; |
| 666 config->codec_settings->VP9()->frameDroppingOn = frame_dropper_on; | 660 config->codec_settings.VP9()->frameDroppingOn = frame_dropper_on; |
| 667 config->codec_settings->VP9()->automaticResizeOn = spatial_resize_on; | 661 config->codec_settings.VP9()->automaticResizeOn = spatial_resize_on; |
| 668 config->codec_settings->VP9()->keyFrameInterval = kBaseKeyFrameInterval; | 662 config->codec_settings.VP9()->keyFrameInterval = kBaseKeyFrameInterval; |
| 669 config->codec_settings->VP9()->resilienceOn = resilience_on; | 663 config->codec_settings.VP9()->resilienceOn = resilience_on; |
| 670 break; | 664 break; |
| 671 default: | 665 default: |
| 672 RTC_NOTREACHED(); | 666 RTC_NOTREACHED(); |
| 673 break; | 667 break; |
| 674 } | 668 } |
| 675 | 669 |
| 676 config->frame_length_in_bytes = | 670 config->frame_length_in_bytes = |
| 677 CalcBufferSize(VideoType::kI420, width, height); | 671 CalcBufferSize(VideoType::kI420, width, height); |
| 678 } | 672 } |
| 679 | 673 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 702 max_key_frame_size_mismatch; | 696 max_key_frame_size_mismatch; |
| 703 rc_thresholds[update_index].max_delta_frame_size_mismatch = | 697 rc_thresholds[update_index].max_delta_frame_size_mismatch = |
| 704 max_delta_frame_size_mismatch; | 698 max_delta_frame_size_mismatch; |
| 705 rc_thresholds[update_index].max_encoding_rate_mismatch = | 699 rc_thresholds[update_index].max_encoding_rate_mismatch = |
| 706 max_encoding_rate_mismatch; | 700 max_encoding_rate_mismatch; |
| 707 rc_thresholds[update_index].max_time_hit_target = max_time_hit_target; | 701 rc_thresholds[update_index].max_time_hit_target = max_time_hit_target; |
| 708 rc_thresholds[update_index].num_spatial_resizes = num_spatial_resizes; | 702 rc_thresholds[update_index].num_spatial_resizes = num_spatial_resizes; |
| 709 rc_thresholds[update_index].num_key_frames = num_key_frames; | 703 rc_thresholds[update_index].num_key_frames = num_key_frames; |
| 710 } | 704 } |
| 711 | 705 |
| 706 // Config. |
| 707 TestConfig config_; |
| 708 |
| 712 // Codecs. | 709 // Codecs. |
| 713 std::unique_ptr<VideoEncoder> encoder_; | 710 std::unique_ptr<VideoEncoder> encoder_; |
| 714 std::unique_ptr<cricket::WebRtcVideoEncoderFactory> external_encoder_factory_; | 711 std::unique_ptr<cricket::WebRtcVideoEncoderFactory> external_encoder_factory_; |
| 715 std::unique_ptr<VideoDecoder> decoder_; | 712 std::unique_ptr<VideoDecoder> decoder_; |
| 716 std::unique_ptr<cricket::WebRtcVideoDecoderFactory> external_decoder_factory_; | 713 std::unique_ptr<cricket::WebRtcVideoDecoderFactory> external_decoder_factory_; |
| 717 VideoCodec codec_settings_; | |
| 718 | 714 |
| 719 // Helper objects. | 715 // Helper objects. |
| 720 std::unique_ptr<test::FrameReader> analysis_frame_reader_; | 716 std::unique_ptr<test::FrameReader> analysis_frame_reader_; |
| 721 std::unique_ptr<test::FrameWriter> analysis_frame_writer_; | 717 std::unique_ptr<test::FrameWriter> analysis_frame_writer_; |
| 722 test::PacketReader packet_reader_; | 718 test::PacketReader packet_reader_; |
| 723 std::unique_ptr<test::PacketManipulator> packet_manipulator_; | 719 std::unique_ptr<test::PacketManipulator> packet_manipulator_; |
| 724 test::Stats stats_; | 720 test::Stats stats_; |
| 725 test::TestConfig config_; | |
| 726 // Must be destroyed before |encoder_| and |decoder_|. | 721 // Must be destroyed before |encoder_| and |decoder_|. |
| 727 std::unique_ptr<test::VideoProcessor> processor_; | 722 std::unique_ptr<test::VideoProcessor> processor_; |
| 728 | 723 |
| 729 // Visualization objects. | 724 // Visualization objects. |
| 730 std::unique_ptr<IvfFileWriter> encoded_frame_writer_; | 725 std::unique_ptr<IvfFileWriter> encoded_frame_writer_; |
| 731 std::unique_ptr<test::FrameWriter> decoded_frame_writer_; | 726 std::unique_ptr<test::FrameWriter> decoded_frame_writer_; |
| 732 | 727 |
| 733 // Quantities defined/updated for every encoder rate update. | 728 // Quantities defined/updated for every encoder rate update. |
| 734 int num_frames_per_update_[kMaxNumTemporalLayers]; | 729 int num_frames_per_update_[kMaxNumTemporalLayers]; |
| 735 float sum_frame_size_mismatch_[kMaxNumTemporalLayers]; | 730 float sum_frame_size_mismatch_[kMaxNumTemporalLayers]; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 753 int start_frame_rate_; | 748 int start_frame_rate_; |
| 754 | 749 |
| 755 // Codec and network settings. | 750 // Codec and network settings. |
| 756 int num_temporal_layers_; | 751 int num_temporal_layers_; |
| 757 }; | 752 }; |
| 758 | 753 |
| 759 } // namespace test | 754 } // namespace test |
| 760 } // namespace webrtc | 755 } // namespace webrtc |
| 761 | 756 |
| 762 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_INTEGRATIONTES
T_H_ | 757 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_INTEGRATIONTES
T_H_ |
| OLD | NEW |