| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "remoting/codec/video_encoder_vpx.h" | 5 #include "remoting/codec/video_encoder_vpx.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 for (int x = 0; x < frame_size.width(); ++x) { | 31 for (int x = 0; x < frame_size.width(); ++x) { |
| 32 for (int y = 0; y < frame_size.height(); ++y) { | 32 for (int y = 0; y < frame_size.height(); ++y) { |
| 33 uint8_t* pixel_u8 = frame->data() + (y * frame->stride()) + | 33 uint8_t* pixel_u8 = frame->data() + (y * frame->stride()) + |
| 34 (x * webrtc::DesktopFrame::kBytesPerPixel); | 34 (x * webrtc::DesktopFrame::kBytesPerPixel); |
| 35 *(reinterpret_cast<uint32_t*>(pixel_u8)) = | 35 *(reinterpret_cast<uint32_t*>(pixel_u8)) = |
| 36 ((x + y) & 1) ? kGreenColor : kBlueColor; | 36 ((x + y) & 1) ? kGreenColor : kBlueColor; |
| 37 } | 37 } |
| 38 } | 38 } |
| 39 frame->mutable_updated_region()->SetRect( | 39 frame->mutable_updated_region()->SetRect( |
| 40 webrtc::DesktopRect::MakeSize(frame_size)); | 40 webrtc::DesktopRect::MakeSize(frame_size)); |
| 41 return frame.Pass(); | 41 return frame; |
| 42 } | 42 } |
| 43 | 43 |
| 44 TEST(VideoEncoderVpxTest, Vp8) { | 44 TEST(VideoEncoderVpxTest, Vp8) { |
| 45 scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8()); | 45 scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP8()); |
| 46 TestVideoEncoder(encoder.get(), false); | 46 TestVideoEncoder(encoder.get(), false); |
| 47 } | 47 } |
| 48 | 48 |
| 49 TEST(VideoEncoderVpxTest, Vp9) { | 49 TEST(VideoEncoderVpxTest, Vp9) { |
| 50 scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP9()); | 50 scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP9()); |
| 51 // VP9 encoder defaults to lossless encode and lossy (I420) color. | 51 // VP9 encoder defaults to lossless encode and lossy (I420) color. |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 177 |
| 178 TEST(VideoEncoderVpxTest, Vp9LossyUnchangedFrame) { | 178 TEST(VideoEncoderVpxTest, Vp9LossyUnchangedFrame) { |
| 179 scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP9()); | 179 scoped_ptr<VideoEncoderVpx> encoder(VideoEncoderVpx::CreateForVP9()); |
| 180 encoder->SetLosslessEncode(false); | 180 encoder->SetLosslessEncode(false); |
| 181 // Expect that VP9+CR should generate no more than 10 top-off frames | 181 // Expect that VP9+CR should generate no more than 10 top-off frames |
| 182 // per cycle, and take no more than 2 cycles to top-off. | 182 // per cycle, and take no more than 2 cycles to top-off. |
| 183 TestVideoEncoderEmptyFrames(encoder.get(), 20); | 183 TestVideoEncoderEmptyFrames(encoder.get(), 20); |
| 184 } | 184 } |
| 185 | 185 |
| 186 } // namespace remoting | 186 } // namespace remoting |
| OLD | NEW |