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