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

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

Issue 3008543002: Make rate control and quality thresholds optional in VideoProcessorIntegrationTest. (Closed)
Patch Set: asapersson comments 1. Created 3 years, 3 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_INTEGRATIONTEST_H _ 11 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_INTEGRATIONTEST_H _
12 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_INTEGRATIONTEST_H _ 12 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_INTEGRATIONTEST_H _
13 13
14 #include <math.h> 14 #include <math.h>
15 15
16 #include <limits> 16 #include <limits>
17 #include <memory> 17 #include <memory>
18 #include <string> 18 #include <string>
19 #include <utility> 19 #include <utility>
20 #include <vector>
20 21
21 #if defined(WEBRTC_ANDROID) 22 #if defined(WEBRTC_ANDROID)
22 #include "webrtc/modules/video_coding/codecs/test/android_test_initializer.h" 23 #include "webrtc/modules/video_coding/codecs/test/android_test_initializer.h"
23 #include "webrtc/sdk/android/src/jni/androidmediadecoder_jni.h" 24 #include "webrtc/sdk/android/src/jni/androidmediadecoder_jni.h"
24 #include "webrtc/sdk/android/src/jni/androidmediaencoder_jni.h" 25 #include "webrtc/sdk/android/src/jni/androidmediaencoder_jni.h"
25 #elif defined(WEBRTC_IOS) 26 #elif defined(WEBRTC_IOS)
26 #include "webrtc/modules/video_coding/codecs/test/objc_codec_h264_test.h" 27 #include "webrtc/modules/video_coding/codecs/test/objc_codec_h264_test.h"
27 #endif 28 #endif
28 29
29 #include "webrtc/media/engine/internaldecoderfactory.h" 30 #include "webrtc/media/engine/internaldecoderfactory.h"
(...skipping 28 matching lines...) Expand all
58 const int kPercTargetvsActualMismatch = 20; 59 const int kPercTargetvsActualMismatch = 20;
59 const int kBaseKeyFrameInterval = 3000; 60 const int kBaseKeyFrameInterval = 3000;
60 61
61 // Parameters from VP8 wrapper, which control target size of key frames. 62 // Parameters from VP8 wrapper, which control target size of key frames.
62 const float kInitialBufferSize = 0.5f; 63 const float kInitialBufferSize = 0.5f;
63 const float kOptimalBufferSize = 0.6f; 64 const float kOptimalBufferSize = 0.6f;
64 const float kScaleKeyFrameSize = 0.5f; 65 const float kScaleKeyFrameSize = 0.5f;
65 66
66 // Thresholds for the quality metrics. Defaults are maximally minimal. 67 // Thresholds for the quality metrics. Defaults are maximally minimal.
67 struct QualityThresholds { 68 struct QualityThresholds {
68 QualityThresholds() {}
69 QualityThresholds(double min_avg_psnr, 69 QualityThresholds(double min_avg_psnr,
70 double min_min_psnr, 70 double min_min_psnr,
71 double min_avg_ssim, 71 double min_avg_ssim,
72 double min_min_ssim) 72 double min_min_ssim)
73 : min_avg_psnr(min_avg_psnr), 73 : min_avg_psnr(min_avg_psnr),
74 min_min_psnr(min_min_psnr), 74 min_min_psnr(min_min_psnr),
75 min_avg_ssim(min_avg_ssim), 75 min_avg_ssim(min_avg_ssim),
76 min_min_ssim(min_min_ssim) {} 76 min_min_ssim(min_min_ssim) {}
77 double min_avg_psnr = std::numeric_limits<double>::min(); 77 double min_avg_psnr;
78 double min_min_psnr = std::numeric_limits<double>::min(); 78 double min_min_psnr;
79 double min_avg_ssim = 0.0; 79 double min_avg_ssim;
80 double min_min_ssim = 0.0; 80 double min_min_ssim;
81 }; 81 };
82 82
83 // The sequence of bit rate and frame rate changes for the encoder, the frame 83 // The sequence of bit rate and frame rate changes for the encoder, the frame
84 // number where the changes are made, and the total number of frames for the 84 // number where the changes are made, and the total number of frames for the
85 // test. 85 // test.
86 struct RateProfile { 86 struct RateProfile {
87 int target_bit_rate[kMaxNumRateUpdates]; 87 int target_bit_rate[kMaxNumRateUpdates];
88 int input_frame_rate[kMaxNumRateUpdates]; 88 int input_frame_rate[kMaxNumRateUpdates];
89 int frame_index_rate_update[kMaxNumRateUpdates + 1]; 89 int frame_index_rate_update[kMaxNumRateUpdates + 1];
90 int num_frames; 90 int num_frames;
91 }; 91 };
92 92
93 // Thresholds for the rate control metrics. The rate mismatch thresholds are 93 // Thresholds for the rate control metrics. The rate mismatch thresholds are
94 // defined as percentages. |max_time_hit_target| is defined as number of frames, 94 // defined as percentages. |max_time_hit_target| is defined as number of frames,
95 // after a rate update is made to the encoder, for the encoder to reach within 95 // after a rate update is made to the encoder, for the encoder to reach within
96 // |kPercTargetvsActualMismatch| of new target rate. The thresholds are defined 96 // |kPercTargetvsActualMismatch| of new target rate. The thresholds are defined
97 // for each rate update sequence. 97 // for each rate update sequence.
98 struct RateControlThresholds { 98 struct RateControlThresholds {
99 int max_num_dropped_frames; 99 int max_num_dropped_frames;
100 int max_key_frame_size_mismatch; 100 int max_key_frame_size_mismatch;
101 int max_delta_frame_size_mismatch; 101 int max_delta_frame_size_mismatch;
102 int max_encoding_rate_mismatch; 102 int max_encoding_rate_mismatch;
103 int max_time_hit_target; 103 int max_time_hit_target;
104 int num_spatial_resizes; // Set to -1 to disable check. 104 int num_spatial_resizes;
105 int num_key_frames; // Set to -1 to disable check. 105 int num_key_frames;
106 }; 106 };
107 107
108 // Should video files be saved persistently to disk for post-run visualization? 108 // Should video files be saved persistently to disk for post-run visualization?
109 struct VisualizationParams { 109 struct VisualizationParams {
110 bool save_encoded_ivf; 110 bool save_encoded_ivf;
111 bool save_decoded_y4m; 111 bool save_decoded_y4m;
112 }; 112 };
113 113
114 // Integration test for video processor. Encodes+decodes a clip and 114 // Integration test for video processor. Encodes+decodes a clip and
115 // writes it to the output directory. After completion, quality metrics 115 // writes it to the output directory. After completion, quality metrics
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 perc_encoding_rate_mismatch_ = 299 perc_encoding_rate_mismatch_ =
300 100 * fabs(encoding_bitrate_total_ - bitrate_kbps_) / bitrate_kbps_; 300 100 * fabs(encoding_bitrate_total_ - bitrate_kbps_) / bitrate_kbps_;
301 if (perc_encoding_rate_mismatch_ < kPercTargetvsActualMismatch && 301 if (perc_encoding_rate_mismatch_ < kPercTargetvsActualMismatch &&
302 !encoding_rate_within_target_) { 302 !encoding_rate_within_target_) {
303 num_frames_to_hit_target_ = num_frames_total_; 303 num_frames_to_hit_target_ = num_frames_total_;
304 encoding_rate_within_target_ = true; 304 encoding_rate_within_target_ = true;
305 } 305 }
306 } 306 }
307 307
308 // Verify expected behavior of rate control and print out data. 308 // Verify expected behavior of rate control and print out data.
309 void VerifyRateControlMetrics(int rate_update_index, 309 void PrintAndMaybeVerifyRateControlMetrics(
310 const RateControlThresholds& rc_expected) { 310 int rate_update_index,
311 const std::vector<RateControlThresholds>* rc_thresholds) {
311 int num_dropped_frames = processor_->NumberDroppedFrames(); 312 int num_dropped_frames = processor_->NumberDroppedFrames();
312 int num_resize_actions = processor_->NumberSpatialResizes(); 313 int num_resize_actions = processor_->NumberSpatialResizes();
313 printf( 314 printf(
314 "Rate update #%d:\n" 315 "Rate update #%d:\n"
315 " Target bitrate : %d\n" 316 " Target bitrate : %d\n"
316 " Encoded bitrate : %f\n" 317 " Encoded bitrate : %f\n"
317 " Frame rate : %d\n", 318 " Frame rate : %d\n",
318 rate_update_index, bitrate_kbps_, encoding_bitrate_total_, framerate_); 319 rate_update_index, bitrate_kbps_, encoding_bitrate_total_, framerate_);
319 printf( 320 printf(
320 " # processed frames : %d\n" 321 " # processed frames : %d\n"
321 " # frames to convergence: %d\n" 322 " # frames to convergence: %d\n"
322 " # dropped frames : %d\n" 323 " # dropped frames : %d\n"
323 " # spatial resizes : %d\n", 324 " # spatial resizes : %d\n",
324 num_frames_total_, num_frames_to_hit_target_, num_dropped_frames, 325 num_frames_total_, num_frames_to_hit_target_, num_dropped_frames,
325 num_resize_actions); 326 num_resize_actions);
326 327
327 EXPECT_LE(perc_encoding_rate_mismatch_, 328 const RateControlThresholds* rc_threshold = nullptr;
328 rc_expected.max_encoding_rate_mismatch); 329 if (rc_thresholds) {
330 rc_threshold = &(*rc_thresholds)[rate_update_index];
331
332 EXPECT_LE(perc_encoding_rate_mismatch_,
333 rc_threshold->max_encoding_rate_mismatch);
334 }
329 if (num_key_frames_ > 0) { 335 if (num_key_frames_ > 0) {
330 int perc_key_frame_size_mismatch = 336 int perc_key_frame_size_mismatch =
331 100 * sum_key_frame_size_mismatch_ / num_key_frames_; 337 100 * sum_key_frame_size_mismatch_ / num_key_frames_;
332 printf( 338 printf(
333 " # key frames : %d\n" 339 " # key frames : %d\n"
334 " Key frame rate mismatch: %d\n", 340 " Key frame rate mismatch: %d\n",
335 num_key_frames_, perc_key_frame_size_mismatch); 341 num_key_frames_, perc_key_frame_size_mismatch);
336 EXPECT_LE(perc_key_frame_size_mismatch, 342 if (rc_threshold) {
337 rc_expected.max_key_frame_size_mismatch); 343 EXPECT_LE(perc_key_frame_size_mismatch,
344 rc_threshold->max_key_frame_size_mismatch);
345 }
338 } 346 }
339 347
340 const int num_temporal_layers = 348 const int num_temporal_layers =
341 NumberOfTemporalLayers(config_.codec_settings); 349 NumberOfTemporalLayers(config_.codec_settings);
342 for (int i = 0; i < num_temporal_layers; i++) { 350 for (int i = 0; i < num_temporal_layers; i++) {
343 int perc_frame_size_mismatch = 351 int perc_frame_size_mismatch =
344 100 * sum_frame_size_mismatch_[i] / num_frames_per_update_[i]; 352 100 * sum_frame_size_mismatch_[i] / num_frames_per_update_[i];
345 int perc_encoding_rate_mismatch = 353 int perc_encoding_rate_mismatch =
346 100 * fabs(encoding_bitrate_[i] - bitrate_layer_[i]) / 354 100 * fabs(encoding_bitrate_[i] - bitrate_layer_[i]) /
347 bitrate_layer_[i]; 355 bitrate_layer_[i];
348 printf( 356 printf(
349 " Temporal layer #%d:\n" 357 " Temporal layer #%d:\n"
350 " Target layer bitrate : %f\n" 358 " Target layer bitrate : %f\n"
351 " Layer frame rate : %f\n" 359 " Layer frame rate : %f\n"
352 " Layer per frame bandwidth : %f\n" 360 " Layer per frame bandwidth : %f\n"
353 " Layer encoding bitrate : %f\n" 361 " Layer encoding bitrate : %f\n"
354 " Layer percent frame size mismatch : %d\n" 362 " Layer percent frame size mismatch : %d\n"
355 " Layer percent encoding rate mismatch: %d\n" 363 " Layer percent encoding rate mismatch: %d\n"
356 " # frames processed per layer : %d\n", 364 " # frames processed per layer : %d\n",
357 i, bitrate_layer_[i], framerate_layer_[i], per_frame_bandwidth_[i], 365 i, bitrate_layer_[i], framerate_layer_[i], per_frame_bandwidth_[i],
358 encoding_bitrate_[i], perc_frame_size_mismatch, 366 encoding_bitrate_[i], perc_frame_size_mismatch,
359 perc_encoding_rate_mismatch, num_frames_per_update_[i]); 367 perc_encoding_rate_mismatch, num_frames_per_update_[i]);
360 EXPECT_LE(perc_frame_size_mismatch, 368 if (rc_threshold) {
361 rc_expected.max_delta_frame_size_mismatch); 369 EXPECT_LE(perc_frame_size_mismatch,
362 EXPECT_LE(perc_encoding_rate_mismatch, 370 rc_threshold->max_delta_frame_size_mismatch);
363 rc_expected.max_encoding_rate_mismatch); 371 EXPECT_LE(perc_encoding_rate_mismatch,
372 rc_threshold->max_encoding_rate_mismatch);
373 }
364 } 374 }
365 printf("\n"); 375 printf("\n");
366 376
367 EXPECT_LE(num_frames_to_hit_target_, rc_expected.max_time_hit_target); 377 if (rc_threshold) {
368 EXPECT_LE(num_dropped_frames, rc_expected.max_num_dropped_frames); 378 EXPECT_LE(num_frames_to_hit_target_, rc_threshold->max_time_hit_target);
369 if (rc_expected.num_spatial_resizes >= 0) { 379 EXPECT_LE(num_dropped_frames, rc_threshold->max_num_dropped_frames);
370 EXPECT_EQ(rc_expected.num_spatial_resizes, num_resize_actions); 380 EXPECT_EQ(rc_threshold->num_spatial_resizes, num_resize_actions);
371 } 381 EXPECT_EQ(rc_threshold->num_key_frames, num_key_frames_);
372 if (rc_expected.num_key_frames >= 0) {
373 EXPECT_EQ(rc_expected.num_key_frames, num_key_frames_);
374 } 382 }
375 } 383 }
376 384
377 static void VerifyQuality(const QualityMetricsResult& psnr_result, 385 static void VerifyQuality(const QualityMetricsResult& psnr_result,
378 const QualityMetricsResult& ssim_result, 386 const QualityMetricsResult& ssim_result,
379 const QualityThresholds& quality_thresholds) { 387 const QualityThresholds& quality_thresholds) {
380 EXPECT_GT(psnr_result.average, quality_thresholds.min_avg_psnr); 388 EXPECT_GT(psnr_result.average, quality_thresholds.min_avg_psnr);
381 EXPECT_GT(psnr_result.min, quality_thresholds.min_min_psnr); 389 EXPECT_GT(psnr_result.min, quality_thresholds.min_min_psnr);
382 EXPECT_GT(ssim_result.average, quality_thresholds.min_avg_ssim); 390 EXPECT_GT(ssim_result.average, quality_thresholds.min_avg_ssim);
383 EXPECT_GT(ssim_result.min, quality_thresholds.min_min_ssim); 391 EXPECT_GT(ssim_result.min, quality_thresholds.min_min_ssim);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 } 460 }
453 framerate_layer_[i] = 461 framerate_layer_[i] =
454 framerate_ / static_cast<float>(1 << (num_temporal_layers - 1)); 462 framerate_ / static_cast<float>(1 << (num_temporal_layers - 1));
455 } 463 }
456 if (num_temporal_layers == 3) { 464 if (num_temporal_layers == 3) {
457 framerate_layer_[2] = framerate_ / 2.0f; 465 framerate_layer_[2] = framerate_ / 2.0f;
458 } 466 }
459 } 467 }
460 468
461 // Processes all frames in the clip and verifies the result. 469 // Processes all frames in the clip and verifies the result.
462 // TODO(brandtr): Change the second last argument to be a 470 void ProcessFramesAndMaybeVerify(
463 // const std::vector<RateControlThresholds>&, so we can ensure that the user 471 const RateProfile& rate_profile,
464 // does not expect us to do mid-clip rate updates when we are not able to, 472 const std::vector<RateControlThresholds>* rc_thresholds,
465 // e.g., when we are operating in batch mode. 473 const QualityThresholds* quality_thresholds,
466 void ProcessFramesAndVerify(const QualityThresholds& quality_thresholds, 474 const VisualizationParams* visualization_params) {
467 const RateProfile& rate_profile,
468 RateControlThresholds* rc_thresholds,
469 const VisualizationParams* visualization_params) {
470 config_.codec_settings.startBitrate = rate_profile.target_bit_rate[0]; 475 config_.codec_settings.startBitrate = rate_profile.target_bit_rate[0];
471 SetUpObjects(visualization_params, rate_profile.target_bit_rate[0], 476 SetUpObjects(visualization_params, rate_profile.target_bit_rate[0],
472 rate_profile.input_frame_rate[0]); 477 rate_profile.input_frame_rate[0]);
473 478
474 // Set initial rates. 479 // Set initial rates.
475 bitrate_kbps_ = rate_profile.target_bit_rate[0]; 480 bitrate_kbps_ = rate_profile.target_bit_rate[0];
476 framerate_ = rate_profile.input_frame_rate[0]; 481 framerate_ = rate_profile.input_frame_rate[0];
477 SetTemporalLayerRates(); 482 SetTemporalLayerRates();
478 // Set the initial target size for key frame. 483 // Set the initial target size for key frame.
479 target_size_key_frame_initial_ = 484 target_size_key_frame_initial_ =
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 ++num_frames_per_update_[tl_idx]; 524 ++num_frames_per_update_[tl_idx];
520 ++num_frames_total_; 525 ++num_frames_total_;
521 UpdateRateControlMetrics(frame_number); 526 UpdateRateControlMetrics(frame_number);
522 527
523 ++frame_number; 528 ++frame_number;
524 529
525 // If we hit another/next update, verify stats for current state and 530 // If we hit another/next update, verify stats for current state and
526 // update layers and codec with new rates. 531 // update layers and codec with new rates.
527 if (frame_number == 532 if (frame_number ==
528 rate_profile.frame_index_rate_update[update_index + 1]) { 533 rate_profile.frame_index_rate_update[update_index + 1]) {
529 VerifyRateControlMetrics(update_index, rc_thresholds[update_index]); 534 PrintAndMaybeVerifyRateControlMetrics(update_index, rc_thresholds);
530 535
531 // Update layer rates and the codec with new rates. 536 // Update layer rates and the codec with new rates.
532 ++update_index; 537 ++update_index;
533 bitrate_kbps_ = rate_profile.target_bit_rate[update_index]; 538 bitrate_kbps_ = rate_profile.target_bit_rate[update_index];
534 framerate_ = rate_profile.input_frame_rate[update_index]; 539 framerate_ = rate_profile.input_frame_rate[update_index];
535 SetTemporalLayerRates(); 540 SetTemporalLayerRates();
536 ResetRateControlMetrics( 541 ResetRateControlMetrics(
537 rate_profile.frame_index_rate_update[update_index + 1]); 542 rate_profile.frame_index_rate_update[update_index + 1]);
538 processor_->SetRates(bitrate_kbps_, framerate_); 543 processor_->SetRates(bitrate_kbps_, framerate_);
539 } 544 }
540 } 545 }
541 // TODO(brandtr): Refactor "frame number accounting" so we don't have to 546 // TODO(brandtr): Refactor "frame number accounting" so we don't have to
542 // call ProcessFrame one extra time here. 547 // call ProcessFrame one extra time here.
543 processor_->ProcessFrame(frame_number); 548 processor_->ProcessFrame(frame_number);
544 } 549 }
545 550
546 // Verify rate control metrics for all frames (if in batch mode), or for all 551 // Verify rate control metrics for all frames (if in batch mode), or for all
547 // frames since the last rate update (if not in batch mode). 552 // frames since the last rate update (if not in batch mode).
548 VerifyRateControlMetrics(update_index, rc_thresholds[update_index]); 553 PrintAndMaybeVerifyRateControlMetrics(update_index, rc_thresholds);
549 EXPECT_EQ(num_frames, frame_number); 554 EXPECT_EQ(num_frames, frame_number);
550 EXPECT_EQ(num_frames + 1, static_cast<int>(stats_.stats_.size())); 555 EXPECT_EQ(num_frames + 1, static_cast<int>(stats_.stats_.size()));
551 556
552 // Release encoder and decoder to make sure they have finished processing. 557 // Release encoder and decoder to make sure they have finished processing.
553 processor_->Release(); 558 processor_->Release();
554 DestroyEncoderAndDecoder(); 559 DestroyEncoderAndDecoder();
555 560
556 // Close the analysis files before we use them for SSIM/PSNR calculations. 561 // Close the analysis files before we use them for SSIM/PSNR calculations.
557 analysis_frame_reader_->Close(); 562 analysis_frame_reader_->Close();
558 analysis_frame_writer_->Close(); 563 analysis_frame_writer_->Close();
559 564
560 // Close visualization files. 565 // Close visualization files.
561 if (encoded_frame_writer_) { 566 if (encoded_frame_writer_) {
562 EXPECT_TRUE(encoded_frame_writer_->Close()); 567 EXPECT_TRUE(encoded_frame_writer_->Close());
563 } 568 }
564 if (decoded_frame_writer_) { 569 if (decoded_frame_writer_) {
565 decoded_frame_writer_->Close(); 570 decoded_frame_writer_->Close();
566 } 571 }
567 572
568 // TODO(marpan): Should compute these quality metrics per SetRates update. 573 // TODO(marpan): Should compute these quality metrics per SetRates update.
569 QualityMetricsResult psnr_result, ssim_result; 574 QualityMetricsResult psnr_result, ssim_result;
570 EXPECT_EQ(0, I420MetricsFromFiles(config_.input_filename.c_str(), 575 EXPECT_EQ(0, I420MetricsFromFiles(config_.input_filename.c_str(),
571 config_.output_filename.c_str(), 576 config_.output_filename.c_str(),
572 config_.codec_settings.width, 577 config_.codec_settings.width,
573 config_.codec_settings.height, 578 config_.codec_settings.height,
574 &psnr_result, &ssim_result)); 579 &psnr_result, &ssim_result));
575 VerifyQuality(psnr_result, ssim_result, quality_thresholds); 580 if (quality_thresholds) {
581 VerifyQuality(psnr_result, ssim_result, *quality_thresholds);
582 }
576 stats_.PrintSummary(); 583 stats_.PrintSummary();
577 printf("PSNR avg: %f, min: %f\nSSIM avg: %f, min: %f\n", 584 printf("PSNR avg: %f, min: %f\nSSIM avg: %f, min: %f\n",
578 psnr_result.average, psnr_result.min, ssim_result.average, 585 psnr_result.average, psnr_result.min, ssim_result.average,
579 ssim_result.min); 586 ssim_result.min);
580 printf("\n"); 587 printf("\n");
581 588
582 // Remove analysis file. 589 // Remove analysis file.
583 if (remove(config_.output_filename.c_str()) < 0) { 590 if (remove(config_.output_filename.c_str()) < 0) {
584 fprintf(stderr, "Failed to remove temporary file!\n"); 591 fprintf(stderr, "Failed to remove temporary file!\n");
585 } 592 }
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 int rate_update_index, 662 int rate_update_index,
656 int bitrate_kbps, 663 int bitrate_kbps,
657 int framerate_fps, 664 int framerate_fps,
658 int frame_index_rate_update) { 665 int frame_index_rate_update) {
659 rate_profile->target_bit_rate[rate_update_index] = bitrate_kbps; 666 rate_profile->target_bit_rate[rate_update_index] = bitrate_kbps;
660 rate_profile->input_frame_rate[rate_update_index] = framerate_fps; 667 rate_profile->input_frame_rate[rate_update_index] = framerate_fps;
661 rate_profile->frame_index_rate_update[rate_update_index] = 668 rate_profile->frame_index_rate_update[rate_update_index] =
662 frame_index_rate_update; 669 frame_index_rate_update;
663 } 670 }
664 671
665 static void SetRateControlThresholds(RateControlThresholds* rc_thresholds, 672 static void AddRateControlThresholds(
666 int update_index, 673 int max_num_dropped_frames,
667 int max_num_dropped_frames, 674 int max_key_frame_size_mismatch,
668 int max_key_frame_size_mismatch, 675 int max_delta_frame_size_mismatch,
669 int max_delta_frame_size_mismatch, 676 int max_encoding_rate_mismatch,
670 int max_encoding_rate_mismatch, 677 int max_time_hit_target,
671 int max_time_hit_target, 678 int num_spatial_resizes,
672 int num_spatial_resizes, 679 int num_key_frames,
673 int num_key_frames) { 680 std::vector<RateControlThresholds>* rc_thresholds) {
674 rc_thresholds[update_index].max_num_dropped_frames = max_num_dropped_frames; 681 RTC_DCHECK(rc_thresholds);
675 rc_thresholds[update_index].max_key_frame_size_mismatch = 682
676 max_key_frame_size_mismatch; 683 rc_thresholds->emplace_back();
677 rc_thresholds[update_index].max_delta_frame_size_mismatch = 684 RateControlThresholds* rc_threshold = &rc_thresholds->back();
678 max_delta_frame_size_mismatch; 685 rc_threshold->max_num_dropped_frames = max_num_dropped_frames;
679 rc_thresholds[update_index].max_encoding_rate_mismatch = 686 rc_threshold->max_key_frame_size_mismatch = max_key_frame_size_mismatch;
680 max_encoding_rate_mismatch; 687 rc_threshold->max_delta_frame_size_mismatch = max_delta_frame_size_mismatch;
681 rc_thresholds[update_index].max_time_hit_target = max_time_hit_target; 688 rc_threshold->max_encoding_rate_mismatch = max_encoding_rate_mismatch;
682 rc_thresholds[update_index].num_spatial_resizes = num_spatial_resizes; 689 rc_threshold->max_time_hit_target = max_time_hit_target;
683 rc_thresholds[update_index].num_key_frames = num_key_frames; 690 rc_threshold->num_spatial_resizes = num_spatial_resizes;
691 rc_threshold->num_key_frames = num_key_frames;
684 } 692 }
685 693
686 // Config. 694 // Config.
687 TestConfig config_; 695 TestConfig config_;
688 696
689 // Codecs. 697 // Codecs.
690 std::unique_ptr<cricket::WebRtcVideoEncoderFactory> encoder_factory_; 698 std::unique_ptr<cricket::WebRtcVideoEncoderFactory> encoder_factory_;
691 VideoEncoder* encoder_; 699 VideoEncoder* encoder_;
692 std::unique_ptr<cricket::WebRtcVideoDecoderFactory> decoder_factory_; 700 std::unique_ptr<cricket::WebRtcVideoDecoderFactory> decoder_factory_;
693 VideoDecoder* decoder_; 701 VideoDecoder* decoder_;
(...skipping 27 matching lines...) Expand all
721 float target_size_key_frame_initial_; 729 float target_size_key_frame_initial_;
722 float target_size_key_frame_; 730 float target_size_key_frame_;
723 float sum_key_frame_size_mismatch_; 731 float sum_key_frame_size_mismatch_;
724 int num_key_frames_; 732 int num_key_frames_;
725 }; 733 };
726 734
727 } // namespace test 735 } // namespace test
728 } // namespace webrtc 736 } // namespace webrtc
729 737
730 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_INTEGRATIONTES T_H_ 738 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_INTEGRATIONTES T_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698