OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "media/base/video_frame.h" | |
6 #include "remoting/base/codec_test.h" | |
7 #include "remoting/base/decoder_vp8.h" | |
8 #include "remoting/base/encoder_vp8.h" | |
9 #include "testing/gtest/include/gtest/gtest.h" | |
10 | |
11 namespace remoting { | |
12 | |
13 class DecoderVp8Test : public testing::Test { | |
14 protected: | |
15 EncoderVp8 encoder_; | |
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); | |
30 } | |
31 | |
32 // Check that encoding and decoding a particular frame doesn't change the | |
33 // frame too much. The frame used is a gradient, which does not contain sharp | |
34 // transitions, so encoding lossiness should not be too high. | |
35 TEST_F(DecoderVp8Test, Gradient) { | |
36 TestGradient(320, 240, 320, 240, 0.03, 0.01); | |
37 } | |
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 // The maximum error is non-deterministic. The mean error is not too high, | |
61 // which suggests that the problem is restricted to a small area of the output | |
62 // image. See crbug.com/139437 and crbug.com/139633. | |
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); | |
72 } | |
73 | |
74 } // namespace remoting | |
OLD | NEW |