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 "media/base/video_frame.h" | 5 #include "media/base/video_frame.h" |
6 #include "remoting/base/codec_test.h" | 6 #include "remoting/base/codec_test.h" |
7 #include "remoting/base/decoder_vp8.h" | 7 #include "remoting/base/decoder_vp8.h" |
8 #include "remoting/base/encoder_vp8.h" | 8 #include "remoting/base/encoder_vp8.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
11 namespace remoting { | 11 namespace remoting { |
12 | 12 |
13 TEST(DecoderVp8Test, EncodeAndDecode) { | 13 class DecoderVp8Test : public testing::Test { |
14 EncoderVp8 encoder; | 14 protected: |
15 DecoderVp8 decoder; | 15 EncoderVp8 encoder_; |
16 TestEncoderDecoder(&encoder, &decoder, false); | 16 DecoderVp8 decoder_; |
| 17 |
| 18 void TestGradient(int screen_width, int screen_height, |
| 19 int view_width, int view_height, |
| 20 double max_error_limit, double mean_error_limit) { |
| 21 TestEncoderDecoderGradient(&encoder_, &decoder_, |
| 22 SkISize::Make(screen_width, screen_height), |
| 23 SkISize::Make(view_width, view_height), |
| 24 max_error_limit, mean_error_limit); |
| 25 } |
| 26 }; |
| 27 |
| 28 TEST_F(DecoderVp8Test, EncodeAndDecode) { |
| 29 TestEncoderDecoder(&encoder_, &decoder_, false); |
17 } | 30 } |
18 | 31 |
19 // Check that encoding and decoding a particular frame doesn't change the | 32 // Check that encoding and decoding a particular frame doesn't change the |
20 // frame too much. The frame used is a gradient, which does not contain sharp | 33 // frame too much. The frame used is a gradient, which does not contain sharp |
21 // transitions, so encoding lossiness should not be too high. | 34 // transitions, so encoding lossiness should not be too high. |
22 TEST(DecoderVp8Test, Gradient) { | 35 TEST_F(DecoderVp8Test, Gradient) { |
23 EncoderVp8 encoder; | 36 TestGradient(320, 240, 320, 240, 0.03, 0.01); |
24 DecoderVp8 decoder; | 37 } |
25 TestEncoderDecoderGradient(&encoder, &decoder, 0.03, 0.01); | 38 |
| 39 TEST_F(DecoderVp8Test, GradientScaleUpEvenToEven) { |
| 40 TestGradient(320, 240, 640, 480, 0.04, 0.02); |
| 41 } |
| 42 |
| 43 TEST_F(DecoderVp8Test, GradientScaleUpEvenToOdd) { |
| 44 TestGradient(320, 240, 641, 481, 0.04, 0.02); |
| 45 } |
| 46 |
| 47 TEST_F(DecoderVp8Test, GradientScaleUpOddToEven) { |
| 48 TestGradient(321, 241, 640, 480, 0.04, 0.02); |
| 49 } |
| 50 |
| 51 TEST_F(DecoderVp8Test, GradientScaleUpOddToOdd) { |
| 52 TestGradient(321, 241, 641, 481, 0.04, 0.02); |
| 53 } |
| 54 |
| 55 TEST_F(DecoderVp8Test, GradientScaleDownEvenToEven) { |
| 56 TestGradient(320, 240, 160, 120, 0.04, 0.02); |
| 57 } |
| 58 |
| 59 TEST_F(DecoderVp8Test, GradientScaleDownEvenToOdd) { |
| 60 // TODO(simonmorris): The maximum error is non-deterministic. |
| 61 // The mean error is not too high, which suggests that the problem is |
| 62 // restricted to a small area of the output image. See crbug.com/139437. |
| 63 TestGradient(320, 240, 161, 121, 1.0, 0.02); |
| 64 } |
| 65 |
| 66 TEST_F(DecoderVp8Test, GradientScaleDownOddToEven) { |
| 67 TestGradient(321, 241, 160, 120, 0.04, 0.02); |
| 68 } |
| 69 |
| 70 TEST_F(DecoderVp8Test, GradientScaleDownOddToOdd) { |
| 71 TestGradient(321, 241, 161, 121, 0.04, 0.02); |
26 } | 72 } |
27 | 73 |
28 } // namespace remoting | 74 } // namespace remoting |
OLD | NEW |