| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_decoder_vp8.h" | 5 #include "remoting/codec/video_decoder_vp8.h" |
| 6 | 6 |
| 7 #include "media/base/video_frame.h" | 7 #include "media/base/video_frame.h" |
| 8 #include "remoting/codec/codec_test.h" | 8 #include "remoting/codec/codec_test.h" |
| 9 #include "remoting/codec/video_encoder_vp8.h" | 9 #include "remoting/codec/video_encoder_vp8.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
| 11 | 12 |
| 12 namespace remoting { | 13 namespace remoting { |
| 13 | 14 |
| 14 class VideoDecoderVp8Test : public testing::Test { | 15 class VideoDecoderVp8Test : public testing::Test { |
| 15 protected: | 16 protected: |
| 16 VideoEncoderVp8 encoder_; | 17 VideoEncoderVp8 encoder_; |
| 17 VideoDecoderVp8 decoder_; | 18 VideoDecoderVp8 decoder_; |
| 18 | 19 |
| 19 void TestGradient(int screen_width, int screen_height, | 20 void TestGradient(int screen_width, int screen_height, |
| 20 int view_width, int view_height, | 21 int view_width, int view_height, |
| 21 double max_error_limit, double mean_error_limit) { | 22 double max_error_limit, double mean_error_limit) { |
| 22 TestVideoEncoderDecoderGradient(&encoder_, &decoder_, | 23 TestVideoEncoderDecoderGradient( |
| 23 SkISize::Make(screen_width, screen_height), | 24 &encoder_, &decoder_, |
| 24 SkISize::Make(view_width, view_height), | 25 webrtc::DesktopSize(screen_width, screen_height), |
| 25 max_error_limit, mean_error_limit); | 26 webrtc::DesktopSize(view_width, view_height), |
| 27 max_error_limit, mean_error_limit); |
| 26 } | 28 } |
| 27 }; | 29 }; |
| 28 | 30 |
| 29 TEST_F(VideoDecoderVp8Test, VideoEncodeAndDecode) { | 31 TEST_F(VideoDecoderVp8Test, VideoEncodeAndDecode) { |
| 30 TestVideoEncoderDecoder(&encoder_, &decoder_, false); | 32 TestVideoEncoderDecoder(&encoder_, &decoder_, false); |
| 31 } | 33 } |
| 32 | 34 |
| 33 // Check that encoding and decoding a particular frame doesn't change the | 35 // Check that encoding and decoding a particular frame doesn't change the |
| 34 // frame too much. The frame used is a gradient, which does not contain sharp | 36 // frame too much. The frame used is a gradient, which does not contain sharp |
| 35 // transitions, so encoding lossiness should not be too high. | 37 // transitions, so encoding lossiness should not be too high. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 66 | 68 |
| 67 TEST_F(VideoDecoderVp8Test, GradientScaleDownOddToEven) { | 69 TEST_F(VideoDecoderVp8Test, GradientScaleDownOddToEven) { |
| 68 TestGradient(321, 241, 160, 120, 0.04, 0.02); | 70 TestGradient(321, 241, 160, 120, 0.04, 0.02); |
| 69 } | 71 } |
| 70 | 72 |
| 71 TEST_F(VideoDecoderVp8Test, GradientScaleDownOddToOdd) { | 73 TEST_F(VideoDecoderVp8Test, GradientScaleDownOddToOdd) { |
| 72 TestGradient(321, 241, 161, 121, 0.04, 0.02); | 74 TestGradient(321, 241, 161, 121, 0.04, 0.02); |
| 73 } | 75 } |
| 74 | 76 |
| 75 } // namespace remoting | 77 } // namespace remoting |
| OLD | NEW |