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

Side by Side Diff: webrtc/modules/video_coding/codecs/test/videoprocessor.cc

Issue 2708993005: Minor changes in videoprocessor and videoprocessor_integrationtests.h (Closed)
Patch Set: Created 3 years, 9 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 13 matching lines...) Expand all
24 #include "webrtc/modules/video_coding/include/video_codec_initializer.h" 24 #include "webrtc/modules/video_coding/include/video_codec_initializer.h"
25 #include "webrtc/modules/video_coding/utility/default_video_bitrate_allocator.h" 25 #include "webrtc/modules/video_coding/utility/default_video_bitrate_allocator.h"
26 #include "webrtc/modules/video_coding/utility/simulcast_rate_allocator.h" 26 #include "webrtc/modules/video_coding/utility/simulcast_rate_allocator.h"
27 #include "webrtc/system_wrappers/include/cpu_info.h" 27 #include "webrtc/system_wrappers/include/cpu_info.h"
28 28
29 namespace webrtc { 29 namespace webrtc {
30 namespace test { 30 namespace test {
31 31
32 namespace { 32 namespace {
33 const int k90khzTimestampFrameDiff = 3000; // Assuming 30 fps. 33 const int k90khzTimestampFrameDiff = 3000; // Assuming 30 fps.
34
35 void PrintCodecSettings(const VideoCodec* config) {
36 printf(" Start bitrate : %d kbps\n", config->startBitrate);
37 printf(" Width : %d\n", config->width);
38 printf(" Height : %d\n", config->height);
39 printf(" Codec type : %s\n",
40 CodecTypeToPayloadName(config->codecType).value_or("Unknown"));
41 if (config->codecType == kVideoCodecVP8) {
42 printf(" Denoising : %d\n", config->VP8().denoisingOn);
43 printf(" Error concealment: %d\n", config->VP8().errorConcealmentOn);
44 printf(" Frame dropping : %d\n", config->VP8().frameDroppingOn);
45 printf(" Resilience : %d\n", config->VP8().resilience);
46 } else if (config->codecType == kVideoCodecVP9) {
47 printf(" Denoising : %d\n", config->VP9().denoisingOn);
48 printf(" Frame dropping : %d\n", config->VP9().frameDroppingOn);
49 printf(" Resilience : %d\n", config->VP9().resilience);
50 }
51 }
52
53 int GetElapsedTimeMicroseconds(int64_t start_ns, int64_t stop_ns) {
54 int64_t diff_us = (stop_ns - start_ns) / rtc::kNumNanosecsPerMicrosec;
55 RTC_DCHECK_GE(diff_us, std::numeric_limits<int>::min());
56 RTC_DCHECK_LE(diff_us, std::numeric_limits<int>::max());
57 return static_cast<int>(diff_us);
58 }
34 } // namespace 59 } // namespace
35 60
36 const char* ExcludeFrameTypesToStr(ExcludeFrameTypes e) { 61 const char* ExcludeFrameTypesToStr(ExcludeFrameTypes e) {
37 switch (e) { 62 switch (e) {
38 case kExcludeOnlyFirstKeyFrame: 63 case kExcludeOnlyFirstKeyFrame:
39 return "ExcludeOnlyFirstKeyFrame"; 64 return "ExcludeOnlyFirstKeyFrame";
40 case kExcludeAllKeyFrames: 65 case kExcludeAllKeyFrames:
41 return "ExcludeAllKeyFrames"; 66 return "ExcludeAllKeyFrames";
42 default: 67 default:
43 RTC_NOTREACHED(); 68 RTC_NOTREACHED();
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 RTC_CHECK_EQ(decoder_->InitDecode(config_.codec_settings, num_cores), 170 RTC_CHECK_EQ(decoder_->InitDecode(config_.codec_settings, num_cores),
146 WEBRTC_VIDEO_CODEC_OK) 171 WEBRTC_VIDEO_CODEC_OK)
147 << "Failed to initialize VideoDecoder"; 172 << "Failed to initialize VideoDecoder";
148 173
149 if (config_.verbose) { 174 if (config_.verbose) {
150 printf("Video Processor:\n"); 175 printf("Video Processor:\n");
151 printf(" #CPU cores used : %d\n", num_cores); 176 printf(" #CPU cores used : %d\n", num_cores);
152 printf(" Total # of frames: %d\n", 177 printf(" Total # of frames: %d\n",
153 analysis_frame_reader_->NumberOfFrames()); 178 analysis_frame_reader_->NumberOfFrames());
154 printf(" Codec settings:\n"); 179 printf(" Codec settings:\n");
155 printf(" Start bitrate : %d kbps\n",
156 config_.codec_settings->startBitrate);
157 printf(" Width : %d\n", config_.codec_settings->width);
158 printf(" Height : %d\n", config_.codec_settings->height);
159 printf(" Codec type : %s\n",
160 CodecTypeToPayloadName(config_.codec_settings->codecType)
161 .value_or("Unknown"));
162 printf(" Encoder implementation name: %s\n", 180 printf(" Encoder implementation name: %s\n",
163 encoder_->ImplementationName()); 181 encoder_->ImplementationName());
164 printf(" Decoder implementation name: %s\n", 182 printf(" Decoder implementation name: %s\n",
165 decoder_->ImplementationName()); 183 decoder_->ImplementationName());
166 if (config_.codec_settings->codecType == kVideoCodecVP8) { 184 PrintCodecSettings(config_.codec_settings);
167 printf(" Denoising : %d\n",
168 config_.codec_settings->VP8()->denoisingOn);
169 printf(" Error concealment: %d\n",
170 config_.codec_settings->VP8()->errorConcealmentOn);
171 printf(" Frame dropping : %d\n",
172 config_.codec_settings->VP8()->frameDroppingOn);
173 printf(" Resilience : %d\n",
174 config_.codec_settings->VP8()->resilience);
175 } else if (config_.codec_settings->codecType == kVideoCodecVP9) {
176 printf(" Resilience : %d\n",
177 config_.codec_settings->VP9()->resilience);
178 }
179 } 185 }
180 initialized_ = true; 186 initialized_ = true;
181 return true; 187 return true;
182 } 188 }
183 189
184 VideoProcessorImpl::~VideoProcessorImpl() { 190 VideoProcessorImpl::~VideoProcessorImpl() {
185 encoder_->RegisterEncodeCompleteCallback(nullptr); 191 encoder_->RegisterEncodeCompleteCallback(nullptr);
186 decoder_->RegisterDecodeCompleteCallback(nullptr); 192 decoder_->RegisterDecodeCompleteCallback(nullptr);
187 } 193 }
188 194
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 memcpy(last_successful_frame_buffer_.get(), image_buffer.get(), 455 memcpy(last_successful_frame_buffer_.get(), image_buffer.get(),
450 extracted_length); 456 extracted_length);
451 457
452 RTC_CHECK(analysis_frame_writer_->WriteFrame(image_buffer.get())); 458 RTC_CHECK(analysis_frame_writer_->WriteFrame(image_buffer.get()));
453 if (decoded_frame_writer_) { 459 if (decoded_frame_writer_) {
454 RTC_CHECK(decoded_frame_writer_->WriteFrame(image_buffer.get())); 460 RTC_CHECK(decoded_frame_writer_->WriteFrame(image_buffer.get()));
455 } 461 }
456 } 462 }
457 } 463 }
458 464
459 int VideoProcessorImpl::GetElapsedTimeMicroseconds(int64_t start,
460 int64_t stop) {
461 int64_t encode_time = (stop - start) / rtc::kNumNanosecsPerMicrosec;
462 RTC_DCHECK_GE(encode_time, std::numeric_limits<int>::min());
463 RTC_DCHECK_LE(encode_time, std::numeric_limits<int>::max());
464 return static_cast<int>(encode_time);
465 }
466
467 } // namespace test 465 } // namespace test
468 } // namespace webrtc 466 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698