| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 FrameStatistic& Stats::NewFrame(int frame_number) { | 44 FrameStatistic& Stats::NewFrame(int frame_number) { |
| 45 RTC_DCHECK_GE(frame_number, 0); | 45 RTC_DCHECK_GE(frame_number, 0); |
| 46 FrameStatistic stat; | 46 FrameStatistic stat; |
| 47 stat.frame_number = frame_number; | 47 stat.frame_number = frame_number; |
| 48 stats_.push_back(stat); | 48 stats_.push_back(stat); |
| 49 return stats_[frame_number]; | 49 return stats_[frame_number]; |
| 50 } | 50 } |
| 51 | 51 |
| 52 void Stats::PrintSummary() { | 52 void Stats::PrintSummary() { |
| 53 printf("Processing summary:\n"); | |
| 54 if (stats_.empty()) { | 53 if (stats_.empty()) { |
| 55 printf("No frame statistics have been logged yet.\n"); | 54 printf("No frame statistics have been logged yet.\n"); |
| 56 return; | 55 return; |
| 57 } | 56 } |
| 58 | 57 |
| 59 // Calculate min, max, average and total encoding time. | 58 // Calculate min, max, average and total encoding time. |
| 60 int total_encoding_time_in_us = 0; | 59 int total_encoding_time_in_us = 0; |
| 61 int total_decoding_time_in_us = 0; | 60 int total_decoding_time_in_us = 0; |
| 62 int total_qp = 0; | 61 int total_qp = 0; |
| 63 int total_qp_count = 0; | 62 int total_qp_count = 0; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 total_encoded_key_frames_lengths / num_keyframes, num_keyframes); | 137 total_encoded_key_frames_lengths / num_keyframes, num_keyframes); |
| 139 } | 138 } |
| 140 if (num_nonkeyframes > 0) { | 139 if (num_nonkeyframes > 0) { |
| 141 printf(" Average non-key frame size: %7" PRIuS " bytes (%" PRIuS | 140 printf(" Average non-key frame size: %7" PRIuS " bytes (%" PRIuS |
| 142 " frames)\n", | 141 " frames)\n", |
| 143 total_encoded_nonkey_frames_lengths / num_nonkeyframes, | 142 total_encoded_nonkey_frames_lengths / num_nonkeyframes, |
| 144 num_nonkeyframes); | 143 num_nonkeyframes); |
| 145 } | 144 } |
| 146 | 145 |
| 147 // Bitrate stats. | 146 // Bitrate stats. |
| 148 printf("Bit rates:\n"); | 147 printf("Bitrates:\n"); |
| 149 frame = std::min_element(stats_.begin(), stats_.end(), LessForBitRate); | 148 frame = std::min_element(stats_.begin(), stats_.end(), LessForBitRate); |
| 150 printf(" Min bit rate: %7d kbps (frame %d)\n", frame->bit_rate_in_kbps, | 149 printf(" Min bitrate: %7d kbps (frame %d)\n", frame->bit_rate_in_kbps, |
| 151 frame->frame_number); | 150 frame->frame_number); |
| 152 frame = std::max_element(stats_.begin(), stats_.end(), LessForBitRate); | 151 frame = std::max_element(stats_.begin(), stats_.end(), LessForBitRate); |
| 153 printf(" Max bit rate: %7d kbps (frame %d)\n", frame->bit_rate_in_kbps, | 152 printf(" Max bitrate: %7d kbps (frame %d)\n", frame->bit_rate_in_kbps, |
| 154 frame->frame_number); | 153 frame->frame_number); |
| 155 | 154 |
| 156 int avg_qp = (total_qp_count > 0) ? (total_qp / total_qp_count) : -1; | |
| 157 printf("Average QP: %d\n", avg_qp); | |
| 158 | |
| 159 printf("\n"); | 155 printf("\n"); |
| 160 printf("Total encoding time : %7d ms.\n", total_encoding_time_in_us / 1000); | 156 printf("Total encoding time : %7d ms.\n", total_encoding_time_in_us / 1000); |
| 161 printf("Total decoding time : %7d ms.\n", total_decoding_time_in_us / 1000); | 157 printf("Total decoding time : %7d ms.\n", total_decoding_time_in_us / 1000); |
| 162 printf("Total processing time: %7d ms.\n", | 158 printf("Total processing time: %7d ms.\n", |
| 163 (total_encoding_time_in_us + total_decoding_time_in_us) / 1000); | 159 (total_encoding_time_in_us + total_decoding_time_in_us) / 1000); |
| 160 |
| 161 int avg_qp = (total_qp_count > 0) ? (total_qp / total_qp_count) : -1; |
| 162 printf("Average QP: %d\n", avg_qp); |
| 164 } | 163 } |
| 165 | 164 |
| 166 } // namespace test | 165 } // namespace test |
| 167 } // namespace webrtc | 166 } // namespace webrtc |
| OLD | NEW |