Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / remoting / codec / video_encoder_vpx_perftest.cc
blob3dc4ef16ebcc6d243dba090c5a4365428be7c00a
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "remoting/codec/video_encoder_vpx.h"
7 #include <limits>
8 #include <vector>
10 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "remoting/codec/codec_test.h"
13 #include "testing/gtest/include/gtest/gtest.h"
14 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
16 using webrtc::DesktopSize;
18 namespace remoting {
20 // Measure the performance of the VP8 encoder.
21 TEST(VideoEncoderVpxTest, MeasureVp8Fps) {
22 scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8());
24 const DesktopSize kFrameSizes[] = {
25 DesktopSize(1280, 1024), DesktopSize(1920, 1200)
28 for (size_t i = 0; i < arraysize(kFrameSizes); ++i) {
29 float fps =
30 MeasureVideoEncoderFpsWithSize(encoder.get(), kFrameSizes[i]);
31 LOG(ERROR) << kFrameSizes[i].width() << "x" << kFrameSizes[i].height()
32 << ": " << fps << "fps";
36 // Measure the performance of the VP9 encoder.
37 TEST(VideoEncoderVpxTest, MeasureVp9Fps) {
38 const DesktopSize kFrameSizes[] = {
39 DesktopSize(1280, 1024), DesktopSize(1920, 1200)
42 for (int lossless_mode = 0; lossless_mode < 4; ++lossless_mode) {
43 bool lossless_color = lossless_mode & 1;
44 bool lossless_encode = lossless_mode & 2;
46 scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP9());
47 encoder->SetLosslessColor(lossless_color);
48 encoder->SetLosslessEncode(lossless_encode);
50 for (size_t i = 0; i < arraysize(kFrameSizes); ++i) {
51 float fps =
52 MeasureVideoEncoderFpsWithSize(encoder.get(), kFrameSizes[i]);
53 LOG(ERROR) << kFrameSizes[i].width() << "x" << kFrameSizes[i].height()
54 << "(" << (lossless_encode ? "lossless" : "lossy ") << ")"
55 << "(" << (lossless_color ? "I444" : "I420") << ")"
56 << ": " << fps << "fps";
61 } // namespace remoting