Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: webrtc/modules/video_coding/codecs/vp8/reference_picture_selection_unittest.cc

Issue 1541803002: Lint fix for webrtc/modules/video_coding PART 1! (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "vpx/vpx_encoder.h" 12 #include "vpx/vpx_encoder.h"
13 #include "vpx/vp8cx.h" 13 #include "vpx/vp8cx.h"
14 #include "webrtc/modules/video_coding/codecs/vp8/reference_picture_selection.h" 14 #include "webrtc/modules/video_coding/codecs/vp8/reference_picture_selection.h"
15 15
16 using webrtc::ReferencePictureSelection; 16 using webrtc::ReferencePictureSelection;
17 17
18 // The minimum time between reference frame updates. Should match the values 18 // The minimum time between reference frame updates. Should match the values
19 // set in reference_picture_selection.h 19 // set in reference_picture_selection.h
20 static const uint32_t kMinUpdateInterval = 10; 20 static const uint32_t kMinUpdateInterval = 10;
21 // The minimum time between decoder refreshes through restricted prediction. 21 // The minimum time between decoder refreshes through restricted prediction.
22 // Should match the values set in reference_picture_selection.h 22 // Should match the values set in reference_picture_selection.h
23 static const int kRtt = 10; 23 static const int kRtt = 10;
24 24
25 static const int kNoPropagationGolden = VP8_EFLAG_NO_REF_ARF | 25 static const int kNoPropagationGolden =
26 VP8_EFLAG_NO_UPD_GF | 26 VP8_EFLAG_NO_REF_ARF | VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF;
27 VP8_EFLAG_NO_UPD_ARF; 27 static const int kNoPropagationAltRef =
28 static const int kNoPropagationAltRef = VP8_EFLAG_NO_REF_GF | 28 VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF;
29 VP8_EFLAG_NO_UPD_GF | 29 static const int kPropagateGolden = VP8_EFLAG_FORCE_GF | VP8_EFLAG_NO_UPD_ARF |
30 VP8_EFLAG_NO_UPD_ARF; 30 VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_LAST;
31 static const int kPropagateGolden = VP8_EFLAG_FORCE_GF | 31 static const int kPropagateAltRef = VP8_EFLAG_FORCE_ARF | VP8_EFLAG_NO_UPD_GF |
32 VP8_EFLAG_NO_UPD_ARF | 32 VP8_EFLAG_NO_REF_ARF |
33 VP8_EFLAG_NO_REF_GF | 33 VP8_EFLAG_NO_REF_LAST;
34 VP8_EFLAG_NO_REF_LAST; 34 static const int kRefreshFromGolden =
35 static const int kPropagateAltRef = VP8_EFLAG_FORCE_ARF | 35 VP8_EFLAG_NO_REF_LAST | VP8_EFLAG_NO_REF_ARF;
36 VP8_EFLAG_NO_UPD_GF | 36 static const int kRefreshFromAltRef =
37 VP8_EFLAG_NO_REF_ARF | 37 VP8_EFLAG_NO_REF_LAST | VP8_EFLAG_NO_REF_GF;
38 VP8_EFLAG_NO_REF_LAST;
39 static const int kRefreshFromGolden = VP8_EFLAG_NO_REF_LAST |
40 VP8_EFLAG_NO_REF_ARF;
41 static const int kRefreshFromAltRef = VP8_EFLAG_NO_REF_LAST |
42 VP8_EFLAG_NO_REF_GF;
43
44 38
45 class TestRPS : public ::testing::Test { 39 class TestRPS : public ::testing::Test {
46 protected: 40 protected:
47 virtual void SetUp() { 41 virtual void SetUp() {
48 rps_.Init(); 42 rps_.Init();
49 // Initialize with sending a key frame and acknowledging it. 43 // Initialize with sending a key frame and acknowledging it.
50 rps_.EncodedKeyFrame(0); 44 rps_.EncodedKeyFrame(0);
51 rps_.ReceivedRPSI(0); 45 rps_.ReceivedRPSI(0);
52 rps_.SetRtt(kRtt); 46 rps_.SetRtt(kRtt);
53 } 47 }
(...skipping 23 matching lines...) Expand all
77 TEST_F(TestRPS, TestDecoderRefresh) { 71 TEST_F(TestRPS, TestDecoderRefresh) {
78 uint32_t time = kRtt + 1; 72 uint32_t time = kRtt + 1;
79 // No more than one refresh per RTT. 73 // No more than one refresh per RTT.
80 EXPECT_EQ(rps_.ReceivedSLI(90 * time), true); 74 EXPECT_EQ(rps_.ReceivedSLI(90 * time), true);
81 time += 5; 75 time += 5;
82 EXPECT_EQ(rps_.ReceivedSLI(90 * time), false); 76 EXPECT_EQ(rps_.ReceivedSLI(90 * time), false);
83 time += kRtt - 4; 77 time += kRtt - 4;
84 EXPECT_EQ(rps_.ReceivedSLI(90 * time), true); 78 EXPECT_EQ(rps_.ReceivedSLI(90 * time), true);
85 // Enough time have elapsed since the previous reference propagation, we will 79 // Enough time have elapsed since the previous reference propagation, we will
86 // therefore get both a refresh from golden and a propagation of alt-ref. 80 // therefore get both a refresh from golden and a propagation of alt-ref.
87 EXPECT_EQ(rps_.EncodeFlags(5, true, 90 * time), kRefreshFromGolden | 81 EXPECT_EQ(rps_.EncodeFlags(5, true, 90 * time),
88 kPropagateAltRef); 82 kRefreshFromGolden | kPropagateAltRef);
89 rps_.ReceivedRPSI(5); 83 rps_.ReceivedRPSI(5);
90 time += kRtt + 1; 84 time += kRtt + 1;
91 // Enough time for a new refresh, but not enough time for a reference 85 // Enough time for a new refresh, but not enough time for a reference
92 // propagation. 86 // propagation.
93 EXPECT_EQ(rps_.ReceivedSLI(90 * time), true); 87 EXPECT_EQ(rps_.ReceivedSLI(90 * time), true);
94 EXPECT_EQ(rps_.EncodeFlags(6, true, 90 * time), kRefreshFromAltRef | 88 EXPECT_EQ(rps_.EncodeFlags(6, true, 90 * time),
95 kNoPropagationAltRef); 89 kRefreshFromAltRef | kNoPropagationAltRef);
96 } 90 }
97 91
98 TEST_F(TestRPS, TestWrap) { 92 TEST_F(TestRPS, TestWrap) {
99 EXPECT_EQ(rps_.ReceivedSLI(0xffffffff), true); 93 EXPECT_EQ(rps_.ReceivedSLI(0xffffffff), true);
100 EXPECT_EQ(rps_.ReceivedSLI(1), false); 94 EXPECT_EQ(rps_.ReceivedSLI(1), false);
101 EXPECT_EQ(rps_.ReceivedSLI(90 * 100), true); 95 EXPECT_EQ(rps_.ReceivedSLI(90 * 100), true);
102 96
103 EXPECT_EQ(rps_.EncodeFlags(7, false, 0xffffffff), kPropagateAltRef); 97 EXPECT_EQ(rps_.EncodeFlags(7, false, 0xffffffff), kPropagateAltRef);
104 EXPECT_EQ(rps_.EncodeFlags(8, false, 1), kNoPropagationGolden); 98 EXPECT_EQ(rps_.EncodeFlags(8, false, 1), kNoPropagationGolden);
105 EXPECT_EQ(rps_.EncodeFlags(10, false, 90 * 100), kPropagateAltRef); 99 EXPECT_EQ(rps_.EncodeFlags(10, false, 90 * 100), kPropagateAltRef);
106 } 100 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698