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

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

Issue 3004583002: Change frame bookkeeping in VideoProcessorIntegrationTest. (Closed)
Patch Set: 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
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 int frame_number = 0; 493 int frame_number = 0;
494 int update_index = 0; 494 int update_index = 0;
495 int num_frames = rate_profile.num_frames; 495 int num_frames = rate_profile.num_frames;
496 ResetRateControlMetrics( 496 ResetRateControlMetrics(
497 rate_profile.frame_index_rate_update[update_index + 1]); 497 rate_profile.frame_index_rate_update[update_index + 1]);
498 498
499 if (config_.batch_mode) { 499 if (config_.batch_mode) {
500 // In batch mode, we calculate the metrics for all frames after all frames 500 // In batch mode, we calculate the metrics for all frames after all frames
501 // have been sent for encoding. 501 // have been sent for encoding.
502 502
503 // TODO(brandtr): Refactor "frame number accounting" so we don't have to 503 for (frame_number = 0; frame_number < num_frames; ++frame_number) {
504 // call ProcessFrame num_frames+1 times here.
505 for (frame_number = 0; frame_number <= num_frames; ++frame_number) {
506 processor_->ProcessFrame(frame_number); 504 processor_->ProcessFrame(frame_number);
507 } 505 }
508 506
509 for (frame_number = 0; frame_number < num_frames; ++frame_number) { 507 for (frame_number = 0; frame_number < num_frames; ++frame_number) {
510 const int tl_idx = TemporalLayerIndexForFrame(frame_number); 508 const int tl_idx = TemporalLayerIndexForFrame(frame_number);
511 ++num_frames_per_update_[tl_idx]; 509 ++num_frames_per_update_[tl_idx];
512 ++num_frames_total_; 510 ++num_frames_total_;
513 UpdateRateControlMetrics(frame_number); 511 UpdateRateControlMetrics(frame_number);
514 } 512 }
515 } else { 513 } else {
(...skipping 24 matching lines...) Expand all
540 // Update layer rates and the codec with new rates. 538 // Update layer rates and the codec with new rates.
541 ++update_index; 539 ++update_index;
542 bitrate_kbps_ = rate_profile.target_bit_rate[update_index]; 540 bitrate_kbps_ = rate_profile.target_bit_rate[update_index];
543 framerate_ = rate_profile.input_frame_rate[update_index]; 541 framerate_ = rate_profile.input_frame_rate[update_index];
544 SetTemporalLayerRates(); 542 SetTemporalLayerRates();
545 ResetRateControlMetrics( 543 ResetRateControlMetrics(
546 rate_profile.frame_index_rate_update[update_index + 1]); 544 rate_profile.frame_index_rate_update[update_index + 1]);
547 processor_->SetRates(bitrate_kbps_, framerate_); 545 processor_->SetRates(bitrate_kbps_, framerate_);
548 } 546 }
549 } 547 }
550 // TODO(brandtr): Refactor "frame number accounting" so we don't have to
551 // call ProcessFrame one extra time here.
552 processor_->ProcessFrame(frame_number);
553 } 548 }
554 549
555 // Verify rate control metrics for all frames (if in batch mode), or for all 550 // Verify rate control metrics for all frames (if in batch mode), or for all
556 // frames since the last rate update (if not in batch mode). 551 // frames since the last rate update (if not in batch mode).
557 PrintAndMaybeVerifyRateControlMetrics(update_index, rc_thresholds); 552 PrintAndMaybeVerifyRateControlMetrics(update_index, rc_thresholds);
558 EXPECT_EQ(num_frames, frame_number); 553 EXPECT_EQ(num_frames, frame_number);
559 EXPECT_EQ(num_frames + 1, static_cast<int>(stats_.stats_.size())); 554 EXPECT_EQ(num_frames, static_cast<int>(stats_.stats_.size()));
560 555
561 // Release encoder and decoder to make sure they have finished processing. 556 // Release encoder and decoder to make sure they have finished processing.
562 processor_->Release(); 557 processor_->Release();
563 DestroyEncoderAndDecoder(); 558 DestroyEncoderAndDecoder();
564 559
565 // Close the analysis files before we use them for SSIM/PSNR calculations. 560 // Close the analysis files before we use them for SSIM/PSNR calculations.
566 analysis_frame_reader_->Close(); 561 analysis_frame_reader_->Close();
567 analysis_frame_writer_->Close(); 562 analysis_frame_writer_->Close();
568 563
569 // Close visualization files. 564 // Close visualization files.
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 float target_size_key_frame_initial_; 728 float target_size_key_frame_initial_;
734 float target_size_key_frame_; 729 float target_size_key_frame_;
735 float sum_key_frame_size_mismatch_; 730 float sum_key_frame_size_mismatch_;
736 int num_key_frames_; 731 int num_key_frames_;
737 }; 732 };
738 733
739 } // namespace test 734 } // namespace test
740 } // namespace webrtc 735 } // namespace webrtc
741 736
742 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_INTEGRATIONTES T_H_ 737 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_TEST_VIDEOPROCESSOR_INTEGRATIONTES T_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698